diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-11-27 13:28:45 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-11-27 13:28:45 -0800 |
commit | ed20513c8de70e8bd7f18d2fb5beb1a81f49cdf8 (patch) | |
tree | eba3e85b41ebcef42d39fccd00943a7a77eb1ff4 | |
parent | a7c940edce6554cb57468a8a9936277b709cc7fc (diff) | |
parent | b274a7146c44624bc30bbd54124312d4d3e6a28d (diff) | |
download | git-ed20513c8de70e8bd7f18d2fb5beb1a81f49cdf8.tar.gz git-ed20513c8de70e8bd7f18d2fb5beb1a81f49cdf8.tar.xz |
Merge branch 'jh/update-ref-d-through-symref' into maint
* jh/update-ref-d-through-symref:
Fix failure to delete a packed ref through a symref
t1400-update-ref: Add test verifying bug with symrefs in delete_ref()
-rw-r--r-- | refs.c | 2 | ||||
-rwxr-xr-x | t/t1400-update-ref.sh | 18 |
2 files changed, 19 insertions, 1 deletions
@@ -1770,7 +1770,7 @@ int delete_ref(const char *refname, const unsigned char *sha1, int delopt) * packed one. Also, if it was not loose we need to repack * without it. */ - ret |= repack_without_ref(refname); + ret |= repack_without_ref(lock->ref_name); unlink_or_warn(git_path("logs/%s", lock->ref_name)); invalidate_ref_cache(NULL); diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index 4fd83a667..e415ee0bb 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -74,6 +74,24 @@ test_expect_success "delete $m (by HEAD)" ' ' rm -f .git/$m +test_expect_success \ + "create $m (by HEAD)" \ + "git update-ref HEAD $A && + test $A"' = $(cat .git/'"$m"')' +test_expect_success \ + "pack refs" \ + "git pack-refs --all" +test_expect_success \ + "move $m (by HEAD)" \ + "git update-ref HEAD $B $A && + test $B"' = $(cat .git/'"$m"')' +test_expect_success "delete $m (by HEAD) should remove both packed and loose $m" ' + git update-ref -d HEAD $B && + ! grep "$m" .git/packed-refs && + ! test -f .git/$m +' +rm -f .git/$m + cp -f .git/HEAD .git/HEAD.orig test_expect_success "delete symref without dereference" ' git update-ref --no-deref -d HEAD && |