From: Junio C Hamano Date: Thu, 31 Mar 2011 02:33:53 +0000 (-0700) Subject: Merge branch 'maint' X-Git-Tag: v1.7.5-rc0~1 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/bcef9b6327a7d0a01b9207a9cf0aa2783e12fb41 Merge branch 'maint' * maint: parse-remote: typofix --- bcef9b6327a7d0a01b9207a9cf0aa2783e12fb41 diff --cc git-parse-remote.sh index 91688792a2,9b950be28d..ea093d251d --- a/git-parse-remote.sh +++ b/git-parse-remote.sh @@@ -4,9 -4,59 +4,9 @@@ # this would fail in that case and would issue an error message. GIT_DIR=$(git rev-parse -q --git-dir) || :; -get_data_source () { - case "$1" in - */*) - echo '' - ;; - .) - echo self - ;; - *) - if test "$(git config --get "remote.$1.url")" - then - echo config - elif test -f "$GIT_DIR/remotes/$1" - then - echo remotes - elif test -f "$GIT_DIR/branches/$1" - then - echo branches - else - echo '' - fi ;; - esac -} - -get_remote_url () { - data_source=$(get_data_source "$1") - case "$data_source" in - '') - echo "$1" - ;; - self) - echo "$1" - ;; - config) - git config --get "remote.$1.url" - ;; - remotes) - sed -ne '/^URL: */{ - s///p - q - }' "$GIT_DIR/remotes/$1" - ;; - branches) - sed -e 's/#.*//' "$GIT_DIR/branches/$1" - ;; - *) - die "internal error: get-remote-url $1" ;; - esac -} - get_default_remote () { curr_branch=$(git symbolic-ref -q HEAD) - curr_branch="${cur_branch#refs/heads/}" + curr_branch="${curr_branch#refs/heads/}" origin=$(git config --get "branch.$curr_branch.remote") echo ${origin:-origin} }