GIT 1.3.0 rc1
[git.git] / git-parse-remote.sh
index aea7b0e..63f2281 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
@@ -84,14 +86,14 @@ canon_refs_list_for_fetch () {
                local=$(expr "$ref" : '[^:]*:\(.*\)')
                case "$remote" in
                '') remote=HEAD ;;
-               refs/heads/* | refs/tags/*) ;;
-               heads/* | tags/* ) remote="refs/$remote" ;;
+               refs/heads/* | refs/tags/* | refs/remotes/*) ;;
+               heads/* | tags/* | remotes/* ) remote="refs/$remote" ;;
                *) remote="refs/heads/$remote" ;;
                esac
                case "$local" in
                '') local= ;;
-               refs/heads/* | refs/tags/*) ;;
-               heads/* | tags/* ) local="refs/$local" ;;
+               refs/heads/* | refs/tags/* | refs/remotes/*) ;;
+               heads/* | tags/* | remotes/* ) local="refs/$local" ;;
                *) local="refs/heads/$local" ;;
                esac