From: Junio C Hamano <junkio@cox.net>
To: Luben Tuikov <ltuikov@yahoo.com>
Cc: git@vger.kernel.org, Andreas Ericsson <ae@op5.se>
Subject: Re: [RFC] git-format-patch options
Date: Mon, 21 Nov 2005 11:27:12 -0800 [thread overview]
Message-ID: <7vhda5ssxb.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <20051121162540.4722.qmail@web31812.mail.mud.yahoo.com> (Luben Tuikov's message of "Mon, 21 Nov 2005 08:25:40 -0800 (PST)")
Luben Tuikov <ltuikov@yahoo.com> writes:
> I was wondering about the value of
>
> git-format-patch <commit-ish>
>
> to output/prepare a diff patch between the indicated commit
> and its parent. As opposed to the current behaviour giving
> all changes between the indicated commit and HEAD.
Yes, that would be "git-format-patch $commit^1 $commit", but it
might deserve better shortcuts.
Later Andreas quoted the backward compatibility constraints:
> # Backward compatible argument parsing hack.
> #
> # Historically, we supported:
> # 1. "rev1" is equivalent to "rev1..HEAD"
> # 2. "rev1..rev2"
> # 3. "rev1" "rev2 is equivalent to "rev1..rev2"
> #
> # We want to take a sequence of "rev1..rev2" in general.
> # Also, "rev1.." should mean "rev1..HEAD"; git-diff users are
> # familiar with that syntax.
The case statement that follows that comment is not quite right,
BTW. "format-patch foo bar..baz" should mean sequence of "foo"
and then "bar..baz", but it incorrectly translates to a
malformed "foo..bar..baz".
Modulo that bug, what the current code does is to special case
one or two arguments case and rewrite them in that case
statement, and then iterate over the resulting "$@". We barf if
each 'revpair' is not in rev1..rev2 format.
But it might make sense to (still keeping the above three
backward compatibility syntax exceptions) interpret "rev" to
mean "rev^1..rev", like this:
---
diff --git a/git-format-patch.sh b/git-format-patch.sh
index 7ee5d32..351790c 100755
--- a/git-format-patch.sh
+++ b/git-format-patch.sh
@@ -99,7 +99,7 @@ filelist=$tmp-files
# Also, "rev1.." should mean "rev1..HEAD"; git-diff users are
# familiar with that syntax.
-case "$#,$1" in
+case "$#,$1$2" in
1,?*..?*)
# single "rev1..rev2"
;;
@@ -131,7 +131,8 @@ do
rev2=`expr "$revpair" : '.*\.\.\(.*\)'`
;;
*)
- usage
+ rev1="$revpair^"
+ rev2="$revpair"
;;
esac
git-rev-parse --verify "$rev1^0" >/dev/null 2>&1 ||
next prev parent reply other threads:[~2005-11-21 19:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-21 16:25 [RFC] git-format-patch options Luben Tuikov
2005-11-21 16:44 ` Andreas Ericsson
2005-11-21 17:36 ` Luben Tuikov
2005-11-21 17:59 ` Andreas Ericsson
2005-11-21 18:27 ` Luben Tuikov
2005-11-21 19:11 ` Ryan Anderson
2005-11-22 1:53 ` Luben Tuikov
2005-11-21 19:27 ` Junio C Hamano [this message]
2005-11-22 6:26 ` Luben Tuikov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vhda5ssxb.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=ae@op5.se \
--cc=git@vger.kernel.org \
--cc=ltuikov@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).