All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC] git-svn: don't create master if another head exists
@ 2012-06-24 22:08 Marcin Owsiany
  2012-06-25  4:16 ` Eric Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Marcin Owsiany @ 2012-06-24 22:08 UTC (permalink / raw)
  To: git; +Cc: Eric Wong

git-svn insists on creating the "master" head (unless it exists) on every
"fetch". While it is useful that it gets created initially (users expect this
git convention), some users find it annoying that it gets recreated, especially
when they would like the git branch names to follow SVN repository branch
names. More background in
http://thread.gmane.org/gmane.comp.version-control.git/115030

Make git-svn skip the "master" creation if there is another head ref pointing
to the same place. This means "master" does get created on initial "clone" but
does not get recreated once a user deletes it.

Signed-off-by: Marcin Owsiany <marcin@owsiany.pl>
---
 git-svn.perl |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

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'));
 
-- 
1.7.7.3


-- 
Marcin Owsiany <marcin@owsiany.pl>              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

^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2012-07-19 17:20 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-24 22:08 [PATCH/RFC] git-svn: don't create master if another head exists Marcin Owsiany
2012-06-25  4:16 ` Eric Wong
2012-06-25  6:01   ` Junio C Hamano
2012-06-25  7:41   ` Marcin Owsiany
2012-06-25  5:44 ` Junio C Hamano
2012-06-25  7:53   ` Marcin Owsiany
2012-06-25  5:47 ` Junio C Hamano
2012-06-25  7:57   ` Marcin Owsiany
2012-06-25 17:01     ` Junio C Hamano
2012-06-26 21:21       ` Marcin Owsiany
2012-06-26 22:03         ` Junio C Hamano
2012-06-26 22:32           ` Marcin Owsiany
2012-07-09 22:03             ` Marcin Owsiany
2012-07-09 22:43               ` Junio C Hamano
2012-07-11  1:26                 ` Eric Wong
2012-07-11 21:40                   ` Marcin Owsiany
2012-07-11 22:56                     ` Junio C Hamano
2012-07-18  7:49                       ` Marcin Owsiany
2012-07-18 11:27                         ` Eric Wong
2012-07-18 12:47                           ` Marcin Owsiany
2012-07-19  8:19                             ` Eric Wong
2012-07-19 17:20                               ` Junio C Hamano
2012-07-18 20:32                         ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.