Re: [PATCH] git-relink: avoid hard linking in objects/info directory
- From
- Rafael Garcia-Suarez <rgarciasuarez@gmail.com>
- Date
- Jan 30, 2008, 07:34 UTC
- Message-ID
- <b77c1dce0801292334p7c348744re6a7fdbb0f17d5b3@mail.gmail.com>
- In-Reply-To
- <479FAB9A.9040009@nrlssc.navy.mil>
On 29/01/2008, Brandon Casey <casey@nrlssc.navy.mil> wrote:
Show 21 quoted lines
> git-relink is intended to search for packs and loose objects in
> common between two repositories and to replace the one set with
> hard links to the other. Files other than packs and loose objects
> should not be touched, so add the "info" sub-directory to the
> pattern of directory excludes.
>
> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
> ---
> git-relink.perl | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/git-relink.perl b/git-relink.perl
> index f6b4f6a..d267404 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 !/^(\.{1,2}|info)$/, readdir(D);That looks a bit fragile. If the intent is to get a list of files in $master_dir, why not simply say:
my @hashdirs = grep -f, readdir(D);
That will appropriately skip ., .. and any other dirs.