[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    Re: [PATCH] git-relink: avoid hard linking in objects/info directory
From:       Brandon Casey <casey () nrlssc ! navy ! mil>
Date:       2008-01-30 16:19:22
Message-ID: 47A0A38A.7050600 () nrlssc ! navy ! mil
[Download RAW message or body]

Rafael Garcia-Suarez wrote:
> On 30/01/2008, Junio C Hamano <gitster@pobox.com> wrote:
>> The statement is trying to find directories whose names match
>> /^[0-9a-f]{2}$/ (two hexdigits) or /^pack$/.
> 
> Ah, I see better now.
> 
>> But I do agree that listing things to skip is a fragile approach
>> than listing things you know are safe to relink.
>>
>> How about doing it this way instead?
>>
>>  git-relink.perl |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/git-relink.perl b/git-relink.perl
>> index f6b4f6a..9101926 100755
>> --- a/git-relink.perl
>> +++ b/git-relink.perl
>> @@ -40,7 +40,7 @@ my $master_dir = pop @dirs;
>>  opendir(D,$master_dir . "objects/")
>>         or die "Failed to open $master_dir/objects/ : $!";
>>
>> -my @hashdirs = grep !/^\.{1,2}$/, readdir(D);
>> +my @hashdirs = grep { ($_ eq 'pack') || /^[0-9a-f]{2}$/ } readdir(D);
> 
> Fine, except that one can factorize one step further:
>     grep /^(pack|[0-9a-f]{2})$/, readdir(D);

Looks fine to me.

-brandon

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic