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

Re: [PATCH] Return non-zero status from pull if merge fails.

From
Junio C Hamano <junkio@cox.net>
Date
Nov 8, 2006, 00:05 UTC
Message-ID
<7vy7qmzttk.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20061107181053.GA26856@spearce.org>
"Shawn O. Pearce" <spearce@spearce.org> writes:
Show 13 quoted lines
> diff --git a/git-merge.sh b/git-merge.sh
> index cb09438..7725908 100755
> --- a/git-merge.sh
> +++ b/git-merge.sh
> @@ -203,7 +203,7 @@ f,*)
>  	git-update-index --refresh 2>/dev/null
>  	new_head=$(git-rev-parse --verify "$1^0") &&
>  	git-read-tree -u -v -m $head "$new_head" &&
> -	finish "$new_head" "Fast forward"
> +	finish "$new_head" "Fast forward" || exit 1
>  	dropsave
>  	exit 0
>  	;;

The shell function "finish" itself exits when there is an error; is this needed?

Show 8 quoted lines
> @@ -214,7 +214,7 @@ f,*)
> +	git var GIT_COMMITTER_IDENT >/dev/null || exit 1
> @@ -225,7 +225,7 @@ f,*)
> +	    ) || exit 1
> @@ -253,7 +253,7 @@ f,*)
> +git var GIT_COMMITTER_IDENT >/dev/null || exit 1
> @@ -327,7 +327,7 @@ done
> +    result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree $parents) || exit 1

Are these needed? Wouldn't "something || exit" already exit non-zero when something exits non-zero?

Show 12 quoted lines
> diff --git a/git-pull.sh b/git-pull.sh
> index ed04e7d..d10fcdd 100755
> --- a/git-pull.sh
> +++ b/git-pull.sh
> @@ -102,6 +102,6 @@ case "$strategy_args" in
>  esac
>  
>  merge_name=$(git-fmt-merge-msg <"$GIT_DIR/FETCH_HEAD") || exit
> -git-merge "--reflog-action=pull $*" \
> +exec git-merge "--reflog-action=pull $*" \
>  	$no_summary $no_commit $squash $strategy_args \
>  	"$merge_name" HEAD $merge_head
I think this is a good change.
Previous: Shawn O. PearceNext: Shawn Pearce
Message 2 of 5 in “Return non-zero status from pull if merge fails.”
  1. Return non-zero status from pull if merge fails.Shawn O. Pearce, Nov 7, 2006
  2. Junio C HamanoNov 8, 2006
  3. Shawn PearceNov 8, 2006
  4. Junio C HamanoNov 8, 2006
  5. Shawn PearceNov 8, 2006

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.