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

[PATCH 1/3] git-svn: error out from dcommit on a parent-less commit

From
EWEric Wong <normalperson@yhbt.net>
Date
Nov 23, 2006, 22:54 UTC
Message-ID
<1164322445180-git-send-email-normalperson@yhbt.net>

dcommit would unconditionally append "~1" to a commit in order to generate a diff. Now we generate a meaningful error message if we try to generate an impossible diff.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 git-svn.perl |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 80b7b87..f0db4af 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -589,6 +589,13 @@ sub dcommit {
 	chomp(my @refs = safe_qx(qw/git-rev-list --no-merges/, "$gs..HEAD"));
 	my $last_rev;
 	foreach my $d (reverse @refs) {
+		if (quiet_run('git-rev-parse','--verify',"$d~1") != 0) {
+			die "Commit $d\n",
+			    "has no parent commit, and therefore ",
+			    "nothing to diff against.\n",
+			    "You should be working from a repository ",
+			    "originally created by git-svn\n";
+		}
 		unless (defined $last_rev) {
 			(undef, $last_rev, undef) = cmt_metadata("$d~1");
 			unless (defined $last_rev) {
-- 
1.4.4.1.g22a08
Next: Eric Wong
Message 1 of 3 in “git-svn: error out from dcommit on a parent-less commit”
  1. 1/3 git-svn: error out from dcommit on a parent-less commitEric Wong, Nov 23, 2006
  2. 2/3 git-svn: correctly handle revision 0 in SVN repositoriesEric Wong, Nov 23, 2006
  3. 3/3 git-svn: preserve uncommitted changes after dcommitEric Wong, Nov 23, 2006

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.