Re: Question about 'branch -d' safety
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Jul 10, 2010, 21:57 UTC
- Message-ID
- <m3lj9jknlr.fsf@localhost.localdomain>
- In-Reply-To
- <20100710214050.GA3680@burratino>
Jonathan Nieder <jrnieder@gmail.com> writes:
Show 20 quoted lines
> Clemens Buchacher wrote:
>
> > Maybe the real solution is a reflog for deleted branch
> > heads, rather than being too careful about whether or not a branch
> > can be deleted.
>
> Yes, I think so. Would there be any bad side effects to this?
>
> diff --git a/refs.c b/refs.c
> index b540067..7ed0154 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -1084,7 +1084,6 @@ int delete_ref(const char *refname, const unsigned char *sha1, int delopt)
> */
> ret |= repack_without_ref(refname);
>
> - unlink_or_warn(git_path("logs/%s", lock->ref_name));
> invalidate_cached_refs();
> unlock_ref(lock);
> return ret;It's unfortunately not so easy. The problem you have to solve is D/F conflict: if you have 'foo/bar' branch, you can't create 'foo' branch, but after deleting 'foo/bar' you want to be able to create 'foo' branch and reflog for 'foo' branch.
Therefore there were ideas for various "Attic"-like areas for reflogs for deleted branches...
-- Jakub Narebski Poland ShadeHawk on #git