3 . git-sh-setup-script || die "Not a git archive"
8 # Not so fast. This could be the partial URL shorthand...
9 token=$(expr "$1" : '\([^/]*\)/')
10 remainder=$(expr "$1" : '[^/]*/\(.*\)')
11 if test -f "$GIT_DIR/branches/$token"
19 if test -f "$GIT_DIR/remotes/$1"
22 elif test -f "$GIT_DIR/branches/$1"
32 data_source=$(get_data_source "$1")
33 case "$data_source" in
40 }' "$GIT_DIR/remotes/$1" ;;
42 sed -e 's/#.*//' "$GIT_DIR/branches/$1" ;;
44 token=$(expr "$1" : '\([^/]*\)/')
45 remainder=$(expr "$1" : '[^/]*/\(.*\)')
46 url=$(sed -e 's/#.*//' "$GIT_DIR/branches/$token")
47 echo "$url/$remainder"
50 die "internal error: get-remote-url $1" ;;
54 get_remote_default_refs_for_push () {
55 data_source=$(get_data_source "$1")
56 case "$data_source" in
57 '' | branches | branches-partial)
58 ;; # no default push mapping, just send matching refs.
62 }' "$GIT_DIR/remotes/$1" ;;
64 die "internal error: get-remote-default-ref-for-push $1" ;;
68 # Subroutine to canonicalize remote:local notation
69 canon_refs_list_for_fetch () {
75 ref=$(expr "$ref" : '\+\(.*\)')
79 expr "$ref" : '.*:' >/dev/null || ref="${ref}:"
80 remote=$(expr "$ref" : '\([^:]*\):')
81 local=$(expr "$ref" : '[^:]*:\(.*\)')
84 *) remote="refs/heads/$remote" ;;
88 *) local="refs/heads/$local" ;;
90 echo "${force}${remote}:${local}"
94 # Returns list of src: (no store), or src:dst (store)
95 get_remote_default_refs_for_fetch () {
96 data_source=$(get_data_source "$1")
97 case "$data_source" in
98 '' | branches-partial)
101 remote_branch=$(sed -ne '/#/s/.*#//p' "$GIT_DIR/branches/$1")
102 case "$remote_branch" in '') remote_branch=master ;; esac
103 echo "refs/heads/${remote_branch}:refs/heads/$1"
106 canon_refs_list_for_fetch $(sed -ne '/^Pull: */{
108 }' "$GIT_DIR/remotes/$1")
111 die "internal error: get-remote-default-ref-for-push $1" ;;
115 get_remote_refs_for_push () {
117 0) die "internal error: get-remote-refs-for-push." ;;
118 1) get_remote_default_refs_for_push "$@" ;;
119 *) shift; echo "$@" ;;
123 get_remote_refs_for_fetch () {
126 die "internal error: get-remote-refs-for-fetch." ;;
128 get_remote_default_refs_for_fetch "$@" ;;
134 if test "$tag_just_seen"
136 echo "refs/tags/${ref}:refs/tags/${ref}"
147 canon_refs_list_for_fetch "$ref"