From: John Cai <johncai86@gmail.com>
To: Elijah Newren <newren@gmail.com>
Cc: "John Cai via GitGitGadget" <gitgitgadget@gmail.com>,
git@vger.kernel.org, "Eric Sunshine" <sunshine@sunshineco.com>,
"Phillip Wood" <phillip.wood123@gmail.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Jeff King" <peff@peff.net>
Subject: Re: [PATCH v3 2/2] diff: teach diff to read algorithm from diff driver
Date: Mon, 20 Feb 2023 11:49:08 -0500 [thread overview]
Message-ID: <47981D9E-9DC7-4C23-911D-13BA52A27040@gmail.com> (raw)
In-Reply-To: <CABPp-BGDi1VQXFdGw_Y8i0ZDBOoHJe9039fh4mO44qJ-nJE1ig@mail.gmail.com>
Hi Elijah,
On 20 Feb 2023, at 11:21, Elijah Newren wrote:
> On Mon, Feb 20, 2023 at 7:32 AM John Cai <johncai86@gmail.com> wrote:
> [...]
>>> I'm still curious if this should this also include warnings/caveats, such as:
>>> * The diff attribute specified in .gitattributes will be ignored in
>>> a bare clone
>>> * The diff attribute specified in .gitattributes will be ignored if
>>> it is only specified in another branch (e.g. on a branch "special-file
>>> diff=patience" recorded in .gitattributes, then checkout master but
>>> run `git log -1 -p $branch`)
>>> * When a file is renamed, the diff attribute for the pre-image name
>>> is the only one the system pays attention to (thus adding "-R" can
>>> flip which diff algorithm is run for the renamed file).
>>
>> I would be fine with adding that--though originally I was thinking that these
>> can be inferred from the way that gitattributes are documented in [1]. Calling
>> these out would make it more clear though, so I could go either way.
>>
>>>
>>> Also, since I tested the three items above to verify they are valid
>>> warnings, I'm a bit confused. I thought your intent was to use this
>>> server-side[1], so isn't the bare clone aspect a deal-breaker for your
>>> intended usecase?
>>>
>>> [1] https://lore.kernel.org/git/7852AC7B-7A4E-4DD0-ADEA-CFFD5D16C595@gmail.com/
>>
>> yes, indeed. I was planning on adding bare repository support in a separate
>> patch series, since the additions in [2] allows .gitattributes to be read from a
>> bare repository.
>>
>> 1. https://git-scm.com/docs/gitattributes
>> 2. https://lore.kernel.org/git/0ca8b2458921fc40269b0c43b5ec86eba77d6b54.1673684790.git.karthik.188@gmail.com/
>>
>> thanks!
>> John
>
> Oh, interesting, I didn't know about [2]. So, is the plan to take the
> --source option from that series and add it to diff (perhaps with a
> different name, since log tends to consume diff options and --source
> is already taken)?
Yep, that would be the general idea
>
> And do you expect to get the tree-ish from the two the users are
> already specifying to diff? If so, which one do you use (the two
> commits being diffed might have differing .gitattributes files)? If
> not, what does that mean for users of e.g. the GitLab UI who have to
> specify a third tree when diffing?
Good question! Since it seems that when `git-diff(1)` considers diff.<driver>,
it goes with the path of the first one. (might need some confirmation here)
in diff.c:
static void run_diff(struct diff_filepair *p, struct diff_options *o)
{
const char *pgm = external_diff();
struct strbuf msg;
struct diff_filespec *one = p->one;
struct diff_filespec *two = p->two;
const char *name;
const char *other;
const char *attr_path;
name = one->path;
other = (strcmp(name, two->path) ? two->path : NULL);
attr_path = name;
if (o->prefix_length)
I was thinking we would just use the tree-ish of the first one
thanks
John
next prev parent reply other threads:[~2023-02-20 16:49 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-05 3:46 [PATCH 0/2] Teach diff to honor diff algorithms set through git attributes John Cai via GitGitGadget
2023-02-05 3:46 ` [PATCH 1/2] diff: consolidate diff algorithm option parsing John Cai via GitGitGadget
2023-02-06 16:20 ` Phillip Wood
2023-02-05 3:46 ` [PATCH 2/2] diff: teach diff to read gitattribute diff-algorithm John Cai via GitGitGadget
2023-02-05 17:50 ` Eric Sunshine
2023-02-06 13:10 ` John Cai
2023-02-06 16:27 ` Phillip Wood
2023-02-06 18:14 ` Eric Sunshine
2023-02-06 19:50 ` John Cai
2023-02-09 8:26 ` Elijah Newren
2023-02-09 10:31 ` "bad" diffs (was: [PATCH 2/2] diff: teach diff to read gitattribute diff-algorithm) Ævar Arnfjörð Bjarmason
2023-02-09 16:37 ` [PATCH 2/2] diff: teach diff to read gitattribute diff-algorithm John Cai
2023-02-06 16:39 ` Ævar Arnfjörð Bjarmason
2023-02-06 20:37 ` John Cai
2023-02-07 14:55 ` Phillip Wood
2023-02-07 17:00 ` John Cai
2023-02-09 9:09 ` Elijah Newren
2023-02-09 14:44 ` Phillip Wood
2023-02-10 9:57 ` Elijah Newren
2023-02-11 17:39 ` Phillip Wood
2023-02-11 1:59 ` Jeff King
2023-02-15 2:35 ` Elijah Newren
2023-02-15 4:21 ` Jeff King
2023-02-15 5:20 ` Junio C Hamano
2023-02-15 14:44 ` Phillip Wood
2023-02-15 15:00 ` Jeff King
2023-02-07 17:27 ` Ævar Arnfjörð Bjarmason
2023-02-15 14:47 ` Phillip Wood
2023-02-09 8:44 ` Elijah Newren
2023-02-14 21:16 ` John Cai
2023-02-15 3:41 ` Elijah Newren
2023-02-09 7:50 ` Elijah Newren
2023-02-09 9:41 ` Ævar Arnfjörð Bjarmason
2023-02-11 2:04 ` Jeff King
2023-02-07 17:56 ` Jeff King
2023-02-07 20:18 ` Ævar Arnfjörð Bjarmason
2023-02-07 20:47 ` Junio C Hamano
2023-02-07 21:05 ` Ævar Arnfjörð Bjarmason
2023-02-07 21:28 ` Junio C Hamano
2023-02-07 21:44 ` Ævar Arnfjörð Bjarmason
2023-02-09 16:34 ` John Cai
2023-02-11 1:39 ` Jeff King
2023-02-14 21:40 ` [PATCH v2 0/2] Teach diff to honor diff algorithms set through git attributes John Cai via GitGitGadget
2023-02-14 21:40 ` [PATCH v2 1/2] diff: consolidate diff algorithm option parsing John Cai via GitGitGadget
2023-02-15 2:38 ` Junio C Hamano
2023-02-15 23:34 ` John Cai
2023-02-15 23:42 ` Junio C Hamano
2023-02-16 2:14 ` Jeff King
2023-02-16 2:57 ` Junio C Hamano
2023-02-16 20:34 ` John Cai
2023-02-14 21:40 ` [PATCH v2 2/2] diff: teach diff to read gitattribute diff-algorithm John Cai via GitGitGadget
2023-02-15 2:56 ` Junio C Hamano
2023-02-15 3:20 ` Junio C Hamano
2023-02-16 20:37 ` John Cai
2023-02-17 20:21 ` [PATCH v3 0/2] Teach diff to honor diff algorithms set through git attributes John Cai via GitGitGadget
2023-02-17 20:21 ` [PATCH v3 1/2] diff: consolidate diff algorithm option parsing John Cai via GitGitGadget
2023-02-17 21:27 ` Junio C Hamano
2023-02-18 1:36 ` Elijah Newren
2023-02-17 20:21 ` [PATCH v3 2/2] diff: teach diff to read algorithm from diff driver John Cai via GitGitGadget
2023-02-17 21:50 ` Junio C Hamano
2023-02-18 2:56 ` Elijah Newren
2023-02-20 15:32 ` John Cai
2023-02-20 16:21 ` Elijah Newren
2023-02-20 16:49 ` John Cai [this message]
2023-02-20 17:32 ` Elijah Newren
2023-02-20 20:53 ` John Cai
2023-02-22 19:47 ` Jeff King
2023-02-24 17:44 ` John Cai
2023-02-18 1:16 ` [PATCH v3 0/2] Teach diff to honor diff algorithms set through git attributes Elijah Newren
2023-02-20 13:37 ` John Cai
2023-02-20 21:04 ` [PATCH v4 " John Cai via GitGitGadget
2023-02-20 21:04 ` [PATCH v4 1/2] diff: consolidate diff algorithm option parsing John Cai via GitGitGadget
2023-02-20 21:04 ` [PATCH v4 2/2] diff: teach diff to read algorithm from diff driver John Cai via GitGitGadget
2023-02-21 17:34 ` [PATCH v4 0/2] Teach diff to honor diff algorithms set through git attributes Junio C Hamano
2023-02-21 18:05 ` Elijah Newren
2023-02-21 18:51 ` Junio C Hamano
2023-02-21 19:36 ` John Cai
2023-02-21 20:16 ` Elijah Newren
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47981D9E-9DC7-4C23-911D-13BA52A27040@gmail.com \
--to=johncai86@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=newren@gmail.com \
--cc=peff@peff.net \
--cc=phillip.wood123@gmail.com \
--cc=sunshine@sunshineco.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).