* git pull fails to exit with non-zero status after fatal error
@ 2007-03-03 16:45 Larry Streepy
2007-03-03 18:13 ` Johannes Schindelin
0 siblings, 1 reply; 8+ messages in thread
From: Larry Streepy @ 2007-03-03 16:45 UTC (permalink / raw)
To: git
We have just upgraded to 1.5 (don't know if this is specific to 1.5, but
just in case). When I perform a git-pull on a working repo that has a
modified file, git pull refuses to do the pull, as shown below:
$ git pull
Updating b5d9263..506b347
tools/Pvt/Pvt.py: needs update
fatal: Entry 'tools/Pvt/Pvt.py' not uptodate. Cannot merge.
$ echo $?
0
Notice the exit status of 0. The driver scripts I use rely on a
non-zero status to send me email when the git-pull fails, but this case
eludes detection.
I'm assuming this is a bug, but if it's intended behavior I'd like to
understand why it would use a 0 exit status after a issuing a fatal error.
Thanks,
Larry.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: git pull fails to exit with non-zero status after fatal error
2007-03-03 16:45 git pull fails to exit with non-zero status after fatal error Larry Streepy
@ 2007-03-03 18:13 ` Johannes Schindelin
2007-03-03 19:27 ` Larry Streepy
2007-03-03 20:56 ` Junio C Hamano
0 siblings, 2 replies; 8+ messages in thread
From: Johannes Schindelin @ 2007-03-03 18:13 UTC (permalink / raw)
To: Larry Streepy; +Cc: git
Hi,
On Sat, 3 Mar 2007, Larry Streepy wrote:
> We have just upgraded to 1.5 (don't know if this is specific to 1.5, but just
> in case). When I perform a git-pull on a working repo that has a modified
> file, git pull refuses to do the pull, as shown below:
>
> $ git pull
> Updating b5d9263..506b347
> tools/Pvt/Pvt.py: needs update
> fatal: Entry 'tools/Pvt/Pvt.py' not uptodate. Cannot merge.
> $ echo $?
> 0
>
> Notice the exit status of 0.
Does this fix it?
diff --git a/git-merge.sh b/git-merge.sh
index 498c938..6b23bf5 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -295,8 +295,9 @@ f,*)
new_head=$(git-rev-parse --verify "$1^0") &&
git-read-tree -v -m -u --exclude-per-directory=.gitignore $head "$new_head" &&
finish "$new_head" "Fast forward"
+ ret=$?
dropsave
- exit 0
+ exit $ret
;;
?,1,?*"$LF"?*,*)
# We are not doing octopus and not fast forward. Need a
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: git pull fails to exit with non-zero status after fatal error
2007-03-03 18:13 ` Johannes Schindelin
@ 2007-03-03 19:27 ` Larry Streepy
2007-03-03 20:56 ` Junio C Hamano
1 sibling, 0 replies; 8+ messages in thread
From: Larry Streepy @ 2007-03-03 19:27 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
I'll give it a try and let you know.
Thanks for the quick feedback.
Larry.
Johannes Schindelin wrote:
> Does this fix it?
>
> diff --git a/git-merge.sh b/git-merge.sh
> index 498c938..6b23bf5 100755
> --- a/git-merge.sh
> +++ b/git-merge.sh
> @@ -295,8 +295,9 @@ f,*)
> new_head=$(git-rev-parse --verify "$1^0") &&
> git-read-tree -v -m -u --exclude-per-directory=.gitignore $head "$new_head" &&
> finish "$new_head" "Fast forward"
> + ret=$?
> dropsave
> - exit 0
> + exit $ret
> ;;
> ?,1,?*"$LF"?*,*)
> # We are not doing octopus and not fast forward. Need a
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: git pull fails to exit with non-zero status after fatal error
2007-03-03 18:13 ` Johannes Schindelin
2007-03-03 19:27 ` Larry Streepy
@ 2007-03-03 20:56 ` Junio C Hamano
2007-03-03 21:10 ` Johannes Schindelin
1 sibling, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2007-03-03 20:56 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Larry Streepy, git
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> On Sat, 3 Mar 2007, Larry Streepy wrote:
>
>> $ git pull
>> Updating b5d9263..506b347
>> tools/Pvt/Pvt.py: needs update
>> fatal: Entry 'tools/Pvt/Pvt.py' not uptodate. Cannot merge.
>> $ echo $?
>> 0
>>
>> Notice the exit status of 0.
>
> Does this fix it?
>
> diff --git a/git-merge.sh b/git-merge.sh
> index 498c938..6b23bf5 100755
> --- a/git-merge.sh
> +++ b/git-merge.sh
> @@ -295,8 +295,9 @@ f,*)
> new_head=$(git-rev-parse --verify "$1^0") &&
> git-read-tree -v -m -u --exclude-per-directory=.gitignore $head "$new_head" &&
> finish "$new_head" "Fast forward"
> + ret=$?
> dropsave
> - exit 0
> + exit $ret
> ;;
> ?,1,?*"$LF"?*,*)
> # We are not doing octopus and not fast forward. Need a
The cation "dropsave" takes is to remove the files that are not
needed after a successful merge, so I think it is better to fail
if the && chain that ends with finish, like this.
diff --git a/git-merge.sh b/git-merge.sh
index 498c938..4afcd95 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -294,7 +294,7 @@ f,*)
git-update-index --refresh 2>/dev/null
new_head=$(git-rev-parse --verify "$1^0") &&
git-read-tree -v -m -u --exclude-per-directory=.gitignore $head "$new_head" &&
- finish "$new_head" "Fast forward"
+ finish "$new_head" "Fast forward" || exit
dropsave
exit 0
;;
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: git pull fails to exit with non-zero status after fatal error
2007-03-03 20:56 ` Junio C Hamano
@ 2007-03-03 21:10 ` Johannes Schindelin
2007-03-03 21:23 ` Shawn O. Pearce
0 siblings, 1 reply; 8+ messages in thread
From: Johannes Schindelin @ 2007-03-03 21:10 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Larry Streepy, git
Hi,
On Sat, 3 Mar 2007, Junio C Hamano wrote:
> - finish "$new_head" "Fast forward"
> + finish "$new_head" "Fast forward" || exit
Doesn't "exit" default to "exit 0"?
Ciao,
Dscho
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: git pull fails to exit with non-zero status after fatal error
2007-03-03 21:10 ` Johannes Schindelin
@ 2007-03-03 21:23 ` Shawn O. Pearce
2007-03-03 22:17 ` Junio C Hamano
2007-03-03 22:49 ` Johannes Schindelin
0 siblings, 2 replies; 8+ messages in thread
From: Shawn O. Pearce @ 2007-03-03 21:23 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, Larry Streepy, git
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> On Sat, 3 Mar 2007, Junio C Hamano wrote:
>
> > - finish "$new_head" "Fast forward"
> > + finish "$new_head" "Fast forward" || exit
>
> Doesn't "exit" default to "exit 0"?
No, it carries the exit status of the prior failed command if the
prior command failed. ;-)
For what its worth, I learned that only while hacking on git-merge.
I think it is highly non-obvious.
--
Shawn.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: git pull fails to exit with non-zero status after fatal error
2007-03-03 21:23 ` Shawn O. Pearce
@ 2007-03-03 22:17 ` Junio C Hamano
2007-03-03 22:49 ` Johannes Schindelin
1 sibling, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2007-03-03 22:17 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Johannes Schindelin, Larry Streepy, git
"Shawn O. Pearce" <spearce@spearce.org> writes:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>> On Sat, 3 Mar 2007, Junio C Hamano wrote:
>>
>> > - finish "$new_head" "Fast forward"
>> > + finish "$new_head" "Fast forward" || exit
>>
>> Doesn't "exit" default to "exit 0"?
>
> No, it carries the exit status of the prior failed command if the
> prior command failed. ;-)
>
> For what its worth, I learned that only while hacking on git-merge.
> I think it is highly non-obvious.
Sorry to be a traditionalist. "sequence && of && commands || exit"
is an established bourne shell idiom.
I do not mind if somebody proposed to change that to "... || exit $?"
to unconfuse uninitiated, though.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: git pull fails to exit with non-zero status after fatal error
2007-03-03 21:23 ` Shawn O. Pearce
2007-03-03 22:17 ` Junio C Hamano
@ 2007-03-03 22:49 ` Johannes Schindelin
1 sibling, 0 replies; 8+ messages in thread
From: Johannes Schindelin @ 2007-03-03 22:49 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Junio C Hamano, Larry Streepy, git
Hi,
On Sat, 3 Mar 2007, Shawn O. Pearce wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > On Sat, 3 Mar 2007, Junio C Hamano wrote:
> >
> > > - finish "$new_head" "Fast forward"
> > > + finish "$new_head" "Fast forward" || exit
> >
> > Doesn't "exit" default to "exit 0"?
>
> No, it carries the exit status of the prior failed command if the
> prior command failed. ;-)
You live and learn, live and learn...
Thanks,
Dscho
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-03-03 22:49 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-03 16:45 git pull fails to exit with non-zero status after fatal error Larry Streepy
2007-03-03 18:13 ` Johannes Schindelin
2007-03-03 19:27 ` Larry Streepy
2007-03-03 20:56 ` Junio C Hamano
2007-03-03 21:10 ` Johannes Schindelin
2007-03-03 21:23 ` Shawn O. Pearce
2007-03-03 22:17 ` Junio C Hamano
2007-03-03 22:49 ` Johannes Schindelin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.