Re: [PATCH] gitk - dont warn when deleting synonym for current head
From: Mark Levedahl <hidden>
Date: 2016-06-15 22:43:29
Mark Levedahl wrote:
current checked out branch = master HEAD contains ref: refs/heads/master foo points to the same commit as master I attempted to delete foo. Note: the context menu does not allow deleting the currently checked out branch, so the referenced check is irrelevant to that.
By the way, I'm not sure how gitk can usefully do the implied check without loading the full repository DAG. The check requires finding that the referenced commit is not reachable by anything in .git/refs/* except the branch head in question, yet in general gitk has not explored all of those refs, only those explicitly given on the command line (or HEAD by default). So, unless "delete branch" is going to require a variant of "git-rev-list --all", I think the choices are either a) do what the user requested, or b) offer a "Are you sure you want to do this?" dialog followed by doing what the user asked. git-branch -d is similarly challenged: it complains unless the branch to delete is reachable from the current HEAD, and requires -D to delete anything else. It does not check to see if the commit is otherwise reachable from .git/refs/*. Mark