Code

struct rev_info: convert prune_data to struct pathspec
[git.git] / builtin / fast-export.c
index a9bbf8653d1a8fa704a38c06102ec3ace4a59a28..ba57457cc54812ba935c5259277e12d72463f63f 100644 (file)
@@ -167,7 +167,15 @@ static int depth_first(const void *a_, const void *b_)
        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,
@@ -643,7 +651,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
        if (import_filename)
                import_marks(import_filename);
 
-       if (import_filename && revs.prune_data)
+       if (import_filename && revs.prune_data.nr)
                full_tree = 1;
 
        get_tags_and_duplicates(&revs.pending, &extra_refs);