Thread (1 message) 1 message, 1 author, 2016-06-15

Re: git diff across submodules

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:54:49

Jens Lehmann [off-list ref] writes:
That's pretty cool! Even though diff options like --stat and --name-only
still won't take into account what happened inside the submodule this
approach makes it possible to see the diff recursively. Wouldn't it make
sense add this script to contrib (after teaching it new and removed
submodules and documenting its use in a few lines after the shebang)?
A few things somebody may want to work on while doing that "few
lines of documentation" I know about are:

 * From the core side, pass options that are releavant when
   generating patch (i.e. with p) in environment variables to the
   external diff script;

 * Not using "s/$1" and "m/$1" as prefix; instead, pass src/dst
   prefix values (i.e. s/ and m/) from the core side in environment
   variables, and make the external diff script itself aware of
   possibly nested submodules, e.g.

    SUBMODULE_PATH="${SUBMODULE_PATH}$1"
    export SUBMODULE_PATH
    exec git --no-pager diff -p \
    	--src-prefix="$SRC_PREFIX/$SUBMODULE_PATH" \
    	--dst-prefix="$DST_PREFIX/$SUBMODULE_PATH" "$3" "$6"

After people gain sufficient experience with it, as the next step,
we can think about how to handle --stat and other options when we
are run without -p (currently the attribute mechanism would not
trigger) and then we can call the result a native "diff that
recurses into submodules" that people can use without setting up the
attributes based mechanism.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help