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

[PATCH] git log --full-diff

From
Junio C Hamano <junkio@cox.net>
Date
Apr 10, 2006, 23:44 UTC
Message-ID
<7vek05808p.fsf_-_@assigned-by-dhcp.cox.net>
In-Reply-To
<7vodz980az.fsf@assigned-by-dhcp.cox.net>

Without this flag, "git log -p paths..." shows commits that touch the specified paths, and diffs about the same specified paths. With this, the full diff is shown for commits that touch the specified paths.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 git.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
fd3ed3d9667e034b90aad02b4f9e5efcc61f1ce3
diff --git a/git.c b/git.c
index 8776088..ad896da 100644
--- a/git.c
+++ b/git.c
@@ -288,7 +288,9 @@ static int cmd_log(int argc, const char 
 	int abbrev_commit = 0;
 	const char *commit_prefix = "commit ";
 	struct log_tree_opt opt;
+	int shown = 0;
 	int do_diff = 0;
+	int full_diff = 0;
 
 	init_log_tree_opt(&opt);
 	argc = setup_revisions(argc, argv, &rev, "HEAD");
@@ -315,6 +317,10 @@ static int cmd_log(int argc, const char 
 			else if (40 < abbrev)
 				abbrev = 40;
 		}
+		else if (!strcmp(arg, "--full-diff")) {
+			do_diff = 1;
+			full_diff = 1;
+		}
 		else {
 			int cnt = log_tree_opt_parse(&opt, argv+1, argc-1);
 			if (0 < cnt) {
@@ -328,6 +334,7 @@ static int cmd_log(int argc, const char 
 
 		argc--; argv++;
 	}
+
 	if (do_diff) {
 		opt.diffopt.abbrev = abbrev;
 		opt.verbose_header = 0;
@@ -339,12 +346,16 @@ static int cmd_log(int argc, const char 
 			opt.diffopt.output_format = DIFF_FORMAT_PATCH;
 		if (opt.diffopt.output_format == DIFF_FORMAT_PATCH)
 			opt.diffopt.recursive = 1;
+		if (!full_diff && rev.prune_data)
+			diff_tree_setup_paths(rev.prune_data, &opt.diffopt);
 		diff_setup_done(&opt.diffopt);
 	}
 
 	prepare_revision_walk(&rev);
 	setup_pager();
 	while ((commit = get_revision(&rev)) != NULL) {
+		if (commit_format != CMIT_FMT_ONELINE && shown)
+			putchar('\n');
 		fputs(commit_prefix, stdout);
 		if (abbrev_commit && abbrev)
 			fputs(find_unique_abbrev(commit->object.sha1, abbrev),
@@ -377,9 +388,9 @@ static int cmd_log(int argc, const char 
 		pretty_print_commit(commit_format, commit, ~0, buf,
 				    LOGSIZE, abbrev);
 		printf("%s\n", buf);
-
 		if (do_diff)
 			log_tree_commit(&opt, commit);
+		shown = 1;
 	}
 	free(buf);
 	return 0;
-- 
1.3.0.rc3.g910a
Previous: Junio C HamanoNext: Linus Torvalds
Message 21 of 22 in “git log [diff-tree options]...”
  1. git log [diff-tree options]...Junio C Hamano, Apr 9, 2006
  2. Junio C HamanoApr 9, 2006
  3. Linus TorvaldsApr 9, 2006
  4. Junio C HamanoApr 9, 2006
  5. Linus TorvaldsApr 9, 2006
  6. Junio C HamanoApr 9, 2006
  7. Linus TorvaldsApr 9, 2006
  8. Johannes SchindelinApr 9, 2006
  9. Johannes SchindelinApr 9, 2006
  10. Timo HirvonenApr 9, 2006
  11. Johannes SchindelinApr 10, 2006
  12. Junio C HamanoApr 9, 2006
  13. Linus TorvaldsApr 10, 2006
  14. Johannes SchindelinApr 10, 2006
  15. Randal L. SchwartzApr 11, 2006
  16. Junio C HamanoApr 11, 2006
  17. Petr BaudisApr 11, 2006
  18. Randal L. SchwartzApr 11, 2006
  19. Junio C HamanoApr 10, 2006
  20. tree-diff: do not assume we use only one pathspecJunio C Hamano, Apr 10, 2006
  21. git log --full-diffJunio C Hamano, Apr 10, 2006
  22. Linus TorvaldsApr 10, 2006

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.