]> git.ipfire.org Git - thirdparty/git.git/commitdiff
parse-remote and ls-remote clean-up.
authorJunio C Hamano <junkio@cox.net>
Thu, 24 Nov 2005 07:46:13 +0000 (23:46 -0800)
committerJunio C Hamano <junkio@cox.net>
Fri, 25 Nov 2005 21:49:17 +0000 (13:49 -0800)
There is no reason to use git-sh-setup from git-ls-remote.
git-parse-remote can help the caller to use .git/remotes
shortcut if it is run inside a git repository, but can still be
useful outside a git repositoryas long as the caller does not
use any shortcut.  Use "git-rev-parse --git-dir" to figure out
where the GIT_DIR is, instead of using git-sh-setup.

This also makes "git-ls-remote origin" to work from inside a
subdirectory of a git managed repository as a side effect.

Signed-off-by: Junio C Hamano <junkio@cox.net>
git-ls-remote.sh
git-parse-remote.sh

index f0f0b07f6f8c85219104303d65dabbba80fd3098..dc6a775a9be83cfd349773b07051cd256d5ea114 100755 (executable)
@@ -1,6 +1,5 @@
 #!/bin/sh
 #
-. git-sh-setup
 
 usage () {
     echo >&2 "usage: $0 [--heads] [--tags] <repository> <refs>..."
index aea7b0e5497fb0727533ea750503193fe308374a..5f158c613f333026ed42eac1c059b01500ba5e53 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 
-. git-sh-setup
+# git-ls-remote could be called from outside a git managed repository;
+# this would fail in that case and would issue an error message.
+GIT_DIR=$(git-rev-parse --git-dir 2>/dev/null) || :;
 
 get_data_source () {
        case "$1" in