Re: [PATCH v3 02/44] refs: make repack_without_refs and is_branch public
- From
Michael Haggerty <mhagger@alum.mit.edu>
- Date
- Oct 13, 2015, 07:23 UTC
- Message-ID
- <561CB188.2090508@alum.mit.edu>
- In-Reply-To
- <561C6EE8.3000301@alum.mit.edu>
On 10/13/2015 04:39 AM, Michael Haggerty wrote:
Show 12 quoted lines
> On 10/12/2015 11:51 PM, David Turner wrote: >> is_branch was already non-static, but this patch declares it in the >> header. >> >> Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> >> Signed-off-by: David Turner <dturner@twopensource.com> >> --- >> [...] > > It seems odd that repack_without_refs() should be made public (and > ultimately end up in refs.h) given that it intrinsically only has to do > with file-based references. But I will read on...
I think the reason you needed to do this was because you wanted to move delete_refs() to the common code. It is true that delete_ref() can be moved to the common code. And most of the code in delete_refs() is just a loop calling delete_ref(). But delete_refs() also does the very files-specific optimization of calling repack_without_refs() before the loop. *That* call shouldn't be in the common code.
So my suggestion is that you write a common_delete_refs() function that only includes the loop over delete_ref(), and a files_delete_refs() function that is basically
{
result = repack_without_refs(refnames, &err);
if (result) {
...report error...
return result;
}
return common_delete_refs(...);
}Michael
-- Michael Haggerty mhagger@alum.mit.edu