summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 667bb59)
raw | patch | inline | side by side (parent: 667bb59)
author | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Thu, 19 May 2005 20:44:29 +0000 (13:44 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Thu, 19 May 2005 20:44:29 +0000 (13:44 -0700) |
"Let there be light"
diff-tree.c | patch | blob | history |
diff --git a/diff-tree.c b/diff-tree.c
index d3d83bd8df2d89a6440b0978826e1e0550c4e837..9d94e0cc58be314017d570f75fc3169197f46a9e 100644 (file)
--- a/diff-tree.c
+++ b/diff-tree.c
#include "diff.h"
static int silent = 0;
+static int show_root_diff = 0;
static int verbose_header = 0;
static int ignore_merges = 1;
static int recursive = 0;
return ret;
}
+static int diff_root_tree(const unsigned char *new, const char *base)
+{
+ int retval;
+ void *tree;
+ unsigned long size;
+
+ if (generate_patch)
+ diff_setup(detect_rename, 0, 0, 0, 0);
+ tree = read_object_with_reference(new, "tree", &size, 0);
+ if (!tree)
+ die("unable to read root tree (%s)", sha1_to_hex(new));
+ retval = diff_tree("", 0, tree, size, base);
+ free(tree);
+ if (generate_patch)
+ diff_flush();
+ return retval;
+}
+
static int get_one_line(const char *msg, unsigned long len)
{
int ret = 0;
if (!buf)
return -1;
- /* More than one parent? */
- if (ignore_merges) {
- if (!memcmp(buf + 46 + 48, "parent ", 7))
- return 0;
- }
-
if (!name) {
static char commit_name[60];
strcpy(commit_name, sha1_to_hex(commit));
name = commit_name;
}
+ /* Root commit? */
+ if (show_root_diff && memcmp(buf + 46, "parent ", 7)) {
+ header = generate_header(name, "root", buf, size);
+ diff_root_tree(commit, "");
+ }
+
+ /* More than one parent? */
+ if (ignore_merges) {
+ if (!memcmp(buf + 46 + 48, "parent ", 7))
+ return 0;
+ }
+
offset = 46;
while (offset + 48 < size && !memcmp(buf + offset, "parent ", 7)) {
unsigned char parent[20];
read_stdin = 1;
continue;
}
+ if (!strcmp(arg, "--root")) {
+ show_root_diff = 1;
+ continue;
+ }
usage(diff_tree_usage);
}