bug: update hook failure doesn't prevent local deletion of a branch
From: Andy Parkins <hidden>
Date: 2016-06-15 22:43:23
Hello, I wanted to delete a branch (let's call it "deleted-branch") from my public repository. I ran this: $ git push origin :deleted-branch deleting 'refs/heads/deleted-branch' Also local refs/remotes/up/deleted-branch *** Update hook: aborting error: hooks/update exited with error code 1 error: hook declined to update refs/heads/deleted-branch ng refs/heads/deleted-branch hook declined error: failed to push to '/path/to/git/repo.git' Coincidentally, my update hook happened to have a bug in it that prevented me from running the operation. However, when I run the operation again... $ git push origin :deleted-branch deleting 'refs/heads/deleted-branch' Also local refs/remotes/up/deleted-branch error: unlink(.git/refs/remotes/up/deleted-branch) failed: No such file or directory error: Failed to delete If the remote didn't get deleted, then it seems wrong that the local copy does get deleted. Summary: when using git-push to delete a remote branch, and that deletion is disallowed by the update hook, the local tracking branch _is_ deleted. Obviously, this isn't _that_ serious because it could be recovered again with a git-fetch; but it does make some scary looking errors. Andy -- Dr Andy Parkins, M Eng (hons), MIET andyparkins@gmail.com