Skip to content
Browse files

hit with the rico, they repo your vehico

  • Loading branch information...
1 parent 027fdc5 commit 44965ac8f21fcf908aa374e320ddb08bb1ef215a @aanand committed Jun 16, 2010
Showing with 12 additions and 2 deletions.
  1. +12 −2 lib/git-up.rb
View
14 lib/git-up.rb
@@ -3,11 +3,11 @@
class GitUp
def initialize(args)
- @repo = Grit::Repo.new(File.expand_path("."))
- @head = @repo.head
end
def run
+ get_repo
+
system "git fetch"
raise GitError, "`git fetch` failed" unless $? == 0
@@ -48,6 +48,16 @@ def run
exit 1
end
+ def get_repo
+ git_dir = `git rev-parse --git-dir`
+
+ if $? == 0
+ @repo = Grit::Repo.new(File.dirname(git_dir))
+ else
+ raise GitError, "We don't seem to be in a git repository."
+ end
+ end
+
def remote_for_branch(branch)
remote_name = @repo.config["branch.#{branch.name}.remote"] || "origin"
@repo.remotes.find { |r| r.name == "#{remote_name}/#{branch.name}" }

0 comments on commit 44965ac

Please sign in to comment.
Something went wrong with that request. Please try again.