[PATCH] send-pack: avoid redundant "pack-objects died with strange error"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Arnout Engelen wrote:

> arnouten@bird:~/asdf/notion$ git push sourceforge master
> raboofje@xxxxxxxxxxxxxxxxxxxxxxxxxx's password: 
> Counting objects: 21542, done.
> Compressing objects: 100% (4179/4179), done.
> fatal: Unable to create temporary file: Permission denied
> error: pack-objects died of signal 13
> error: pack-objects died with strange error
> error: failed to push some refs to 'ssh://raboofje@xxxxxxxxxxxxxxxxxxxxxxxxxx/gitroot/notion/notion' arnouten@bird:~/asdf/notion$

That reminds me: the output seems more noisy than it needs to be, no?

-- 8< --
Subject: send-pack: avoid redundant "pack-objects died with strange error"

Saying "pack-objects died with strange error" after "pack-objects
died of signal 13" seems kind of redundant.  The latter was
introduced when send-pack switched to the run-command API, which
reports abnormal exits on behalf of the caller.

Normal exits with nonzero status are not reported by run-command,
though.  Be more helpful in reporting them by including the exit
status while at it.

The result should look something like this:

	$ git push sf master
	Counting objects: 21542, done.
	Compressing objects: 100% (4179/4179), done.
	fatal: Unable to create temporary file: Permission denied
	error: pack-objects died of signal 13
	error: failed to push some refs to 'ssh://sf.net/gitroot/project/project'
	$

Or in the "controlled exit" case:

	[...]
	error: pack-objects died with status 128
	error: failed to push some refs to 'ssh://example.com/foo/bar'
	$

Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
 builtin/send-pack.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index 481602d..51b722b 100644
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
@@ -50,7 +50,7 @@ static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *ext
 		NULL,
 	};
 	struct child_process po;
-	int i;
+	int i, status;
 
 	i = 4;
 	if (args->use_thin_pack)
@@ -100,9 +100,10 @@ static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *ext
 		po.out = -1;
 	}
 
-	if (finish_command(&po))
-		return error("pack-objects died with strange error");
-	return 0;
+	status = finish_command(&po);
+	if (status > 0)
+		error("pack-objects died with status %d", status);
+	return status;
 }
 
 static int receive_status(int in, struct ref *refs)
-- 
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]