summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-03-16submodule: fix latent check_has_commit() bugLibravatar Glen Choo2-38/+6
When check_has_commit() is called on a missing submodule, initialization of the struct repository fails, but it attempts to clear the struct anyway (which is a fatal error). This bug is masked by its only caller, submodule_has_commits(), first calling add_submodule_odb(). The latter fails if the submodule does not exist, making submodule_has_commits() exit early and not invoke check_has_commit(). Fix this bug, and because calling add_submodule_odb() is no longer necessary as of 13a2f620b2 (submodule: pass repo to check_has_commit(), 2021-10-08), remove that call too. This is the last caller of add_submodule_odb(), so remove that function. (Submodule ODBs are still added as alternates via add_submodule_odb_by_path().) Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-16fetch: fetch unpopulated, changed submodulesLibravatar Glen Choo6-46/+477
"git fetch --recurse-submodules" only considers populated submodules (i.e. submodules that can be found by iterating the index), which makes "git fetch" behave differently based on which commit is checked out. As a result, even if the user has initialized all submodules correctly, they may not fetch the necessary submodule commits, and commands like "git checkout --recurse-submodules" might fail. Teach "git fetch" to fetch cloned, changed submodules regardless of whether they are populated. This is in addition to the current behavior of fetching populated submodules (which is always attempted regardless of what was fetched in the superproject, or even if nothing was fetched in the superproject). A submodule may be encountered multiple times (via the list of populated submodules or via the list of changed submodules). When this happens, "git fetch" only reads the 'populated copy' and ignores the 'changed copy'. Amend the verify_fetch_result() test helper so that we can assert on which 'copy' is being read. Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07submodule: move logic into fetch_task_create()Libravatar Glen Choo1-47/+52
get_fetch_task() gets a fetch task by iterating the index; a future commit will introduce a similar function, get_fetch_task_from_changed(), that gets a fetch task from the list of changed submodules. Both functions are similar in that they need to: * create a fetch task * initialize the submodule repo for the fetch task * determine the default recursion mode Move all of this logic into fetch_task_create() so that it is no longer split between fetch_task_create() and get_fetch_task(). This will make it easier to share code with get_fetch_task_from_changed(). Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07submodule: extract get_fetch_task()Libravatar Glen Choo1-25/+36
get_next_submodule() configures the parallel submodule fetch by performing two functions: * iterate the index to find submodules * configure the child processes to fetch the submodules found in the previous step Extract the index iterating code into an iterator function, get_fetch_task(), so that get_next_submodule() is agnostic of how to find submodules. This prepares for a subsequent commit will teach the fetch machinery to also iterate through the list of changed submodules (in addition to the index). Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07submodule: store new submodule commits oid_array in a structLibravatar Glen Choo1-18/+34
This commit prepares for a future commit that will teach `git fetch --recurse-submodules` how to fetch submodules that are present in <gitdir>/modules, but are not populated. To do this, we need to store more information about the changed submodule so that we can read the submodule configuration from the superproject commit instead of the filesystem. Refactor the changed submodules string_list.util to hold a struct instead of an oid_array. This struct only holds the new_commits oid_array for now; more information will be added later. Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07submodule: inline submodule_commits() into callerLibravatar Glen Choo1-16/+6
When collecting the string_list of changed submodule names, the new submodules commits are stored in the string_list_item.util as an oid_array. A subsequent commit will replace the oid_array with a struct that has more information. Prepare for this change by inlining submodule_commits() (which inserts into the string_list and initializes the string_list_item.util) into its only caller so that the code is easier to refactor later. Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07submodule: make static functions read submodules from commitsLibravatar Glen Choo1-10/+19
A future commit will teach "fetch --recurse-submodules" to fetch unpopulated submodules. To prepare for this, teach the necessary static functions how to read submodules from superproject commits using a "treeish_name" argument (instead of always reading from the index and filesystem) but do not actually change where submodules are read from. Submodules will be read from commits when we fetch unpopulated submodules. Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07t5526: create superproject commits with test helperLibravatar Glen Choo1-50/+45
A few tests in t5526 use this pattern as part of their setup: 1. Create new commits in the upstream submodules (using add_upstream_commit()). 2. In the upstream superprojects, add the new submodule commits from the previous step. A future commit will add more tests with this pattern, so reduce the verbosity of present and future tests by introducing a test helper that creates superproject commits. Since we now have two helpers that add upstream commits, rename add_upstream_commit() to add_submodule_commits(). Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07t5526: stop asserting on stderr literallyLibravatar Glen Choo1-61/+56
In the previous commit message, we noted that not all of the "git fetch" stderr is relevant to the tests. Most of the test setup lines are dedicated to these details of the stderr: 1. which repos (super/sub/deep) are involved in the fetch 2. the head of the remote-tracking branch before the fetch (i.e. $head1) 3. the head of the remote-tracking branch after the fetch (i.e. $head2) 1. and 3. are relevant because they tell us that the expected commit is fetched by the expected repo, but 2. is completely irrelevant. Stop asserting on $head1 by replacing it with a dummy value in the actual and expected output. Do this by introducing test helpers (write_expected_*()) that make it easier to construct the expected output, and use sed to munge the actual output. Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07t5526: introduce test helper to assert on fetchesLibravatar Glen Choo1-55/+84
Tests in t/t5526-fetch-submodules.sh are unnecessarily noisy: * The tests have extra logic in order to reproduce the expected stderr literally, but not all of these details (e.g. the head of the remote-tracking branch before the fetch) are relevant to the test. * The expect.err file is constructed by the add_upstream_commit() helper as input into test_cmp, but most tests fetch a different combination of repos from expect.err. This results in noisy tests that modify parts of that expect.err to generate the expected output. To address both of these issues, introduce a verify_fetch_result() helper to t/t5526-fetch-submodules.sh that asserts on the output of "git fetch --recurse-submodules" and handles the ordering of expect.err. As a result, the tests no longer construct expect.err manually. Tests still consider the old head of the remote-tracking branch ("$head1"), but that will be fixed in a later commit. Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-02-23The seventh batchLibravatar Junio C Hamano1-0/+12
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-02-23Merge branch 'bc/clarify-eol-attr'Libravatar Junio C Hamano1-5/+6
Documentation update * bc/clarify-eol-attr: doc: clarify interaction between 'eol' and text=auto
2022-02-23Merge branch 'ds/mailmap'Libravatar Junio C Hamano1-2/+3
Update mailmap entries. * ds/mailmap: mailmap: change primary address for Derrick Stolee
2022-02-23Merge branch 'ah/log-no-graph'Libravatar Junio C Hamano7-4/+105
"git log --graph --graph" used to leak a graph structure, and there was no way to countermand "--graph" that appear earlier on the command line. A "--no-graph" option has been added and resource leakage has been plugged. * ah/log-no-graph: log: add a --no-graph option log: fix memory leak if --graph is passed multiple times
2022-02-23Merge branch 'hw/t1410-adjust-test-for-reftable'Libravatar Junio C Hamano1-2/+3
Fix tests that are unnecessarily specific to ref-files backend. * hw/t1410-adjust-test-for-reftable: t1410: mark bufsize boundary test as REFFILES t1410: use test-tool ref-store to inspect reflogs
2022-02-23Merge branch 'ps/fetch-optim-with-commit-graph'Libravatar Junio C Hamano2-14/+22
A couple of optimization to "git fetch". * ps/fetch-optim-with-commit-graph: fetch: skip computing output width when not printing anything fetch-pack: use commit-graph when computing cutoff
2022-02-23Merge branch 'sy/t0001-use-path-is-helper'Libravatar Junio C Hamano1-1/+2
Test modernization. * sy/t0001-use-path-is-helper: t0001: replace "test [-d|-f]" with test_path_is_* functions
2022-02-23Merge branch 'bs/forbid-i18n-of-protocol-token-in-fetch-pack'Libravatar Junio C Hamano1-2/+10
L10n support for a few error messages. * bs/forbid-i18n-of-protocol-token-in-fetch-pack: fetch-pack: parameterize message containing 'ready' keyword
2022-02-18The sixth batchLibravatar Junio C Hamano1-0/+34
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-02-18Merge branch 'jc/glossary-worktree'Libravatar Junio C Hamano1-2/+11
"working tree" and "per-worktree ref" were in glossary, but "worktree" itself wasn't, which has been corrected. * jc/glossary-worktree: glossary: describe "worktree"
2022-02-18Merge branch 'jd/t0015-modernize'Libravatar Junio C Hamano1-3/+3
Test modernization. * jd/t0015-modernize: t/t0015-hash.sh: remove unnecessary '\' at line end
2022-02-18Merge branch 'js/short-help-outside-repo-fix'Libravatar Junio C Hamano5-11/+23
"git cmd -h" outside a repository should error out cleanly for many commands, but instead it hit a BUG(), which has been corrected. * js/short-help-outside-repo-fix: t0012: verify that built-ins handle `-h` even without gitdir checkout/fetch/pull/pack-objects: allow `-h` outside a repository
2022-02-18Merge branch 'tb/midx-no-bitmap-for-no-objects'Libravatar Junio C Hamano2-0/+31
When there is no object to write .bitmap file for, "git multi-pack-index" triggered an error, instead of just skipping, which has been corrected. * tb/midx-no-bitmap-for-no-objects: midx: prevent writing a .bitmap without any objects
2022-02-18Merge branch 'ab/release-transport-ls-refs-options'Libravatar Junio C Hamano7-15/+26
* ab/release-transport-ls-refs-options: ls-remote & transport API: release "struct transport_ls_refs_options"
2022-02-18Merge branch 'ab/hash-object-leakfix'Libravatar Junio C Hamano2-2/+8
Trivial leakfix. * ab/hash-object-leakfix: hash-object: fix a trivial leak in --path
2022-02-18Merge branch 'gc/branch-recurse-submodules'Libravatar Junio C Hamano16-81/+846
"git branch" learned the "--recurse-submodules" option. * gc/branch-recurse-submodules: branch.c: use 'goto cleanup' in setup_tracking() to fix memory leaks branch: add --recurse-submodules option for branch creation builtin/branch: consolidate action-picking logic in cmd_branch() branch: add a dry_run parameter to create_branch() branch: make create_branch() always create a branch branch: move --set-upstream-to behavior to dwim_and_setup_tracking()
2022-02-18Merge branch 'ab/t0051-skip-on-non-windows'Libravatar Junio C Hamano1-1/+6
Conditional test update. * ab/t0051-skip-on-non-windows: t0051: use "skip_all" under !MINGW in single-test file
2022-02-18Merge branch 'ps/avoid-unnecessary-hook-invocation-with-packed-refs'Libravatar Junio C Hamano8-19/+114
Because a deletion of ref would need to remove it from both the loose ref store and the packed ref store, a delete-ref operation that logically removes one ref may end up invoking ref-transaction hook twice, which has been corrected. * ps/avoid-unnecessary-hook-invocation-with-packed-refs: refs: skip hooks when deleting uncovered packed refs refs: do not execute reference-transaction hook on packing refs refs: demonstrate excessive execution of the reference-transaction hook refs: allow skipping the reference-transaction hook refs: allow passing flags when beginning transactions refs: extract packed_refs_delete_refs() to allow control of transaction
2022-02-18Merge branch 'pw/use-in-process-checkout-in-rebase'Libravatar Junio C Hamano9-163/+312
Use an internal call to reset_head() helper function instead of spawning "git checkout" in "rebase", and update code paths that are involved in the change. * pw/use-in-process-checkout-in-rebase: rebase -m: don't fork git checkout rebase --apply: set ORIG_HEAD correctly rebase --apply: fix reflog reset_head(): take struct rebase_head_opts rebase: cleanup reset_head() calls create_autostash(): remove unneeded parameter reset_head(): make default_reflog_action optional reset_head(): factor out ref updates reset_head(): remove action parameter rebase --apply: don't run post-checkout hook if there is an error rebase: do not remove untracked files on checkout rebase: pass correct arguments to post-checkout hook t5403: refactor rebase post-checkout hook tests rebase: factor out checkout for up to date branch
2022-02-18Merge branch 'cb/clear-quarantine-early-on-all-ref-update-errors'Libravatar Junio C Hamano2-0/+17
"receive-pack" checks if it will do any ref updates (various conditions could reject a push) before received objects are taken out of the temporary directory used for quarantine purposes, so that a push that is known-to-fail will not leave crufts that a future "gc" needs to clean up. * cb/clear-quarantine-early-on-all-ref-update-errors: receive-pack: purge temporary data if no command is ready to run
2022-02-17The fifth batchLibravatar Junio C Hamano1-0/+24
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-02-17Merge branch 'ab/complete-show-all-commands'Libravatar Junio C Hamano2-22/+72
The command line completion script (in contrib/) learned to complete all Git subcommands, including the ones that are normally hidden, when GIT_COMPLETION_SHOW_ALL_COMMANDS is used. * ab/complete-show-all-commands: completion: add a GIT_COMPLETION_SHOW_ALL_COMMANDS completion tests: re-source git-completion.bash in a subshell
2022-02-17Merge branch 'sy/modernize-t-lib-read-tree-m-3way'Libravatar Junio C Hamano1-84/+84
Style updates on a test script helper. * sy/modernize-t-lib-read-tree-m-3way: t/lib-read-tree-m-3way: indent with tabs t/lib-read-tree-m-3way: modernize style
2022-02-17Merge branch 'po/doc-check-ignore-markup-fix'Libravatar Junio C Hamano1-2/+2
Typofix. * po/doc-check-ignore-markup-fix: doc: check-ignore: code-quote an exclamation mark
2022-02-17Merge branch 'js/scalar-global-options'Libravatar Junio C Hamano3-1/+39
Scalar update. * js/scalar-global-options: scalar: accept -C and -c options before the subcommand
2022-02-17Merge branch 'vd/sparse-clean-etc'Libravatar Junio C Hamano8-17/+360
"git update-index", "git checkout-index", and "git clean" are taught to work better with the sparse checkout feature. * vd/sparse-clean-etc: update-index: reduce scope of index expansion in do_reupdate update-index: integrate with sparse index update-index: add tests for sparse-checkout compatibility checkout-index: integrate with sparse index checkout-index: add --ignore-skip-worktree-bits option checkout-index: expand sparse checkout compatibility tests clean: integrate with sparse index reset: reorder wildcard pathspec conditions reset: fix validation in sparse index test
2022-02-17Merge branch 'jz/rev-list-exclude-first-parent-only'Libravatar Junio C Hamano6-26/+51
"git log" and friends learned an option --exclude-first-parent-only to propagate UNINTERESTING bit down only along the first-parent chain, just like --first-parent option shows commits that lack the UNINTERESTING bit only along the first-parent chain. * jz/rev-list-exclude-first-parent-only: git-rev-list: add --exclude-first-parent-only flag
2022-02-17Merge branch 'jz/patch-id-hunk-header-parsing-fix'Libravatar Junio C Hamano2-36/+68
Unlike "git apply", "git patch-id" did not handle patches with hunks that has only 1 line in either preimage or postimage, which has been corrected. * jz/patch-id-hunk-header-parsing-fix: patch-id: fix scan_hunk_header on diffs with 1 line of before/after patch-id: fix antipatterns in tests
2022-02-17Merge branch 'hn/reftable-tests'Libravatar Junio C Hamano2-6/+12
Prepare more test scripts for the introduction of reftable. * hn/reftable-tests: t5312: prepare for reftable t1405: mark test that checks existence as REFFILES t1405: explictly delete reflogs for reftable
2022-02-17Merge branch 'tk/subtree-merge-not-ff-only'Libravatar Junio C Hamano1-2/+2
When "git subtree" wants to create a merge, it used "git merge" and let it be affected by end-user's "merge.ff" configuration, which has been corrected. * tk/subtree-merge-not-ff-only: subtree: force merge commit
2022-02-16The fourth batchLibravatar Junio C Hamano1-0/+28
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-02-16Merge branch 'ab/do-not-hide-failures-in-git-dot-pm'Libravatar Junio C Hamano5-6/+19
Git.pm update. * ab/do-not-hide-failures-in-git-dot-pm: perl Git.pm: don't ignore signalled failure in _cmd_close()
2022-02-16Merge branch 'js/no-more-legacy-stash'Libravatar Junio C Hamano5-47/+0
Removal of unused code and doc. * js/no-more-legacy-stash: stash: stop warning about the obsolete `stash.useBuiltin` config setting stash: remove documentation for `stash.useBuiltin` add: remove support for `git-legacy-stash` git-sh-setup: remove remnant bits referring to `git-legacy-stash`
2022-02-16Merge branch 'js/diff-filter-negation-fix'Libravatar Junio C Hamano4-59/+60
"git diff --diff-filter=aR" is now parsed correctly. * js/diff-filter-negation-fix: diff-filter: be more careful when looking for negative bits diff.c: move the diff filter bits definitions up a bit docs(diff): lose incorrect claim about `diff-files --diff-filter=A`
2022-02-16Merge branch 'en/fetch-negotiation-default-fix'Libravatar Junio C Hamano5-18/+44
Interaction between fetch.negotiationAlgorithm and feature.experimental configuration variables has been corrected. * en/fetch-negotiation-default-fix: repo-settings: rename the traditional default fetch.negotiationAlgorithm repo-settings: fix error handling for unknown values repo-settings: fix checking for fetch.negotiationAlgorithm=default
2022-02-16Merge branch 'ab/auto-detect-zlib-compress2'Libravatar Junio C Hamano8-46/+21
The build procedure has been taught to notice older version of zlib and enable our replacement uncompress2() automatically. * ab/auto-detect-zlib-compress2: compat: auto-detect if zlib has uncompress2()
2022-02-16Merge branch 'tb/midx-bitmap-corruption-fix'Libravatar Junio C Hamano11-151/+321
A bug that made multi-pack bitmap and the object order out-of-sync, making the .midx data corrupt, has been fixed. * tb/midx-bitmap-corruption-fix: pack-bitmap.c: gracefully fallback after opening pack/MIDX midx: read `RIDX` chunk when present t/lib-bitmap.sh: parameterize tests over reverse index source t5326: move tests to t/lib-bitmap.sh t5326: extract `test_rev_exists` t5326: drop unnecessary setup pack-revindex.c: instrument loading on-disk reverse index midx.c: make changing the preferred pack safe t5326: demonstrate bitmap corruption after permutation
2022-02-16Merge branch 'en/remerge-diff'Libravatar Junio C Hamano23-48/+727
"git log --remerge-diff" shows the difference from mechanical merge result and the result that is actually recorded in a merge commit. * en/remerge-diff: diff-merges: avoid history simplifications when diffing merges merge-ort: mark conflict/warning messages from inner merges as omittable show, log: include conflict/warning messages in --remerge-diff headers diff: add ability to insert additional headers for paths merge-ort: format messages slightly different for use in headers merge-ort: mark a few more conflict messages as omittable merge-ort: capture and print ll-merge warnings in our preferred fashion ll-merge: make callers responsible for showing warnings log: clean unneeded objects during `log --remerge-diff` show, log: provide a --remerge-diff capability
2022-02-16Merge branch 'hn/reftable-coverity-fixes'Libravatar Junio C Hamano19-529/+620
Problems identified by Coverity in the reftable code have been corrected. * hn/reftable-coverity-fixes: reftable: add print functions to the record types reftable: make reftable_record a tagged union reftable: remove outdated file reftable.c reftable: implement record equality generically reftable: make reftable-record.h function signatures const correct reftable: handle null refnames in reftable_ref_record_equal reftable: drop stray printf in readwrite_test reftable: order unittests by complexity reftable: all xxx_free() functions accept NULL arguments reftable: fix resource warning reftable: ignore remove() return value in stack_test.c reftable: check reftable_stack_auto_compact() return value reftable: fix resource leak blocksource.c reftable: fix resource leak in block.c error path reftable: fix OOB stack write in print functions
2022-02-16Merge branch 'll/doc-mktree-typofix'Libravatar Junio C Hamano1-1/+1
Typofix. * ll/doc-mktree-typofix: fix typo in git-mktree.txt