{"thread":{"id":"7062","subject":"git pull fails to exit with non-zero status after fatal error","startedAt":"2007-03-03T16:45:53Z","lastAt":"2007-03-03T22:49:17Z","messageCount":8,"participants":["Larry Streepy","Johannes Schindelin","Junio C Hamano","Shawn O. Pearce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"36184","messageId":"45E9A641.8020002@lightspeed.com","threadId":"7062","inReplyTo":null,"subject":"git pull fails to exit with non-zero status after fatal error","fromName":"Larry Streepy","fromEmail":"larry@lightspeed.com","sentAt":"2007-03-03T16:45:53Z","receivedAt":"2007-03-03T16:45:53Z","isPatch":false,"sender":{"key":"larry@lightspeed.com","avatar":null},"body":"We have just upgraded to 1.5 (don't know if this is specific to 1.5, but \njust in case).  When I perform a git-pull on a working repo that has a \nmodified file, git pull refuses to do the pull, as shown below:\n\n$ git pull\nUpdating b5d9263..506b347\ntools/Pvt/Pvt.py: needs update\nfatal: Entry 'tools/Pvt/Pvt.py' not uptodate. Cannot merge.\n$ echo $?\n0\n\nNotice the exit status of 0.  The driver scripts I use rely on a \nnon-zero status to send me email when the git-pull fails, but this case \neludes detection.\n\nI'm assuming this is a bug, but if it's intended behavior I'd like to \nunderstand why it would use a 0 exit status after a issuing a fatal error.\n\nThanks,\nLarry.\n"},{"id":"36186","messageId":"Pine.LNX.4.63.0703031913100.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"7062","inReplyTo":"45E9A641.8020002@lightspeed.com","subject":"Re: git pull fails to exit with non-zero status after fatal error","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-03-03T18:13:41Z","receivedAt":"2007-03-03T18:13:41Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 3 Mar 2007, Larry Streepy wrote:\n\n> We have just upgraded to 1.5 (don't know if this is specific to 1.5, but just\n> in case).  When I perform a git-pull on a working repo that has a modified\n> file, git pull refuses to do the pull, as shown below:\n> \n> $ git pull\n> Updating b5d9263..506b347\n> tools/Pvt/Pvt.py: needs update\n> fatal: Entry 'tools/Pvt/Pvt.py' not uptodate. Cannot merge.\n> $ echo $?\n> 0\n> \n> Notice the exit status of 0.\n\nDoes this fix it?\n\ndiff --git a/git-merge.sh b/git-merge.sh\nindex 498c938..6b23bf5 100755\n--- a/git-merge.sh\n+++ b/git-merge.sh\n@@ -295,8 +295,9 @@ f,*)\n \tnew_head=$(git-rev-parse --verify \"$1^0\") &&\n \tgit-read-tree -v -m -u --exclude-per-directory=.gitignore $head \"$new_head\" &&\n \tfinish \"$new_head\" \"Fast forward\"\n+\tret=$?\n \tdropsave\n-\texit 0\n+\texit $ret\n \t;;\n ?,1,?*\"$LF\"?*,*)\n \t# We are not doing octopus and not fast forward.  Need a\n"},{"id":"36197","messageId":"45E9CC25.3030305@lightspeed.com","threadId":"7062","inReplyTo":"Pine.LNX.4.63.0703031913100.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: git pull fails to exit with non-zero status after fatal error","fromName":"Larry Streepy","fromEmail":"larry@lightspeed.com","sentAt":"2007-03-03T19:27:33Z","receivedAt":"2007-03-03T19:27:33Z","isPatch":false,"sender":{"key":"larry@lightspeed.com","avatar":null},"body":"I'll give it a try and let you know.\n\nThanks for the quick feedback.\n\nLarry.\n\nJohannes Schindelin wrote:\n> Does this fix it?\n>\n> diff --git a/git-merge.sh b/git-merge.sh\n> index 498c938..6b23bf5 100755\n> --- a/git-merge.sh\n> +++ b/git-merge.sh\n> @@ -295,8 +295,9 @@ f,*)\n>  \tnew_head=$(git-rev-parse --verify \"$1^0\") &&\n>  \tgit-read-tree -v -m -u --exclude-per-directory=.gitignore $head \"$new_head\" &&\n>  \tfinish \"$new_head\" \"Fast forward\"\n> +\tret=$?\n>  \tdropsave\n> -\texit 0\n> +\texit $ret\n>  \t;;\n>  ?,1,?*\"$LF\"?*,*)\n>  \t# We are not doing octopus and not fast forward.  Need a\n>   \n"},{"id":"36206","messageId":"7vabyu9hcp.fsf@assigned-by-dhcp.cox.net","threadId":"7062","inReplyTo":"Pine.LNX.4.63.0703031913100.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: git pull fails to exit with non-zero status after fatal error","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-03-03T20:56:06Z","receivedAt":"2007-03-03T20:56:06Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> On Sat, 3 Mar 2007, Larry Streepy wrote:\n>\n>> $ git pull\n>> Updating b5d9263..506b347\n>> tools/Pvt/Pvt.py: needs update\n>> fatal: Entry 'tools/Pvt/Pvt.py' not uptodate. Cannot merge.\n>> $ echo $?\n>> 0\n>> \n>> Notice the exit status of 0.\n>\n> Does this fix it?\n>\n> diff --git a/git-merge.sh b/git-merge.sh\n> index 498c938..6b23bf5 100755\n> --- a/git-merge.sh\n> +++ b/git-merge.sh\n> @@ -295,8 +295,9 @@ f,*)\n>  \tnew_head=$(git-rev-parse --verify \"$1^0\") &&\n>  \tgit-read-tree -v -m -u --exclude-per-directory=.gitignore $head \"$new_head\" &&\n>  \tfinish \"$new_head\" \"Fast forward\"\n> +\tret=$?\n>  \tdropsave\n> -\texit 0\n> +\texit $ret\n>  \t;;\n>  ?,1,?*\"$LF\"?*,*)\n>  \t# We are not doing octopus and not fast forward.  Need a\n\nThe cation \"dropsave\" takes is to remove the files that are not\nneeded after a successful merge, so I think it is better to fail\nif the && chain that ends with finish, like this.\n\ndiff --git a/git-merge.sh b/git-merge.sh\nindex 498c938..4afcd95 100755\n--- a/git-merge.sh\n+++ b/git-merge.sh\n@@ -294,7 +294,7 @@ f,*)\n \tgit-update-index --refresh 2>/dev/null\n \tnew_head=$(git-rev-parse --verify \"$1^0\") &&\n \tgit-read-tree -v -m -u --exclude-per-directory=.gitignore $head \"$new_head\" &&\n-\tfinish \"$new_head\" \"Fast forward\"\n+\tfinish \"$new_head\" \"Fast forward\" || exit\n \tdropsave\n \texit 0\n \t;;\n"},{"id":"36208","messageId":"Pine.LNX.4.63.0703032210010.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"7062","inReplyTo":"7vabyu9hcp.fsf@assigned-by-dhcp.cox.net","subject":"Re: git pull fails to exit with non-zero status after fatal error","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-03-03T21:10:31Z","receivedAt":"2007-03-03T21:10:31Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 3 Mar 2007, Junio C Hamano wrote:\n\n> -\tfinish \"$new_head\" \"Fast forward\"\n> +\tfinish \"$new_head\" \"Fast forward\" || exit\n\nDoesn't \"exit\" default to \"exit 0\"?\n\nCiao,\nDscho\n"},{"id":"36209","messageId":"20070303212348.GA17796@spearce.org","threadId":"7062","inReplyTo":"Pine.LNX.4.63.0703032210010.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: git pull fails to exit with non-zero status after fatal error","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-03-03T21:23:48Z","receivedAt":"2007-03-03T21:23:48Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> On Sat, 3 Mar 2007, Junio C Hamano wrote:\n> \n> > -\tfinish \"$new_head\" \"Fast forward\"\n> > +\tfinish \"$new_head\" \"Fast forward\" || exit\n> \n> Doesn't \"exit\" default to \"exit 0\"?\n\nNo, it carries the exit status of the prior failed command if the\nprior command failed.  ;-)\n\nFor what its worth, I learned that only while hacking on git-merge.\nI think it is highly non-obvious.\n\n-- \nShawn.\n"},{"id":"36214","messageId":"7vlkie7z0s.fsf@assigned-by-dhcp.cox.net","threadId":"7062","inReplyTo":"20070303212348.GA17796@spearce.org","subject":"Re: git pull fails to exit with non-zero status after fatal error","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-03-03T22:17:23Z","receivedAt":"2007-03-03T22:17:23Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n>> On Sat, 3 Mar 2007, Junio C Hamano wrote:\n>> \n>> > -\tfinish \"$new_head\" \"Fast forward\"\n>> > +\tfinish \"$new_head\" \"Fast forward\" || exit\n>> \n>> Doesn't \"exit\" default to \"exit 0\"?\n>\n> No, it carries the exit status of the prior failed command if the\n> prior command failed.  ;-)\n>\n> For what its worth, I learned that only while hacking on git-merge.\n> I think it is highly non-obvious.\n\nSorry to be a traditionalist.  \"sequence && of && commands || exit\"\nis an established bourne shell idiom.\n\nI do not mind if somebody proposed to change that to \"... || exit $?\"\nto unconfuse uninitiated, though.\n"},{"id":"36216","messageId":"Pine.LNX.4.63.0703032348570.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"7062","inReplyTo":"20070303212348.GA17796@spearce.org","subject":"Re: git pull fails to exit with non-zero status after fatal error","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-03-03T22:49:17Z","receivedAt":"2007-03-03T22:49:17Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 3 Mar 2007, Shawn O. Pearce wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> > On Sat, 3 Mar 2007, Junio C Hamano wrote:\n> > \n> > > -\tfinish \"$new_head\" \"Fast forward\"\n> > > +\tfinish \"$new_head\" \"Fast forward\" || exit\n> > \n> > Doesn't \"exit\" default to \"exit 0\"?\n> \n> No, it carries the exit status of the prior failed command if the\n> prior command failed.  ;-)\n\nYou live and learn, live and learn...\n\nThanks,\nDscho\n"}]}