Re: git-fetch question/bug
"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;
}
/*