Re: git-fetch question/bug

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

 



"Govind Salinas" <blix@xxxxxxxxxxxxxxxxx> 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;
 }
 
 /*
--
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]

  Powered by Linux