summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-01-23repository: add repo reference to index_stateLibravatar Derrick Stolee2-0/+7
It will be helpful to add behavior to index operations that might trigger an object lookup. Since each index belongs to a specific repository, add a 'repo' pointer to struct index_state that allows access to this repository. Add a BUG() statement if the repo already has an index, and the index already has a repo, but somehow the index points to a different repo. This will prevent future changes from needing to pass an additional 'struct repository *repo' parameter and instead rely only on the 'struct index_state *istate' parameter. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-23fsmonitor: de-duplicate BUG()s around dirty bitsLibravatar Derrick Stolee1-14/+13
The index has an fsmonitor_dirty bitmap that records which index entries are "dirty" based on the response from the FSMonitor. If this bitmap ever grows larger than the index, then there was an error in how it was constructed, and it was probably a developer's bug. There are several BUG() statements that are very similar, so replace these uses with a simpler assert_index_minimum(). Since there is one caller that uses a custom 'pos' value instead of the bit_size member, we cannot simplify it too much. However, the error string is identical in each, so this simplifies things. Be sure to add one when checking if a position if valid, since the minimum is a bound on the expected size. The end result is that the code is simpler to read while also preserving these assertions for developers in the FSMonitor space. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-23cache-tree: extract subtree_pos()Libravatar Derrick Stolee2-3/+5
This method will be helpful to use outside of cache-tree.c in a later feature. The implementation is subtle due to subtree_name_cmp() sorting by length and then lexicographically. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-23cache-tree: simplify verify_cache() prototypeLibravatar Derrick Stolee1-9/+8
The verify_cache() method takes an array of cache entries and a count, but these are always provided directly from a struct index_state. Use a pointer to the full structure instead. There is a subtle point when istate->cache_nr is zero that subtracting one will underflow. This triggers a failure in t0000-basic.sh, among others. Use "i + 1 < istate->cache_nr" to avoid these strange comparisons. Convert i to be unsigned as well, which also removes the potential signed overflow in the unlikely case that cache_nr is over 2.1 billion entries. The 'funny' variable has a maximum value of 11, so making it unsigned does not change anything of importance. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-23cache-tree: clean up cache_tree_update()Libravatar Derrick Stolee4-16/+9
Make the method safer by allocating a cache_tree member for the given index_state if it is not already present. This is preferrable to a BUG() statement or returning with an error because future callers will want to populate an empty cache-tree using this method. Callers can also remove their conditional allocations of cache_tree. Also drop local variables that can be found directly from the 'istate' parameter. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-15cache-tree: speed up consecutive path comparisonsLibravatar Derrick Stolee1-2/+2
The previous change reduced time spent in strlen() while comparing consecutive paths in verify_cache(), but we can do better. The conditional checks the existence of a directory separator at the correct location, but only after doing a string comparison. Swap the order to be logically equivalent but perform fewer string comparisons. To test the effect on performance, I used a repository with over three million paths in the index. I then ran the following command on repeat: git -c index.threads=1 commit --amend --allow-empty --no-edit Here are the measurements over 10 runs after a 5-run warmup: Benchmark #1: v2.30.0 Time (mean ± σ): 854.5 ms ± 18.2 ms Range (min … max): 825.0 ms … 892.8 ms Benchmark #2: Previous change Time (mean ± σ): 833.2 ms ± 10.3 ms Range (min … max): 815.8 ms … 849.7 ms Benchmark #3: This change Time (mean ± σ): 815.5 ms ± 18.1 ms Range (min … max): 795.4 ms … 849.5 ms This change is 2% faster than the previous change and 5% faster than v2.30.0. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-15cache-tree: use ce_namelen() instead of strlen()Libravatar René Scharfe1-4/+6
Use the name length field of cache entries instead of calculating its value anew. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-15index-format: discuss recursion of cache-tree betterLibravatar Derrick Stolee1-1/+2
The end of the cache tree index extension format trails off with ellipses ever since 23fcc98 (doc: technical details about the index file format, 2011-03-01). While an intuitive reader could gather what this means, it could be better to use "and so on" instead. Really, this is only justified because I also wanted to point out that the number of subtrees in the index format is used to determine when the recursive depth-first-search stack should be "popped." This should help to add clarity to the format. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-15index-format: update preamble to cache tree extensionLibravatar Derrick Stolee1-6/+27
I had difficulty in my efforts to learn about the cache tree extension based on the documentation and code because I had an incorrect assumption about how it behaved. This might be due to some ambiguity in the documentation, so this change modifies the beginning of the cache tree format by expanding the description of the feature. My hope is that this documentation clarifies a few things: 1. There is an in-memory recursive tree structure that is constructed from the extension data. This structure has a few differences, such as where the name is stored. 2. What does it mean for an entry to be invalid? 3. When exactly are "new" trees created? Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-15index-format: use 'cache tree' over 'cached tree'Libravatar Derrick Stolee2-4/+4
The index has a "cache tree" extension. This corresponds to a significant API implemented in cache-tree.[ch]. However, there are a few places that refer to this erroneously as "cached tree". These are rare, but notably the index-format.txt file itself makes this error. The only other reference is in t7104-reset-hard.sh. Reported-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-15cache-tree: trace regions for prime_cache_treeLibravatar Derrick Stolee1-0/+3
Commands such as "git reset --hard" rebuild the in-memory representation of the cache tree index extension by parsing tree objects starting at a known root tree. The performance of this operation can vary widely depending on the width and depth of the repository's working directory structure. Measure the time in this operation using trace2 regions in prime_cache_tree(). Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-15cache-tree: trace regions for I/OLibravatar Derrick Stolee1-1/+10
As we write or read the cache tree index extension, it can be good to isolate how much of the file I/O time is spent constructing this in-memory tree from the existing index or writing it out again to the new index file. Use trace2 regions to indicate that we are spending time on this operation. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-04cache-tree: use trace2 in cache_tree_update()Libravatar Derrick Stolee1-0/+2
This matches a trace_performance_enter()/trace_performance_leave() pair added by 0d1ed59 (unpack-trees: add performance tracing, 2018-08-18). Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-04unpack-trees: add trace2 regionsLibravatar Derrick Stolee1-0/+5
The unpack_trees() method is quite complicated and its performance can change dramatically depending on how it is used. We already have some performance tracing regions, but they have not been updated to the trace2 API. Do so now. We already have trace2 regions in unpack_trees.c:clear_ce_flags(), which uses a linear scan through the index without recursing into trees. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-04tree-walk: report recursion countsLibravatar Derrick Stolee1-0/+33
The traverse_trees() method recursively walks through trees, but also prunes the tree-walk based on a callback. Some callers, such as unpack_trees(), are quite complicated and can have wildly different performance between two different commands. Create constants that count these values and then report the results at the end of a process. These counts are cumulative across multiple "root" instances of traverse_trees(), but they provide reproducible values for demonstrating improvements to the pruning algorithm when possible. This change is modeled after a similar statistics reporting in 42e50e78 (revision.c: add trace2 stats around Bloom filter usage, 2020-04-06). Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-27Git 2.30Libravatar Junio C Hamano2-12/+9
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-27Merge branch 'pb/doc-git-linkit-fix'Libravatar Junio C Hamano1-2/+2
Docfix. * pb/doc-git-linkit-fix: git.txt: fix typos in 'linkgit' macro invocation
2020-12-27Merge tag 'l10n-2.30.0-rnd2' of https://github.com/git-l10n/git-poLibravatar Junio C Hamano12-26547/+53354
l10n for Git 2.30.0 round 2 * tag 'l10n-2.30.0-rnd2' of https://github.com/git-l10n/git-po: l10n: zh_CN: for git v2.30.0 l10n round 1 and 2 l10n: zh_TW.po: v2.30.0 round 2 (1 untranslated) l10n: pl.po: add translation and set team leader l10n: pl.po: started Polish translation l10n: de.po: Update German translation for Git 2.30.0 l10n: Update Catalan translation l10n: bg.po: Updated Bulgarian translation (5037t) l10n: fr.po v2.30.0 rnd 2 l10n: tr: v2.30.0-r2 l10n: sv.po: Update Swedish translation (5037t0f0u) l10n: vi.po(5037t): v2.30.0 rnd 2 l10n: git.pot: v2.30.0 round 2 (1 new, 2 removed) l10n: Update Catalan translation l10n: fr.po: v2.30.0 rnd 1 l10n: fr.po Fix a typo l10n: fr fix misleading message l10n: tr: v2.30.0-r1 l10n: sv.po: Update Swedish translation (5038t0f0u) l10n: git.pot: v2.30.0 round 1 (70 new, 45 removed)
2020-12-27l10n: zh_CN: for git v2.30.0 l10n round 1 and 2Libravatar Jiang Xin1-2475/+2588
Translate 71 new messages (5037t0f0u) for git 2.30.0. Reviewed-by: 依云 <lilydjwg@gmail.com> Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2020-12-25Merge branch 'l10n/zh_TW/201223' of github.com:l10n-tw/git-poLibravatar Jiang Xin1-2744/+2602
* 'l10n/zh_TW/201223' of github.com:l10n-tw/git-po: l10n: zh_TW.po: v2.30.0 round 2 (1 untranslated)
2020-12-25l10n: zh_TW.po: v2.30.0 round 2 (1 untranslated)Libravatar pan934121-2744/+2602
Signed-off-by: pan93412 <pan93412@gmail.com>
2020-12-23l10n: pl.po: add translation and set team leaderLibravatar Arusekk2-8992/+22386
Signed-off-by: Arusekk <arek_koz@o2.pl>
2020-12-23Git 2.30-rc2Libravatar Junio C Hamano2-1/+6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-23Merge branch 'nk/refspecs-negative-fix'Libravatar Junio C Hamano2-3/+64
Hotfix for recent regression. * nk/refspecs-negative-fix: negative-refspec: improve comment on query_matches_negative_refspec negative-refspec: fix segfault on : refspec
2020-12-23Merge branch 'ma/maintenance-crontab-fix'Libravatar Junio C Hamano3-5/+20
Hotfix for a topic of this cycle. * ma/maintenance-crontab-fix: t7900-maintenance: test for magic markers gc: fix handling of crontab magic markers git-maintenance.txt: add missing word
2020-12-23Merge branch 'dl/checkout-p-merge-base'Libravatar Junio C Hamano2-2/+9
Fix to a regression introduced during this cycle. * dl/checkout-p-merge-base: checkout -p: handle tree arguments correctly again
2020-12-23Merge branch 'js/no-more-prepare-for-main-in-test'Libravatar Junio C Hamano11-619/+621
Test coverage fix. * js/no-more-prepare-for-main-in-test: tests: drop the `PREPARE_FOR_MAIN_BRANCH` prereq t9902: use `main` as initial branch name t6302: use `main` as initial branch name t5703: use `main` as initial branch name t5510: use `main` as initial branch name t5505: finalize transitioning to using the branch name `main` t3205: finalize transitioning to using the branch name `main` t3203: complete the transition to using the branch name `main` t3201: finalize transitioning to using the branch name `main` t3200: finish transitioning to the initial branch name `main` t1400: use `main` as initial branch name
2020-12-23Merge branch 'jx/pack-redundant-on-single-pack'Libravatar Junio C Hamano2-4/+39
"git pack-redandant" when there is only one packfile used to crash, which has been corrected. * jx/pack-redundant-on-single-pack: pack-redundant: fix crash when one packfile in repo
2020-12-23l10n: pl.po: started Polish translationLibravatar m4sk1n1-0/+12579
Signed-off-by: Arusekk <arek_koz@o2.pl>
2020-12-23l10n: de.po: Update German translation for Git 2.30.0Libravatar Matthias Rüster1-2600/+2729
Reviewed-by: Ralf Thielow <ralf.thielow@gmail.com> Reviewed-by: Phillip Szelat <phillip.szelat@gmail.com> Signed-off-by: Matthias Rüster <matthias.ruester@gmail.com>
2020-12-23Merge branch 'master' of github.com:Softcatala/git-poLibravatar Jiang Xin1-1082/+755
* 'master' of github.com:Softcatala/git-po: l10n: Update Catalan translation
2020-12-22git.txt: fix typos in 'linkgit' macro invocationLibravatar Philippe Blain1-2/+2
The 'linkgit' Asciidoc macro is misspelled as 'linkit' in the description of 'GIT_SEQUENCE_EDITOR' since the addition of that variable to git(1) in 902a126eca (doc: mention GIT_SEQUENCE_EDITOR and 'sequence.editor' more, 2020-08-31). Also, it uses two colons instead of one. Fix that. Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-22l10n: Update Catalan translationLibravatar Jordi Mas1-1082/+755
Signed-off-by: Jordi Mas <jmas@softcatala.org>
2020-12-22l10n: bg.po: Updated Bulgarian translation (5037t)Libravatar Alexander Shopov1-2480/+2600
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2020-12-21negative-refspec: improve comment on query_matches_negative_refspecLibravatar Nipunn Koorapati1-0/+6
Comment did not adequately explain how the two loops work together to achieve the goal of querying for matching of any negative refspec. Signed-off-by: Nipunn Koorapati <nipunn@dropbox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-21negative-refspec: fix segfault on : refspecLibravatar Nipunn Koorapati2-3/+58
The logic added to check for negative pathspec match by c0192df630 (refspec: add support for negative refspecs, 2020-09-30) looks at refspec->src assuming it is never NULL, however when remote.origin.push is set to ":", then refspec->src is NULL, causing a segfault within strcmp. Tell git to handle matching refspec by adding the needle to the set of positively matched refspecs, since matching ":" refspecs match anything as src. Add test for matching refspec pushes fetch-negative-refspec both individually and in combination with a negative refspec. Signed-off-by: Nipunn Koorapati <nipunn@dropbox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-22Merge branch 'fr_2.30_rnd2' of github.com:jnavila/gitLibravatar Jiang Xin1-382/+419
* 'fr_2.30_rnd2' of github.com:jnavila/git: l10n: fr.po v2.30.0 rnd 2
2020-12-21t7900-maintenance: test for magic markersLibravatar Martin Ågren1-0/+9
When we insert our "BEGIN" and "END" markers into the cron table, it's so that a Git version from many years into the future would be able to identify this region in the cron table. Let's add a test to make sure that these markers don't ever change. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Acked-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-21gc: fix handling of crontab magic markersLibravatar Martin Ågren2-4/+10
On `git maintenance start`, we add a few entries to the user's cron table. We wrap our entries using two magic markers, "# BEGIN GIT MAINTENANCE SCHEDULE" and "# END GIT MAINTENANCE SCHEDULE". At a later `git maintenance stop`, we will go through the table and remove these lines. Or rather, we will remove the "BEGIN" marker, the "END" marker and everything between them. Alas, we have a bug in how we detect the "END" marker: we don't. As we loop through all the lines of the crontab, if we are in the "old region", i.e., the region we're aiming to remove, we make an early `continue` and don't get as far as checking for the "END" marker. Thus, once we've seen our "BEGIN", we remove everything until the end of the file. Rewrite the logic for identifying these markers. There are four cases that are mutually exclusive: The current line starts a region or it ends it, or it's firmly within the region, or it's outside of it (and should be printed). Signed-off-by: Martin Ågren <martin.agren@gmail.com> Acked-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-21git-maintenance.txt: add missing wordLibravatar Martin Ågren1-1/+1
Add a missing "a" before "bunch". Signed-off-by: Martin Ågren <martin.agren@gmail.com> Acked-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-21checkout -p: handle tree arguments correctly againLibravatar Johannes Schindelin2-2/+9
This fixes a segmentation fault. The bug is caused by dereferencing `new_branch_info->commit` when it is `NULL`, which is the case when the tree-ish argument is actually a tree, not a commit-ish. This was introduced in 5602b500c3c (builtin/checkout: fix `git checkout -p HEAD...` bug, 2020-10-07), where we tried to ensure that the special tree-ish `HEAD...` is handled correctly. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-21l10n: fr.po v2.30.0 rnd 2Libravatar Jean-Noël Avila1-382/+419
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
2020-12-21l10n: tr: v2.30.0-r2Libravatar Emir Sarı1-374/+392
Signed-off-by: Emir Sarı <bitigchi@me.com>
2020-12-21l10n: sv.po: Update Swedish translation (5037t0f0u)Libravatar Peter Krefting1-371/+393
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2020-12-21l10n: vi.po(5037t): v2.30.0 rnd 2Libravatar Tran Ngoc Quan1-2621/+2783
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2020-12-21l10n: git.pot: v2.30.0 round 2 (1 new, 2 removed)Libravatar Jiang Xin1-370/+376
Generate po/git.pot from v2.30.0-rc1 for git v2.30.0 l10n round 2. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2020-12-21Merge remote-tracking branch 'github/master' into git-po-masterLibravatar Jiang Xin43-1794/+2162
* github/master: (42 commits) Git 2.30-rc1 git-gui: use gray background for inactive text widgets Another batch before 2.30-rc1 git-gui: Fix selected text colors Makefile: conditionally include GIT-VERSION-FILE git-gui: fix colored label backgrounds when using themed widgets config.mak.uname: remove old NonStop compatibility settings diff: correct interaction between --exit-code and -I<pattern> t/perf: fix test_export() failure with BSD `sed` style: do not "break" in switch() after "return" compat-util: pretend that stub setitimer() always succeeds strmap: make callers of strmap_remove() to call it in void context doc: mention Python 3.x supports index-format.txt: document v2 format of file system monitor extension docs: multi-pack-index: remove note about future 'verify' work init: provide useful advice about init.defaultBranch get_default_branch_name(): prepare for showing some advice branch -m: allow renaming a yet-unborn branch init: document `init.defaultBranch` better t7900: use --fixed-value in git-maintenance tests ...
2020-12-19l10n: Update Catalan translationLibravatar Jordi Mas1-2704/+2992
Signed-off-by: Jordi Mas <jmas@softcatala.org>
2020-12-18Git 2.30-rc1Libravatar Junio C Hamano2-1/+5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-18Merge branch 'jc/diff-I-status-fix'Libravatar Junio C Hamano2-1/+26
"git diff -I<pattern> -exit-code" should exit with 0 status when all the changes match the ignored pattern, but it didn't. * jc/diff-I-status-fix: diff: correct interaction between --exit-code and -I<pattern>