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

Re: [PATCH v4 1/2] push: Don't push a repository with unpushed submodules

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 19, 2011, 23:26 UTC
Message-ID
<7vwre9yodc.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1313791728-11328-2-git-send-email-iveqy@iveqy.com>
Fredrik Gustafsson <iveqy@iveqy.com> writes:
Show 13 quoted lines
> diff --git a/combine-diff.c b/combine-diff.c
> index b11eb71..f7a8978 100644
> --- a/combine-diff.c
> +++ b/combine-diff.c
> @@ -1074,7 +1074,7 @@ void diff_tree_combined(const unsigned char *sha1,
>  		 * when doing combined diff.
>  		 */
>  		int stat_opt = (opt->output_format &
> -				(DIFF_FORMAT_NUMSTAT|DIFF_FORMAT_DIFFSTAT));
> +				(DIFF_FORMAT_NUMSTAT|DIFF_FORMAT_DIFFSTAT|DIFF_FORMAT_CALLBACK));
>  		if (i == 0 && stat_opt)
>  			diffopts.output_format = stat_opt;
>  		else

Sorry, but this is not what I meant. With this change, you are running N (= number of parents) diffs with the end result, but only making a callback while running a diff with the first parent, and not getting anything from comparison with other parents.

The existing NUMSTAT/STAT exception is only justified because that is how "diff --stat" shows merges (i.e. showing the extent of damage to the mainline, assuming you are viewing a merge to the mainline from a side branch).

What I meant was more along the lines of the following, but I think we would need a new kind of callback that can take N-way parents (which is not depicted here).

Let me cook up something and get back to you later tonight.
 combine-diff.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/combine-diff.c b/combine-diff.c
index 655fa89..51ebd31 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -1017,6 +1017,12 @@ void diff_tree_combined(const unsigned char *sha1,
 			num_paths++;
 	}
 	if (num_paths) {
+		if (opt->output_format & DIFF_FORMAT_CALLBACK) {
+			for (p = paths; p; p = p->next) {
+				if (p->len)
+					... make callback here ...
+			}
+		}
 		if (opt->output_format & (DIFF_FORMAT_RAW |
 					  DIFF_FORMAT_NAME |
 					  DIFF_FORMAT_NAME_STATUS)) {
Previous: Fredrik GustafssonNext: Junio C Hamano
Message 3 of 20 in “push: submodule support”
  1. 0/2 push: submodule supportFredrik Gustafsson, Aug 19, 2011
  2. 1/2 push: Don't push a repository with unpushed submodulesFredrik Gustafsson, Aug 19, 2011
  3. Junio C HamanoAug 19, 2011
  4. Junio C HamanoAug 20, 2011
  5. Junio C HamanoAug 21, 2011
  6. Heiko VoigtAug 22, 2011
  7. Junio C HamanoAug 22, 2011
  8. Heiko VoigtAug 23, 2011
  9. revision-walking: allow iterating revisions multiple timesHeiko Voigt, Aug 24, 2011
  10. Junio C HamanoAug 24, 2011
  11. 2/2 demonstrate format-callback used in combined diffJunio C Hamano, Aug 20, 2011
  12. Fredrik GustafssonAug 21, 2011
  13. 2/2 push: teach --recurse-submodules the on-demand optionFredrik Gustafsson, Aug 19, 2011
  14. Junio C HamanoSep 2, 2011
  15. Junio C HamanoOct 17, 2011
  16. Jens LehmannOct 18, 2011
  17. Phil HordDec 12, 2011
  18. Jens LehmannDec 12, 2011
  19. Phil HordDec 12, 2011
  20. Jens LehmannDec 13, 2011

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.