]> git.ipfire.org Git - thirdparty/git.git/commitdiff
2.36 fast-export regression fix
authorRené Scharfe <l.s.r@web.de>
Sat, 30 Apr 2022 14:31:43 +0000 (16:31 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sat, 30 Apr 2022 18:50:33 +0000 (11:50 -0700)
e900d494dc (diff: add an API for deferred freeing, 2021-02-11) added a
way to allow reusing diffopts: the no_free bit.  244c27242f (diff.[ch]:
have diff_free() call clear_pathspec(opts.pathspec), 2022-02-16) made
that mechanism mandatory.

git fast-export doesn't set no_free, so path limiting stopped working
after the first commit.  Set the flag and add a basic test to make sure
only changes to the specified files are exported.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fast-export.c
t/t9350-fast-export.sh

index 510139e9b54ecadf81d91a8a22297fd0ed3b9872..921091d7aad0ae80649dd8bdca55e6505436da07 100644 (file)
@@ -1261,6 +1261,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
        revs.diffopt.format_callback = show_filemodify;
        revs.diffopt.format_callback_data = &paths_of_changed_objects;
        revs.diffopt.flags.recursive = 1;
+       revs.diffopt.no_free = 1;
        while ((commit = get_revision(&revs)))
                handle_commit(commit, &revs, &paths_of_changed_objects);
 
index 7b7a18dd2c1e07afe2a129b868bf878020882a1f..fc99703fc5181041e521ab5bb5f783c4ed484b64 100755 (executable)
@@ -500,6 +500,13 @@ test_expect_success 'path limiting with import-marks does not lose unmodified fi
        grep file0 actual
 '
 
+test_expect_success 'path limiting works' '
+       git fast-export simple -- file >actual &&
+       sed -ne "s/^M .* //p" <actual | sort -u >actual.files &&
+       echo file >expect &&
+       test_cmp expect actual.files
+'
+
 test_expect_success 'avoid corrupt stream with non-existent mark' '
        test_create_repo avoid_non_existent_mark &&
        (