summaryrefslogtreecommitdiff
path: root/t
AgeCommit message (Collapse)AuthorFilesLines
2019-08-01Merge branch 'jk/repack-silence-auto-bitmap-warning'Libravatar Junio C Hamano1-1/+14
Squelch unneeded and misleading warnings from "repack" when the command attempts to generate pack bitmaps without explicitly asked for by the user. * jk/repack-silence-auto-bitmap-warning: repack: simplify handling of auto-bitmaps and .keep files repack: silence warnings when auto-enabled bitmaps cannot be built t7700: clean up .keep file in bitmap-writing test
2019-08-01Merge branch 'jk/sort-iter-test-output'Libravatar Junio C Hamano2-33/+55
* jk/sort-iter-test-output: t: sort output of hashmap iteration
2019-08-01Merge branch 'jc/dir-iterator-test-fix'Libravatar Junio C Hamano2-3/+12
* jc/dir-iterator-test-fix: test-dir-iterator: do not assume errno values
2019-08-01Merge branch 'bc/hash-independent-tests-part-4'Libravatar Junio C Hamano11-93/+142
Update to the tests to help SHA-256 transition continues. * bc/hash-independent-tests-part-4: t2203: avoid hard-coded object ID values t1710: make hash independent t1007: remove SHA1 prerequisites t0090: make test pass with SHA-256 t0027: make hash size independent t6030: make test work with SHA-256 t5000: make hash independent t1450: make hash size independent t1410: make hash size independent t: add helper to convert object IDs to paths
2019-07-31repack: simplify handling of auto-bitmaps and .keep filesLibravatar Jeff King1-1/+2
Commit 7328482253 (repack: disable bitmaps-by-default if .keep files exist, 2019-06-29) taught repack to prefer disabling bitmaps to duplicating objects (unless bitmaps were asked for explicitly). But there's an easier way to do this: if we keep passing the --honor-pack-keep flag to pack-objects when auto-enabling bitmaps, then pack-objects already makes the same decision (it will disable bitmaps rather than duplicate). Better still, pack-objects can actually decide to do so based not just on the presence of a .keep file, but on whether that .keep file actually impacts the new pack we're making (so if we're racing with a push or fetch, for example, their temporary .keep file will not block us from generating bitmaps if they haven't yet updated their refs). And because repack uses the --write-bitmap-index-quiet flag, we don't have to worry about pack-objects generating confusing warnings when it does see a .keep file. We can confirm this by tweaking the .keep test to check repack's stderr. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-31repack: silence warnings when auto-enabled bitmaps cannot be builtLibravatar Jeff King1-0/+11
Depending on various config options, a full repack may not be able to build a reachability bitmap index (e.g., if pack.packSizeLimit forces us to write multiple packs). In these cases pack-objects may write a warning to stderr. Since 36eba0323d (repack: enable bitmaps by default on bare repos, 2019-03-14), we may generate these warnings even when the user did not explicitly ask for bitmaps. This has two downsides: - it can be confusing, if they don't know what bitmaps are - a daemonized auto-gc will write this to its log file, and the presence of the warning may suppress further auto-gc (until gc.logExpiry has elapsed) Let's have repack communicate to pack-objects that the choice to turn on bitmaps was not made explicitly by the user, which in turn allows pack-objects to suppress these warnings. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-31t7700: clean up .keep file in bitmap-writing testLibravatar Jeff King1-0/+1
After our test snippet finishes, the .keep file is left in place, making it hard to do further tests of the auto-bitmap-writing code (since it suppresses the feature completely). Let's clean it up. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-31t: sort output of hashmap iterationLibravatar Jeff King2-33/+55
The iteration order of a hashmap is undefined, and may depend on things like the exact set of items added, or the table has been grown or shrunk. In the case of an oidmap, it even depends on endianness, because we take the oid hash by casting sha1 bytes directly into an unsigned int. Let's sort the test-tool output from any hash iterators. In the case of t0011, this is just future-proofing. But for t0016, it actually fixes a reported failure on the big-endian s390 and nonstop ports. I didn't bother to teach the helper functions to optionally sort output. They are short enough that it's simpler to just repeat them inline for the iteration tests than it is to add a --sort option. Reported-by: Randall S. Becker <rsbecker@nexbridge.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-30test-dir-iterator: do not assume errno valuesLibravatar Junio C Hamano2-3/+12
A few tests printed 'errno' as an integer and compared with hardcoded integers; this is obviously not portable. A two things to note are: - the string obtained by strerror() is not portable, and cannot be used for the purpose of these tests. - there unfortunately isn't a portable way to map error numbers to error names. As we only care about a few selected errors, just map the error number to the name before emitting for comparison. Reported-by: Randall S. Becker <rsbecker@nexbridge.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-29Merge branch 'jk/xdiff-clamp-funcname-context-index'Libravatar Junio C Hamano1-0/+22
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-07-25Merge branch 'jk/test-commit-bulk'Libravatar Junio C Hamano6-33/+136
A test helper has been introduced to optimize preparation of test repositories with many simple commits, and a handful of test scripts have been updated to use it. * jk/test-commit-bulk: t6200: use test_commit_bulk t5703: use test_commit_bulk t5702: use test_commit_bulk t3311: use test_commit_bulk t5310: increase the number of bitmapped commits test-lib: introduce test_commit_bulk
2019-07-25Merge branch 'jc/denoise-rm-to-resolve'Libravatar Junio C Hamano1-0/+13
"git rm" to resolve a conflicted path leaked an internal message "needs merge" before actually removing the path, which was confusing. This has been corrected. * jc/denoise-rm-to-resolve: rm: resolving by removal is not a warning-worthy event
2019-07-25Merge branch 'js/clean-report-too-long-a-path'Libravatar Junio C Hamano1-0/+12
"git clean" silently skipped a path when it cannot lstat() it; now it gives a warning. * js/clean-report-too-long-a-path: clean: show an error message when the path is too long
2019-07-25Merge branch 'tg/stash-keep-index-with-removed-paths'Libravatar Junio C Hamano1-0/+7
"git stash --keep-index" did not work correctly on paths that have been removed, which has been fixed. * tg/stash-keep-index-with-removed-paths: stash: fix handling removed files with --keep-index
2019-07-25Merge branch 'js/mingw-spawn-with-spaces-in-path'Libravatar Junio C Hamano1-0/+6
Window 7 update ;-) * js/mingw-spawn-with-spaces-in-path: mingw: support spawning programs containing spaces in their names
2019-07-25Merge branch 'mt/dir-iterator-updates'Libravatar Junio C Hamano5-0/+341
Adjust the dir-iterator API and apply it to the local clone optimization codepath. * mt/dir-iterator-updates: clone: replace strcmp by fspathcmp clone: use dir-iterator to avoid explicit dir traversal clone: extract function from copy_or_link_directory clone: copy hidden paths at local clone dir-iterator: add flags parameter to dir_iterator_begin dir-iterator: refactor state machine model dir-iterator: use warning_errno when possible dir-iterator: add tests for dir-iterator API clone: better handle symlinked files at .git/objects/ clone: test for our behavior on odd objects/* content
2019-07-25Merge branch 'ac/log-use-mailmap-by-default-transition'Libravatar Junio C Hamano1-0/+2
The "git log" command learns to issue a warning when log.mailmap configuration is not set and --[no-]mailmap option is not used, to prepare users for future versions of Git that uses the mailmap by default. * ac/log-use-mailmap-by-default-transition: tests: defang pager tests by explicitly disabling the log.mailmap warning documentation: mention --no-use-mailmap and log.mailmap false setting log: add warning for unspecified log.mailmap setting
2019-07-25Merge branch 'es/local-atomic-push-failure-with-http'Libravatar Junio C Hamano1-0/+49
"git push --atomic" that goes over the transport-helper (namely, the smart http transport) failed to prevent refs to be pushed when it can locally tell that one of the ref update will fail without having to consult the other end, which has been corrected. * es/local-atomic-push-failure-with-http: transport-helper: avoid var decl in for () loop control transport-helper: enforce atomic in push_refs_with_push
2019-07-25Merge branch 'tg/range-diff-output-update'Libravatar Junio C Hamano2-23/+185
"git range-diff" output has been tweaked for easier identification of which part of what file the patch shown is about. * tg/range-diff-output-update: range-diff: add headers to the outer hunk header range-diff: add filename to inner diff range-diff: add section header instead of diff header range-diff: suppress line count in outer diff range-diff: don't remove funcname from inner diff range-diff: split lines manually range-diff: fix function parameter indentation apply: make parse_git_diff_header public apply: only pass required data to gitdiff_* functions apply: only pass required data to find_name_* apply: only pass required data to check_header_line apply: only pass required data to git_header_name apply: only pass required data to skip_tree_prefix apply: replace marc.info link with public-inbox
2019-07-25Merge branch 'ab/test-env'Libravatar Junio C Hamano14-111/+173
Many GIT_TEST_* environment variables control various aspects of how our tests are run, but a few followed "non-empty is true, empty or unset is false" while others followed the usual "there are a few ways to spell true, like yes, on, etc., and also ways to spell false, like no, off, etc." convention. * ab/test-env: env--helper: mark a file-local symbol as static tests: make GIT_TEST_FAIL_PREREQS a boolean tests: replace test_tristate with "git env--helper" tests README: re-flow a previously changed paragraph tests: make GIT_TEST_GETTEXT_POISON a boolean t6040 test: stop using global "script" variable config.c: refactor die_bad_number() to not call gettext() early env--helper: new undocumented builtin wrapping git_env_*() config tests: simplify include cycle test
2019-07-23xdiff: clamp function context indices in post-imageLibravatar Jeff King1-0/+22
After finding a function line for --function-context in the pre-image, xdl_emit_diff() calculates the equivalent line in the post-image. It assumes that the lines between changes are the same on both sides. If the option --ignore-blank-lines was also given then this is not necessarily true. Clamp the calculation results for start and end of the function context to prevent out-of-bounds array accesses. Note that this _just_ fixes the case where our mismatch sends us off the beginning of the file. There are likely other cases where our assumption causes us to go to the wrong line within the file. Nobody has developed a test case yet, and the ultimate fix is likely more complicated than this patch. But this at least prevents a segfault in the meantime. Credit for finding the bug goes to "Liu Wei of Tencent Security Xuanwu Lab". Reported-by: 刘炜 <lw17qhdz@gmail.com> 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-07-23t6200: use test_commit_bulkLibravatar Jeff King1-6/+1
There's a loop that creates 30 commits using test_commit. Using test_commit_bulk speeds this up from: Benchmark #1: ./t6200-fmt-merge-msg.sh --root=/var/ram/git-tests Time (mean ± σ): 1.926 s ± 0.240 s [User: 1.055 s, System: 0.963 s] Range (min … max): 1.431 s … 2.166 s 10 runs to: Benchmark #1: ./t6200-fmt-merge-msg.sh --root=/var/ram/git-tests Time (mean ± σ): 1.343 s ± 0.179 s [User: 766.5 ms, System: 662.9 ms] Range (min … max): 1.032 s … 1.664 s 10 runs for an average savings of over 30%. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-19Merge branch 'jl/status-reduce-vertical-blank'Libravatar Junio C Hamano3-81/+0
Extra blank lines in "git status" output have been reduced. * jl/status-reduce-vertical-blank: status: remove the empty line after hints
2019-07-19Merge branch 'pw/rebase-progress-test-cleanup'Libravatar Junio C Hamano1-8/+11
Test cleanup. * pw/rebase-progress-test-cleanup: t3420: remove progress lines before comparing output
2019-07-19Merge branch 'pw/prompt-cherry-pick-revert-fix'Libravatar Junio C Hamano1-2/+18
When one step in multi step cherry-pick or revert is reset or committed, the command line prompt script failed to notice the current status, which has been improved. * pw/prompt-cherry-pick-revert-fix: git-prompt: improve cherry-pick/revert detection
2019-07-19Merge branch 'ew/repack-with-bitmaps-by-default'Libravatar Junio C Hamano1-0/+10
Generation of pack bitmaps are now disabled when .keep files exist, as these are mutually exclusive features. * ew/repack-with-bitmaps-by-default: repack: disable bitmaps-by-default if .keep files exist
2019-07-19Merge branch 'jk/check-connected-with-alternates'Libravatar Junio C Hamano2-0/+87
The tips of refs from the alternate object store can be used as starting point for reachability computation now. * jk/check-connected-with-alternates: check_everything_connected: assume alternate ref tips are valid object-store.h: move for_each_alternate_ref() from transport.h
2019-07-19Merge branch 'nd/tree-walk-with-repo'Libravatar Junio C Hamano2-2/+18
The tree-walk API learned to pass an in-core repository instance throughout more codepaths. * nd/tree-walk-with-repo: t7814: do not generate same commits in different repos Use the right 'struct repository' instead of the_repository match-trees.c: remove the_repo from shift_tree*() tree-walk.c: remove the_repo from get_tree_entry_follow_symlinks() tree-walk.c: remove the_repo from get_tree_entry() tree-walk.c: remove the_repo from fill_tree_descriptor() sha1-file.c: remove the_repo from read_object_with_reference()
2019-07-19Merge branch 'ra/cherry-pick-revert-skip'Libravatar Junio C Hamano1-0/+122
"git cherry-pick/revert" learned a new "--skip" action. * ra/cherry-pick-revert-skip: cherry-pick/revert: advise using --skip cherry-pick/revert: add --skip option sequencer: use argv_array in reset_merge sequencer: rename reset_for_rollback to reset_merge sequencer: add advice for revert
2019-07-19Merge branch 'tb/ref-filter-multiple-patterns'Libravatar Junio C Hamano1-0/+26
"git for-each-ref" with multiple patterns have been optimized. * tb/ref-filter-multiple-patterns: ref-filter.c: find disjoint pattern prefixes
2019-07-19Merge branch 'pw/status-with-corrupt-sequencer-state'Libravatar Junio C Hamano1-0/+16
The code to read state files used by the sequencer machinery for "git status" has been made more robust against a corrupt or stale state files. * pw/status-with-corrupt-sequencer-state: status: do not report errors in sequencer/todo sequencer: factor out todo command name parsing sequencer: always allow tab after command name
2019-07-19Merge branch 'ds/commit-graph-incremental'Libravatar Junio C Hamano2-1/+344
The commits in a repository can be described by multiple commit-graph files now, which allows the commit-graph files to be updated incrementally. * ds/commit-graph-incremental: commit-graph: test verify across alternates commit-graph: normalize commit-graph filenames commit-graph: test --split across alternate without --split commit-graph: test octopus merges with --split commit-graph: clean up chains after flattened write commit-graph: verify chains with --shallow mode commit-graph: create options for split files commit-graph: expire commit-graph files commit-graph: allow cross-alternate chains commit-graph: merge commit-graph chains commit-graph: add --split option to builtin commit-graph: write commit-graph chains commit-graph: rearrange chunk count logic commit-graph: add base graphs chunk commit-graph: load commit-graph chains commit-graph: rename commit_compare to oid_compare commit-graph: prepare for commit-graph chains commit-graph: document commit-graph chains
2019-07-19Merge branch 'br/blame-ignore'Libravatar Junio C Hamano4-7/+754
"git blame" learned to "ignore" commits in the history, whose effects (as well as their presence) get ignored. * br/blame-ignore: t8014: remove unnecessary braces blame: drop some unused function parameters blame: add a test to cover blame_coalesce() blame: use the fingerprint heuristic to match ignored lines blame: add a fingerprint heuristic to match ignored lines blame: optionally track line fingerprints during fill_blame_origin() blame: add config options for the output of ignored or unblamable lines blame: add the ability to ignore commits and their changes blame: use a helper function in blame_chunk() Move oidset_parse_file() to oidset.c fsck: rename and touch up init_skiplist()
2019-07-19Merge branch 'cc/test-oidmap'Libravatar Junio C Hamano6-17/+217
Extend the test coverage a bit. * cc/test-oidmap: t0016: add 'remove' subcommand test test-oidmap: remove 'add' subcommand test-hashmap: remove 'hash' command oidmap: use sha1hash() instead of static hash() function t: add t0016-oidmap.sh t/helper: add test-oidmap.c
2019-07-19Merge branch 'ds/midx-expire-repack'Libravatar Junio C Hamano1-0/+184
"git multi-pack-index" learned expire and repack subcommands. * ds/midx-expire-repack: t5319: use 'test-tool path-utils' instead of 'ls -l' t5319-multi-pack-index.sh: test batch size zero midx: add test that 'expire' respects .keep files multi-pack-index: test expire while adding packs midx: implement midx_repack() multi-pack-index: prepare 'repack' subcommand multi-pack-index: implement 'expire' subcommand midx: refactor permutation logic and pack sorting midx: simplify computation of pack name lengths multi-pack-index: prepare for 'expire' subcommand Docs: rearrange subcommands for multi-pack-index repack: refactor pack deletion for future use
2019-07-19clean: show an error message when the path is too longLibravatar Johannes Schindelin1-0/+12
When `lstat()` failed, `git clean` would abort without an error message, leaving the user quite puzzled. In particular on Windows, where the default maximum path length is quite small (yet there are ways to circumvent that limit in many cases), it is very important that users be given an indication why their command failed because of too long paths when it did. This test case makes sure that a warning is issued that would have helped the user who reported this issue: https://github.com/git-for-windows/git/issues/521 Note that we temporarily set `core.longpaths = false` in the regression test; this ensures forward-compatibility with the `core.longpaths` feature that has not yet been upstreamed from Git for Windows. Helped-by: René Scharfe <l.s.r@web.de> Helped-by: SZEDER Gábor <szeder.dev@gmail.com> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-18rm: resolving by removal is not a warning-worthy eventLibravatar Junio C Hamano1-0/+13
When resolving a conflict on a path in favor of removing it, using "git rm" on it is the standard way to do so. The user however is greeted with a "needs merge" message during that operation: $ git merge side-branch $ edit conflicted-path-1 $ git add conflicted-path-1 $ git rm conflicted-path-2 conflicted-path-2: needs merge rm 'conflicted-path-2' The removal by "git rm" does get performed, but an uninitiated user may find it confusing, "needs merge? so I need to resolve conflict before being able to remove it???" The message is coming from "update-index --refresh" that is called internally to make sure "git rm" knows which paths are clean and which paths are dirty, in order to prevent removal of paths modified relative to the index without the "-f" option. We somehow ended up not squelching this message which seeped through to the UI surface. Use the same mechanism used by "git commit", "git describe", etc. to squelch the message. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-16stash: fix handling removed files with --keep-indexLibravatar Thomas Gummerer1-0/+7
git stash push --keep-index is supposed to keep all changes that have been added to the index, both in the index and on disk. Currently this doesn't behave correctly when a file is removed from the index. Instead of keeping it deleted on disk, --keep-index currently restores the file. Fix that behaviour by using 'git checkout' in no-overlay mode which can faithfully restore the index and working tree. This also simplifies the code. Note that this will overwrite untracked files if the untracked file has the same name as a file that has been deleted in the index. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-16mingw: support spawning programs containing spaces in their namesLibravatar Johannes Schindelin1-0/+6
On some older Windows versions (e.g. Windows 7), the CreateProcessW() function does not really support spaces in its first argument, lpApplicationName. But it supports passing NULL as lpApplicationName, which makes it figure out the application from the (possibly quoted) first argument of lpCommandLine. Let's use that trick (if we are certain that the first argument matches the executable's path) to support launching programs whose path contains spaces. We will abuse the test-fake-ssh.exe helper to verify that this works and does not regress. This fixes https://github.com/git-for-windows/git/issues/692 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-15tests: defang pager tests by explicitly disabling the log.mailmap warningLibravatar Ariadne Conill1-0/+2
In the previous patch, we added a deprecation warning for the current log.mailmap setting. This warning only appears when git is attached to a controlling terminal. Some tests however run under an emulated terminal, so we need to disable the warning for those tests. Thanks to Junio for suggesting that we do this in the setup function. Signed-off-by: Ariadne Conill <ariadne@dereferenced.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-12transport-helper: enforce atomic in push_refs_with_pushLibravatar Emily Shaffer1-0/+49
Teach transport-helper how to notice if skipping a ref during push would violate atomicity on the client side. We notice that a ref would be rejected, and choose not to send it, but don't notice that if the client has asked for --atomic we are violating atomicity if all the other pushes we are sending would succeed. Asking the server end to uphold atomicity wouldn't work here as the server doesn't have any idea that we tried to update a ref that's broken. The added test-case is a succinct way to reproduce this issue that fails today. The same steps work fine when we aren't using a transport-helper to get to the upstream, i.e. when we've added a local repository as a remote: git remote add ~/upstream upstream Signed-off-by: Emily Shaffer <emilyshaffer@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-11Merge branch 'js/rebase-reschedule-applies-only-to-interactive'Libravatar Junio C Hamano1-0/+8
The configuration variable rebase.rescheduleFailedExec should be effective only while running an interactive rebase and should not affect anything when running an non-interactive one, which was not the case. This has been corrected. * js/rebase-reschedule-applies-only-to-interactive: rebase --am: ignore rebase.rescheduleFailedExec
2019-07-11Merge branch 'jt/t5551-test-chunked'Libravatar Junio C Hamano1-3/+2
Update smart-http test. * jt/t5551-test-chunked: t5551: test usage of chunked encoding explicitly
2019-07-11range-diff: add headers to the outer hunk headerLibravatar Thomas Gummerer1-19/+22
Add the section headers/hunk headers we introduced in the previous commits to the outer diff's hunk headers. This makes it easier to understand which change we are actually looking at. For example an outer hunk header might now look like: @@ Documentation/config/interactive.txt while previously it would have only been @@ which doesn't give a lot of context for the change that follows. For completeness also add section headers for the commit metadata and the commit message, although they are arguably less important. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-11range-diff: add filename to inner diffLibravatar Thomas Gummerer1-6/+10
In a range-diff it's not always clear which file a certain funcname of the inner diff belongs to, because the diff header (or section header as added in a previous commit) is not always visible in the range-diff. Add the filename to the inner diffs header, so it's always visible to users. This also allows us to add the filename + the funcname to the outer diffs hunk headers using a custom userdiff pattern, which will be done in the next commit. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-11range-diff: add section header instead of diff headerLibravatar Thomas Gummerer2-10/+165
Currently range-diff keeps the diff header of the inner diff intact (apart from stripping lines starting with index). This diff header is somewhat useful, especially when files get different names in different ranges. However there is no real need to keep the whole diff header for that. The main reason we currently do that is probably because it is easy to do. Introduce a new range diff hunk header, that's enclosed by "##", similar to how line numbers in diff hunks are enclosed by "@@", and give human readable information of what exactly happened to the file, including the file name. This improves the readability of the range-diff by giving more concise information to the users. For example if a file was renamed in one iteration, but not in another, the diff of the headers would be quite noisy. However the diff of a single line is concise and should be easier to understand. Additionally, this allows us to add these range diff section headers to the outer diffs hunk headers using a custom userdiff pattern, which should help making the range-diff more readable. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-11range-diff: suppress line count in outer diffLibravatar Thomas Gummerer1-8/+8
The line count in the outer diff's hunk headers of a range diff is not all that interesting. It merely shows how far along the inner diff are on both sides. That number is of no use for human readers, and range-diffs are not meant to be machine readable. In a subsequent commit we're going to add some more contextual information such as the filename corresponding to the diff to the hunk headers. Remove the unnecessary information, and just keep the "@@" to indicate that a new hunk of the outer diff is starting. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-11range-diff: don't remove funcname from inner diffLibravatar Thomas Gummerer1-3/+3
When postprocessing the inner diff in range-diff, we currently replace the whole hunk header line with just "@@". This matches how 'git tbdiff' used to handle hunk headers as well. Most likely this is being done because line numbers in the hunk header are not relevant without other changes. They can for example easily change if a range is rebased, and lines are added/removed before a change that we actually care about in our ranges. However it can still be useful to have the function name that 'git diff' extracts as additional context for the change. Note that it is not guaranteed that the hunk header actually shows up in the range-diff, and this change only aims to improve the case where a hunk header would already be included in the final output. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-11clone: copy hidden paths at local cloneLibravatar Matheus Tavares1-0/+9
Make the copy_or_link_directory function no longer skip hidden directories. This function, used to copy .git/objects, currently skips all hidden directories but not hidden files, which is an odd behaviour. The reason for that could be unintentional: probably the intention was to skip '.' and '..' only but it ended up accidentally skipping all directories starting with '.'. Besides being more natural, the new behaviour is more permissive to the user. Also adjust tests to reflect this behaviour change. Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Co-authored-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-11dir-iterator: add flags parameter to dir_iterator_beginLibravatar Matheus Tavares2-7/+107
Add the possibility of giving flags to dir_iterator_begin to initialize a dir-iterator with special options. Currently possible flags are: - DIR_ITERATOR_PEDANTIC, which makes dir_iterator_advance abort immediately in the case of an error, instead of keep looking for the next valid entry; - DIR_ITERATOR_FOLLOW_SYMLINKS, which makes the iterator follow symlinks and include linked directories' contents in the iteration. These new flags will be used in a subsequent patch. Also add tests for the flags' usage and adjust refs/files-backend.c to the new dir_iterator_begin signature. Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br> Signed-off-by: Junio C Hamano <gitster@pobox.com>