diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c index a55c60d759..aa81199f85 100644 --- a/builtin/sparse-checkout.c +++ b/builtin/sparse-checkout.c @@ -112,7 +112,9 @@ static int update_working_directory(struct pattern_list *pl) repo_hold_locked_index(r, &lock_file, LOCK_DIE_ON_ERROR); + setup_unpack_trees_porcelain(&o, "sparse-checkout"); result = update_sparsity(&o); + clear_unpack_trees_porcelain(&o); if (result == UPDATE_SPARSITY_WARNINGS) /* diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh index a991e0a80d..9bc65d32f0 100755 --- a/t/t1091-sparse-checkout-builtin.sh +++ b/t/t1091-sparse-checkout-builtin.sh @@ -328,12 +328,10 @@ test_expect_success 'sparse-checkout (init|set|disable) warns with dirty status' echo dirty >dirty/folder1/a && git -C dirty sparse-checkout init 2>err && - test_i18ngrep "error" err && - test_i18ngrep "Cannot update sparse checkout" err && + test_i18ngrep "error.*Cannot update sparse checkout" err && git -C dirty sparse-checkout set /folder2/* /deep/deeper1/* 2>err && - test_i18ngrep "error" err && - test_i18ngrep "Cannot update sparse checkout" err && + test_i18ngrep "error.*Cannot update sparse checkout" err && test_path_is_file dirty/folder1/a && git -C dirty sparse-checkout disable 2>err &&