Permalink
Browse files

Make nub (or open -a GitNub) work from subdirectories

  • Loading branch information...
1 parent afbdb35 commit cd89473f5e13a271cae42f605cd70a9c3793d98e @kballard kballard committed Mar 21, 2008
Showing with 5 additions and 1 deletion.
  1. +5 −1 ApplicationController.rb
View
@@ -7,6 +7,7 @@
#
$VERBOSE = nil
require 'rubygems'
+require 'pathname'
require 'osx/cocoa'
require 'mime-types/lib/mime/types'
require 'grit/lib/grit'
@@ -16,7 +17,10 @@
OSX.ns_import 'CommitSummaryCell'
include OSX
-REPOSITORY_LOCATION = ENV['PWD'].nil? ? '' : ENV['PWD']
+# we use ENV['PWD'] instead of Dir.getwd if it exists so
+# `open GitNub` will work, since that launches us at / but leaves ENV['PWD'] intact
+pwd = Pathname.new(ENV['PWD'].nil? ? Dir.getwd : ENV['PWD'])
+REPOSITORY_LOCATION = pwd + `cd #{pwd} && git rev-parse --git-dir 2>/dev/null`.chomp
class ApplicationController < OSX::NSObject
ib_outlet :commits_table

0 comments on commit cd89473

Please sign in to comment.