Subject: Re: Question about 'branch -d' safety

From: Clemens Buchacher <[email-masked]>
Date: Mon, 12 Jul 2010 20:47:55 +0200

On Sun, Jul 11, 2010 at 11:41:54AM -0700, Junio C Hamano wrote:
> 
>  - It is no longer possible to get rid of objects associated with the
>    history of a branch by deleting the branch and then running gc.

Yes, this should be fixed in the final implementation. The reflog
should be accessible as usual, and should expire normally, even if
the branch has been deleted.

>  - It is no longer possible to trust git that you would start a history of
>    a branch afresh when you create one.  If you happened to have an
>    unrelated branch with the same name in the past, the new branch
>    inherits reflog entries when it shouldn't.

The reflog does not guarantee any such relatedness with previous
entries anyways. Doing "git reset --hard <unrelated-branch>" is not
much different from deleting the branch and creating a new
unrelated branch of the same name.

And if it's really an issue, we can always make the reflog stop
listing entries at the latest branch creation entry, and make
listing beyound that optional. (I actually had to change the reflog
walker to make it continue beyound branch creation.)

> What problem are you guys really trying to solve?

The reflog protects you from almost all involuntary loss of
information. Except for recovery after git branch -D and even git
branch -d, as per the scenario I described in the original posting
of this thread.

Clemens