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

[PATCH] git-svn: exit with status 1 for test failures

From
EWEric Wong <normalperson@yhbt.net>
Date
Nov 25, 2006, 06:38 UTC
Message-ID
<11644367004098-git-send-email-normalperson@yhbt.net>
In-Reply-To
<11644366982320-git-send-email-normalperson@yhbt.net>

Some versions of the SVN libraries cause die() to exit with 255, and 40cf043389ef4cdf3e56e7c4268d6f302e387fa0 tightened up test_expect_failure to reject return values >128.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 git-svn.perl |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 5d67771..0a47b1f 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -21,6 +21,7 @@ $ENV{TZ} = 'UTC';
 $ENV{LC_ALL} = 'C';
 $| = 1; # unbuffer STDOUT
 
+sub fatal (@) { print STDERR $@; exit 1 }
 # If SVN:: library support is added, please make the dependencies
 # optional and preserve the capability to use the command-line client.
 # use eval { require SVN::... } to make it lazy load
@@ -569,7 +570,7 @@ sub commit_lib {
 				$no = 1;
 			}
 		}
-		close $fh or croak $?;
+		close $fh or exit 1;
 		if (! defined $r_new && ! defined $cmt_new) {
 			unless ($no) {
 				die "Failed to parse revision information\n";
@@ -868,13 +869,16 @@ sub commit_diff {
 						print "Committed $_[0]\n";
 					}, @lock)
 				);
-	my $mods = libsvn_checkout_tree($ta, $tb, $ed);
-	if (@$mods == 0) {
-		print "No changes\n$ta == $tb\n";
-		$ed->abort_edit;
-	} else {
-		$ed->close_edit;
-	}
+	eval {
+		my $mods = libsvn_checkout_tree($ta, $tb, $ed);
+		if (@$mods == 0) {
+			print "No changes\n$ta == $tb\n";
+			$ed->abort_edit;
+		} else {
+			$ed->close_edit;
+		}
+	};
+	fatal "$@\n" if $@;
 	$_message = $_file = undef;
 	return $rev_committed;
 }
-- 
1.4.4.1.g22a08
Previous: Eric WongNext: Sam Vilain
Message 2 of 5 in “git-svn: correctly access repos when only given partial read permissions”
  1. git-svn: correctly access repos when only given partial read permissionsEric Wong, Nov 25, 2006
  2. git-svn: exit with status 1 for test failuresEric Wong, Nov 25, 2006
  3. Sam VilainDec 2, 2006
  4. Eric WongDec 2, 2006
  5. Sam VilainDec 2, 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.