git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git log [diff-tree options]...
@ 2006-04-09  9:04 Junio C Hamano
  2006-04-09  9:16 ` Junio C Hamano
  2006-04-09 16:53 ` Linus Torvalds
  0 siblings, 2 replies; 22+ messages in thread
From: Junio C Hamano @ 2006-04-09  9:04 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git

And this makes "git log" to take common diff-tree options, so
that it can be used as "git whatchanged".

The recent revision walker updates by Linus to make path
limiting low-latency helps this quite a bit.

Signed-off-by: Junio C Hamano <junkio@cox.net>

---

 git.c |   32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)

52b70d56bd23811003a72866cc23a0a44b9da1b7
diff --git a/git.c b/git.c
index fa58232..8776088 100644
--- a/git.c
+++ b/git.c
@@ -16,6 +16,8 @@ #include "common-cmds.h"
 #include "cache.h"
 #include "commit.h"
 #include "revision.h"
+#include "diff.h"
+#include "log-tree.h"
 
 #ifndef PATH_MAX
 # define PATH_MAX 4096
@@ -285,7 +287,10 @@ static int cmd_log(int argc, const char 
 	int abbrev = DEFAULT_ABBREV;
 	int abbrev_commit = 0;
 	const char *commit_prefix = "commit ";
+	struct log_tree_opt opt;
+	int do_diff = 0;
 
+	init_log_tree_opt(&opt);
 	argc = setup_revisions(argc, argv, &rev, "HEAD");
 	while (1 < argc) {
 		const char *arg = argv[1];
@@ -310,9 +315,31 @@ static int cmd_log(int argc, const char 
 			else if (40 < abbrev)
 				abbrev = 40;
 		}
-		else
+		else {
+			int cnt = log_tree_opt_parse(&opt, argv+1, argc-1);
+			if (0 < cnt) {
+				do_diff = 1;
+				argv += cnt;
+				argc -= cnt;
+				continue;
+			}
 			die("unrecognized argument: %s", arg);
+		}
+
 		argc--; argv++;
+	}
+	if (do_diff) {
+		opt.diffopt.abbrev = abbrev;
+		opt.verbose_header = 0;
+		opt.always_show_header = 0;
+		opt.no_commit_id = 1;
+		if (opt.combine_merges)
+			opt.ignore_merges = 0;
+		if (opt.dense_combined_merges)
+			opt.diffopt.output_format = DIFF_FORMAT_PATCH;
+		if (opt.diffopt.output_format == DIFF_FORMAT_PATCH)
+			opt.diffopt.recursive = 1;
+		diff_setup_done(&opt.diffopt);
 	}
 
 	prepare_revision_walk(&rev);
@@ -350,6 +377,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);
 	}
 	free(buf);
 	return 0;
-- 
1.2.6.gad0b

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2006-04-11  0:50 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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     ` [PATCH] git log --full-diff Junio C Hamano
2006-04-10 23:54     ` [PATCH] git log [diff-tree options] Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).