mirror of
https://github.com/git/git.git
synced 2024-10-28 12:59:41 +01:00
Merge branch 'ds/sparse-diff-index'
The underlying machinery for "git diff-index" has long been made to expand the sparse index as needed, but the command fully expanded the sparse index upfront, which now has been taught not to do. * ds/sparse-diff-index: diff-index: integrate with the sparse index
This commit is contained in:
commit
11fd53a6c2
2 changed files with 16 additions and 3 deletions
|
@ -25,6 +25,10 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
|
|||
usage(diff_cache_usage);
|
||||
|
||||
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
|
||||
|
||||
prepare_repo_settings(the_repository);
|
||||
the_repository->settings.command_requires_full_index = 0;
|
||||
|
||||
repo_init_revisions(the_repository, &rev, prefix);
|
||||
rev.abbrev = 0;
|
||||
prefix = precompose_argv_prefix(argc, argv, prefix);
|
||||
|
|
|
@ -803,6 +803,8 @@ test_expect_success 'update-index --remove outside sparse definition' '
|
|||
test_sparse_match git diff --cached --name-status &&
|
||||
test_cmp expect sparse-checkout-out &&
|
||||
|
||||
test_sparse_match git diff-index --cached HEAD &&
|
||||
|
||||
# Reset the state
|
||||
test_all_match git reset --hard &&
|
||||
|
||||
|
@ -812,6 +814,8 @@ test_expect_success 'update-index --remove outside sparse definition' '
|
|||
test_sparse_match git diff --cached --name-status &&
|
||||
test_must_be_empty sparse-checkout-out &&
|
||||
|
||||
test_sparse_match git diff-index --cached HEAD &&
|
||||
|
||||
# Reset the state
|
||||
test_all_match git reset --hard &&
|
||||
|
||||
|
@ -823,7 +827,9 @@ test_expect_success 'update-index --remove outside sparse definition' '
|
|||
D folder1/a
|
||||
EOF
|
||||
test_sparse_match git diff --cached --name-status &&
|
||||
test_cmp expect sparse-checkout-out
|
||||
test_cmp expect sparse-checkout-out &&
|
||||
|
||||
test_sparse_match git diff-index --cached HEAD
|
||||
'
|
||||
|
||||
test_expect_success 'update-index with directories' '
|
||||
|
@ -1551,7 +1557,7 @@ test_expect_success 'sparse-index is not expanded: describe' '
|
|||
ensure_not_expanded describe
|
||||
'
|
||||
|
||||
test_expect_success 'sparse index is not expanded: diff' '
|
||||
test_expect_success 'sparse index is not expanded: diff and diff-index' '
|
||||
init_repos &&
|
||||
|
||||
write_script edit-contents <<-\EOF &&
|
||||
|
@ -1568,6 +1574,7 @@ test_expect_success 'sparse index is not expanded: diff' '
|
|||
test_all_match git diff --cached &&
|
||||
ensure_not_expanded diff &&
|
||||
ensure_not_expanded diff --cached &&
|
||||
ensure_not_expanded diff-index --cached HEAD &&
|
||||
|
||||
# Add file outside cone
|
||||
test_all_match git reset --hard &&
|
||||
|
@ -1582,6 +1589,7 @@ test_expect_success 'sparse index is not expanded: diff' '
|
|||
test_all_match git diff --cached &&
|
||||
ensure_not_expanded diff &&
|
||||
ensure_not_expanded diff --cached &&
|
||||
ensure_not_expanded diff-index --cached HEAD &&
|
||||
|
||||
# Merge conflict outside cone
|
||||
# The sparse checkout will report a warning that is not in the
|
||||
|
@ -1594,7 +1602,8 @@ test_expect_success 'sparse index is not expanded: diff' '
|
|||
test_all_match git diff &&
|
||||
test_all_match git diff --cached &&
|
||||
ensure_not_expanded diff &&
|
||||
ensure_not_expanded diff --cached
|
||||
ensure_not_expanded diff --cached &&
|
||||
ensure_not_expanded diff-index --cached HEAD
|
||||
'
|
||||
|
||||
test_expect_success 'sparse index is not expanded: show and rev-parse' '
|
||||
|
|
Loading…
Reference in a new issue