Re: [PATCH/RFC] git-svn: don't create master if another head exists

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Marcin Owsiany <marcin@xxxxxxxxxx> writes:

> diff --git a/git-svn.perl b/git-svn.perl
> index 0b074c4..90f3d06 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -1613,6 +1613,8 @@ sub post_fetch_checkout {
>  	}
>  
>  	my $valid_head = verify_ref('HEAD^0');
> +	my @heads_commits = eval { command(qw(show-ref --heads --hash)) };
> +	return if $valid_head and grep { $_ eq $valid_head } @heads_commits;
>  	command_noisy(qw(update-ref refs/heads/master), $gs->refname);
>  	return if ($valid_head || !verify_ref('HEAD^0'));

This looks like a typical XY solution.  What are you really trying
to validate?  "HEAD" points at an existing branch and you do not
care what branch it is?  HEAD may not even point at a valid branch
but can be detached as long as it happens to point at a commit that
is at the tip of some branch (hence building further commit on HEAD
will break the condition you are checking in the above code)?

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


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]