summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* add -p: don't rely on apply's '--recount' optionpw/add-p-recountPhillip Wood2018-03-051-1/+1
| | | | | | | | Now that add -p counts patches properly it should be possible to turn off the '--recount' option when invoking 'git apply' Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* add -p: fix counting when splitting and coalescingPhillip Wood2018-03-052-8/+34
| | | | | | | | | | | | When a file has no trailing new line at the end diff records this by appending "\ No newline at end of file" below the last line of the file. This line should not be counted in the hunk header. Fix the splitting and coalescing code to count files without a trailing new line properly and change one of the tests to test splitting without a trailing new line. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* add -p: calculate offset delta for edited patchesPhillip Wood2018-03-052-10/+51
| | | | | | | | | | | | | | | | | | | | | | | | | Recount the number of preimage and postimage lines in a hunk after it has been edited so any change in the number of insertions or deletions can be used to adjust the offsets of subsequent hunks. If an edited hunk is subsequently split then the offset correction will be lost. It would be possible to fix this if it is a problem, however the code here is still an improvement on the status quo for the common case where an edited hunk is applied without being split. This is also a necessary step to removing '--recount' and '--allow-overlap' from the invocation of 'git apply'. Before '--recount' can be removed the splitting and coalescing counting needs to be fixed to handle a missing newline at the end of a file. In order to remove '--allow-overlap' there needs to be i) some way of verifying the offset data in the edited hunk (probably by correlating the preimage (or postimage if the patch is going to be applied in reverse) lines of the edited and unedited versions to see if they are offset or if any leading/trailing context lines have been removed) and ii) a way of dealing with edited hunks that change context lines that are shared with neighbouring hunks. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* add -p: adjust offsets of subsequent hunks when one is skippedPhillip Wood2018-03-012-3/+14
| | | | | | | | | | | | | | | Since commit 8cbd431082 ("git-add--interactive: replace hunk recounting with apply --recount", 2008-7-2) if a hunk is skipped then we rely on the context lines to apply subsequent hunks in the right place. While this works most of the time it is possible for hunks to end up being applied in the wrong place. To fix this adjust the offset of subsequent hunks to correct for any change in the number of insertions or deletions due to the skipped hunk. The change in offset due to edited hunks that have the number of insertions or deletions changed is ignored here, it will be fixed in the next commit. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* t3701: add failing test for pathological context linesPhillip Wood2018-03-011-0/+30
| | | | | | | | | | | | | | | When a hunk is skipped by add -i the offsets of subsequent hunks are not adjusted to account for any missing insertions due to the skipped hunk. Most of the time this does not matter as apply uses the context lines to apply the subsequent hunks in the correct place, however in pathological cases the context lines will match at the now incorrect offset and the hunk will be applied in the wrong place. The offsets of hunks following an edited hunk that has had the number of insertions or deletions changed also need to be updated in the same way. Add failing tests to demonstrate this. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* t3701: don't hard code sha1 hash valuesPhillip Wood2018-03-011-10/+23
| | | | | | | | | | | | | Use a filter when comparing diffs to fix the value of non-zero hashes in diff index lines so we're not hard coding sha1 hash values in the expected output. This makes it easier to change the expected output if a test is edited as we don't need to worry about the exact hash value and means the tests will work when the hash algorithm is transitioned away from sha1. Thanks-to: Junio C Hamano <gitster@pobox.com> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* t3701: use test_write_lines and write_scriptPhillip Wood2018-02-201-28/+5
| | | | | | | Simplify things slightly by using the above helpers. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* t3701: indent here documentsPhillip Wood2018-02-201-87/+87
| | | | | | | | | Indent here documents in line with the current style for tests. While at it, quote the end marker of here-docs that do not use variable interpolation. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* add -i: add function to format hunk headerPhillip Wood2018-02-201-10/+11
| | | | | | | | This code is duplicated in a couple of places so make it into a function as we're going to add some more callers shortly. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Git 2.16.1v2.16.1Junio C Hamano2018-01-213-2/+13
| | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'bc/hash-algo' into maintJunio C Hamano2018-01-212-1/+18
|\ | | | | | | | | | | * bc/hash-algo: t5601-clone: test case-conflicting files on case-insensitive filesystem repository: pre-initialize hash algo pointer
| * t5601-clone: test case-conflicting files on case-insensitive filesystemEric Sunshine2018-01-211-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A recently introduced regression caused a segfault at clone time on case-insensitive filesystems when filenames differing only in case are present. This bug has already been fixed (repository: pre-initialize hash algo pointer, 2018-01-18), but it's not the first time similar problems have arisen. Therefore, introduce a test to catch this case and protect against future regressions. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * repository: pre-initialize hash algo pointerbrian m. carlson2018-01-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are various git subcommands (among them, clone) which don't set up the repository (that is, they lack RUN_SETUP or RUN_SETUP_GENTLY) but end up needing to have information about the hash algorithm in use. Because the hash algorithm is part of struct repository and it's only initialized in repository setup, we can end up dereferencing a NULL pointer in some cases if we call one of these subcommands and look up the empty blob or empty tree values. A "git clone" of a project that has two paths that differ only in case suffers from this if it is run on a case insensitive platform. When the command attempts to check out one of these two paths after checking out the other one, the checkout codepath needs to see if the version that is already on the filesystem (which should not happen if the FS were case sensitive) is dirty, and it needs to exercise the hashing code at that point. In the future, we can add a command line option for this or read it from the configuration, but until we're ready to expose that functionality to the user, simply initialize the repository structure to use the current hash algorithm, SHA-1. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Git 2.16v2.16.0Junio C Hamano2018-01-172-3/+6
| | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge tag 'l10n-2.16.0-rnd2' of git://github.com/git-l10n/git-poJunio C Hamano2018-01-1612-20028/+22202
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | l10n for Git 2.16.0 round 2 * tag 'l10n-2.16.0-rnd2' of git://github.com/git-l10n/git-po: (24 commits) l10n: de.po: translate 72 new messages l10n: de.po: improve messages when a branch starts to track another ref l10n: bg.po: Updated Bulgarian translation (3288t) l10n: TEAMS: add zh_CN team members l10n: zh_CN: for git v2.16.0 l10n round 2 l10n: sv.po: Update Swedish translation (3288t0f0u) l10n: ru.po: update Russian translation l10n: TEAMS: Add ko team members l10n: ko.po: Update Korean translation l10n: fr.po 2.16 round 2 l10n: es.po: Spanish translation 2.16.0 round 2 l10n: vi.po(3288t): Updated Vietnamese translation for v2.16.0 round 2 l10n: git.pot: v2.16.0 round 2 (8 new, 4 removed) l10n: es.po: Update Spanish Translation v2.16.0 l10n: fr.po v2.16.0 round 1 l10n: bg.po: Updated Bulgarian translation (3284t) l10n: sv.po: Update Swedish translation (3284t0f0u) l10n: fr.po: "worktree list" mistranslated as prune l10n: git.pot: v2.16.0 round 1 (64 new, 25 removed) l10n: fixes to German translation ...
| * | l10n: de.po: translate 72 new messagesRalf Thielow2018-01-151-1934/+2172
| | | | | | | | | | | | | | | | | | | | | | | | | | | Translate 72 new messages came from git.pot update in 18a907225 (l10n: git.pot: v2.16.0 round 1 (64 new, 25 removed)) and 005c62fe4 (l10n: git.pot: v2.16.0 round 2 (8 new, 4 removed)). Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Acked-by: Matthias Rüster <matthias.ruester@gmail.com>
| * | l10n: de.po: improve messages when a branch starts to track another refRalf Thielow2018-01-151-8/+8
| | | | | | | | | | | | Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
| * | l10n: bg.po: Updated Bulgarian translation (3288t)Alexander Shopov2018-01-111-181/+203
| | | | | | | | | | | | Signed-off-by: Alexander Shopov <ash@kambanaria.org>
| * | l10n: TEAMS: add zh_CN team membersJiang Xin2018-01-101-0/+1
| | | | | | | | | | | | | | | | | | Add Fangyi Zhou to zh_CN l10n team members. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
| * | l10n: zh_CN: for git v2.16.0 l10n round 2Jiang Xin2018-01-101-1920/+2144
| | | | | | | | | | | | | | | | | | | | | | | | Translate 72 messages (3288t0f0u) for git v2.16.0-rc1. Signed-off-by: Jiang Xin <worldhello.net@gmail.com> Reviewed-by: 依云 <lilydjwg@gmail.com> Reviewed-by: Fangyi Zhou <fangyi.zhou@yuriko.moe>
| * | Merge branch 'master' of git://github.com/nafmo/git-l10n-svJiang Xin2018-01-101-181/+197
| |\ \ | | | | | | | | | | | | | | | | * 'master' of git://github.com/nafmo/git-l10n-sv: l10n: sv.po: Update Swedish translation (3288t0f0u)
| | * | l10n: sv.po: Update Swedish translation (3288t0f0u)Peter Krefting2018-01-091-181/+197
| | | | | | | | | | | | | | | | Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
| * | | Merge branch 'russian-l10n' of https://github.com/DJm00n/git-po-ruJiang Xin2018-01-101-1918/+2092
| |\ \ \ | | | | | | | | | | | | | | | | | | | | * 'russian-l10n' of https://github.com/DJm00n/git-po-ru: l10n: ru.po: update Russian translation
| | * | | l10n: ru.po: update Russian translationDimitriy Ryazantcev2018-01-091-1918/+2092
| | |/ / | | | | | | | | | | | | Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
| * | | l10n: TEAMS: Add ko team membersChangwoo Ryu2018-01-091-0/+2
| |/ / | | | | | | | | | | | | | | | Add Gwan-gyeong Mun and Sihyeon Jang. Signed-off-by: Changwoo Ryu <cwryu@debian.org>
| * | Merge branch 'ko/merge-l10n' of https://github.com/git-l10n-ko/git-l10n-koJiang Xin2018-01-092-1944/+2200
| |\ \ | | | | | | | | | | | | | | | | * 'ko/merge-l10n' of https://github.com/git-l10n-ko/git-l10n-ko: l10n: ko.po: Update Korean translation
| | * | l10n: ko.po: Update Korean translationChangwoo Ryu2018-01-082-1944/+2200
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Changwoo Ryu <cwryu@debian.org> Signed-off-by: Sihyeon Jang <uneedsihyeon@gmail.com> Signed-off-by: Gwan-gyeong Mun <elongbug@gmail.com> Reviewed-by: Changwoo Ryu <cwryu@debian.org>
| * | | Merge branch '2.16' of https://github.com/ChrisADR/git-poJiang Xin2018-01-081-181/+197
| |\ \ \ | | | | | | | | | | | | | | | | | | | | * '2.16' of https://github.com/ChrisADR/git-po: l10n: es.po: Spanish translation 2.16.0 round 2
| | * | | l10n: es.po: Spanish translation 2.16.0 round 2Christopher Díaz Riveros2018-01-071-181/+197
| | |/ / | | | | | | | | | | | | Signed-off-by: Christopher Díaz Riveros <chrisadr@gentoo.org>
| * | | Merge branch 'fr_2.16-rc1' of git://github.com/jnavila/gitJiang Xin2018-01-081-192/+225
| |\ \ \ | | | | | | | | | | | | | | | | | | | | * 'fr_2.16-rc1' of git://github.com/jnavila/git: l10n: fr.po 2.16 round 2
| | * | | l10n: fr.po 2.16 round 2Jean-Noel Avila2018-01-071-192/+225
| | |/ / | | | | | | | | | | | | Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
| * | | l10n: vi.po(3288t): Updated Vietnamese translation for v2.16.0 round 2Tran Ngoc Quan2018-01-071-1929/+2156
| |/ / | | | | | | | | | Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
| * | l10n: git.pot: v2.16.0 round 2 (8 new, 4 removed)Jiang Xin2018-01-071-173/+192
| | | | | | | | | | | | | | | | | | Generate po/git.pot from v2.16.0-rc1 for git v2.16.0 l10n round 2. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
| * | Merge branch 'master' of git://github.com/git-l10n/git-poJiang Xin2018-01-078-10292/+11238
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'master' of git://github.com/git-l10n/git-po: l10n: es.po: Update Spanish Translation v2.16.0 l10n: fr.po v2.16.0 round 1 l10n: bg.po: Updated Bulgarian translation (3284t) l10n: sv.po: Update Swedish translation (3284t0f0u) l10n: fr.po: "worktree list" mistranslated as prune l10n: git.pot: v2.16.0 round 1 (64 new, 25 removed) l10n: fixes to German translation l10n: Update Spanish translation l10n: zh_CN translate parameter name l10n: zh_CN Fix typo l10n: Fixes to Catalan translation
| | * \ Merge branch '2.16' of https://github.com/ChrisADR/git-poJiang Xin2018-01-061-1920/+2129
| | |\ \ | | | | | | | | | | | | | | | | | | | | * '2.16' of https://github.com/ChrisADR/git-po: l10n: es.po: Update Spanish Translation v2.16.0
| | | * | l10n: es.po: Update Spanish Translation v2.16.0Christopher Díaz Riveros2018-01-041-1920/+2129
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Christopher Díaz Riveros <chrisadr@gentoo.org>
| | * | | Merge branch 'fr_2.16' of git://github.com/jnavila/gitJiang Xin2018-01-061-1911/+2113
| | |\ \ \ | | | |/ / | | |/| | | | | | | | | | | | | | | | | * 'fr_2.16' of git://github.com/jnavila/git: l10n: fr.po v2.16.0 round 1 l10n: fr.po: "worktree list" mistranslated as prune
| | | * | l10n: fr.po v2.16.0 round 1Jean-Noel Avila2018-01-021-1910/+2112
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
| | | * | l10n: fr.po: "worktree list" mistranslated as pruneLouis Bettens2017-12-311-1/+1
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Louis Bettens <louis@bettens.info>
| | * | | Merge branch 'master' of git://github.com/alshopov/git-poJiang Xin2018-01-021-1934/+2106
| | |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | * 'master' of git://github.com/alshopov/git-po: l10n: bg.po: Updated Bulgarian translation (3284t)
| | | * | | l10n: bg.po: Updated Bulgarian translation (3284t)Alexander Shopov2018-01-011-1934/+2106
| | | |/ / | | | | | | | | | | | | | | | Signed-off-by: Alexander Shopov <ash@kambanaria.org>
| | * | | l10n: sv.po: Update Swedish translation (3284t0f0u)Peter Krefting2018-01-011-1910/+2118
| | |/ / | | | | | | | | | | | | | | | | | | | | Also corrected spelling. Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
| | * | Merge branch 'maint' of git://github.com/git-l10n/git-poJiang Xin2017-12-314-745/+746
| | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'maint' of git://github.com/git-l10n/git-po: l10n: fixes to German translation l10n: Update Spanish translation l10n: zh_CN translate parameter name l10n: zh_CN Fix typo l10n: Fixes to Catalan translation
| | | * | l10n: fixes to German translationRobert Abel2017-12-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Der-, die- and dasselbe and their declensions are spelt as one word in German. Signed-off-by: Robert Abel <rabel@robertabel.eu> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
| | | * | Merge branch '2.15.1' of https://github.com/ChrisADR/git-po into maintJiang Xin2017-12-051-531/+534
| | | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | * '2.15.1' of https://github.com/ChrisADR/git-po: l10n: Update Spanish translation
| | | | * | l10n: Update Spanish translationChristopher Díaz Riveros2017-12-041-531/+534
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Christopher Díaz Riveros <chrisadr@gentoo.org>
| | | * | | l10n: zh_CN translate parameter nameFangyi Zhou2017-12-031-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Translate parameters such as: * <new-branch-name> in advice.c:126, * <command>, <path>, <revision> in setup.c:171, setup.c:184, setup.c:252, * <base-commit-id> in builtin/log.c:1288, * <conflicted_files> in git-rebase.sh:58, and more... Signed-off-by: Fangyi Zhou <fangyi.zhou@yuriko.moe> Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
| | | * | | l10n: zh_CN Fix typoZhou Fangyi2017-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | apply.c:125 say -> way Signed-off-by: Fangyi Zhou <fangyi.zhou@yuriko.moe>
| | | * | | l10n: Fixes to Catalan translationJordi Mas2017-11-041-193/+191
| | | |/ / | | | | | | | | | | | | | | | Signed-off-by: Jordi Mas <jmas@softcatala.org>
| | * | | l10n: git.pot: v2.16.0 round 1 (64 new, 25 removed)Jiang Xin2017-12-311-1885/+2039
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generate po/git.pot from v2.16.0-rc0 for git v2.16.0 l10n round 1. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>