]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'sl/sparse-write-tree'
authorJunio C Hamano <gitster@pobox.com>
Tue, 18 Apr 2023 01:05:11 +0000 (18:05 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Apr 2023 01:05:11 +0000 (18:05 -0700)
"git write-tree" learns to work better with sparse-index.

* sl/sparse-write-tree:
  write-tree: integrate with sparse index

1  2 
builtin/write-tree.c
t/perf/p2000-sparse-operations.sh

index 6085f64d1009528a9e21a888755c649480ae87ed,a7678300962b659215d65dc3e5e44c036b186aaa..32e302a813d56a22320c988ae26a69f98aa22a94
@@@ -41,8 -38,10 +41,11 @@@ int cmd_write_tree(int argc, const cha
        argc = parse_options(argc, argv, cmd_prefix, write_tree_options,
                             write_tree_usage, 0);
  
 -      ret = write_cache_as_tree(&oid, flags, tree_prefix);
+       prepare_repo_settings(the_repository);
+       the_repository->settings.command_requires_full_index = 0;
 +      ret = write_index_as_tree(&oid, &the_index, get_index_file(), flags,
 +                                tree_prefix);
        switch (ret) {
        case 0:
                printf("%s\n", oid_to_hex(&oid));
index e4a132f5934488be8530dfdfcef03ea9fbc642d7,5fe6bf3dddaea8080bcda7f2b86efd9d803a662e..f7bdba90c55cac4368774dd5f0afa7814b35a9f3
@@@ -124,6 -124,7 +124,7 @@@ test_perf_on_all git read-tree -mu HEA
  test_perf_on_all git checkout-index -f --all
  test_perf_on_all git update-index --add --remove $SPARSE_CONE/a
  test_perf_on_all "git rm -f $SPARSE_CONE/a && git checkout HEAD -- $SPARSE_CONE/a"
 -test_perf_on_all git grep --cached --sparse bogus -- "f2/f1/f1/*"
 +test_perf_on_all git grep --cached bogus -- "f2/f1/f1/*"
+ test_perf_on_all git write-tree
  
  test_done