git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git diff across submodules

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 20, 2012, 20:52 UTC
Message-ID
<7vr4pwa02u.fsf@alter.siamese.dyndns.org>
In-Reply-To
<505B73CE.5030009@web.de>
Jens Lehmann <Jens.Lehmann@web.de> writes:
Show 5 quoted lines
> 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.

Previous: Jens Lehmann
Message 6 of 6 in “git diff across submodules”
  1. Kenny SimpsonSep 18, 2012
  2. Jens LehmannSep 18, 2012
  3. Junio C HamanoSep 18, 2012
  4. Junio C HamanoSep 19, 2012
  5. Jens LehmannSep 20, 2012
  6. Junio C HamanoSep 20, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.