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

From: Jonathan Nieder <[email-masked]>
Date: Sat, 16 Oct 2010 12:09:54 -0500

Saying "pack-objects died with strange error" after "pack-objects died
of signal 13" seems kind of redundant.  The latter message was
introduced when the run-command API changed to report abnormal exits
on behalf of the caller (v1.6.5-rc0~86^2~5, 2009-07-04).

Similarly, after a controlled pack-objects failure (detectable as a
normal exit with nonzero status), a "died with strange error" message
would be redundant next to the message from pack-objects itself.

So leave off the "strange error" messages.

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 (contrived example):

	[...]
	fatal: delta size changed
	error: failed to push some refs to 'ssh://example.com/foo/bar'
	$

Improved-by: Johannes Sixt <[email-masked]>
Signed-off-by: Jonathan Nieder <[email-masked]>
---
On Sat, Oct 16, 2010 at 11:25:33AM +0200, Johannes Sixt wrote:
> On Samstag, 16. Oktober 2010, Jonathan Nieder wrote:

>> 	[...]
>> 	error: pack-objects died with status 128
>> 	error: failed to push some refs to 'ssh://example.com/foo/bar'
>
> I sense that this quote is not complete. Did you strip some error message by 
> writing just "[...]"?

That was invented example output.

Googling for "pack-objects died with strange error" gives me [1], with
v1.6.2:

	$ git push
	Counting objects: 68, done.
	Delta compression using 2 threads.
	Compressing objects: 100% (50/50), done.
	Connection to SERVER closed by remote host.
	error: pack-objects died with strange error
	error: failed to push some refs to 'SERVER:PROJECT.git'

and [2], with v1.6.4.4:

	Counting objects: 4364, done.
	Delta compression using up to 2 threads.
	Compressing objects: 100% (4240/4240), done.
	error: pack-objects died with strange error | 44 KiB/s   
	error: failed to push some refs to 'mysite:main_site_repo'

and some similar examples.  All involve git versions before
v1.6.5-rc0~86^2~5 (run_command: report system call errors instead of
returning error codes, 2009-07-04) and after a triage turn out to be
signals.

Let's go with your fix (thanks!).

[1] http://stackoverflow.com/questions/718962/git-push-error-pack-objects-died-with-strange-error
[2] http://stackoverflow.com/questions/1781013/git-error-failed-to-push-some-refs-pack-objects-died-with-strange-error

 builtin/send-pack.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index 481602d..8aa3031 100644
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
@@ -101,7 +101,7 @@ static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *ext
 	}
 
 	if (finish_command(&po))
-		return error("pack-objects died with strange error");
+		return -1;
 	return 0;
 }
 
-- 
1.7.2.3