Merge branch 'lt/config-fsync'
[gitweb.git] / t / t5515-fetch-merge-logic.sh
index 3def75eeb29f0eeaa096ab4b9f4511a01a3ce3d8..8becbc3f38fde02371ebbcd9a39a320a1c00c290 100755 (executable)
@@ -142,9 +142,12 @@ do
                        set x $cmd; shift
                        git symbolic-ref HEAD refs/heads/$1 ; shift
                        rm -f .git/FETCH_HEAD
-                       rm -f .git/refs/heads/*
-                       rm -f .git/refs/remotes/rem/*
-                       rm -f .git/refs/tags/*
+                       git for-each-ref \
+                               refs/heads refs/remotes/rem refs/tags |
+                       while read val type refname
+                       do
+                               git update-ref -d "$refname" "$val"
+                       done
                        git fetch "$@" >/dev/null
                        cat .git/FETCH_HEAD
                } >"$actual_f" &&