summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-01-10diff --color-moved-ws: handle blank linesLibravatar Phillip Wood2-7/+68
When using --color-moved-ws=allow-indentation-change allow lines with the same indentation change to be grouped across blank lines. For now this only works if the blank lines have been moved as well, not for blocks that have just had their indentation changed. This completes the changes to the implementation of --color-moved=allow-indentation-change. Running git diff --color-moved=allow-indentation-change v2.18.0 v2.19.0 now takes 5.0s. This is a saving of 41% from 8.5s for the optimized version of the previous implementation and 66% from the original which took 14.6s. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-10diff --color-moved-ws: modify allow-indentation-changeLibravatar Phillip Wood2-58/+130
Currently diff --color-moved-ws=allow-indentation-change does not support indentation that contains a mix of tabs and spaces. For example in commit 546f70f377 ("convert.h: drop 'extern' from function declaration", 2018-06-30) the function parameters in the following lines are not colored as moved [1]. -extern int stream_filter(struct stream_filter *, - const char *input, size_t *isize_p, - char *output, size_t *osize_p); +int stream_filter(struct stream_filter *, + const char *input, size_t *isize_p, + char *output, size_t *osize_p); This commit changes the way the indentation is handled to track the visual size of the indentation rather than the characters in the indentation. This has the benefit that any whitespace errors do not interfer with the move detection (the whitespace errors will still be highlighted according to --ws-error-highlight). During the discussion of this feature there were concerns about the correct detection of indentation for python. However those concerns apply whether or not we're detecting moved lines so no attempt is made to determine if the indentation is 'pythonic'. [1] Note that before the commit to fix the erroneous coloring of moved lines each line was colored as a different block, since that commit they are uncolored. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-10diff --color-moved-ws: optimize allow-indentation-changeLibravatar Phillip Wood1-8/+11
When running git diff --color-moved-ws=allow-indentation-change v2.18.0 v2.19.0 cmp_in_block_with_wsd() is called 694908327 times. Of those 42.7% return after comparing a and b. By comparing the lengths first we can return early in all but 0.03% of those cases without dereferencing the string pointers. The comparison between a and c fails in 6.8% of calls, by comparing the lengths first we reject all the failing calls without dereferencing the string pointers. This reduces the time to run the command above by by 42% from 14.6s to 8.5s. This is still much slower than the normal --color-moved which takes ~0.6-0.7s to run but is a significant improvement. The next commits will replace the current implementation with one that works with mixed tabs and spaces in the indentation. I think it is worth optimizing the current implementation first to enable a fair comparison between the two implementations. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-10diff --color-moved=zebra: be stricter with color alternationLibravatar Phillip Wood2-11/+22
Currently when using --color-moved=zebra the color of moved blocks depends on the number of lines separating them. This means that adding an odd number of unmoved lines between blocks that are already separated by one or more unmoved lines will change the color of subsequent moved blocks. This does not make much sense as the blocks were already separated by unmoved lines and causes problems when adding lines to test cases. Fix this by only using the alternate colors for adjacent moved blocks. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-10diff --color-moved-ws: fix false positivesLibravatar Phillip Wood1-6/+9
'diff --color-moved-ws=allow-indentation-change' can color lines as moved when they are in fact different. For example in commit 1a07e59c3e ("Update messages in preparation for i18n", 2018-07-21) the lines - die (_("must end with a color")); + die(_("must end with a color")); are colored as moved even though they are different. This is because if there is a fuzzy match for the first line of a potential moved block the line is marked as moved before the potential match is checked to see if it actually matches. The fix is to delay marking the line as moved until after we have checked that there really is at least one matching potential moved block. Note that the test modified in the last commit still fails because adding an unmoved line between two moved blocks that are already separated by unmoved lines changes the color of the block following the addition. This should not be the case and will be fixed in the next commit. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-10diff --color-moved-ws: demonstrate false positivesLibravatar Phillip Wood1-2/+6
'diff --color-moved-ws=allow-indentation-change' can highlight lines that have internal whitespace changes rather than indentation changes. For example in commit 1a07e59c3e ("Update messages in preparation for i18n", 2018-07-21) the lines - die (_("must end with a color")); + die(_("must end with a color")); are highlighted as moved when they should not be. Modify an existing test to show the problem that will be fixed in the next commit. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-10diff: allow --no-color-moved-wsLibravatar Phillip Wood2-1/+12
Allow --no-color-moved-ws and --color-moved-ws=no to cancel any previous --color-moved-ws option. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-10Use "whitespace" consistentlyLibravatar Phillip Wood3-7/+7
Most of the messages and documentation use 'whitespace' rather than 'white space' or 'white spaces' convert to latter two to the former for consistency. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-10diff: document --no-color-movedLibravatar Phillip Wood1-0/+4
Add documentation for --no-color-moved. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-29Merge branch 'ja/i18n-fix'Libravatar Junio C Hamano2-2/+2
* ja/i18n-fix: i18n: fix small typos
2018-11-29Merge branch 'nd/n18n-fix'Libravatar Junio C Hamano1-1/+1
* nd/n18n-fix: transport-helper.c: do not translate a string twice
2018-11-29i18n: fix small typosLibravatar Jean-Noël Avila2-2/+2
Translating the new strings introduced for v2.20 showed some typos. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-29transport-helper.c: do not translate a string twiceLibravatar Nguyễn Thái Ngọc Duy1-1/+1
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-26Merge branch 'nd/per-worktree-ref-iteration'Libravatar Junio C Hamano1-1/+2
Build fix. * nd/per-worktree-ref-iteration: files-backend.c: fix build error on Solaris
2018-11-26Merge branch 'tb/clone-case-smashing-warning-test'Libravatar Junio C Hamano1-1/+1
The code recently added to "git clone" to see if the platform's filesystem is adequate to check out and use the project code correctly (e.g. a case smashing filesystem cannot be used for a project with two files whose paths are different only in case) was meant to help Windows users, but the test for it was not enabled for that platform, which has been corrected. * tb/clone-case-smashing-warning-test: t5601-99: Enable colliding file detection for MINGW
2018-11-26Merge branch 'jk/t5562-perl-path-fix'Libravatar Junio C Hamano2-1/+1
Hotfix for test breakage on platforms whose Perl is not at /usr/bin/perl * jk/t5562-perl-path-fix: t5562: fix perl path
2018-11-26files-backend.c: fix build error on SolarisLibravatar Nguyễn Thái Ngọc Duy1-1/+2
This function files_reflog_path returns void, which usually means "return;" not returning "void value" from another function. Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-24t5562: fix perl pathLibravatar Jeff King2-1/+1
Some systems do not have perl installed to /usr/bin. Use the variable from the build settiings, and call perl directly than via shebang. Signed-off-by: Max Kirillov <max@max630.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-24t5601-99: Enable colliding file detection for MINGWLibravatar Torsten Bögershausen1-1/+1
Commit b878579ae7 (clone: report duplicate entries on case-insensitive filesystems - 2018-08-17) adds a warning to user when cloning a repo with case-sensitive file names on a case-insensitive file system. This test has never been enabled for MINGW. It had been working since day 1, but I forget to report that to the author. Enable it after a re-test. Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-21Git 2.20-rc1Libravatar Junio C Hamano2-3/+8
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-21Sync with 2.19.2Libravatar Junio C Hamano1-0/+108
2018-11-21Git 2.19.2Libravatar Junio C Hamano3-2/+110
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-21Merge branch 'sg/test-rebase-editor-fix' into maintLibravatar Junio C Hamano2-7/+7
* sg/test-rebase-editor-fix: t3404-rebase-interactive: test abbreviated commands
2018-11-21Merge branch 'tb/char-may-be-unsigned' into maintLibravatar Junio C Hamano1-1/+1
Build portability fix. * tb/char-may-be-unsigned: path.c: char is not (always) signed
2018-11-21Merge branch 'jk/uploadpack-packobjectshook-fix' into maintLibravatar Junio C Hamano1-3/+6
Code clean-up that results in a small bugfix. * jk/uploadpack-packobjectshook-fix: upload-pack: fix broken if/else chain in config callback
2018-11-21Merge branch 'uk/merge-subtree-doc-update' into maintLibravatar Junio C Hamano1-1/+1
Belated documentation update to adjust to a new world order that happened a yew years ago. * uk/merge-subtree-doc-update: howto/using-merge-subtree: mention --allow-unrelated-histories
2018-11-21Merge branch 'jc/cocci-preincr' into maintLibravatar Junio C Hamano2-1/+6
Code cleanup. * jc/cocci-preincr: fsck: s/++i > 1/i++/ cocci: simplify "if (++u > 1)" to "if (u++)"
2018-11-21Merge branch 'ah/doc-updates' into maintLibravatar Junio C Hamano12-79/+92
Doc updates. * ah/doc-updates: doc: fix formatting in git-update-ref doc: fix indentation of listing blocks in gitweb.conf.txt doc: fix descripion for 'git tag --format' doc: fix inappropriate monospace formatting doc: fix ASCII art tab spacing doc: clarify boundaries of 'git worktree list --porcelain'
2018-11-21Merge branch 'sg/doc-show-branch-typofix' into maintLibravatar Junio C Hamano1-1/+1
Docfix. * sg/doc-show-branch-typofix: doc: fix small typo in git show-branch
2018-11-21Merge branch 'tq/branch-style-fix' into maintLibravatar Junio C Hamano1-2/+1
Code clean-up. * tq/branch-style-fix: branch: trivial style fix
2018-11-21Merge branch 'tq/branch-create-wo-branch-get' into maintLibravatar Junio C Hamano1-5/+0
Code clean-up. * tq/branch-create-wo-branch-get: builtin/branch.c: remove useless branch_get
2018-11-21Merge branch 'sb/strbuf-h-update' into maintLibravatar Junio C Hamano1-67/+81
Code clean-up to serve as a BCP example. Further clean-up patches may want to follow soon. * sb/strbuf-h-update: strbuf.h: format according to coding guidelines
2018-11-21Merge branch 'du/cherry-is-plumbing' into maintLibravatar Junio C Hamano2-12/+1
Doc update to mark "git cherry" as a plumbing command. * du/cherry-is-plumbing: doc: move git-cherry to plumbing
2018-11-21Merge branch 'du/get-tar-commit-id-is-plumbing' into maintLibravatar Junio C Hamano1-1/+1
Doc update to mark "git get-tar-commit-id" as a plumbing command. * du/get-tar-commit-id-is-plumbing: doc: move git-get-tar-commit-id to plumbing
2018-11-21Merge branch 'mm/doc-no-dashed-git' into maintLibravatar Junio C Hamano2-3/+3
Doc update. * mm/doc-no-dashed-git: doc: fix a typo and clarify a sentence
2018-11-21Merge branch 'du/rev-parse-is-plumbing' into maintLibravatar Junio C Hamano1-1/+1
Doc update. * du/rev-parse-is-plumbing: doc: move git-rev-parse from porcelain to plumbing
2018-11-21Merge branch 'ma/t7005-bash-workaround' into maintLibravatar Junio C Hamano1-1/+1
Test fix. * ma/t7005-bash-workaround: t7005-editor: quote filename to fix whitespace-issue
2018-11-21Merge branch 'jc/how-to-document-api' into maintLibravatar Junio C Hamano1-1/+4
Doc update. * jc/how-to-document-api: CodingGuidelines: document the API in *.h files
2018-11-21Merge branch 'mw/doc-typofixes' into maintLibravatar Junio C Hamano2-3/+2
Typofixes. * mw/doc-typofixes: docs: typo: s/isimilar/similar/ docs: graph: remove unnecessary `graph_update()' call docs: typo: s/go/to/
2018-11-21Merge branch 'rs/sequencer-oidset-insert-avoids-dups' into maintLibravatar Junio C Hamano1-3/+1
Code clean-up. * rs/sequencer-oidset-insert-avoids-dups: sequencer: use return value of oidset_insert()
2018-11-21Merge branch 'ma/mailing-list-address-in-git-help' into maintLibravatar Junio C Hamano1-1/+3
Doc update. * ma/mailing-list-address-in-git-help: git doc: direct bug reporters to mailing list archive
2018-11-21Merge branch 'nd/packobjectshook-doc-fix' into maintLibravatar Junio C Hamano1-4/+4
Doc update. * nd/packobjectshook-doc-fix: config.txt: correct the note about uploadpack.packObjectsHook
2018-11-21Merge branch 'ma/t1400-undebug-test' into maintLibravatar Junio C Hamano1-1/+1
Test fix. * ma/t1400-undebug-test: t1400: drop debug `echo` to actually execute `test`
2018-11-21Merge branch 'ma/commit-graph-docs' into maintLibravatar Junio C Hamano2-19/+20
Doc update. * ma/commit-graph-docs: Doc: refer to the "commit-graph file" with dash git-commit-graph.txt: refer to "*commit*-graph file" git-commit-graph.txt: typeset more in monospace git-commit-graph.txt: fix bullet lists
2018-11-21Merge branch 'dz/credential-doc-url-matching-rules' into maintLibravatar Junio C Hamano1-0/+6
Doc update. * dz/credential-doc-url-matching-rules: doc: clarify gitcredentials path component matching
2018-11-21Merge branch 'jk/check-everything-connected-is-long-gone' into maintLibravatar Junio C Hamano1-1/+1
Comment fix. * jk/check-everything-connected-is-long-gone: receive-pack: update comment with check_everything_connected
2018-11-21Merge branch 'fe/doc-updates' into maintLibravatar Junio C Hamano3-5/+39
Doc updates. * fe/doc-updates: git-describe.1: clarify that "human readable" is also git-readable git-column.1: clarify initial description, provide examples git-archimport.1: specify what kind of Arch we're talking about
2018-11-21Merge branch 'tg/t5551-with-curl-7.61.1' into maintLibravatar Junio C Hamano1-34/+34
Test update. Supersedes tz/t5551-with-curl-7.61.1 topic * tg/t5551-with-curl-7.61.1: t5551: compare sorted cookies files t5551: move setup code inside test_expect blocks
2018-11-21Merge branch 'tq/refs-internal-comment-fix' into maintLibravatar Junio C Hamano1-1/+1
Fix for typo in a sample code in comment. * tq/refs-internal-comment-fix: refs: docstring typo
2018-11-21Merge branch 'sg/split-index-test' into maintLibravatar Junio C Hamano2-8/+11
Test updates. * sg/split-index-test: t0090: disable GIT_TEST_SPLIT_INDEX for the test checking split index t1700-split-index: drop unnecessary 'grep'