diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-05-27 13:59:09 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-05-27 13:59:09 -0700 |
| commit | 6e5fb398d3503ecea3c8ddeeb3c9c8a8c7b6a4ba (patch) | |
| tree | c61316a2ba59166fc56de303b2459e6f32654371 /builtin | |
| parent | Merge branch 'rj/build-tweaks-part2' (diff) | |
| parent | p2000: add performance test for patch-mode commands (diff) | |
| download | git-6e5fb398d3503ecea3c8ddeeb3c9c8a8c7b6a4ba.tar.gz git-6e5fb398d3503ecea3c8ddeeb3c9c8a8c7b6a4ba.zip | |
Merge branch 'ds/sparse-apply-add-p'
"git apply" and "git add -i/-p" code paths no longer unnecessarily
expand sparse-index while working.
* ds/sparse-apply-add-p:
p2000: add performance test for patch-mode commands
reset: integrate sparse index with --patch
git add: make -p/-i aware of sparse index
apply: integrate with the sparse index
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/add.c | 7 | ||||
| -rw-r--r-- | builtin/apply.c | 7 | ||||
| -rw-r--r-- | builtin/reset.c | 6 |
3 files changed, 13 insertions, 7 deletions
diff --git a/builtin/add.c b/builtin/add.c index 747511b68b..7c292ffdc6 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -390,6 +390,10 @@ int cmd_add(int argc, argc = parse_options(argc, argv, prefix, builtin_add_options, builtin_add_usage, PARSE_OPT_KEEP_ARGV0); + + prepare_repo_settings(repo); + repo->settings.command_requires_full_index = 0; + if (patch_interactive) add_interactive = 1; if (add_interactive) { @@ -426,9 +430,6 @@ int cmd_add(int argc, add_new_files = !take_worktree_changes && !refresh_only && !add_renormalize; require_pathspec = !(take_worktree_changes || (0 < addremove_explicit)); - prepare_repo_settings(repo); - repo->settings.command_requires_full_index = 0; - repo_hold_locked_index(repo, &lock_file, LOCK_DIE_ON_ERROR); /* diff --git a/builtin/apply.c b/builtin/apply.c index 84f1863d3a..a1e20c593d 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -12,7 +12,7 @@ static const char * const apply_usage[] = { int cmd_apply(int argc, const char **argv, const char *prefix, - struct repository *repo UNUSED) + struct repository *repo) { int force_apply = 0; int options = 0; @@ -35,6 +35,11 @@ int cmd_apply(int argc, &state, &force_apply, &options, apply_usage); + if (repo) { + prepare_repo_settings(repo); + repo->settings.command_requires_full_index = 0; + } + if (check_apply_state(&state, force_apply)) exit(128); diff --git a/builtin/reset.c b/builtin/reset.c index 73b4537a9a..dc50ffc1ac 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -420,6 +420,9 @@ int cmd_reset(int argc, oidcpy(&oid, &tree->object.oid); } + prepare_repo_settings(the_repository); + the_repository->settings.command_requires_full_index = 0; + if (patch_mode) { if (reset_type != NONE) die(_("options '%s' and '%s' cannot be used together"), "--patch", "--{hard,mixed,soft}"); @@ -457,9 +460,6 @@ int cmd_reset(int argc, if (intent_to_add && reset_type != MIXED) die(_("the option '%s' requires '%s'"), "-N", "--mixed"); - prepare_repo_settings(the_repository); - the_repository->settings.command_requires_full_index = 0; - if (repo_read_index(the_repository) < 0) die(_("index file corrupt")); |
