Re: builtin difftool parsing issue
- From
- Paul Sbarra <sbarra.paul@gmail.com>
- Date
- Jan 2, 2017, 19:05 UTC
- Message-ID
- <CAGf+dSjM9nuroeSM9mkQmO3ho4XcZhLo1CR76q-jbeQ-WNGG+Q@mail.gmail.com>
- In-Reply-To
- <alpine.DEB.2.20.1701021712010.3469@virtualbox>
> 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.