提交 05be8a98 编写于 作者: C Chris Wanstrath

Use the origin url to find the repo name. Thanks akahn and mislav! Closes #13

上级 cff1869f
......@@ -6,6 +6,7 @@
* Respect git behavior when pager is empty string
* `git push` multi-remote support
* `hub.http-clone` configuration setting
* Use the origin url to find the repo name
## 0.1.3 (2009-12-11)
......
......@@ -32,13 +32,21 @@ module Hub
extend self
# Templates and useful information.
USER = `git config --global github.user`.chomp
ORIGIN = `git config remote.origin.url`.chomp
HTTP_CLONE = `git config --global hub.http-clone`.chomp == 'yes'
PUBLIC = (HTTP_CLONE ? 'http' : 'git') + '://github.com/%s/%s.git'
PRIVATE = 'git@github.com:%s/%s.git'
USER = `git config --global github.user`.chomp
REPO = `basename $(pwd)`.chomp
LGHCONF = "http://github.com/guides/local-github-config"
# Set the repo name based on the current origin or, as a fallback,
# the cwd.
if ORIGIN =~ %r{\bgithub\.com[:/](.+)/(.+).git$}
REPO = $2
else
REPO = `basename $(pwd)`.chomp
end
# $ hub clone rtomayko/tilt
# > git clone git://github.com/rtomayko/tilt.
#
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册