> 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.