From: Michael Haggerty Date: Tue, 06 May 2014 15:23:10 GMT Subject: Re: [PATCH] add a reflog_exists and delete_reflog abstraction Message-ID: <5368FE5E.7020009@alum.mit.edu> In-Reply-To: <1399330677-17930-1-git-send-email-sahlberg@google.com> On 05/06/2014 12:57 AM, Ronnie Sahlberg wrote: > This is a single patch that adds two new functions to try to hide the reflog > implementation details from the callers in checkout.c and reflog.c. > It adds new functions to test if a reflog exists and to delete it, thus > allowing checkout.c to perform this if-test-then-delete operation without > having to know the internal implementation of reflogs (i.e. that they are files > that live unde r.git/logs) > > It also changes checkout.c to use ref_exists when checking for whether a ref > exists or not instead of checking if the loose ref file exists or not. > Using ref_exists instead both hides the reflog implementation details from > checkout.c as well as making the code more robust against future changes. > It currently has a hard assumption that the loose ref file must exist at this > stage or else it would end up deleting the reflog which is true today, as far > as I can tell, but would break if git would change such that we could have > a branch checked out without having a loose ref file for that branch. For single patches, people usually don't send a separate cover letter. Any comments that you want to make that are not suitable for the commit message can go between the "---" line and the diffstat of the patch email. Regarding this change, I think before too long we will also need an API to turn reflogs on for a reference. We might want to add a flag to ref transaction entries that cause the reflog to be created if it doesn't already exist. Reflogs can currently be created for a reference via the config setting "core.logAllRefUpdates" or (for branches) by "git branch --create-reflog" (maybe there are others). Several tests in the test suite currently create reflog files by hand. Thus we might also need a way to create reflogs at the command line by the time we implement pluggable reference backends. Michael -- Michael Haggerty mhagger@alum.mit.edu http://softwareswirl.blogspot.com/