Re: [PATCH] nmbug: Add 'clone' and replace FETCH_HEAD with @{upstream}

Subject: Re: [PATCH] nmbug: Add 'clone' and replace FETCH_HEAD with @{upstream}

Date: Sat, 08 Mar 2014 08:43:26 -0400

To: W. Trevor King, notmuch@notmuchmail.org

Cc:

From: David Bremner


"W. Trevor King" <wking@tremily.us> writes:


> +sub do_clone {
> +  my $repository = shift;
> +  system ('git', 'clone', '--bare', $repository, $NMBGIT) == 0
> +    or die "'git clone' exited with nonzero value\n";
> +  my $branch = git ('symbolic-ref', 'HEAD');
> +  $branch =~ s|^refs/heads/||;
> +  git ('config', 'remote.origin.fetch', '+refs/heads/*:refs/remotes/origin/*');
> +  git ('config', "branch.$branch.remote", 'origin');
> +  git ('config', "branch.$branch.merge", 'refs/heads/$branch');
> +  do_fetch();
> +}

I think doing a fetch immediately after a clone deserves a comment.

>  
> @@ -473,7 +487,7 @@ sub diff_index {
>  sub diff_refs {
>    my $filter = shift;
>    my $ref1 = shift || 'HEAD';
> -  my $ref2 = shift || 'FETCH_HEAD';
> +  my $ref2 = shift || '@{upstream}';

I wonder about hard-coding '@{upstream}' in several places. What do you
think about a global "constant"? OF course it was hard-coded FETCH_HEAD
before, but I think not in quite as many places.

Thread: