All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Cc: Linus Torvalds <torvalds@osdl.org>
Subject: [PATCH] git log --full-diff
Date: Mon, 10 Apr 2006 16:44:06 -0700	[thread overview]
Message-ID: <7vek05808p.fsf_-_@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <7vodz980az.fsf@assigned-by-dhcp.cox.net> (Junio C. Hamano's message of "Mon, 10 Apr 2006 16:42:44 -0700")

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

  parent reply	other threads:[~2006-04-10 23:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-09  9:04 [PATCH] git log [diff-tree options] Junio C Hamano
2006-04-09  9:16 ` Junio C Hamano
2006-04-09 16:53 ` Linus Torvalds
2006-04-09 18:46   ` Junio C Hamano
2006-04-09 19:02     ` Linus Torvalds
2006-04-09 19:08       ` Junio C Hamano
2006-04-09 19:26         ` Linus Torvalds
2006-04-09 21:13       ` Johannes Schindelin
2006-04-09 22:01         ` Johannes Schindelin
2006-04-09 22:22           ` Timo Hirvonen
2006-04-10  8:10             ` Johannes Schindelin
2006-04-09 23:51           ` Junio C Hamano
2006-04-10  0:06             ` Linus Torvalds
2006-04-10  8:22             ` Johannes Schindelin
2006-04-11  0:04         ` Randal L. Schwartz
2006-04-11  0:12           ` Junio C Hamano
2006-04-11  0:31             ` Petr Baudis
2006-04-11  0:50               ` Randal L. Schwartz
2006-04-10 23:42   ` Junio C Hamano
2006-04-10 23:43     ` [PATCH] tree-diff: do not assume we use only one pathspec Junio C Hamano
2006-04-10 23:44     ` Junio C Hamano [this message]
2006-04-10 23:54     ` [PATCH] git log [diff-tree options] Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vek05808p.fsf_-_@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.