* git-fetch question/bug @ 2008-03-14 5:08 Govind Salinas 2008-03-14 5:27 ` Junio C Hamano 0 siblings, 1 reply; 4+ messages in thread From: Govind Salinas @ 2008-03-14 5:08 UTC (permalink / raw) To: Git Mailing List Hey, I was wrapping git-fetch when I discovered that it does not return error when the fetch fails due to it not being a ff... ~/Desktop/Projects/test (test2) govind@gnosis: 574> git fetch . remotes/origin/gitnext:test2 From . ! [rejected] origin/gitnext -> test2 (non fast forward) ~/Desktop/Projects/test (test2) govind@gnosis: 575> echo $? 0 ~/Desktop/Projects/test (test2) govind@gnosis: 576> git version git version 1.5.4.3.587.g0bdd73 So, is this the expected behavior? I expect it should return non-0 when it does not perform the requested fetch. If this is supposed to be this way, then sorry for the noise. Thanks, Govind. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: git-fetch question/bug 2008-03-14 5:08 git-fetch question/bug Govind Salinas @ 2008-03-14 5:27 ` Junio C Hamano 2008-03-14 7:52 ` Jakub Narebski 2008-03-14 15:57 ` Daniel Barkalow 0 siblings, 2 replies; 4+ messages in thread From: Junio C Hamano @ 2008-03-14 5:27 UTC (permalink / raw) To: Govind Salinas; +Cc: Git Mailing List, Daniel Barkalow "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; } /* ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: git-fetch question/bug 2008-03-14 5:27 ` Junio C Hamano @ 2008-03-14 7:52 ` Jakub Narebski 2008-03-14 15:57 ` Daniel Barkalow 1 sibling, 0 replies; 4+ messages in thread From: Jakub Narebski @ 2008-03-14 7:52 UTC (permalink / raw) To: git Junio C Hamano wrote: > "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? [...] Wouldn't it be better to distinguish somehow remote side errors (like for example: could not connect to remote server) and local side errors (like fetch refused because of being not fast-forward)? The former are usually not recoverable (unless it is URL that is mistyped), the latter could be usually resolved (forced for example)... -- Jakub Narebski Warsaw, Poland ShadeHawk on #git ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: git-fetch question/bug 2008-03-14 5:27 ` Junio C Hamano 2008-03-14 7:52 ` Jakub Narebski @ 2008-03-14 15:57 ` Daniel Barkalow 1 sibling, 0 replies; 4+ messages in thread From: Daniel Barkalow @ 2008-03-14 15:57 UTC (permalink / raw) To: Junio C Hamano; +Cc: Govind Salinas, Git Mailing List On Thu, 13 Mar 2008, Junio C Hamano wrote: > "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? Looks right to me, although we should probably note that this probably means that if pull does a fetch that fails for some ref that you're not merging, it won't do the merge, even though it obviously could. So I think fixing this would presently (unless fetch and pull communicate more) be a regression for people whose upstreams introduce a new non-ff branch that matches their non-force fetch pattern. -Daniel *This .sig left intentionally blank* ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-03-14 15:58 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-03-14 5:08 git-fetch question/bug Govind Salinas 2008-03-14 5:27 ` Junio C Hamano 2008-03-14 7:52 ` Jakub Narebski 2008-03-14 15:57 ` Daniel Barkalow
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).