Subject: Re: [PATCH v3 02/44] refs: make repack_without_refs and is_branch public

From: Michael Haggerty <[email-masked]>
Date: Tue, 13 Oct 2015 09:23:52 +0200

On 10/13/2015 04:39 AM, Michael Haggerty wrote:
> 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 <[email-masked]>
>> Signed-off-by: David Turner <[email-masked]>
>> ---
>> [...]
> 
> 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
[email-masked]