Skip to contentSkip to conversation

log-tree: separate major part of diff-tree.

PATCH New Junio C Hamano 1 participant 1 message Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 log-tree: separate major part of diff-tree.

This separates out the part that deals with one-commit diff-tree (and --stdin form) into a separate log-tree module.

There are two goals with this. The more important one is to be able to make this part available to "git log --diff", so that we can have a native "git whatchanged" command. Another is to simplify the commit log generation part simpler.

---

* I tried to be very careful while doing this, to make sure there is no behaviour change. This is a preparation step for the next one, which is...

 Makefile    |    4 +
 diff-tree.c |  226 ++++++-----------------------------------------------------
 log-tree.c  |  175 ++++++++++++++++++++++++++++++++++++++++++++++
 log-tree.h  |   23 ++++++
 4 files changed, 224 insertions(+), 204 deletions(-)
 create mode 100644 log-tree.c
 create mode 100644 log-tree.h

5f1c3f07b7f4a8436c7773b8e7a04998190c125e

Makefile +2 -2
index 6b10eaa..b272146 100644
@@ -194,12 +194,12 @@ LIB_H = \
 	blob.h cache.h commit.h csum-file.h delta.h \
 	diff.h object.h pack.h pkt-line.h quote.h refs.h \
 	run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \
-	tree-walk.h
+	tree-walk.h log-tree.h
 
 DIFF_OBJS = \
 	diff.o diffcore-break.o diffcore-order.o diffcore-pathspec.o \
 	diffcore-pickaxe.o diffcore-rename.o tree-diff.o combine-diff.o \
-	diffcore-delta.o
+	diffcore-delta.o log-tree.o
 
 LIB_OBJS = \
 	blob.o commit.o connect.o csum-file.o \
diff-tree.c +24 -202

295 lines not on this page · raw message

log-tree.c new file +175 -0

175 lines not on this page · raw message

log-tree.h new file +23 -0
new file mode 100644
index 0000000..da166c6
@@ -0,0 +1,23 @@
+#ifndef LOG_TREE_H
+#define LOG_TREE_H
+
+struct log_tree_opt {
+	struct diff_options diffopt;
+	int show_root_diff;
+	int no_commit_id;
+	int verbose_header;
+	int ignore_merges;
+	int combine_merges;
+	int dense_combined_merges;
+	int always_show_header;
+	const char *header_prefix;
+	const char *header;
+	enum cmit_fmt commit_format;
+};
+
+void init_log_tree_opt(struct log_tree_opt *);
+int log_tree_diff_flush(struct log_tree_opt *);
+int log_tree_commit(struct log_tree_opt *, struct commit *);
+int log_tree_opt_parse(struct log_tree_opt *, const char **, int);
+
+#endif
Signature · 1 line
1.2.6.gad0b