From: Junio C Hamano Date: Mon, 9 Sep 2013 21:33:16 +0000 (-0700) Subject: Merge branch 'tr/log-full-diff-keep-true-parents' X-Git-Tag: v1.8.5-rc0~167 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/4ab4a6dfb414230bb3e13ba65a1aa2606c6102f3?ds=inline;hp=-c Merge branch 'tr/log-full-diff-keep-true-parents' Output from "git log --full-diff -- " looked strange, because comparison was done with the previous ancestor that touched the specified , causing the patches for paths outside the pathspec to show more than the single commit has changed. Tweak "git reflog -p" for the same reason using the same mechanism. * tr/log-full-diff-keep-true-parents: log: use true parents for diff when walking reflogs log: use true parents for diff even when rewriting --- 4ab4a6dfb414230bb3e13ba65a1aa2606c6102f3 diff --combined combine-diff.c index 88525b37cf,3d2aaf34ab..4fc16ad4f3 --- a/combine-diff.c +++ b/combine-diff.c @@@ -10,6 -10,7 +10,7 @@@ #include "refs.h" #include "userdiff.h" #include "sha1-array.h" + #include "revision.h" static struct combine_diff_path *intersect_paths(struct combine_diff_path *curr, int n, int num_parent) { @@@ -165,7 -166,7 +166,7 @@@ static struct lline *coalesce_lines(str /* * Coalesce new lines into base by finding the LCS - * - Create the table to run dynamic programing + * - Create the table to run dynamic programming * - Compute the LCS * - Then reverse read the direction structure: * - If we have MATCH, assign parent to base flag, and consume @@@ -1383,7 -1384,7 +1384,7 @@@ void diff_tree_combined(const unsigned void diff_tree_combined_merge(const struct commit *commit, int dense, struct rev_info *rev) { - struct commit_list *parent = commit->parents; + struct commit_list *parent = get_saved_parents(rev, commit); struct sha1_array parents = SHA1_ARRAY_INIT; while (parent) { diff --combined commit.c index a575564a15,5ecdb38b3e..de16a3c0a2 --- a/commit.c +++ b/commit.c @@@ -377,6 -377,22 +377,22 @@@ unsigned commit_list_count(const struc return c; } + struct commit_list *copy_commit_list(struct commit_list *list) + { + struct commit_list *head = NULL; + struct commit_list **pp = &head; + while (list) { + struct commit_list *new; + new = xmalloc(sizeof(struct commit_list)); + new->item = list->item; + new->next = NULL; + *pp = new; + pp = &new->next; + list = list->next; + } + return head; + } + void free_commit_list(struct commit_list *list) { while (list) { @@@ -1416,7 -1432,7 +1432,7 @@@ static int find_invalid_utf8(const cha if ((codepoint & 0x1ff800) == 0xd800) return bad_offset; /* U+xxFFFE and U+xxFFFF are guaranteed non-characters. */ - if ((codepoint & 0xffffe) == 0xfffe) + if ((codepoint & 0xfffe) == 0xfffe) return bad_offset; /* So are anything in the range U+FDD0..U+FDEF. */ if (codepoint >= 0xfdd0 && codepoint <= 0xfdef) diff --combined commit.h index d912a9d4ac,ca766d2f4a..f9504f70cc --- a/commit.h +++ b/commit.h @@@ -62,6 -62,9 +62,9 @@@ struct commit_list *commit_list_insert_ struct commit_list **list); void commit_list_sort_by_date(struct commit_list **list); + /* Shallow copy of the input list */ + struct commit_list *copy_commit_list(struct commit_list *list); + void free_commit_list(struct commit_list *list); /* Commit formats */ @@@ -102,6 -105,8 +105,6 @@@ struct pretty_print_context * Fields below here are manipulated internally by pp_* functions and * should not be counted on by callers. */ - - /* Manipulated by the pp_* functions internally. */ struct string_list in_body_headers; };