summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-11-29reset: make --mixed sparse-awareLibravatar Victoria Dye2-2/+102
Remove the `ensure_full_index` guard on `read_from_tree` and update `git reset --mixed` to ensure it can use sparse directory index entries wherever possible. Sparse directory entries are reset using `diff_tree_oid`, which requires `change` and `add_remove` functions to process the internal contents of the sparse directory. The `recursive` diff option handles cases in which `reset --mixed` must diff/merge files that are nested multiple levels deep in a sparse directory. The use of pathspecs with `git reset --mixed` introduces scenarios in which internal contents of sparse directories may be matched by the pathspec. In order to reset *all* files in the repo that may match the pathspec, the following conditions on the pathspec require index expansion before performing the reset: * "magic" pathspecs * wildcard pathspecs that do not match only in-cone files or entire sparse directories * literal pathspecs matching something outside the sparse checkout definition Helped-by: Elijah Newren <newren@gmail.com> Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-11-29reset: make sparse-aware (except --mixed)Libravatar Victoria Dye4-13/+86
Remove `ensure_full_index` guard on `prime_cache_tree` and update `prime_cache_tree_rec` to correctly reconstruct sparse directory entries in the cache tree. While processing a tree's entries, `prime_cache_tree_rec` must determine whether a directory entry is sparse or not by searching for it in the index (*without* expanding the index). If a matching sparse directory index entry is found, no subtrees are added to the cache tree entry and the entry count is set to 1 (representing the sparse directory itself). Otherwise, the tree is assumed to not be sparse and its subtrees are recursively added to the cache tree. Helped-by: Elijah Newren <newren@gmail.com> Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-11-29reset: integrate with sparse indexLibravatar Victoria Dye2-3/+8
Disable `command_requires_full_index` repo setting and add `ensure_full_index` guards around code paths that cannot yet use sparse directory index entries. `reset --soft` does not modify the index, so no compatibility changes are needed for it to function without expanding the index. For all other reset modes (`--mixed`, `--hard`, `--keep`, `--merge`), the full index is expanded to prevent cache tree corruption and invalid variable accesses. Additionally, the `read_cache()` check verifying an uncorrupted index is moved after argument parsing and preparing the repo settings. The index is not used by the preceding argument handling, but `read_cache()` must be run *after* enabling sparse index for the command (so that the index is not expanded unnecessarily) and *before* using the index for reset (so that it is verified as uncorrupted). Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-11-29reset: expand test coverage for sparse checkoutsLibravatar Victoria Dye2-0/+101
Add new tests for `--merge` and `--keep` modes, as well as mixed reset with pathspecs. New performance test cases exercise various execution paths for `reset`. Co-authored-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-10-27sparse-index: update command for expand/collapse testLibravatar Victoria Dye1-1/+5
In anticipation of `git reset --hard` being able to use the sparse index without expanding it, replace the command in `sparse-index is expanded and converted back` with `git reset -- folder1/a`. This command will need to expand the index to work properly, even after integrating the rest of `reset` with sparse index. Helped-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-10-27reset: preserve skip-worktree bit in mixed resetLibravatar Victoria Dye3-14/+39
Change `update_index_from_diff` to set `skip-worktree` when applicable for new index entries. When `git reset --mixed <tree-ish>` is run, entries in the index with differences between the pre-reset HEAD and reset <tree-ish> are identified and handled with `update_index_from_diff`. For each file, a new cache entry in inserted into the index, created from the <tree-ish> side of the reset (without changing the working tree). However, the newly-created entry must have `skip-worktree` explicitly set in either of the following scenarios: 1. the file is in the current index and has `skip-worktree` set 2. the file is not in the current index but is outside of a defined sparse checkout definition Not setting the `skip-worktree` bit leads to likely-undesirable results for a user. It causes `skip-worktree` settings to disappear on the "diff"-containing files (but *only* the diff-containing files), leading to those files now showing modifications in `git status`. For example, when running `git reset --mixed` in a sparse checkout, some file entries outside of sparse checkout could show up as deleted, despite the user never deleting anything (and not wanting them on-disk anyway). Additionally, add a test to `t7102` to ensure `skip-worktree` is preserved in a basic `git reset --mixed` scenario and update a failure-documenting test from 19a0acc (t1092: test interesting sparse-checkout scenarios, 2021-01-23) with new expected behavior. Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-10-07reset: rename is_missing to !is_in_reset_treeLibravatar Victoria Dye1-3/+3
Rename and invert value of `is_missing` to `is_in_reset_tree` to make the variable more descriptive of what it represents. Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-10-06The eleventh batchLibravatar Junio C Hamano1-0/+9
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-10-06Merge branch 'ab/retire-decl-of-missing-unused-funcs'Libravatar Junio C Hamano4-5/+0
Remove external declaration of functions that no longer exist. * ab/retire-decl-of-missing-unused-funcs: config.h: remove unused git_config_get_untracked_cache() declaration log-tree.h: remove unused function declarations grep.h: remove unused grep_threads_ok() declaration builtin.h: remove cmd_tar_tree() declaration
2021-10-06Merge branch 'lh/systemd-timers'Libravatar Junio C Hamano1-2/+1
Testfix. * lh/systemd-timers: maintenance: fix test t7900-maintenance.sh
2021-10-06Merge branch 'ab/retire-string-list-init'Libravatar Junio C Hamano3-15/+2
Code cleanup. * ab/retire-string-list-init: string-list.[ch]: remove string_list_init() compatibility function
2021-10-06Merge branch 'ab/retire-refs-unused-funcs'Libravatar Junio C Hamano5-107/+19
Code cleanup. * ab/retire-refs-unused-funcs: refs/ref-cache.[ch]: remove "incomplete" from create_dir_entry() refs/ref-cache.c: remove "mkdir" parameter from find_containing_dir() refs/ref-cache.[ch]: remove unused add_ref_entry() refs/ref-cache.[ch]: remove unused remove_entry_from_dir() refs.[ch]: remove unused ref_storage_backend_exists()
2021-10-06Merge branch 'os/status-docfix'Libravatar Junio C Hamano1-1/+1
Docfix. * os/status-docfix: doc: fix capitalization in "git status --porcelain=v2" description
2021-10-06Merge branch 'ws/refer-to-forkpoint-config-in-rebase-doc'Libravatar Junio C Hamano1-1/+2
Doc update. * ws/refer-to-forkpoint-config-in-rebase-doc: Document `rebase.forkpoint` in rebase man page
2021-10-06Merge branch 'gc/doc-first-contribution-reroll'Libravatar Junio C Hamano1-11/+31
Doc update. * gc/doc-first-contribution-reroll: MyFirstContribution: Document --range-diff option when writing v2
2021-10-06Merge branch 'pw/rebase-reread-todo-after-editing'Libravatar Junio C Hamano2-21/+27
The code to re-read the edited todo list in "git rebase -i" was made more robust. * pw/rebase-reread-todo-after-editing: rebase: fix todo-list rereading sequencer.c: factor out a function
2021-10-06Merge branch 'ew/midx-doc-update'Libravatar Junio C Hamano1-1/+3
Doc tweak. * ew/midx-doc-update: doc/technical: update note about core.multiPackIndex
2021-10-06Merge branch 'ab/repo-settings-cleanup'Libravatar Junio C Hamano9-94/+98
Code cleanup. * ab/repo-settings-cleanup: repository.h: don't use a mix of int and bitfields repo-settings.c: simplify the setup read-cache & fetch-negotiator: check "enum" values in switch() environment.c: remove test-specific "ignore_untracked..." variable wrapper.c: add x{un,}setenv(), and use xsetenv() in environment.c
2021-10-06Merge branch 'jk/grep-haystack-is-read-only'Libravatar Junio C Hamano2-46/+45
Code clean-up in the "grep" machinery. * jk/grep-haystack-is-read-only: grep: store grep_source buffer as const grep: mark "haystack" buffers as const grep: stop modifying buffer in grep_source_1() grep: stop modifying buffer in show_line() grep: stop modifying buffer in strip_timestamp
2021-10-06Merge branch 'tb/commit-graph-usage-fix'Libravatar Junio C Hamano4-16/+39
Regression in "git commit-graph" command line parsing has been corrected. * tb/commit-graph-usage-fix: builtin/multi-pack-index.c: disable top-level --[no-]progress builtin/commit-graph.c: don't accept common --[no-]progress
2021-10-06Merge branch 'pw/rebase-of-a-tag-fix'Libravatar Junio C Hamano2-87/+67
"git rebase <upstream> <tag>" failed when aborted in the middle, as it mistakenly tried to write the tag object instead of peeling it to HEAD. * pw/rebase-of-a-tag-fix: rebase: dereference tags rebase: use lookup_commit_reference_by_name() rebase: use our standard error return value t3407: rework rebase --quit tests t3407: strengthen rebase --abort tests t3407: use test_path_is_missing t3407: rename a variable t3407: use test_cmp_rev t3407: use test_commit t3407: run tests in $TEST_DIRECTORY
2021-10-06Merge branch 'jt/add-submodule-odb-clean-up'Libravatar Junio C Hamano11-97/+102
More code paths that use the hack to add submodule's object database to the set of alternate object store have been cleaned up. * jt/add-submodule-odb-clean-up: revision: remove "submodule" from opt struct repository: support unabsorbed in repo_submodule_init submodule: remove unnecessary unabsorbed fallback
2021-10-03The tenth batchLibravatar Junio C Hamano1-0/+34
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-10-03Merge branch 'ah/connect-parse-feature-v0-fix'Libravatar Junio C Hamano2-0/+17
Protocol v0 clients can get stuck parsing a malformed feature line. * ah/connect-parse-feature-v0-fix: connect: also update offset for features without values
2021-10-03Merge branch 'ab/make-compdb-fix'Libravatar Junio C Hamano1-0/+1
Build update. * ab/make-compdb-fix: Makefile: pass -Wno-pendantic under GENERATE_COMPILATION_DATABASE=yes
2021-10-03Merge branch 'bs/difftool-msg-tweak'Libravatar Junio C Hamano1-3/+3
Message tweak. * bs/difftool-msg-tweak: difftool: fix word spacing in the usage strings
2021-10-03Merge branch 'rs/close-pack-leakfix'Libravatar Junio C Hamano1-0/+1
Leakfix. * rs/close-pack-leakfix: packfile: release bad_objects in close_pack()
2021-10-03Merge branch 'ab/bundle-remove-verbose-option'Libravatar Junio C Hamano1-3/+0
Doc update. * ab/bundle-remove-verbose-option: bundle: remove ignored & undocumented "--verbose" flag
2021-10-03Merge branch 'ab/auto-depend-with-pedantic'Libravatar Junio C Hamano1-0/+1
Improve build procedure for developers. * ab/auto-depend-with-pedantic: Makefile: make COMPUTE_HEADER_DEPENDENCIES=auto work with DEVOPTS=pedantic
2021-10-03Merge branch 'ab/make-clean-depend-dirs'Libravatar Junio C Hamano1-1/+0
"make clean" has been updated to remove leftover .depend/ directories, even when it is not told to use them to compute header dependencies. * ab/make-clean-depend-dirs: Makefile: clean .depend dirs under COMPUTE_HEADER_DEPENDENCIES != yes
2021-10-03Merge branch 'ds/perf-test-built-path-fix'Libravatar Junio C Hamano1-1/+1
Perf test fix. * ds/perf-test-built-path-fix: t/perf/run: fix bin-wrappers computation
2021-10-03Merge branch 'jk/http-redact-fix'Libravatar Junio C Hamano2-15/+15
Sensitive data in the HTTP trace were supposed to be redacted, but we failed to do so in HTTP/2 requests. * jk/http-redact-fix: http: match headers case-insensitively when redacting
2021-10-03Merge branch 'bs/ls-files-opt-help-text-update'Libravatar Junio C Hamano1-2/+2
Help text for "ls-files" options have been updated. * bs/ls-files-opt-help-text-update: ls-files: use imperative mood for -X and -z option description
2021-10-03Merge branch 'da/difftool-dir-diff-symlink-fix'Libravatar Junio C Hamano2-2/+67
"git difftool --dir-diff" mishandled symbolic links. * da/difftool-dir-diff-symlink-fix: difftool: fix symlink-file writing in dir-diff mode
2021-10-03Merge branch 'hn/refs-errno-cleanup'Libravatar Junio C Hamano7-151/+146
Futz with the way 'errno' is relied on in the refs API to carry the failure modes up the call chain. * hn/refs-errno-cleanup: refs: make errno output explicit for read_raw_ref_fn refs/files-backend: stop setting errno from lock_ref_oid_basic refs: remove EINVAL errno output from specification of read_raw_ref_fn refs file backend: move raceproof_create_file() here
2021-10-03Merge branch 'ab/refs-files-cleanup'Libravatar Junio C Hamano8-123/+64
Continued work on top of the hn/refs-errno-cleanup topic. * ab/refs-files-cleanup: refs/files: remove unused "errno != ENOTDIR" condition refs/files: remove unused "errno == EISDIR" code refs/files: remove unused "oid" in lock_ref_oid_basic() refs API: remove OID argument to reflog_expire() reflog expire: don't lock reflogs using previously seen OID refs/files: add a comment about refs_reflog_exists() call refs: make repo_dwim_log() accept a NULL oid refs/debug: re-indent argument list for "prepare" refs/files: remove unused "skip" in lock_raw_ref() too refs/files: remove unused "extras/skip" in lock_ref_oid_basic() refs: drop unused "flags" parameter to lock_ref_oid_basic() refs/files: remove unused REF_DELETING in lock_ref_oid_basic() refs/packet: add missing BUG() invocations to reflog callbacks
2021-10-03Merge branch 'cb/cvsserver'Libravatar Junio C Hamano3-17/+24
"git cvsserver" had a long-standing bug in its authentication code, which has finally been corrected (it is unclear and is a separate question if anybody is seriously using it, though). * cb/cvsserver: Documentation: cleanup git-cvsserver git-cvsserver: protect against NULL in crypt(3) git-cvsserver: use crypt correctly to compare password hashes
2021-10-03Merge branch 'jx/ci-l10n'Libravatar Junio C Hamano1-0/+105
CI help for l10n. * jx/ci-l10n: ci: new github-action for git-l10n code review
2021-10-03Merge branch 'jk/clone-unborn-head-in-bare'Libravatar Junio C Hamano2-16/+30
"git clone" from a repository whose HEAD is unborn into a bare repository didn't follow the branch name the other side used, which is corrected. * jk/clone-unborn-head-in-bare: clone: handle unborn branch in bare repos
2021-10-03Merge branch 'en/stash-df-fix'Libravatar Junio C Hamano2-3/+75
"git stash", where the tentative change involves changing a directory to a file (or vice versa), was confused, which has been corrected. * en/stash-df-fix: stash: restore untracked files AFTER restoring tracked files stash: avoid feeding directories to update-index t3903: document a pair of directory/file bugs
2021-10-01config.h: remove unused git_config_get_untracked_cache() declarationLibravatar Ævar Arnfjörð Bjarmason1-1/+0
This function was removed in ad0fb659993 (repo-settings: parse core.untrackedCache, 2019-08-13), but not its corresponding *.h entry. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-10-01log-tree.h: remove unused function declarationsLibravatar Ævar Arnfjörð Bjarmason1-2/+0
The init_log_tree_opt() and log_tree_opt_parse() functions were removed in cd2bdc53094 (Common option parsing for "git log --diff" and friends, 2006-04-14), but not their corresponding *.h declaration. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-10-01grep.h: remove unused grep_threads_ok() declarationLibravatar Ævar Arnfjörð Bjarmason1-1/+0
This function was removed in 0579f91dd74 (grep: enable threading with -p and -W using lazy attribute lookup, 2011-12-12), but not its corresponding *.h declaration. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-10-01builtin.h: remove cmd_tar_tree() declarationLibravatar Ævar Arnfjörð Bjarmason1-1/+0
The cmd_tar_tree() function itself was removed in 925ceccf050 (tar-tree: remove deprecated command, 2013-11-10). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-09-28doc: fix capitalization in "git status --porcelain=v2" descriptionLibravatar Orgad Shaneh1-1/+1
The summary line had xy, while the description (and other sub-sections) has XY. Signed-off-by: Orgad Shaneh <orgads@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-09-28refs/ref-cache.[ch]: remove "incomplete" from create_dir_entry()Libravatar Ævar Arnfjörð Bjarmason3-9/+7
Remove the now-unused "incomplete" parameter from create_dir_entry(), all its callers specify it as "1", so let's drop the "incomplete=0" case. The last caller to use it was search_for_subdir(), but that code was removed in the preceding commit. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-09-28refs/ref-cache.c: remove "mkdir" parameter from find_containing_dir()Libravatar Ævar Arnfjörð Bjarmason1-24/+12
Remove the "mkdir" parameter from the find_containing_dir() function, the add_ref_entry() function removed in the preceding commit was its last user. Since "mkdir" is always "0" we can also remove the parameter from search_for_subdir(), which in turn means that we can delete most of that function. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-09-28refs/ref-cache.[ch]: remove unused add_ref_entry()Libravatar Ævar Arnfjörð Bjarmason2-16/+0
This function has not been used since 9dd389f3d8d (packed_ref_store: get rid of the `ref_cache` entirely, 2017-09-25). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-09-28refs/ref-cache.[ch]: remove unused remove_entry_from_dir()Libravatar Ævar Arnfjörð Bjarmason2-51/+0
This function was missed in 9939b33d6a3 (packed-backend: rip out some now-unused code, 2017-09-08), and has been orphaned since then. Let's delete it. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-09-28refs.[ch]: remove unused ref_storage_backend_exists()Libravatar Ævar Arnfjörð Bjarmason2-7/+0
This function was added in 3dce444f178 (refs: add a backend method structure, 2016-09-04), but has never been used by anything. The only caller that might care uses find_ref_storage_backend() directly. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>