aboutsummaryrefslogtreecommitdiff
path: root/git-parse-remote.sh
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2011-03-01 10:21:36 +0100
committerJunio C Hamano <gitster@pobox.com>2011-03-02 12:26:53 -0800
commit45781adb9a89c0c47f61ccf8062be26b86a38a54 (patch)
tree997eb4ee64dfa2af2dcbdf8e408fb3beb796f2ac /git-parse-remote.sh
parent7ed863a85a6ce2c4ac4476848310b8f917ab41f9 (diff)
downloadgit-45781adb9a89c0c47f61ccf8062be26b86a38a54.tar.gz
git-45781adb9a89c0c47f61ccf8062be26b86a38a54.tar.xz
get_remote_url(): use the same data source as ls-remote to get remote urls
The formerly implemented algorithm behaved differently to remote.c:remote_get() at least for remotes that contain a slash. While the former just assumes a/b is a path the latter checks the config for remote."a/b" first which is more reasonable. This removes the last user of git-parse-remote.sh:get_data_source(), so this function is removed. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-parse-remote.sh')
-rw-r--r--git-parse-remote.sh48
1 files changed, 1 insertions, 47 deletions
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 1cc2ba6e0..0ab1192f8 100644
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -4,54 +4,8 @@
# 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
+ git ls-remote --get-url "$1"
}
get_default_remote () {