git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git pull fails to exit with non-zero status after fatal error

From
Junio C Hamano <junkio@cox.net>
Date
Mar 3, 2007, 20:56 UTC
Message-ID
<7vabyu9hcp.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.63.0703031913100.22628@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 28 quoted lines
> 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
 	;;
Previous: Larry StreepyNext: Johannes Schindelin
Message 4 of 8 in “git pull fails to exit with non-zero status after fatal error”
  1. Larry StreepyMar 3, 2007
  2. Johannes SchindelinMar 3, 2007
  3. Larry StreepyMar 3, 2007
  4. Junio C HamanoMar 3, 2007
  5. Johannes SchindelinMar 3, 2007
  6. Shawn O. PearceMar 3, 2007
  7. Junio C HamanoMar 3, 2007
  8. Johannes SchindelinMar 3, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.