summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-11-16use size_t to store pack .idx byte offsetsLibravatar Jeff King2-5/+5
We sometimes store the offset into a pack .idx file as an "unsigned long", but the mmap'd size of a pack .idx file can exceed 4GB. This is sufficient on LP64 systems like Linux, but will be too small on LLP64 systems like Windows, where "unsigned long" is still only 32 bits. Let's use size_t, which is a better type for an offset into a memory buffer. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-11-16compute pack .idx byte offsets using size_tLibravatar Jeff King4-9/+9
A pack and its matching .idx file are limited to 2^32 objects, because the pack format contains a 32-bit field to store the number of objects. Hence we use uint32_t in the code. But the byte count of even a .idx file can be much larger than that, because it stores at least a hash and an offset for each object. So using SHA-1, a v2 .idx file will cross the 4GB boundary at 153,391,650 objects. This confuses load_idx(), which computes the minimum size like this: unsigned long min_size = 8 + 4*256 + nr*(hashsz + 4 + 4) + hashsz + hashsz; Even though min_size will be big enough on most 64-bit platforms, the actual arithmetic is done as a uint32_t, resulting in a truncation. We actually exceed that min_size, but then we do: unsigned long max_size = min_size; if (nr) max_size += (nr - 1)*8; to account for the variable-sized table. That computation doesn't overflow quite so low, but with the truncation for min_size, we end up with a max_size that is much smaller than our actual size. So we complain that the idx is invalid, and can't find any of its objects. We can fix this case by casting "nr" to a size_t, which will do the multiplication in 64-bits (assuming you're on a 64-bit platform; this will never work on a 32-bit system since we couldn't map the whole .idx anyway). Likewise, we don't have to worry about further additions, because adding a smaller number to a size_t will convert the other side to a size_t. A few notes: - obviously we could just declare "nr" as a size_t in the first place (and likewise, packed_git.num_objects). But it's conceptually a uint32_t because of the on-disk format, and we correctly treat it that way in other contexts that don't need to compute byte offsets (e.g., iterating over the set of objects should and generally does use a uint32_t). Switching to size_t would make all of those other cases look wrong. - it could be argued that the proper type is off_t to represent the file offset. But in practice the .idx file must fit within memory, because we mmap the whole thing. And the rest of the code (including the idx_size variable we're comparing against) uses size_t. - we'll add the same cast to the max_size arithmetic line. Even though we're adding to a larger type, which will convert our result, the multiplication is still done as a 32-bit value and can itself overflow. I didn't check this with my test case, since it would need an even larger pack (~530M objects), but looking at compiler output shows that it works this way. The standard should agree, but I couldn't find anything explicit in 6.3.1.8 ("usual arithmetic conversions"). The case in load_idx() was the most immediate one that I was able to trigger. After fixing it, looking up actual objects (including the very last one in sha1 order) works in a test repo with 153,725,110 objects. That's because bsearch_hash() works with uint32_t entry indices, and the actual byte access: int cmp = hashcmp(table + mi * stride, sha1); is done with "stride" as a size_t, causing the uint32_t "mi" to be promoted to a size_t. This is the way most code will access the index data. However, I audited all of the other byte-wise accesses of packed_git.index_data, and many of the others are suspect (they are similar to the max_size one, where we are adding to a properly sized offset or directly to a pointer, but the multiplication in the sub-expression can overflow). I didn't trigger any of these in practice, but I believe they're potential problems, and certainly adding in the cast is not going to hurt anything here. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-10-29Git 2.29.2Libravatar Junio C Hamano3-2/+14
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-10-29Merge branch 'cc/doc-filter-branch-typofix' into maintLibravatar Junio C Hamano1-1/+1
Docfix. * cc/doc-filter-branch-typofix: filter-branch doc: fix filter-repo typo
2020-10-29Merge branch 'jk/committer-date-is-author-date-fix' into maintLibravatar Junio C Hamano3-5/+5
In 2.29, "--committer-date-is-author-date" option of "rebase" and "am" subcommands lost the e-mail address by mistake, which has been corrected. * jk/committer-date-is-author-date-fix: rebase: fix broken email with --committer-date-is-author-date am: fix broken email with --committer-date-is-author-date t3436: check --committer-date-is-author-date result more carefully
2020-10-23rebase: fix broken email with --committer-date-is-author-dateLibravatar Jeff King2-5/+5
Commit 7573cec52c (rebase -i: support --committer-date-is-author-date, 2020-08-17) copied the committer ident-parsing code from builtin/am.c. And in doing so, it copied a bug in which we always set the email to an empty string. We fixed the version in git-am in the previous commit; this commit fixes the copied code. Reported-by: VenomVendor <info@venomvendor.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-10-23am: fix broken email with --committer-date-is-author-dateLibravatar Jeff King2-3/+3
Commit e8cbe2118a (am: stop exporting GIT_COMMITTER_DATE, 2020-08-17) rewrote the code for setting the committer date to use fmt_ident(), rather than setting an environment variable and letting commit_tree() handle it. But it introduced two bugs: - we use the author email string instead of the committer email - when parsing the committer ident, we used the wrong variable to compute the length of the email, resulting in it always being a zero-length string This commit fixes both, which causes our test of this option via the rebase "apply" backend to now succeed. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-10-23t3436: check --committer-date-is-author-date result more carefullyLibravatar Jeff King1-7/+7
After running "rebase --committer-date-is-author-date", we confirm that the committer date is the same as the author date. However, we don't look at any other parts of the committer ident line to make sure we didn't screw them up. And indeed, there are a few bugs here. Depending on the rebase backend in use, we may accidentally use the author email instead of the committer's, or even an empty string. Let's teach our test_ctime_is_atime helper to check the committer name and email, which reveals several failing tests. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-10-22Git 2.29.1Libravatar Junio C Hamano3-2/+13
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-10-22Merge branch 'js/no-builtins-on-disk-option' into maintLibravatar Junio C Hamano1-9/+6
Brown-paper-bag fix. * js/no-builtins-on-disk-option: SKIP_DASHED_BUILT_INS: do not skip the bin/ programs
2020-10-21SKIP_DASHED_BUILT_INS: do not skip the bin/ programsLibravatar Johannes Schindelin1-9/+6
The idea of the `SKIP_DASHED_BUILT_INS` option is to stop hard-linking the built-in commands as separate executables. The patches to do that specifically excluded the three commands `receive-pack`, `upload-archive` and `upload-pack`, though: these commands are expected to be present in the `PATH` in their dashed form on the server side of any fetch/push. However, due to an oversight by myself, even if those commands were still hard-linked, they were not installed into `bin/`. Noticed-by: Michael Forney <mforney@mforney.org> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Reviewed-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-10-20filter-branch doc: fix filter-repo typoLibravatar Christian Couder1-1/+1
The name of the tool is 'git-filter-repo' not 'git-repo-filter'. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-10-19Git 2.29Libravatar Junio C Hamano1-1/+1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-10-18Merge tag 'l10n-2.29.0-rnd2' of git://github.com/git-l10n/git-poLibravatar Junio C Hamano13-43679/+58411
l10n for Git 2.29.0 round 2 * tag 'l10n-2.29.0-rnd2' of git://github.com/git-l10n/git-po: l10n: zh_CN: for git v2.29.0 l10n round 1 and 2 l10n: de.po: Update German translation for Git 2.29.0 l10n: vi(5013t): Updated translation for v2.29.0 rd2 l10n: pt_PT: make on po/pt_PT.po l10n: Portuguese translation team has changed. Wohoo! l10n: bg.po: Updated Bulgarian translation (5013t) l10n: sv.po: Update Swedish translation (5013t0f0u) l10n: it.po: update the Italian translation l10n: tr: v2.29.0 round 2 l10n: zh_TW.po: v2.29.0 round 2 (2 untranslated) l10n: fr: v2.29.0 rnd 2 l10n: git.pot: v2.29.0 round 2 (1 new, 1 removed) l10n: fr: v2.29.0 rnd 1 l10n: it.po: update the Italian translation for Git 2.29.0 round 1 l10n: tr: v2.29.0 round 1 l10n: Update Catalan translation l10n: git.pot: v2.29.0 round 1 (124 new, 42 removed)
2020-10-18Merge branch 'master' of github.com:Softcatala/git-poLibravatar Jiang Xin1-3572/+4352
* 'master' of github.com:Softcatala/git-po: l10n: Update Catalan translation
2020-10-18l10n: zh_CN: for git v2.29.0 l10n round 1 and 2Libravatar Jiang Xin1-3432/+3788
Translate 124 new messages (5013t0f0u) for git 2.29.0. Reviewed-by: 依云 <lilydjwg@gmail.com> Reviewed-by: Fangyi Zhou <me@fangyi.io> Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2020-10-17Merge https://github.com/prati0100/git-guiLibravatar Junio C Hamano3-49/+93
* https://github.com/prati0100/git-gui: git-gui: blame: prevent tool tips from sticking around after Command-Tab git-gui: improve dark mode support git-gui: fix mixed tabs and spaces; prefer tabs
2020-10-17Merge branch 'sh/blame-tooltip'Libravatar Pratyush Yadav1-0/+1
Make sure `git gui blame` tooltips are destroyed once the window loses focus on MacOS. * sh/blame-tooltip: git-gui: blame: prevent tool tips from sticking around after Command-Tab
2020-10-17git-gui: blame: prevent tool tips from sticking around after Command-TabLibravatar Stefan Haller1-0/+1
On Mac, tooltips are not automatically removed when a window loses focus. Furthermore, mouse-move events are only dispatched to the active window, which means that if we Command-tab to another application while a tool tip is showing, the tool tip will stay there forever (in front of other applications). So we must hide it manually when we lose focus. Do this unconditionally here (i.e. without if {[is_MacOSX]}); it shouldn't hurt on other platforms, even though they don't seem to have this problem. Signed-off-by: Stefan Haller <stefan@haller-berlin.de> Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
2020-10-15Git 2.29-rc2Libravatar Junio C Hamano1-1/+1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-10-15l10n: de.po: Update German translation for Git 2.29.0Libravatar Matthias Rüster1-3452/+3817
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-10-14Merge branch 'pt-PT' of github.com:git-l10n-pt-PT/git-poLibravatar Jiang Xin2-5139/+14813
* 'pt-PT' of github.com:git-l10n-pt-PT/git-po: l10n: pt_PT: make on po/pt_PT.po l10n: Portuguese translation team has changed. Wohoo!
2020-10-13l10n: vi(5013t): Updated translation for v2.29.0 rd2Libravatar Tran Ngoc Quan1-3432/+3869
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2020-10-12l10n: pt_PT: make on po/pt_PT.poLibravatar Daniel Santos1-5136/+14811
Pull from the language Coordenator repository and `make` done at the top-level directory. Signed-off-by: Daniel Santos <hello@brighterdan.com>
2020-10-12l10n: Portuguese translation team has changed. Wohoo!Libravatar Daniel Santos1-3/+2
I am excited. Because I like a lot languages, and because I believe this is the way to contribute to a large number of Portuguese speaking person. Jiang Xin and last Portuguese team gave me the lead. Thank you very much. Honored to be a part of such a project. Signed-off-by: Daniel Santos <hello@brighterdan.com>
2020-10-12Merge branch 'master' of github.com:alshopov/git-poLibravatar Jiang Xin1-3579/+4205
* 'master' of github.com:alshopov/git-po: l10n: bg.po: Updated Bulgarian translation (5013t)
2020-10-12Merge branch 'master' of github.com:nafmo/git-l10n-svLibravatar Jiang Xin1-3429/+3843
* 'master' of github.com:nafmo/git-l10n-sv: l10n: sv.po: Update Swedish translation (5013t0f0u)
2020-10-12Merge branch 'update-italian-translation' of github.com:AlessandroMenti/git-poLibravatar Jiang Xin1-141/+141
* 'update-italian-translation' of github.com:AlessandroMenti/git-po: l10n: it.po: update the Italian translation
2020-10-11l10n: bg.po: Updated Bulgarian translation (5013t)Libravatar Alexander Shopov1-3579/+4205
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2020-10-11l10n: sv.po: Update Swedish translation (5013t0f0u)Libravatar Peter Krefting1-3429/+3843
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2020-10-11Merge branch 'l10n/zh_TW/201010' of github.com:l10n-tw/git-poLibravatar Jiang Xin1-3425/+3892
* 'l10n/zh_TW/201010' of github.com:l10n-tw/git-po: l10n: zh_TW.po: v2.29.0 round 2 (2 untranslated)
2020-10-11l10n: it.po: update the Italian translationLibravatar Alessandro Menti1-141/+141
Update the Italian translation for Git 2.29.0, round 2. Signed-off-by: Alessandro Menti <alessandro.menti@alessandromenti.it>
2020-10-11Merge branch '2.29-r2' of github.com:bitigchi/git-poLibravatar Jiang Xin1-129/+131
* '2.29-r2' of github.com:bitigchi/git-po: l10n: tr: v2.29.0 round 2
2020-10-10l10n: tr: v2.29.0 round 2Libravatar Emir Sarı1-129/+131
Signed-off-by: Emir Sarı <bitigchi@me.com>
2020-10-10l10n: zh_TW.po: v2.29.0 round 2 (2 untranslated)Libravatar pan934121-3425/+3892
Signed-off-by: pan93412 <pan93412@gmail.com>
2020-10-10l10n: fr: v2.29.0 rnd 2Libravatar Jean-Noël Avila1-142/+174
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
2020-10-10l10n: git.pot: v2.29.0 round 2 (1 new, 1 removed)Libravatar Jiang Xin1-116/+116
Generate po/git.pot from v2.29.0-rc1 for git v2.29.0 l10n round 2. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2020-10-10Merge tag 'v2.29.0-rc1' of github.com:git/gitLibravatar Jiang Xin22-89/+159
Git 2.29-rc1 * tag 'v2.29.0-rc1' of github.com:git/git: Git 2.29-rc1 doc: fix the bnf like style of some commands doc: git-remote fix ups doc: use linkgit macro where needed. git-bisect-lk2009: make continuation of list indented ci: do not skip tagged revisions in GitHub workflows ci: skip GitHub workflow runs for already-tested commits/trees tests: avoid using the branch name `main` t1415: avoid using `main` as ref name Makefile: ASCII-sort += lists help: do not expect built-in commands to be hardlinked index-pack: make get_base_data() comment clearer index-pack: drop type_cas mutex index-pack: restore "resolving deltas" progress meter compat/mingw.h: drop extern from function declaration GitHub workflow: automatically follow minor updates of setup-msbuild t5534: split stdout and stderr redirection
2020-10-08Git 2.29-rc1Libravatar Junio C Hamano2-14/+22
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-10-08Merge branch 'js/default-branch-name-part-3'Libravatar Junio C Hamano5-25/+25
Test preparation for the switch of default branch name continues. * js/default-branch-name-part-3: tests: avoid using the branch name `main` t1415: avoid using `main` as ref name
2020-10-08Merge branch 'js/ci-ghwf-dedup-tests'Libravatar Junio C Hamano2-1/+40
The logic to skip testing on the tagged commit and the tag itself was not quite consistent which led to failure of Windows test tasks. It has been revamped to consistently skip revisions that have already been tested, based on the tree object of the revision. * js/ci-ghwf-dedup-tests: ci: do not skip tagged revisions in GitHub workflows ci: skip GitHub workflow runs for already-tested commits/trees
2020-10-08Merge branch 'ja/misc-doc-fixes'Libravatar Junio C Hamano5-21/+21
Doc fixes. * ja/misc-doc-fixes: doc: fix the bnf like style of some commands doc: git-remote fix ups doc: use linkgit macro where needed. git-bisect-lk2009: make continuation of list indented
2020-10-08Merge branch 'dl/makefile-sort'Libravatar Junio C Hamano1-5/+5
Makefile clean-up. * dl/makefile-sort: Makefile: ASCII-sort += lists
2020-10-08Merge branch 'js/no-builtins-on-disk-option'Libravatar Junio C Hamano3-0/+22
Hotfix to breakage introduced in the topic in v2.29-rc0 * js/no-builtins-on-disk-option: help: do not expect built-in commands to be hardlinked
2020-10-08Merge branch 'js/ghwf-setup-msbuild-update'Libravatar Junio C Hamano1-1/+1
CI update. * js/ghwf-setup-msbuild-update: GitHub workflow: automatically follow minor updates of setup-msbuild
2020-10-08Merge branch 'jk/index-pack-hotfixes'Libravatar Junio C Hamano2-17/+19
Hotfix and clean-up for the jt/threaded-index-pack topic that has graduated to v2.29-rc0. * jk/index-pack-hotfixes: index-pack: make get_base_data() comment clearer index-pack: drop type_cas mutex index-pack: restore "resolving deltas" progress meter
2020-10-08Merge branch 'dl/mingw-header-cleanup'Libravatar Junio C Hamano1-1/+1
Header clean-up. * dl/mingw-header-cleanup: compat/mingw.h: drop extern from function declaration
2020-10-08Merge branch 'hx/push-atomic-with-cert'Libravatar Junio C Hamano1-4/+3
Hotfix to a recently added test script. * hx/push-atomic-with-cert: t5534: split stdout and stderr redirection
2020-10-08doc: fix the bnf like style of some commandsLibravatar Jean-Noël Avila2-2/+2
In command line options, variables are entered between < and > Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-10-08doc: git-remote fix upsLibravatar Jean-Noël Avila1-10/+10
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>