Subject: Re: can we prevent reflog deletion when branch is deleted?

From: Sitaram Chamarty <[email-masked]>
Date: Thu, 14 Nov 2013 21:36:42 +0530

On 11/14/2013 01:44 PM, Jeff King wrote:
> On Thu, Nov 14, 2013 at 05:48:50AM +0530, Sitaram Chamarty wrote:
> 
>> Is there *any* way we can preserve a reflog for a deleted branch,
>> perhaps under logs/refs/deleted/<timestamp>/full/ref/name ?
> 
> I had patches to do something like this here:
> 
>   http://thread.gmane.org/gmane.comp.version-control.git/201715/focus=201752
> 
> but there were definitely some buggy corners, as much of the code
> assumed you needed to have a ref to have a reflog. I don't even run with
> it locally anymore.
> 
> At GitHub, we log each change to an "audit log" in addition to the
> regular reflog (we also stuff extra data from the environment into the
> reflog message). So even after a branch is deleted, its audit log
> entries remain, though you have to pull out the data by hand (git
> doesn't know about it at all, except as an append-only sink for
> writing). And git doesn't use the audit log for connectivity, either, so
> eventually the objects could be pruned.
> 
>> Just some basic protection -- don't delete the reflog, and instead,
>> rename it to something that preserves the name but in a different
>> namespace.
> 
> That part is easy. Accessing it seamlessly and handling reflog
> expiration are a little harder. Not because they're intractable, but
> just because there are some low-level assumptions in the git code. The
> patch series I mentioned above mostly works. It probably just needs
> somebody to go through and find the corner cases.

The use cases I am talking about are those where someone deleted
something and it was noticed well within Git's the earliest of Git's
expire timeouts.

So, no need to worry about expiry times and connecting it with object
pruning.  Really, just the eqvt of a "cp" or "mv" of one file is all
that most people need.

Gitolite's log is the same.  So no one who uses Gitolite needs this
feature.  But people shouldn't have to install Gitolite or anything else
just to get this either!