Revert "fetch, pull: ask config for remote information"
This reverts 5a223a0d434c874984a0251eca4520ef95718a6d commit. I asked Johannes to roll an updated version, so let's wait for it.
Junio C Hamano committed
May 2, 2006 at 14:16 UTC
c9889e40858fa8b9265b58519e7281c07f3632c6
1 file changed
+4
-51
git-parse-remote.sh
+4
-51
@@ -4,43 +4,13 @@
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
-if [ -d "$GIT_DIR"/remotes -a "$GIT_REWRITE_REMOTES" = true ]; then
8
- echo "Rewriting $GIT_DIR/remotes" >&2
9
- error=0
10
- # rewrite into config
11
- {
12
- cd "$GIT_DIR"/remotes
13
- ls | while read f; do
14
- name=$(echo -n "$f" | tr -c "A-Za-z0-9" ".")
15
- sed -n \
16
- -e "s/^URL: /remote.$name.url . /p" \
17
- -e "s/^Pull: /remote.$name.pull ^$ /p" \
18
- -e "s/^Push: /remote.$name.push ^$ /p" \
19
- < "$f"
20
- done
21
- echo done
22
- } | while read key regex value; do
23
- case $key in
24
- done)
25
- if [ $error = 0 ]; then
26
- mv "$GIT_DIR"/remotes "$GIT_DIR"/remotes.old
27
- fi ;;
28
- *)
29
- git-repo-config $key "$value" $regex || error=1 ;;
30
- esac
31
- done
32
-fi
33
-
7
get_data_source () {
8
case "$1" in
9
*/*)
10
# Not so fast. This could be the partial URL shorthand...
11
token=$(expr "z$1" : 'z\([^/]*\)/')
12
remainder=$(expr "z$1" : 'z[^/]*/\(.*\)')
40
- if test "$(git-repo-config --get "remote.$token.url")"
41
- then
42
- echo config-partial
43
- elif test -f "$GIT_DIR/branches/$token"
13
+ if test -f "$GIT_DIR/branches/$token"
14
then
15
echo branches-partial
16
else
@@ -48,10 +18,7 @@ get_data_source () {
18
fi
19
;;
20
*)
51
- if test "$(git-repo-config --get "remote.$1.url")"
52
- then
53
- echo config
54
- elif test -f "$GIT_DIR/remotes/$1"
21
+ if test -f "$GIT_DIR/remotes/$1"
22
then
23
echo remotes
24
elif test -f "$GIT_DIR/branches/$1"
@@ -68,15 +35,6 @@ get_remote_url () {
35
case "$data_source" in
36
'')
37
echo "$1" ;;
71
- config-partial)
72
- token=$(expr "z$1" : '\([^/]*\)/')
73
- remainder=$(expr "z$1" : '[^/]*/\(.*\)')
74
- url=$(git-repo-config --get "remote.$token.url")
75
- echo "$url/$remainder"
76
- ;;
77
- config)
78
- git-repo-config --get "remote.$1.url"
79
- ;;
38
remotes)
39
sed -ne '/^URL: */{
40
s///p
@@ -98,10 +56,8 @@ get_remote_url () {
56
get_remote_default_refs_for_push () {
57
data_source=$(get_data_source "$1")
58
case "$data_source" in
101
- '' | config-partial | branches | branches-partial)
59
+ '' | branches | branches-partial)
60
;; # no default push mapping, just send matching refs.
103
- config)
104
- git-repo-config --get-all "remote.$1.push" ;;
61
remotes)
62
sed -ne '/^Push: */{
63
s///p
@@ -155,11 +111,8 @@ canon_refs_list_for_fetch () {
111
get_remote_default_refs_for_fetch () {
112
data_source=$(get_data_source "$1")
113
case "$data_source" in
158
- '' | config-partial | branches-partial)
114
+ '' | branches-partial)
115
echo "HEAD:" ;;
160
- config)
161
- canon_refs_list_for_fetch \
162
- $(git-repo-config --get-all "remote.$1.pull") ;;
116
branches)
117
remote_branch=$(sed -ne '/#/s/.*#//p' "$GIT_DIR/branches/$1")
118
case "$remote_branch" in '') remote_branch=master ;; esac