git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Govind Salinas" <blix@sophiasuchtig.com>
Cc: "Git Mailing List" <git@vger.kernel.org>,
	Daniel Barkalow <barkalow@iabervon.org>
Subject: Re: git-fetch question/bug
Date: Thu, 13 Mar 2008 22:27:43 -0700	[thread overview]
Message-ID: <7vbq5hub74.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <5d46db230803132208r3f3f9e34q80bb9c03d65ab67c@mail.gmail.com> (Govind Salinas's message of "Fri, 14 Mar 2008 00:08:01 -0500")

"Govind Salinas" <blix@sophiasuchtig.com> writes:

> ... git-fetch when I discovered that it does not return
> error when the
> fetch fails due to it not being a ff...

I think this is a regression introduced when "git-fetch" was
re-implemented in C.  git-fetch--tool's native-store subcommand seems to
have signaled this as an error, and it is reasonable to expect an error
exit from the command in this case.

Probably something like this?

 builtin-fetch.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/builtin-fetch.c b/builtin-fetch.c
index 55f611e..a2deb3e 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -297,7 +297,7 @@ static int store_updated_refs(const char *url, struct ref *ref_map)
 {
 	FILE *fp;
 	struct commit *commit;
-	int url_len, i, note_len, shown_url = 0;
+	int url_len, i, note_len, shown_url = 0, err = 0;
 	char note[1024];
 	const char *what, *kind;
 	struct ref *rm;
@@ -364,7 +364,8 @@ static int store_updated_refs(const char *url, struct ref *ref_map)
 			note);
 
 		if (ref) {
-			update_local_ref(ref, what, verbose, note);
+			if (update_local_ref(ref, what, verbose, note))
+				err = 1;
 			if (*note) {
 				if (!shown_url) {
 					fprintf(stderr, "From %.*s\n",
@@ -376,7 +377,7 @@ static int store_updated_refs(const char *url, struct ref *ref_map)
 		}
 	}
 	fclose(fp);
-	return 0;
+	return err;
 }
 
 /*

  reply	other threads:[~2008-03-14  5:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-14  5:08 git-fetch question/bug Govind Salinas
2008-03-14  5:27 ` Junio C Hamano [this message]
2008-03-14  7:52   ` Jakub Narebski
2008-03-14 15:57   ` Daniel Barkalow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vbq5hub74.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=barkalow@iabervon.org \
    --cc=blix@sophiasuchtig.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).