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

Re: [PATCH] git-am --one

From
Junio C Hamano <junkio@cox.net>
Date
Dec 14, 2005, 01:30 UTC
Message-ID
<7vy82o5uss.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<439F7105.9050302@zytor.com>
"H. Peter Anvin" <hpa@zytor.com> writes:
Show 5 quoted lines
> This patch adds the --one (-o) option to git-am, to apply a single 
> message in RFC 2822 format, as opposed to an mbox.  With some MUAs it's 
> a lot easier to save individual messages than with mboxes, and either 
> way the user may want to control the ordering if there are known 
> interdependencies.
Show 13 quoted lines
> +	# standard input.  To prepend the header, we thus want a
> +	# second cat, sigh...
> +	if test "$one" = t
> +	then
> +		LANG=C date +'From - %a %b %d %T %Y' > "$dotest"/fakefrom
> +		fakefrom="$dotest"/fakefrom
> +	else
> +		fakefrom=/dev/null
> +	fi
> +	cat "$@" | cat "$fakefrom" - |
>  	git-mailsplit -d$prec "$dotest/" >"$dotest/last" || {
>  		rm -fr "$dotest"
>  		exit 1

I understand the motivation, but I suspect skipping mailsplit might be simpler, like this untested code perhaps?

	case "$one" in
        '')
        	... original code ...
		;;
        *)
		one=`printf "%${prec}d" 1`
        	cat "$@" >"$dotest/$one"
                echo "$one" >"$dotest/last"
                ;;
	esac
Previous: H. Peter AnvinNext: H. Peter Anvin
Message 2 of 6 in “git-am --one”
  1. git-am --oneH. Peter Anvin, Dec 14, 2005
  2. Junio C HamanoDec 14, 2005
  3. H. Peter AnvinDec 14, 2005
  4. Junio C HamanoDec 14, 2005
  5. H. Peter AnvinDec 14, 2005
  6. Junio C HamanoDec 14, 2005

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.