]> asedeno.scripts.mit.edu Git - git.git/commitdiff
Merge branch 'en/d-f-conflict-fix'
authorJunio C Hamano <gitster@pobox.com>
Wed, 8 Sep 2010 15:54:01 +0000 (08:54 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 Sep 2010 15:54:01 +0000 (08:54 -0700)
* en/d-f-conflict-fix:
  fast-export: ensure that a renamed file is printed after all references

1  2 
builtin/fast-export.c

diff --combined builtin/fast-export.c
index a9bbf8653d1a8fa704a38c06102ec3ace4a59a28,007bba67950ab45f3310410ebc16081b5307e7b4..c8fd46b872780b27b09ad70316fa164d855f3220
@@@ -27,7 -27,6 +27,7 @@@ static enum { ABORT, VERBATIM, WARN, ST
  static enum { ERROR, DROP, REWRITE } tag_of_filtered_mode = ABORT;
  static int fake_missing_tagger;
  static int no_data;
 +static int full_tree;
  
  static int parse_opt_signed_tag_mode(const struct option *opt,
                                     const char *arg, int unset)
@@@ -167,7 -166,15 +167,15 @@@ static int depth_first(const void *a_, 
        cmp = memcmp(name_a, name_b, len);
        if (cmp)
                return cmp;
-       return (len_b - len_a);
+       cmp = len_b - len_a;
+       if (cmp)
+               return cmp;
+       /*
+        * Move 'R'ename entries last so that all references of the file
+        * appear in the output before it is renamed (e.g., when a file
+        * was copied and renamed in the same commit).
+        */
+       return (a->status == 'R') - (b->status == 'R');
  }
  
  static void show_filemodify(struct diff_queue_struct *q,
@@@ -271,8 -278,7 +279,8 @@@ static void handle_commit(struct commi
                message += 2;
  
        if (commit->parents &&
 -          get_object_mark(&commit->parents->item->object) != 0) {
 +          get_object_mark(&commit->parents->item->object) != 0 &&
 +          !full_tree) {
                parse_commit(commit->parents->item);
                diff_tree_sha1(commit->parents->item->tree->object.sha1,
                               commit->tree->object.sha1, "", &rev->diffopt);
                i++;
        }
  
 +      if (full_tree)
 +              printf("deleteall\n");
        log_tree_diff_flush(rev);
        rev->diffopt.output_format = saved_output_format;
  
@@@ -471,7 -475,7 +479,7 @@@ static void get_tags_and_duplicates(str
                        /* handle nested tags */
                        while (tag && tag->object.type == OBJ_TAG) {
                                parse_object(tag->object.sha1);
 -                              string_list_append(full_name, extra_refs)->util = tag;
 +                              string_list_append(extra_refs, full_name)->util = tag;
                                tag = (struct tag *)tag->tagged;
                        }
                        if (!tag)
                }
                if (commit->util)
                        /* more than one name for the same object */
 -                      string_list_append(full_name, extra_refs)->util = commit;
 +                      string_list_append(extra_refs, full_name)->util = commit;
                else
                        commit->util = full_name;
        }
@@@ -598,8 -602,8 +606,8 @@@ static void import_marks(char *input_fi
  int cmd_fast_export(int argc, const char **argv, const char *prefix)
  {
        struct rev_info revs;
 -      struct object_array commits = { 0, 0, NULL };
 -      struct string_list extra_refs = { NULL, 0, 0, 0 };
 +      struct object_array commits = OBJECT_ARRAY_INIT;
 +      struct string_list extra_refs = STRING_LIST_INIT_NODUP;
        struct commit *commit;
        char *export_filename = NULL, *import_filename = NULL;
        struct option options[] = {
                             "Import marks from this file"),
                OPT_BOOLEAN(0, "fake-missing-tagger", &fake_missing_tagger,
                             "Fake a tagger when tags lack one"),
 +              OPT_BOOLEAN(0, "full-tree", &full_tree,
 +                           "Output full tree for each commit"),
                { OPTION_NEGBIT, 0, "data", &no_data, NULL,
                        "Skip output of blob data",
                        PARSE_OPT_NOARG | PARSE_OPT_NEGHELP, NULL, 1 },
        if (import_filename)
                import_marks(import_filename);
  
 +      if (import_filename && revs.prune_data)
 +              full_tree = 1;
 +
        get_tags_and_duplicates(&revs.pending, &extra_refs);
  
        if (prepare_revision_walk(&revs))