Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #6 from tongueroo/master

look for .git/config up the parent dirs, allow gitc command to be used in subdirs
  • Loading branch information...
commit 6def130238dbb1993c7bbe93228bae3169c0fae5 2 parents f4da050 + 2ba79ef
Winton Welsh authored
Showing with 14 additions and 2 deletions.
  1. +14 −2 lib/gitcycle.rb
16 lib/gitcycle.rb
View
@@ -800,9 +800,21 @@ def load_config
end
end
+ def git_config_path(path)
+ config = "#{path}/.git/config"
+ if File.exists?(config)
+ return config
+ elsif path == '/'
+ return nil
+ else
+ path = File.expand_path(path + '/..')
+ git_config_path(path)
+ end
+ end
+
def load_git
- path = "#{Dir.pwd}/.git/config"
- if File.exists?(path)
+ path = git_config_path(Dir.pwd)
+ if path
@git_url = File.read(path).match(/\[remote "origin"\][^\[]*url = ([^\n]+)/m)[1]
@git_repo = @git_url.match(/\/(.+)\./)[1]
@git_login = @git_url.match(/:(.+)\//)[1]
Please sign in to comment.
Something went wrong with that request. Please try again.