From: Junio C Hamano <junkio@cox.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH, N'TH TRY] Teach git-diff-files the new option `--no-index`
Date: Fri, 23 Feb 2007 03:44:30 -0800 [thread overview]
Message-ID: <7vmz353xpd.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.63.0702222148050.22628@wbgn013.biozentrum.uni-wuerzburg.de> (Johannes Schindelin's message of "Thu, 22 Feb 2007 21:50:10 +0100 (CET)")
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> With this flag and given two paths, git-diff-files behaves as a GNU diff
> lookalike (plus the git goodies like --check, colour, etc.). This flag
> is also available in git-diff. It also works outside of a git repository.
>
> In addition, if git-diff{,-files} is called without revision or stage
> parameter, and with exactly two paths at least one of which is not tracked,
> the default is --no-index.
>
> So, you can now say
>
> git diff /etc/inittab /etc/fstab
>
> and it actually works!
Modulo double slashes X-<.
$ diff --git a//etc/inittab b//etc/fstab
index 04eabd6..7314c1a 100644
--- a//etc/inittab
+++ b//etc/fstab
@@ -1,69 +1,13 @@
...
This problem is not new; this should fix it.
-- >8 --
diff-patch: Avoid emitting double-slashes in textual patch.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/diff.c b/diff.c
index 5ecb122..84937cb 100644
--- a/diff.c
+++ b/diff.c
@@ -219,6 +219,9 @@ static void emit_rewrite_diff(const char *name_a,
const char *new = diff_get_color(color_diff, DIFF_FILE_NEW);
const char *reset = diff_get_color(color_diff, DIFF_RESET);
+ name_a += (*name_a == '/');
+ name_b += (*name_b == '/');
+
name_a_tab = strchr(name_a, ' ') ? "\t" : "";
name_b_tab = strchr(name_b, ' ') ? "\t" : "";
@@ -1064,8 +1067,8 @@ static void builtin_diff(const char *name_a,
const char *set = diff_get_color(o->color_diff, DIFF_METAINFO);
const char *reset = diff_get_color(o->color_diff, DIFF_RESET);
- a_one = quote_two("a/", name_a);
- b_two = quote_two("b/", name_b);
+ a_one = quote_two("a/", name_a + (*name_a == '/'));
+ b_two = quote_two("b/", name_b + (*name_b == '/'));
lbl[0] = DIFF_FILE_VALID(one) ? a_one : "/dev/null";
lbl[1] = DIFF_FILE_VALID(two) ? b_two : "/dev/null";
printf("%sdiff --git %s %s%s\n", set, a_one, b_two, reset);
next prev parent reply other threads:[~2007-02-23 11:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-20 18:46 [PATCH] Teach git-diff{,-files} the new option `--no-index` Johannes Schindelin
2007-02-22 10:36 ` Junio C Hamano
2007-02-22 16:25 ` Johannes Schindelin
2007-02-22 18:09 ` Junio C Hamano
2007-02-22 18:27 ` Johannes Schindelin
2007-02-22 18:54 ` [PATCH] run_diff_files(): add option to prevent --no-index Johannes Schindelin
2007-02-22 19:18 ` [PATCH] Teach git-diff{,-files} the new option `--no-index` Junio C Hamano
2007-02-22 20:01 ` Johannes Schindelin
2007-02-22 20:28 ` Junio C Hamano
2007-02-22 20:47 ` Johannes Schindelin
2007-02-22 20:50 ` [PATCH, N'TH TRY] Teach git-diff-files " Johannes Schindelin
2007-02-23 11:44 ` Junio C Hamano [this message]
2007-02-23 16:07 ` diff-patch: Avoid emitting double-slashes in textual patch Johannes Schindelin
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=7vmz353xpd.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.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).