Merge branch 'tr/log-full-diff-keep-true-parents' into maint
authorJunio C Hamano <gitster@pobox.com>
Wed, 18 Sep 2013 18:59:05 +0000 (11:59 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 18 Sep 2013 18:59:05 +0000 (11:59 -0700)
Output from "git log --full-diff -- <pathspec>" looked strange,
because comparison was done with the previous ancestor that touched
the specified <pathspec>, causing the patches for paths outside the
pathspec to show more than the single commit has changed.

* 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

1  2 
combine-diff.c
commit.c
commit.h
diff --combined combine-diff.c
index 88525b37cf461ee922b81fd6848be5efc8e34542,3d2aaf34ab53accccf1c3877557522ea012be42d..4fc16ad4f35c558daf5bf96865801828d10b4b9b
@@@ -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 a575564a15c1c340b36d10c90da8fa343692264d,5ecdb38b3e7601419eed27ad81063ed6c8e5808e..de16a3c0a2d6693173678247ba0755e4d7483a1c
+++ 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 d912a9d4ac3fe36b2e69d48b1725f01bdf289b26,ca766d2f4aa0df98d958e19449ab24d417c5539b..f9504f70cc5b57de590099024556b9d2b6b2cdce
+++ 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;
  };