Re: [PATCH/RFC] git-svn: don't create master if another head exists
From: Marcin Owsiany <hidden>
Date: 2016-06-15 22:54:10
On Sun, Jun 24, 2012 at 10:47:04PM -0700, Junio C Hamano wrote:
Marcin Owsiany [off-list ref] writes:quoted
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.
Can you please explain wha an "XY solution" is? I'm not familiar with this expression.
What are you really trying to validate? "HEAD" points at an existing branch and you do not care what branch it is?
Yes. I think.
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)?
The more questions you ask, the less I feel I know about how git works :-) -- Marcin Owsiany [off-list ref] http://marcin.owsiany.pl/ GnuPG: 2048R/02F946FC 35E9 1344 9F77 5F43 13DD 6423 DBF4 80C6 02F9 46FC "Every program in development at MIT expands until it can read mail." -- Unknown