summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-09-06pack-objects: drop packlist index_pos optimizationLibravatar Jeff King5-34/+29
Once upon a time, the code to add an object to our packing list in pack-objects all lived in a single function. It computed the position within the hash table once, then used it to check if the object was already present, and if not, to add it. Later, in 2834bc27c1 (pack-objects: refactor the packing list, 2013-10-24), this was split into two functions: packlist_find() and packlist_alloc(). We ended up with an "index_pos" variable that gets passed through several functions to make it from one to the other. The resulting code is rather confusing to follow. The "index_pos" variable is sometimes undefined, if we don't yet have a hash table. This works out in practice because in that case packlist_alloc() won't use it at all, since it will have to create/grow the hash table. But it's hard to verify that, and it does cause gcc 9.2.1's -Wmaybe-uninitialized to complain when compiled with "-flto -O3" (rightfully, since we do pass the uninitialized value as a function parameter, even if nobody ends up using it). All of this is to save computing the hash index again when we're inserting into the hash table, which I found doesn't make a measurable difference in the program runtime (which is not surprising, since we're doing all kinds of other heavyweight things for each object). Let's just drop this index_pos variable entirely, simplifying the code (and pleasing the compiler). We might be better still refactoring this custom hash table to use one of our existing implementations (an oidmap, or a kh_oid_map). I stopped short of that here, but this would be the likely first step towards that anyway. Reported-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-06test-read-cache: drop namelen variableLibravatar Jeff King1-3/+2
Early in the function we set "namelen = strlen(name)" if "name" is non-NULL. Later, we use "namelen" only if "name" is non-NULL. However, it's hard to immediately see this, and it seems to confuse gcc 9.2.1 (with "-flto" interestingly, though all of the involved logic is in inline functions; it also triggers when building with ASan). Let's simplify the code and remove the variable entirely. There's only one use of namelen anyway, so we can just call strlen() then. It's true this is in a loop, so we might execute strlen() more often. But: - this is test code that only ever loops twice in our test suite (we do loop 1000 times in a t/perf test, but without using this option). - a decent compiler ought to be able to hoist that out of the loop anyway (though I wouldn't count on gcc 9.2.1 doing so!) Reported-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-06diff-delta: set size out-parameter to 0 for NULL deltaLibravatar Jeff King1-0/+2
When we cannot generate a delta, we return NULL but leave delta_size untouched. This is generally OK, as callers rely on NULL to decide if the output is usable or not. But it can confuse compilers; in particular, gcc 9.2.1 with "-flto -O3" complains in fast-import's store_object() that delta_len may be used uninitialized. Let's change the diff-delta code to set the size explicitly to 0 for a NULL return. That silences the compiler and makes it easier to reason about the result. Reported-by: Stephan Beyer <s-beyer@gmx.net> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-06bulk-checkin: zero-initialize hashfile_checkpointLibravatar Jeff King1-1/+1
We declare a "struct hashfile_checkpoint" but only sometimes actually call hashfile_checkpoint() on it. That makes it not immediately obvious that it's valid when we later access its members. In fact, the code is fine: we fill it in unconditionally in the while(1) loop as long as "idx" is non-NULL. And then if "idx" is NULL, we exit early from the function (because we're just computing the hash, not actually writing), before we look at the struct. However, this does seem to confuse gcc 9.2.1's -Wmaybe-uninitialized when compiled with "-flto -O2" (probably because with LTO it can now realize that our call to hashfile_truncate() does not set the members either). Let's zero-initialize the struct to tell the compiler, as well as any readers of the code, that all is well. Reported-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-06pack-objects: use object_id in packlist_alloc()Libravatar Jeff King3-4/+4
The only caller of packlist_alloc() already has a "struct object_id", and we immediately copy the hash they pass us into our own object_id. Let's avoid the unnecessary round-trip to a raw sha1 pointer. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-06git-am: handle missing "author" when parsing commitLibravatar Jeff King1-1/+3
We try to parse the "author" line out of a commit buffer. We handle the case that split_ident_line() doesn't work, but we don't do any error checking that we found an "author" line in the first place! This would cause us to segfault on such a corrupt object. Let's put in an explicit NULL check (we can just die(), which is what a bogus split would do, too). As a bonus, this silences a warning when compiling with gcc 9.2.1 using "-flto -O3", which claims that ident_len may be uninitialized (it would only be if we had a NULL here). Reported-by: Stephan Beyer <s-beyer@gmx.net> Helped-by: René Scharfe <l.s.r@web.de> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-08-22First batch after Git 2.23Libravatar Junio C Hamano3-2/+54
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-08-22Merge branch 'sg/worktree-remove-errormsg'Libravatar Junio C Hamano1-1/+1
Error message update/clarification. * sg/worktree-remove-errormsg: worktree remove: clarify error message on dirty worktree
2019-08-22Merge branch 'en/fast-import-merge-doc'Libravatar Junio C Hamano1-1/+1
Doc update. * en/fast-import-merge-doc: git-fast-import.txt: clarify that multiple merge commits are allowed
2019-08-22Merge branch 'jk/perf-no-dups'Libravatar Junio C Hamano1-0/+0
Test & perf scripts must use unique numeric prefix, but a pair shared the same number, which is fixed here. * jk/perf-no-dups: t/perf: rename duplicate-numbered test script
2019-08-22Merge branch 'rs/nedalloc-fixlets'Libravatar Junio C Hamano1-3/+3
Compilation fix. * rs/nedalloc-fixlets: nedmalloc: avoid compiler warning about unused value nedmalloc: do assignments only after the declaration section
2019-08-22Merge branch 'sg/show-failed-test-names'Libravatar Junio C Hamano3-12/+14
The first line of verbose output from each test piece now carries the test name and number to help scanning with eyeballs. * sg/show-failed-test-names: tests: show the test name and number at the start of verbose output t0000-basic: use realistic test script names in the verbose tests
2019-08-22Merge branch 'sg/commit-graph-validate'Libravatar Junio C Hamano5-30/+51
The code to write commit-graph over given commit object names has been made a bit more robust. * sg/commit-graph-validate: commit-graph: error out on invalid commit oids in 'write --stdin-commits' commit-graph: turn a group of write-related macro flags into an enum t5318-commit-graph: use 'test_expect_code'
2019-08-22Merge branch 'vn/restore-empty-ita-corner-case-fix'Libravatar Junio C Hamano3-0/+23
"git checkout" and "git restore" to re-populate the index from a tree-ish (typically HEAD) did not work correctly for a path that was removed and then added again with the intent-to-add bit, when the corresponding working tree file was empty. This has been corrected. * vn/restore-empty-ita-corner-case-fix: restore: add test for deleted ita files checkout.c: unstage empty deleted ita files
2019-08-22Merge branch 'sc/pack-refs-deletion-racefix'Libravatar Junio C Hamano1-7/+16
"git pack-refs" can lose refs that are created while running, which is getting corrected. * sc/pack-refs-deletion-racefix: pack-refs: always refresh after taking the lock file
2019-08-22Merge branch 'sg/do-not-skip-non-httpd-tests'Libravatar Junio C Hamano10-122/+153
Test fix. * sg/do-not-skip-non-httpd-tests: t: warn against adding non-httpd-specific tests after sourcing 'lib-httpd' t5703: run all non-httpd-specific tests before sourcing 'lib-httpd.sh' t5510-fetch: run non-httpd-specific test before sourcing 'lib-httpd.sh'
2019-08-22Merge branch 'jk/tree-walk-overflow'Libravatar Junio C Hamano6-68/+103
Codepaths to walk tree objects have been audited for integer overflows and hardened. * jk/tree-walk-overflow: tree-walk: harden make_traverse_path() length computations tree-walk: add a strbuf wrapper for make_traverse_path() tree-walk: accept a raw length for traverse_path_len() tree-walk: use size_t consistently tree-walk: drop oid from traverse_info setup_traverse_info(): stop copying oid
2019-08-22Merge branch 'sg/t5510-test-i18ngrep-fix'Libravatar Junio C Hamano1-1/+1
Test fix. * sg/t5510-test-i18ngrep-fix: t5510-fetch: fix negated 'test_i18ngrep' invocation
2019-08-22Merge branch 'mt/grep-submodules-working-tree'Libravatar Junio C Hamano2-4/+27
"git grep --recurse-submodules" that looks at the working tree files looked at the contents in the index in submodules, instead of files in the working tree. * mt/grep-submodules-working-tree: grep: fix worktree case in submodules
2019-08-16Git 2.23Libravatar Junio C Hamano1-1/+1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-08-16Merge tag 'l10n-2.23.0-rnd2' of git://github.com/git-l10n/git-poLibravatar Junio C Hamano11-36251/+46987
l10n-2.23.0-rnd2
2019-08-16l10n: zh_CN: for git v2.23.0 l10n round 1~2Libravatar Jiang Xin1-2910/+3413
Translate 128 new messages (4674t0f0u) for git 2.23.0. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2019-08-13worktree remove: clarify error message on dirty worktreeLibravatar SZEDER Gábor1-1/+1
To avoid data loss, 'git worktree remove' refuses to delete a worktree if it's dirty or contains untracked files. However, the error message only mentions that the worktree "is dirty", even if the worktree in question is in fact clean, but contains untracked files: $ git worktree add test-worktree Preparing worktree (new branch 'test-worktree') HEAD is now at aa53e60 Initial $ >test-worktree/untracked-file $ git worktree remove test-worktree/ fatal: 'test-worktree/' is dirty, use --force to delete it $ git -C test-worktree/ diff $ git -C test-worktree/ diff --cached $ # Huh? Where are those dirty files?! Clarify this error message to say that the worktree "contains modified or untracked files". Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Reviewed-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-08-12git-fast-import.txt: clarify that multiple merge commits are allowedLibravatar Elijah Newren1-1/+1
The grammar for commits used a '?' rather than a '*' on the `merge` directive line, despite the fact that the code allows multiple `merge` directives in order to support n-way merges. In fact, elsewhere in git-fast-import.txt there is an explicit declaration that "an unlimited number of `merge` commands per commit are permitted by fast-import". Fix the grammar to match the intent and implementation. Reported-by: Joachim Klein <joachim.klein@automata.tools> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-08-12l10n: de.po: Update German translationLibravatar Matthias Ruester1-2910/+3533
Signed-off-by: Matthias Rüster <matthias.ruester@gmail.com> Reviewed-by: Ralf Thielow <ralf.thielow@gmail.com> Reviewed-by: Phillip Szelat <phillip.szelat@gmail.com>
2019-08-12t/perf: rename duplicate-numbered test scriptLibravatar Jeff King1-0/+0
There are two perf scripts numbered p5600, but with otherwise different names ("clone-reference" versus "partial-clone"). We store timing results in files named after the whole script, so internally we don't get confused between the two. But "aggregate.perl" just prints the test number for each result, giving multiple entries for "5600.3". It also makes it impossible to skip one test but not the other with GIT_SKIP_TESTS. Let's renumber the one that appeared later (by date -- the source of the problem is that the two were developed on independent branches). For the non-perf test suite, our test-lint rule would have complained about this when the two were merged, but t/perf never learned that trick. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-08-12Merge branch 'master' of https://github.com/vnwildman/gitLibravatar Jiang Xin1-585/+595
* 'master' of https://github.com/vnwildman/git: l10n: vi(4674t): Updated translation for Vietnamese
2019-08-12Merge branch 'update-italian-translation' of github.com:AlessandroMenti/git-poLibravatar Jiang Xin1-522/+531
* 'update-italian-translation' of github.com:AlessandroMenti/git-po: l10n: it.po: update the Italian localization for v2.23.0 round 2
2019-08-12Merge branch 'next' of https://github.com/ChrisADR/git-poLibravatar Jiang Xin1-3030/+3598
* 'next' of https://github.com/ChrisADR/git-po: l10n: es: 2.23.0 round 2
2019-08-11Sync with Git 2.22.1Libravatar Junio C Hamano2-0/+4
2019-08-11doc: fix repeated wordsLibravatar Mark Rushakoff9-9/+9
Inspired by 21416f0a07 ("restore: fix typo in docs", 2019-08-03), I ran "git grep -E '(\b[a-zA-Z]+) \1\b' -- Documentation/" to find other cases where words were duplicated, e.g. "the the", and in most cases removed one of the repeated words. There were many false positives by this grep command, including deliberate repeated words like "really really" or valid uses of "that that" which I left alone, of course. I also did not correct any of the legitimate, accidentally repeated words in old RelNotes. Signed-off-by: Mark Rushakoff <mark.rushakoff@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-08-11Git 2.22.1Libravatar Junio C Hamano2-1/+4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-08-11.mailmap: update email address of Philip OakleyLibravatar Philip Oakley1-0/+1
My IEE 'home for life' email service is being withdrawn on 30 Sept 2019. Replace with my new email domain. I also have a secondary (backup) 'home for life' through <philipoakley@dunelm.org.uk>. Signed-off-by: Philip Oakley <philipoakley@iee.email> Signed-off-by: Philip Oakley <philipoakley@iee.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-08-11l10n: it.po: update the Italian localization for v2.23.0 round 2Libravatar Alessandro Menti1-522/+531
Signed-off-by: Alessandro Menti <alessandro.menti@alessandromenti.it>
2019-08-11l10n: vi(4674t): Updated translation for VietnameseLibravatar Tran Ngoc Quan1-585/+595
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2019-08-10l10n: es: 2.23.0 round 2Libravatar Christopher Diaz Riveros1-3030/+3598
Signed-off-by: Christopher Diaz Riveros <chrisadr@gentoo.org>
2019-08-10l10n: fr v2.23.0 round 2Libravatar Jean-Noël Avila1-2904/+3429
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
2019-08-10l10n: git.pot: v2.23.0 round 2 (4 new, 6 removed)Libravatar Jiang Xin1-477/+461
Generate po/git.pot from v2.23.0-rc2 for git v2.23.0 l10n round 2. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2019-08-10Merge tag 'v2.23.0-rc2' of git://git.kernel.org/pub/scm/git/gitLibravatar Jiang Xin59-396/+1041
Git 2.23-rc2 * tag 'v2.23.0-rc2' of git://git.kernel.org/pub/scm/git/git: (63 commits) Git 2.23-rc2 t0000: reword comments for "local" test t: decrease nesting in test_oid_to_path sha1-file: release strbuf after use test-dir-iterator: use path argument directly dir-iterator: release strbuf after use commit-graph: release strbufs after use l10n: reformat some localized strings for v2.23.0 merge-recursive: avoid directory rename detection in recursive case commit-graph: fix bug around octopus merges restore: fix typo in docs doc: typo: s/can not/cannot/ and s/is does/does/ Git 2.23-rc1 log: really flip the --mailmap default RelNotes/2.23.0: fix a few typos and other minor issues RelNotes/2.21.1: typofix log: flip the --mailmap default unconditionally config: work around bug with includeif:onbranch and early config A few more last-minute fixes repack: simplify handling of auto-bitmaps and .keep files ...
2019-08-10l10n: bg.po: Updated Bulgarian translation (4674t)Libravatar Alexander Shopov1-2937/+3481
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2019-08-09Merge branch 'cb/xdiff-no-system-includes-in-dot-c' into maintLibravatar Junio C Hamano3-8/+0
Compilation fix. * cb/xdiff-no-system-includes-in-dot-c: xdiff: remove duplicate headers from xpatience.c xdiff: remove duplicate headers from xhistogram.c xdiff: drop system includes in xutils.c
2019-08-09Merge branch 'jk/no-system-includes-in-dot-c' into maintLibravatar Junio C Hamano3-3/+0
Compilation fix. * jk/no-system-includes-in-dot-c: wt-status.h: drop stdio.h include verify-tag: drop signal.h include
2019-08-09Merge branch 'sg/fsck-config-in-doc' into maintLibravatar Junio C Hamano1-0/+5
Doc update. * sg/fsck-config-in-doc: Documentation/git-fsck.txt: include fsck.* config variables
2019-08-09Merge branch 'jk/xdiff-clamp-funcname-context-index' into maintLibravatar Junio C Hamano2-2/+24
The internal diff machinery can be made to read out of bounds while looking for --funcion-context line in a corner case, which has been corrected. * jk/xdiff-clamp-funcname-context-index: xdiff: clamp function context indices in post-image
2019-08-09Git 2.23-rc2Libravatar Junio C Hamano1-1/+1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-08-09Merge branch 'bc/hash-independent-tests-part-4'Libravatar Junio C Hamano2-9/+8
Test fix. * bc/hash-independent-tests-part-4: t0000: reword comments for "local" test t: decrease nesting in test_oid_to_path
2019-08-09Merge branch 'rs/plug-strbuf-reak-in-read-alt-refs'Libravatar Junio C Hamano1-0/+1
Leakfix. * rs/plug-strbuf-reak-in-read-alt-refs: sha1-file: release strbuf after use
2019-08-09Merge branch 'mt/dir-iterator-updates'Libravatar Junio C Hamano2-4/+4
Leakfix. * mt/dir-iterator-updates: test-dir-iterator: use path argument directly dir-iterator: release strbuf after use
2019-08-09Merge branch 'ds/commit-graph-incremental'Libravatar Junio C Hamano1-5/+7
Leakfix. * ds/commit-graph-incremental: commit-graph: release strbufs after use
2019-08-08Merge branch 'ja/l10n-fixes'Libravatar Junio C Hamano2-5/+12
A few messages have been updated to help localization better. * ja/l10n-fixes: l10n: reformat some localized strings for v2.23.0