@matheusbsbs / matheus-bagliano / commits / fbc72799a8
Fork 0

git-fetch: adjust to packed-refs.

The command checked the presence of a ref by directly looking into $GIT_DIR/refs directory. Update it to use show-ref. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Oct 1, 2006 at 00:42 UTC fbc72799a82bb9a25657a6e30bfcd7b8fe3e5a45
1 file changed +4 -4
git-fetch.sh
+4 -4
@@ -147,15 +147,15 @@ update_local_ref () {
147 [ "$verbose" ] && echo >&2 " $label_: $newshort_"
148 return 0
149 fi
150 - oldshort_=$(git-rev-parse --short "$1" 2>/dev/null)
151 - mkdir -p "$(dirname "$GIT_DIR/$1")"
150 + oldshort_=$(git show-ref --hash --abbrev "$1" 2>/dev/null)
151 +
152 case "$1" in
153 refs/tags/*)
154 # Tags need not be pointing at commits so there
155 # is no way to guarantee "fast-forward" anyway.
156 - if test -f "$GIT_DIR/$1"
156 + if test -n "$oldshort_"
157 then
158 - if now_=$(cat "$GIT_DIR/$1") && test "$now_" = "$2"
158 + if now_=$(git show-ref --hash "$1") && test "$now_" = "$2"
159 then
160 [ "$verbose" ] && echo >&2 "* $1: same as $3"
161 [ "$verbose" ] && echo >&2 " $label_: $newshort_" ||: