parse-remote and ls-remote clean-up.
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>
Junio C Hamano committed
Nov 23, 2005 at 23:46 UTC
e8cc80d03934cc607e3a4d89a05350c238dbf9c5
2 files changed
+3
-2
git-ls-remote.sh
-1
@@ -1,6 +1,5 @@
1
#!/bin/sh
2
#
3
-. git-sh-setup
3
4
usage () {
5
echo >&2 "usage: $0 [--heads] [--tags] <repository> <refs>..."
git-parse-remote.sh
+3
-1
@@ -1,6 +1,8 @@
1
#!/bin/sh
2
3
-. git-sh-setup
3
+# git-ls-remote could be called from outside a git managed repository;
4
+# this would fail in that case and would issue an error message.
5
+GIT_DIR=$(git-rev-parse --git-dir 2>/dev/null) || :;
6
7
get_data_source () {
8
case "$1" in