bug: update hook failure doesn't prevent local deletion of a branch
- From
- Andy Parkins <andyparkins@gmail.com>
- Date
- Jul 25, 2007, 11:50 UTC
- Message-ID
- <200707251250.08166.andyparkins@gmail.com>
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