All of lore.kernel.org
 help / color / mirror / Atom feed
* builtin difftool parsing issue
@ 2016-12-22  4:53 Paul Sbarra
  2017-01-02 16:12 ` Johannes Schindelin
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Sbarra @ 2016-12-22  4:53 UTC (permalink / raw)
  To: johannes.schindelin; +Cc: davvid, dennis, git, gitster

Sadly, I haven't been able to figure out how to get the mbox file from
this tread into gmail, but wanted to report a parsing issue I've found
with the builtin difftool.

Original Patch:
https://public-inbox.org/git/ac91e4818cfb5c5af6b5874662dbeb61cde1f69d.1480019834.git.johannes.schindelin@gmx.de/#t

> + *status = *++p;
> + if (!status || p[1])
> + return error("unexpected trailer: '%s'", p);
> + return 0;

The p[1] null check assumes the status is only one character long, but
git-diff's raw output format shows that a numeric value can follow in
the copy-edit and rename-edit cases.

I'm looking forward to seeing the builtin difftool land.  I came across it
while investigating adding --submodule=diff (expanding on diff's
recent addition) support and this looks more promising then the perl
script.  Hopefully I will make some progress.  Any tips/pointers would
be greatly appreciated.

Thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: builtin difftool parsing issue
  2016-12-22  4:53 builtin difftool parsing issue Paul Sbarra
@ 2017-01-02 16:12 ` Johannes Schindelin
  2017-01-02 19:05   ` Paul Sbarra
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2017-01-02 16:12 UTC (permalink / raw)
  To: Paul Sbarra; +Cc: davvid, dennis, git, gitster

Hi Paul,

On Wed, 21 Dec 2016, Paul Sbarra wrote:

> Sadly, I haven't been able to figure out how to get the mbox file from
> this tread into gmail, but wanted to report a parsing issue I've found
> with the builtin difftool.
> 
> Original Patch:
> https://public-inbox.org/git/ac91e4818cfb5c5af6b5874662dbeb61cde1f69d.1480019834.git.johannes.schindelin@gmx.de/#t
> 
> > + *status = *++p;
> > + if (!status || p[1])
> > + return error("unexpected trailer: '%s'", p);
> > + return 0;
> 
> The p[1] null check assumes the status is only one character long, but
> git-diff's raw output format shows that a numeric value can follow in
> the copy-edit and rename-edit cases.

Thank you for the report! I fixed it locally.

> I'm looking forward to seeing the builtin difftool land.  I came across it
> while investigating adding --submodule=diff (expanding on diff's
> recent addition) support and this looks more promising then the perl
> script.  Hopefully I will make some progress.  Any tips/pointers would
> be greatly appreciated.

I would have expected `git difftool --submodule=diff ...` to work... What
are the problems?

Ciao,
Johannes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: builtin difftool parsing issue
  2017-01-02 16:12 ` Johannes Schindelin
@ 2017-01-02 19:05   ` Paul Sbarra
  2017-01-03 18:47     ` Stefan Beller
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Sbarra @ 2017-01-02 19:05 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: David Aguilar, Dennis Kaarsemaker, git, Junio C Hamano

> I would have expected `git difftool --submodule=diff ...` to work... What
> are the problems?

The docs for difftool state...
"git difftool is a frontend to git diff and accepts the same options
and arguments."
which could lead a user to expect passing --submodule=diff to have a
similar behavior for difftool.  It would be especially useful when
combined with --dir-diff.

Unfortunately, due to the way the left/right directories are built up,
difftool needs to handle this option itself.  Currently a file
representing the submodule directory is created that contains the
hash.

if (S_ISGITLINK(lmode) || S_ISGITLINK(rmode)) {
   strbuf_reset(&buf);
   strbuf_addf(&buf, "Subproject commit %s", oid_to_hex(&loid));
   add_left_or_right(&submodules, src_path, buf.buf, 0);
   strbuf_reset(&buf);
   strbuf_addf(&buf, "Subproject commit %s", oid_to_hex(&roid));
   if (!oidcmp(&loid, &roid))
      strbuf_addstr(&buf, "-dirty");
   add_left_or_right(&submodules, dst_path, buf.buf, 1);
   continue;
}

To achieve the desired behavior a diff command would need to be run
within the submodule.  A further complication is whether submodules
should be processed recursively.  I'm not sure whether or not diff
handles them recursively.  I believe the logic to parse and build up
the files would need to be factored out such that it could be called
for the super-project as well as each submodule change.

This is all out of scope for your effort as the existing (perl-based)
difftool doesn't do this either.  However, it's a feature that would
provide a significant simplification to the workflow used at the
office to review changes.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: builtin difftool parsing issue
  2017-01-02 19:05   ` Paul Sbarra
@ 2017-01-03 18:47     ` Stefan Beller
  2017-01-04  1:05       ` Jacob Keller
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Beller @ 2017-01-03 18:47 UTC (permalink / raw)
  To: Paul Sbarra, Jacob Keller
  Cc: Johannes Schindelin, David Aguilar, Dennis Kaarsemaker, git,
	Junio C Hamano

On Mon, Jan 2, 2017 at 11:05 AM, Paul Sbarra <sbarra.paul@gmail.com> wrote:
>> I would have expected `git difftool --submodule=diff ...` to work... What
>> are the problems?
>
> The docs for difftool state...
> "git difftool is a frontend to git diff and accepts the same options
> and arguments."

I think such a sentence in the man page is dangerous, as nobody
was caught this issue until now. There have been numerous authors
and reviewers that touched "diff --submodule=<format>, but as there
is no back-reference, hinting that the patch is only half done, and the
difftool also needs to implement such an option.

We should reword the man page either as

  "git difftool is a frontend to git diff and accepts the most(?) options
  and arguments."

or even be explicit and list the arguments instead. There we could also
describe differences if any (e.g. the formats available might be different
for --submodule=<format>)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: builtin difftool parsing issue
  2017-01-03 18:47     ` Stefan Beller
@ 2017-01-04  1:05       ` Jacob Keller
  0 siblings, 0 replies; 5+ messages in thread
From: Jacob Keller @ 2017-01-04  1:05 UTC (permalink / raw)
  To: Stefan Beller
  Cc: Paul Sbarra, Johannes Schindelin, David Aguilar,
	Dennis Kaarsemaker, git, Junio C Hamano

On Tue, Jan 3, 2017 at 10:47 AM, Stefan Beller <sbeller@google.com> wrote:
> On Mon, Jan 2, 2017 at 11:05 AM, Paul Sbarra <sbarra.paul@gmail.com> wrote:
>>> I would have expected `git difftool --submodule=diff ...` to work... What
>>> are the problems?
>>
>> The docs for difftool state...
>> "git difftool is a frontend to git diff and accepts the same options
>> and arguments."
>
> I think such a sentence in the man page is dangerous, as nobody
> was caught this issue until now. There have been numerous authors
> and reviewers that touched "diff --submodule=<format>, but as there
> is no back-reference, hinting that the patch is only half done, and the
> difftool also needs to implement such an option.
>
> We should reword the man page either as
>
>   "git difftool is a frontend to git diff and accepts the most(?) options
>   and arguments."
>
> or even be explicit and list the arguments instead. There we could also
> describe differences if any (e.g. the formats available might be different
> for --submodule=<format>)

I agree with updating the documentation. Difftool would require
extensive work to support the --submodule format, and I'm not sure
it's worth it.

Thanks,
Jake

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-01-04  1:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-22  4:53 builtin difftool parsing issue Paul Sbarra
2017-01-02 16:12 ` Johannes Schindelin
2017-01-02 19:05   ` Paul Sbarra
2017-01-03 18:47     ` Stefan Beller
2017-01-04  1:05       ` Jacob Keller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.