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

Re: [PATCH] Performance optimization for detection of modified submodules

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 17, 2010, 20:01 UTC
Message-ID
<7vska4xzzf.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4B535E97.1020809@web.de>
Jens Lehmann <Jens.Lehmann@web.de> writes:
Show 6 quoted lines
> So here is my first attempt of implementing your proposal. The test suite
> runs fine, but a few more eyeballs would really be appreciated as i am not
> very familiar with the code and its corner cases (See diff_change(), is it
> sufficient to only set "two->dirty_submodule", even if the REVERSE_DIFF
> option is set? Apart from that i am not so sure about the four changes to
> tree-diff.c).

The effect of REVERSE_DIFF bit is contained in the output layer. The order frontends (e.g. diff-files and diff-lib.c::run_diff_files()) feed the entries from two hierarchies is not affected.

The current callers of addremove() may always give the work tree side as the second one, but the API is meant to be usable by any other new callers and for some of them feeding the work tree side as the first one _might_ be more sensible (we are talking about futureproofing, so by definition we won't know). It might even be the case where an unanticipated new caller might be comparing two trees both living in the work tree (hence you might require two independent dirty_submodule bits to the call to show which side is dirty, and such a caller may say "both sides are dirty").

So it would be most future-proof if you add two independent "dirty" bits to the API if you are changing it: "is the left side of the comparision a dirty submodule?" and "is the right side ...?". Especially I don't think assuming "setting two->dirty is enough for the current implementation" is the right way going forward.

> I think we could skip the call to is_submodule_modified() in
> run_diff_files() and get_stat_data() when the changed flag is already
> set and only short output (without calling diff_populate_gitlink(), e.g.
> "git status -s" or "git diff-files") is requested.

I am puzzled by your "we could skip"; isn't it what you already have done in this patch? More importantly, I think that is the whole point of the change to diff API this patch brings in.

> What do you think
> about doing that in a seperate patch?

Doing these in this same patch like you did is better, as it demonstrates how the callers benefit by the addition of these new bits to the API.

Previous: Jens LehmannNext: Jens Lehmann
Message 12 of 14 in “Show a dirty working tree and a detached HEAD in status for submodule”
  1. Show a dirty working tree and a detached HEAD in status for submoduleJens Lehmann, Jan 11, 2010
  2. Junio C HamanoJan 11, 2010
  3. Jens LehmannJan 12, 2010
  4. Junio C HamanoJan 13, 2010
  5. Show submodules as modified when they contain a dirty work treeJens Lehmann, Jan 13, 2010
  6. Junio C HamanoJan 13, 2010
  7. Jens LehmannJan 14, 2010
  8. Jens LehmannJan 14, 2010
  9. Junio C HamanoJan 14, 2010
  10. Jens LehmannJan 15, 2010
  11. Performance optimization for detection of modified submodulesJens Lehmann, Jan 17, 2010
  12. Junio C HamanoJan 17, 2010
  13. Jens LehmannJan 17, 2010
  14. Nanako ShiraishiJan 15, 2010

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.