git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] prohibit "svn dcommit" on remote-tracking-branches

From
CEChristian Engwer <christian.engwer@wwu.de>
Date
Apr 4, 2012, 08:42 UTC
Message-ID
<20120404084234.GA17768@mathe-macht-spass.de>
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
Next: Eric Wong
Message 1 of 5 in “prohibit "svn dcommit" on remote-tracking-branches”
  1. prohibit "svn dcommit" on remote-tracking-branchesChristian Engwer, Apr 4, 2012
  2. Eric WongApr 10, 2012
  3. Christian EngwerApr 15, 2012
  4. Christian EngwerApr 15, 2012
  5. Jonathan NiederApr 15, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.