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

Re: [PATCH] git-am: teach git-am to apply a patch to an unborn branch

From
Jeff King <peff@peff.net>
Date
Mar 20, 2009, 04:37 UTC
Message-ID
<20090320043752.GA27160@coredump.intra.peff.net>
In-Reply-To
<20090320071231.6117@nanako3.lavabit.com>
On Fri, Mar 20, 2009 at 07:12:31AM +0900, Nanako Shiraishi wrote:
> Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Thanks for picking up this topic. It looks sane overall.
Show 8 quoted lines
> -	parent=$(git rev-parse --verify HEAD) &&
> +	if parent=$(git rev-parse --verify -q HEAD)
> +	then
> +		pparent="-p $parent"
> +	else
> +		echo >&2 "applying to an empty history"
> +		parent= pparent=
> +	fi &&

Note that the '&&' here is now pointless, since one side of the conditional will always be true. We are losing the ability to detect errors besides "HEAD does not point to a valid object", but I don't think there is a way to tell the difference from the exit code of rev-parse.

-Peff
Previous: Junio C Hamano
Message 3 of 3 in “git-am: teach git-am to apply a patch to an unborn branch”
  1. git-am: teach git-am to apply a patch to an unborn branchNanako Shiraishi, Mar 19, 2009
  2. Junio C HamanoMar 19, 2009
  3. Jeff KingMar 20, 2009

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.