git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] prohibit "svn dcommit" on remote-tracking-branches
@ 2012-04-04  8:42 Christian Engwer
  2012-04-10 21:17 ` Eric Wong
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Engwer @ 2012-04-04  8:42 UTC (permalink / raw)
  To: git

A branch should either be a local copy of an svn branch, or a remote
tracking branch. After a "git svn dcommit" a remote tracking branch
could not be synced with the git remote due to the rebase that occured
during the dcommit. Thus we check for a remote entry in the git config
for the current branch and prohibit the "dcommit" if such an entry
exists.
---
 git-svn.perl |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 4334b95..f9c8440 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -759,6 +759,23 @@ sub cmd_dcommit {
 		'Cannot dcommit with a dirty index.  Commit your changes first, '
 		. "or stash them with `git stash'.\n";
 	$head ||= 'HEAD';
+    my ($branches,$ctx) = eval { command_output_pipe('branch') };
+    my $branch = undef;
+    while (<$branches>) {
+        chomp;
+        if (s/^\* +//)
+        {
+            $branch = $_;
+        }
+    }
+	command_close_pipe($branches, $ctx);
+
+    my $remote = eval { command_oneline('config', '--get',
+                                      "branch.${branch}.remote") };
+	if ($remote) {
+		die "You specified a non-svn remote for branch ${branch}.\n".
+            "To change this setting, modify \"branch.${branch}.remote\" using git config.\n";
+	}
 
 	my $old_head;
 	if ($head ne 'HEAD') {
-- 
1.7.9.1

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

end of thread, other threads:[~2012-04-15 21:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-04  8:42 [PATCH] prohibit "svn dcommit" on remote-tracking-branches Christian Engwer
2012-04-10 21:17 ` Eric Wong
2012-04-15 13:40   ` Christian Engwer
2012-04-15 18:55   ` Christian Engwer
2012-04-15 21:23     ` Jonathan Nieder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).