Merge branch 'en/sparse-checkout'
The behaviour of "sparse-checkout" in the state "git clone --no-checkout" left was changed accidentally in 2.27, which has been corrected. * en/sparse-checkout: sparse-checkout: avoid staging deletions of all filesmaint
commit
a554228ffb
|
@ -99,6 +99,10 @@ static int update_working_directory(struct pattern_list *pl)
|
||||||
struct lock_file lock_file = LOCK_INIT;
|
struct lock_file lock_file = LOCK_INIT;
|
||||||
struct repository *r = the_repository;
|
struct repository *r = the_repository;
|
||||||
|
|
||||||
|
/* If no branch has been checked out, there are no updates to make. */
|
||||||
|
if (is_index_unborn(r->index))
|
||||||
|
return UPDATE_SPARSITY_SUCCESS;
|
||||||
|
|
||||||
memset(&o, 0, sizeof(o));
|
memset(&o, 0, sizeof(o));
|
||||||
o.verbose_update = isatty(2);
|
o.verbose_update = isatty(2);
|
||||||
o.update = 1;
|
o.update = 1;
|
||||||
|
|
|
@ -100,6 +100,28 @@ test_expect_success 'clone --sparse' '
|
||||||
check_files clone a
|
check_files clone a
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'interaction with clone --no-checkout (unborn index)' '
|
||||||
|
git clone --no-checkout "file://$(pwd)/repo" clone_no_checkout &&
|
||||||
|
git -C clone_no_checkout sparse-checkout init --cone &&
|
||||||
|
git -C clone_no_checkout sparse-checkout set folder1 &&
|
||||||
|
|
||||||
|
git -C clone_no_checkout sparse-checkout list >actual &&
|
||||||
|
cat >expect <<-\EOF &&
|
||||||
|
folder1
|
||||||
|
EOF
|
||||||
|
test_cmp expect actual &&
|
||||||
|
|
||||||
|
# nothing checked out, expect "No such file or directory"
|
||||||
|
! ls clone_no_checkout/* >actual &&
|
||||||
|
test_must_be_empty actual &&
|
||||||
|
test_path_is_missing clone_no_checkout/.git/index &&
|
||||||
|
|
||||||
|
# No branch is checked out until we manually switch to one
|
||||||
|
git -C clone_no_checkout switch master &&
|
||||||
|
test_path_is_file clone_no_checkout/.git/index &&
|
||||||
|
check_files clone_no_checkout a folder1
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'set enables config' '
|
test_expect_success 'set enables config' '
|
||||||
git init empty-config &&
|
git init empty-config &&
|
||||||
(
|
(
|
||||||
|
|
Loading…
Reference in New Issue