From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pascal Obry <pascal@obry.net>,
Johannes Sixt <j.sixt@viscovery.net>,
Pascal Obry <pascal.obry@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH] Add format-patch option --no-name-prefix.
Date: Tue, 18 Dec 2007 17:06:07 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.4.64.0712181703560.23902@racer.site> (raw)
In-Reply-To: <alpine.LFD.0.9999.0712180840060.21557@woody.linux-foundation.org>
Hi,
On Tue, 18 Dec 2007, Linus Torvalds wrote:
> But I obviously think the version by Dscho is better (exactly because it's
> *not* enough to just clear the name prefix entirely), although I think
> that one is broken too - using ':' to separate the prefixes is *not*
> acceptable, since ':' is very possibly part of the prefix.
>
> So I think you'd need separate arguments for the from/to prefixes, and not
> try to shoehorn it into one argument. With possibly some simple form to
> say "no prefix". So maybe something like
>
> --src-prefix=<string> // default "a/"
> --dst-prefix=<string> // default "b/"
> --no-prefix // shorthand for --src-prefix="" --dst-prefix=""
>
> would work for everybody?
If this is preferred, please squash this:
-- snipsnap --
Documentation/diff-options.txt | 11 ++++++++---
diff.c | 24 ++++++++++++++----------
2 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 672a2d0..0d3dccc 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -211,9 +211,14 @@ endif::git-format-patch[]
--no-ext-diff::
Disallow external diff drivers.
---prefix=<prefix1>[:<prefix2>]::
- Show the given path prefixes instead of "a/" and "b/". Leave
- it empty to show no prefix at all.
+--src-prefix <prefix>::
+ Show the given source prefix instead of "a/".
+
+--dst-prefix <prefix>::
+ Show the given destination prefix instead of "b/".
+
+--no-prefix::
+ Do not show any source or destination prefix.
For more detailed explanation on these common options, see also
link:diffcore.html[diffcore documentation].
diff --git a/diff.c b/diff.c
index 095bbb5..9bc5fea 100644
--- a/diff.c
+++ b/diff.c
@@ -2317,16 +2317,20 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
else if (40 < options->abbrev)
options->abbrev = 40;
}
- else if (!strcmp(arg, "--prefix=")) {
- char *colon = strchr(arg + 9, ':');
- options->a_prefix = arg + 9;
- if (colon) {
- *colon = '\0';
- options->b_prefix = colon + 1;
- }
- else
- options->b_prefix = options->a_prefix;
- }
+ else if (!strcmp(arg, "--src-prefix")) {
+ if (ac < 2)
+ return error("--src-prefix needs a parameter");
+ options->a_prefix = arg + 1;
+ return 2;
+ }
+ else if (!strcmp(arg, "--dst-prefix")) {
+ if (ac < 2)
+ return error("--dst-prefix needs a parameter");
+ options->b_prefix = arg + 1;
+ return 2;
+ }
+ else if (!strcmp(arg, "--no-prefix"))
+ options->a_prefix = options->b_prefix = "";
else
return 0;
return 1;
next prev parent reply other threads:[~2007-12-18 17:06 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-18 15:42 [PATCH] Add format-patch option --no-name-prefix Pascal Obry
2007-12-18 15:47 ` Pascal Obry
2007-12-18 15:54 ` Johannes Sixt
2007-12-18 15:59 ` Pascal Obry
2007-12-18 16:50 ` Linus Torvalds
2007-12-18 16:54 ` Pascal Obry
2007-12-18 17:06 ` Johannes Schindelin [this message]
2007-12-18 17:56 ` Pascal Obry
2007-12-18 18:56 ` [PATCH] Teach diff machinery to display other prefixes than "a/" and "b/" Johannes Schindelin
2007-12-18 19:03 ` Pascal Obry
2007-12-18 19:05 ` Linus Torvalds
2007-12-18 19:32 ` [PATCH v4] " Johannes Schindelin
2007-12-18 19:55 ` Linus Torvalds
2007-12-18 20:07 ` [PATCH] Add format-patch option --no-name-prefix Junio C Hamano
2007-12-18 16:03 ` Andreas Ericsson
2007-12-18 16:11 ` Pascal Obry
2007-12-19 8:55 ` Andreas Ericsson
2007-12-19 9:21 ` Johannes Sixt
2007-12-18 16:21 ` [PATCH] Teach diff machinery to display other prefixes than "a/" and "b/" Johannes Schindelin
2007-12-18 16:45 ` Pascal Obry
2007-12-18 16:58 ` Johannes Schindelin
2007-12-18 17:02 ` Matthieu Moy
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=Pine.LNX.4.64.0712181703560.23902@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=j.sixt@viscovery.net \
--cc=pascal.obry@gmail.com \
--cc=pascal@obry.net \
--cc=torvalds@linux-foundation.org \
/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).