Junio C Hamano [Fri, 19 Jul 2019 18:30:23 +0000 (11:30 -0700)]
Merge branch 'js/trace2-signo-typofix'
Documentation fix.
* js/trace2-signo-typofix:
trace2: correct trace2 field name documentation
Junio C Hamano [Fri, 19 Jul 2019 18:30:23 +0000 (11:30 -0700)]
Merge branch 'kb/mingw-set-home'
Windows port update.
* kb/mingw-set-home:
mingw: initialize HOME on startup
Junio C Hamano [Fri, 19 Jul 2019 18:30:23 +0000 (11:30 -0700)]
Merge branch 'ea/merge-code-cleanup'
A loop has been rewritten for conciseness and clarity.
* ea/merge-code-cleanup:
builtin/merge.c - cleanup of code in for-cycle that tests strategies
Junio C Hamano [Fri, 19 Jul 2019 18:30:23 +0000 (11:30 -0700)]
Merge branch 'jl/status-reduce-vertical-blank'
Extra blank lines in "git status" output have been reduced.
* jl/status-reduce-vertical-blank:
status: remove the empty line after hints
Junio C Hamano [Fri, 19 Jul 2019 18:30:22 +0000 (11:30 -0700)]
Merge branch 'pw/rebase-progress-test-cleanup'
Test cleanup.
* pw/rebase-progress-test-cleanup:
t3420: remove progress lines before comparing output
Junio C Hamano [Fri, 19 Jul 2019 18:30:22 +0000 (11:30 -0700)]
Merge branch 'pw/prompt-cherry-pick-revert-fix'
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
Junio C Hamano [Fri, 19 Jul 2019 18:30:22 +0000 (11:30 -0700)]
Merge branch 'ew/repack-with-bitmaps-by-default'
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
Junio C Hamano [Fri, 19 Jul 2019 18:30:21 +0000 (11:30 -0700)]
Merge branch 'jk/check-connected-with-alternates'
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
Junio C Hamano [Fri, 19 Jul 2019 18:30:21 +0000 (11:30 -0700)]
Merge branch 'nd/tree-walk-with-repo'
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()
Junio C Hamano [Fri, 19 Jul 2019 18:30:21 +0000 (11:30 -0700)]
Merge branch 'ra/cherry-pick-revert-skip'
"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
Junio C Hamano [Fri, 19 Jul 2019 18:30:21 +0000 (11:30 -0700)]
Merge branch 'tb/ref-filter-multiple-patterns'
"git for-each-ref" with multiple patterns have been optimized.
* tb/ref-filter-multiple-patterns:
ref-filter.c: find disjoint pattern prefixes
Junio C Hamano [Fri, 19 Jul 2019 18:30:20 +0000 (11:30 -0700)]
Merge branch 'pw/status-with-corrupt-sequencer-state'
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
Junio C Hamano [Fri, 19 Jul 2019 18:30:20 +0000 (11:30 -0700)]
Merge branch 'ds/commit-graph-incremental'
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
Junio C Hamano [Fri, 19 Jul 2019 18:30:20 +0000 (11:30 -0700)]
Merge branch 'br/blame-ignore'
"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()
Junio C Hamano [Fri, 19 Jul 2019 18:30:19 +0000 (11:30 -0700)]
Merge branch 'cc/test-oidmap'
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
Junio C Hamano [Fri, 19 Jul 2019 18:30:19 +0000 (11:30 -0700)]
Merge branch 'ds/midx-expire-repack'
"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
Junio C Hamano [Thu, 11 Jul 2019 22:17:22 +0000 (15:17 -0700)]
The fifth batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 11 Jul 2019 22:16:49 +0000 (15:16 -0700)]
Merge branch 'js/mingw-use-utf8'
Windows update.
* js/mingw-use-utf8:
mingw: fix possible buffer overrun when calling `GetUserNameW()`
mingw: use Unicode functions explicitly
mingw: get pw_name in UTF-8 format
Junio C Hamano [Thu, 11 Jul 2019 22:16:49 +0000 (15:16 -0700)]
Merge branch 'sg/ci-brew-gcc-workaround'
Dev support update.
* sg/ci-brew-gcc-workaround:
ci/lib.sh: update a comment about installed P4 and Git-LFS versions
ci: disable Homebrew's auto cleanup
ci: don't update Homebrew
Junio C Hamano [Thu, 11 Jul 2019 22:16:49 +0000 (15:16 -0700)]
Merge branch 'kb/windows-force-utf8'
Windows update.
* kb/windows-force-utf8:
gettext: always use UTF-8 on native Windows
Junio C Hamano [Thu, 11 Jul 2019 22:16:49 +0000 (15:16 -0700)]
Merge branch 'dr/progress-i18n'
Progress messages have been made localizable.
* dr/progress-i18n:
l10n: localizable upload progress messages
Junio C Hamano [Thu, 11 Jul 2019 22:16:48 +0000 (15:16 -0700)]
Merge branch 'qn/clone-doc-use-long-form'
The "git clone" documentation refers to command line options in its
description in the short form; they have been replaced with long
forms to make them more recognisable.
* qn/clone-doc-use-long-form:
docs: git-clone: list short form of options first
docs: git-clone: refer to long form of options
Junio C Hamano [Thu, 11 Jul 2019 22:16:48 +0000 (15:16 -0700)]
Merge branch 'js/rebase-reschedule-applies-only-to-interactive'
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
Junio C Hamano [Thu, 11 Jul 2019 22:16:48 +0000 (15:16 -0700)]
Merge branch 'sg/git-C-empty-doc'
Doc update.
* sg/git-C-empty-doc:
Document that 'git -C ""' works and doesn't change directory
Junio C Hamano [Thu, 11 Jul 2019 22:16:47 +0000 (15:16 -0700)]
Merge branch 'jt/t5551-test-chunked'
Update smart-http test.
* jt/t5551-test-chunked:
t5551: test usage of chunked encoding explicitly
Junio C Hamano [Thu, 11 Jul 2019 22:16:47 +0000 (15:16 -0700)]
Merge branch 'js/mingw-gcc-stack-protect'
Windows update.
* js/mingw-gcc-stack-protect:
mingw: enable stack smashing protector
Junio C Hamano [Thu, 11 Jul 2019 22:16:47 +0000 (15:16 -0700)]
Merge branch 'cb/windows-manifest'
Windows update.
* cb/windows-manifest:
mingw: embed a manifest to trick UAC into Doing The Right Thing
Josh Steadmon [Tue, 9 Jul 2019 23:09:01 +0000 (16:09 -0700)]
trace2: correct trace2 field name documentation
Correct the api-trace2 documentation, which lists "signal" as an
expected field for the signal event type, but which actually outputs
"signo" as the field name.
Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 9 Jul 2019 22:48:36 +0000 (15:48 -0700)]
The fourth batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 9 Jul 2019 22:25:46 +0000 (15:25 -0700)]
Merge branch 'ds/fetch-disable-force-notice'
"git fetch" and "git pull" reports when a fetch results in
non-fast-forward updates to let the user notice unusual situation.
The commands learned "--no-shown-forced-updates" option to disable
this safety feature.
* ds/fetch-disable-force-notice:
pull: add --[no-]show-forced-updates passthrough
fetch: warn about forced updates in branch listing
fetch: add --[no-]show-forced-updates argument
Junio C Hamano [Tue, 9 Jul 2019 22:25:46 +0000 (15:25 -0700)]
Merge branch 'jh/status-aheadbehind'
"git status" can be told a non-standard default value for the
"--[no-]ahead-behind" option with a new configuration variable
status.aheadBehind.
* jh/status-aheadbehind:
status: ignore status.aheadbehind in porcelain formats
status: warn when a/b calculation takes too long
status: add status.aheadbehind setting
Junio C Hamano [Tue, 9 Jul 2019 22:25:46 +0000 (15:25 -0700)]
Merge branch 'sg/t5551-fetch-smart-error-is-translated'
Test update.
* sg/t5551-fetch-smart-error-is-translated:
t5551: use 'test_i18ngrep' to check translated output
Junio C Hamano [Tue, 9 Jul 2019 22:25:46 +0000 (15:25 -0700)]
Merge branch 'ms/submodule-foreach-fix'
"git submodule foreach" did not protect command line options passed
to the command to be run in each submodule correctly, when the
"--recursive" option was in use.
* ms/submodule-foreach-fix:
submodule foreach: fix recursion of options
Junio C Hamano [Tue, 9 Jul 2019 22:25:45 +0000 (15:25 -0700)]
Merge branch 'jh/msvc'
Support to build with MSVC has been updated.
* jh/msvc:
msvc: ignore .dll and incremental compile output
msvc: avoid debug assertion windows in Debug Mode
msvc: do not pretend to support all signals
msvc: add pragmas for common warnings
msvc: add a compile-time flag to allow detailed heap debugging
msvc: support building Git using MS Visual C++
msvc: update Makefile to allow for spaces in the compiler path
msvc: fix detect_msys_tty()
msvc: define ftello()
msvc: do not re-declare the timespec struct
msvc: mark a variable as non-const
msvc: define O_ACCMODE
msvc: include sigset_t definition
msvc: fix dependencies of compat/msvc.c
mingw: replace mingw_startup() hack
obstack: fix compiler warning
cache-tree/blame: avoid reusing the DEBUG constant
t0001 (mingw): do not expect a specific order of stdout/stderr
Mark .bat files as requiring CR/LF endings
mingw: fix a typo in the msysGit-specific section
Junio C Hamano [Tue, 9 Jul 2019 22:25:45 +0000 (15:25 -0700)]
Merge branch 'sg/rebase-progress'
Use "Erase in Line" CSI sequence that is already used in the editor
support to clear cruft in the progress output.
* sg/rebase-progress:
progress: use term_clear_line()
rebase: fix garbled progress display with '-x'
pager: add a helper function to clear the last line in the terminal
t3404: make the 'rebase.missingCommitsCheck=ignore' test more focused
t3404: modernize here doc style
Junio C Hamano [Tue, 9 Jul 2019 22:25:45 +0000 (15:25 -0700)]
Merge branch 'jw/gitweb-sample-update'
Doc update.
* jw/gitweb-sample-update:
doc: don't use git.kernel.org as example gitweb URL
Junio C Hamano [Tue, 9 Jul 2019 22:25:44 +0000 (15:25 -0700)]
Merge branch 'js/t0001-case-insensitive'
Test update.
* js/t0001-case-insensitive:
t0001: fix on case-insensitive filesystems
Junio C Hamano [Tue, 9 Jul 2019 22:25:44 +0000 (15:25 -0700)]
Merge branch 'cc/first-contrib-tutorial'
Update docs used in a tutorial.
* cc/first-contrib-tutorial:
doc: improve usage string in MyFirstContribution
Junio C Hamano [Tue, 9 Jul 2019 22:25:44 +0000 (15:25 -0700)]
Merge branch 'ab/fail-prereqs-in-test'
Test updates.
* ab/fail-prereqs-in-test:
tests: mark two failing tests under FAIL_PREREQS
Junio C Hamano [Tue, 9 Jul 2019 22:25:44 +0000 (15:25 -0700)]
Merge branch 'nd/switch-and-restore'
Two new commands "git switch" and "git restore" are introduced to
split "checking out a branch to work on advancing its history" and
"checking out paths out of the index and/or a tree-ish to work on
advancing the current history" out of the single "git checkout"
command.
* nd/switch-and-restore: (46 commits)
completion: disable dwim on "git switch -d"
switch: allow to switch in the middle of bisect
t2027: use test_must_be_empty
Declare both git-switch and git-restore experimental
help: move git-diff and git-reset to different groups
doc: promote "git restore"
user-manual.txt: prefer 'merge --abort' over 'reset --hard'
completion: support restore
t: add tests for restore
restore: support --patch
restore: replace --force with --ignore-unmerged
restore: default to --source=HEAD when only --staged is specified
restore: reject invalid combinations with --staged
restore: add --worktree and --staged
checkout: factor out worktree checkout code
restore: disable overlay mode by default
restore: make pathspec mandatory
restore: take tree-ish from --source option instead
checkout: split part of it to new command 'restore'
doc: promote "git switch"
...
Junio C Hamano [Tue, 9 Jul 2019 22:25:43 +0000 (15:25 -0700)]
Merge branch 'nd/fetch-capability-tweak'
Protocol capabilities that go over wire should never be translated,
but it was incorrectly marked for translation, which has been
corrected. The output of protocol capabilities for debugging has
been tweaked a bit.
* nd/fetch-capability-tweak:
fetch-pack: print server version at the top in -v -v
fetch-pack: print all relevant supported capabilities with -v -v
fetch-pack: move capability names out of i18n strings
Junio C Hamano [Tue, 9 Jul 2019 22:25:43 +0000 (15:25 -0700)]
Merge branch 'jk/oidhash'
Code clean-up to remove hardcoded SHA-1 hash from many places.
* jk/oidhash:
hashmap: convert sha1hash() to oidhash()
hash.h: move object_id definition from cache.h
khash: rename oid helper functions
khash: drop sha1-specific map types
pack-bitmap: convert khash_sha1 maps into kh_oid_map
delta-islands: convert island_marks khash to use oids
khash: rename kh_oid_t to kh_oid_set
khash: drop broken oid_map typedef
object: convert create_object() to use object_id
object: convert internal hash_obj() to object_id
object: convert lookup_object() to use object_id
object: convert lookup_unknown_object() to use object_id
pack-objects: convert locate_object_entry_hash() to object_id
pack-objects: convert packlist_find() to use object_id
pack-bitmap-write: convert some helpers to use object_id
upload-pack: rename a "sha1" variable to "oid"
describe: fix accidental oid/hash type-punning
Junio C Hamano [Tue, 9 Jul 2019 22:25:43 +0000 (15:25 -0700)]
Merge branch 'jk/delta-islands-progress-fix'
The codepath to compute delta islands used to spew progress output
without giving the callers any way to squelch it, which has been
fixed.
* jk/delta-islands-progress-fix:
delta-islands: respect progress flag
Junio C Hamano [Tue, 9 Jul 2019 22:25:42 +0000 (15:25 -0700)]
Merge branch 'md/sort-detached-head-first'
"git branch --list" learned to always output the detached HEAD as
the first item (when the HEAD is detached, of course), regardless
of the locale.
* md/sort-detached-head-first:
ref-filter: sort detached HEAD lines firstly
Junio C Hamano [Tue, 9 Jul 2019 22:25:42 +0000 (15:25 -0700)]
Merge branch 'nd/fetch-multi-gc-once'
"git fetch" that grabs from a group of remotes learned to run the
auto-gc only once at the very end.
* nd/fetch-multi-gc-once:
fetch: only run 'gc' once when fetching multiple remotes
Junio C Hamano [Tue, 9 Jul 2019 22:25:42 +0000 (15:25 -0700)]
Merge branch 'es/rev-list-no-object-names'
"git rev-list --objects" learned with "--no-object-names" option to
squelch the path to the object that is used as a grouping hint for
pack-objects.
* es/rev-list-no-object-names:
rev-list: teach --no-object-names to enable piping
Junio C Hamano [Tue, 9 Jul 2019 22:25:41 +0000 (15:25 -0700)]
Merge branch 'rs/config-unit-parsing'
The code to parse scaled numbers out of configuration files has
been made more robust and also easier to follow.
* rs/config-unit-parsing:
config: simplify parsing of unit factors
config: don't multiply in parse_unit_factor()
config: use unsigned_mult_overflows to check for overflows
Junio C Hamano [Tue, 9 Jul 2019 22:25:41 +0000 (15:25 -0700)]
Merge branch 'js/gcc-8-and-9'
Code clean-up for new compilers.
* js/gcc-8-and-9:
config: avoid calling `labs()` on too-large data type
winansi: simplify loading the GetCurrentConsoleFontEx() function
kwset: allow building with GCC 8
poll (mingw): allow compiling with GCC 8 and DEVELOPER=1
Junio C Hamano [Tue, 9 Jul 2019 22:25:41 +0000 (15:25 -0700)]
Merge branch 'dl/includeif-onbranch'
The conditional inclusion mechanism learned to base the choice on
the branch the HEAD currently is on.
* dl/includeif-onbranch:
config: learn the "onbranch:" includeIf condition
Junio C Hamano [Tue, 9 Jul 2019 22:25:41 +0000 (15:25 -0700)]
Merge branch 'pw/rebase-abort-clean-rewritten'
"git rebase --abort" used to leave refs/rewritten/ when concluding
"git rebase -r", which has been corrected.
* pw/rebase-abort-clean-rewritten:
rebase --abort/--quit: cleanup refs/rewritten
sequencer: return errors from sequencer_remove_state()
rebase: warn if state directory cannot be removed
rebase: fix a memory leak
Junio C Hamano [Tue, 9 Jul 2019 22:25:40 +0000 (15:25 -0700)]
Merge branch 'am/p4-branches-excludes'
"git p4" update.
* am/p4-branches-excludes:
git-p4: respect excluded paths when detecting branches
git-p4: add failing test for "git-p4: respect excluded paths when detecting branches"
git-p4: don't exclude other files with same prefix
git-p4: add failing test for "don't exclude other files with same prefix"
git-p4: don't groom exclude path list on every commit
git-p4: match branches case insensitively if configured
git-p4: add failing test for "git-p4: match branches case insensitively if configured"
git-p4: detect/prevent infinite loop in gitCommitByP4Change()
Junio C Hamano [Tue, 9 Jul 2019 22:25:40 +0000 (15:25 -0700)]
Merge branch 'tg/stash-ref-by-index-fix'
"git stash show 23" used to work, but no more after getting
rewritten in C; this regression has been corrected.
* tg/stash-ref-by-index-fix:
stash: fix show referencing stash index
Junio C Hamano [Tue, 9 Jul 2019 22:25:40 +0000 (15:25 -0700)]
Merge branch 'cb/mkstemps-uint-type-fix'
Variable type fix.
* cb/mkstemps-uint-type-fix:
wrapper: avoid undefined behaviour in macOS
Junio C Hamano [Tue, 9 Jul 2019 22:25:40 +0000 (15:25 -0700)]
Merge branch 'jk/trailers-use-config'
"git interpret-trailers" always treated '#' as the comment
character, regardless of core.commentChar setting, which has been
corrected.
* jk/trailers-use-config:
interpret-trailers: load default config
Junio C Hamano [Tue, 9 Jul 2019 22:25:39 +0000 (15:25 -0700)]
Merge branch 'js/t3404-typofix'
Typofix.
* js/t3404-typofix:
t3404: fix a typo
Junio C Hamano [Tue, 9 Jul 2019 22:25:38 +0000 (15:25 -0700)]
Merge branch 'pw/doc-synopsis-markup-opmode-options'
Docfix.
* pw/doc-synopsis-markup-opmode-options:
show --continue/skip etc. consistently in synopsis
Junio C Hamano [Tue, 9 Jul 2019 22:25:38 +0000 (15:25 -0700)]
Merge branch 'rs/copy-array'
Code clean-up.
* rs/copy-array:
use COPY_ARRAY for copying arrays
coccinelle: use COPY_ARRAY for copying arrays
Junio C Hamano [Tue, 9 Jul 2019 22:25:38 +0000 (15:25 -0700)]
Merge branch 'cb/fsmonitor-intfix'
Variable type fix.
* cb/fsmonitor-intfix:
fsmonitor: avoid signed integer overflow / infinite loop
Junio C Hamano [Tue, 9 Jul 2019 22:25:37 +0000 (15:25 -0700)]
Merge branch 'rs/avoid-overflow-in-midpoint-computation'
Code clean-up to avoid signed integer overlaps during binary search.
* rs/avoid-overflow-in-midpoint-computation:
cleanup: fix possible overflow errors in binary search, part 2
Junio C Hamano [Tue, 9 Jul 2019 22:25:37 +0000 (15:25 -0700)]
Merge branch 'pw/add-p-recount'
"git checkout -p" needs to selectively apply a patch in reverse,
which did not work well.
* pw/add-p-recount:
add -p: fix checkout -p with pathological context
Junio C Hamano [Tue, 9 Jul 2019 22:25:37 +0000 (15:25 -0700)]
Merge branch 'ds/close-object-store'
The commit-graph file is now part of the "files that the runtime
may keep open file descriptors on, all of which would need to be
closed when done with the object store", and the file descriptor to
an existing commit-graph file now is closed before "gc" finalizes a
new instance to replace it.
* ds/close-object-store:
packfile: rename close_all_packs to close_object_store
packfile: close commit-graph in close_all_packs
commit-graph: use raw_object_store when closing
Junio C Hamano [Tue, 9 Jul 2019 22:25:36 +0000 (15:25 -0700)]
Merge branch 'ds/commit-graph-write-refactor'
Renamed from commit-graph-format-v2 and changed scope.
* ds/commit-graph-write-refactor:
commit-graph: extract write_commit_graph_file()
commit-graph: extract copy_oids_to_commits()
commit-graph: extract count_distinct_commits()
commit-graph: extract fill_oids_from_all_packs()
commit-graph: extract fill_oids_from_commit_hex()
commit-graph: extract fill_oids_from_packs()
commit-graph: create write_commit_graph_context
commit-graph: remove Future Work section
commit-graph: collapse parameters into flags
commit-graph: return with errors during write
commit-graph: fix the_repository reference
Junio C Hamano [Tue, 9 Jul 2019 22:25:36 +0000 (15:25 -0700)]
Merge branch 'sg/trace2-rename'
Dev support update to help tracing out tests.
* sg/trace2-rename:
trace2: correct typo in technical documentation
Revert "test-lib: whitelist GIT_TR2_* in the environment"
Junio C Hamano [Tue, 9 Jul 2019 22:25:35 +0000 (15:25 -0700)]
Merge branch 'nd/completion-no-cache-failure'
An incorrect list of options was cached after command line
completion failed (e.g. trying to complete a command that requires
a repository outside one), which has been corrected.
* nd/completion-no-cache-failure:
completion: do not cache if --git-completion-helper fails
Junio C Hamano [Tue, 9 Jul 2019 22:25:35 +0000 (15:25 -0700)]
Merge branch 'js/mergetool-optim'
"git mergetool" and its tests now spawn fewer subprocesses.
* js/mergetool-optim:
mergetool: use shell variable magic instead of `awk`
mergetool: dissect strings with shell variable magic instead of `expr`
t7610-mergetool: use test_cmp instead of test $(cat file) = $txt
t7610-mergetool: do not place pipelines headed by `yes` in subshells
Junio C Hamano [Tue, 9 Jul 2019 22:25:35 +0000 (15:25 -0700)]
Merge branch 'mo/hpux-dynpath'
Auto-detect how to tell HP-UX aCC where to use dynamically linked
libraries from at runtime.
* mo/hpux-dynpath:
configure: Detect linking style for HP aCC on HP-UX
Junio C Hamano [Tue, 9 Jul 2019 22:25:35 +0000 (15:25 -0700)]
Merge branch 'dl/config-alias-doc'
Doc update.
* dl/config-alias-doc:
config/alias.txt: document alias accepting non-command first word
config/alias.txt: change " and ' to `
Junio C Hamano [Tue, 9 Jul 2019 22:25:34 +0000 (15:25 -0700)]
Merge branch 'tm/tag-gpgsign-config'
A new tag.gpgSign configuration variable turns "git tag -a" into
"git tag -s".
* tm/tag-gpgsign-config:
tag: add tag.gpgSign config option to force all tags be GPG-signed
Junio C Hamano [Tue, 9 Jul 2019 22:25:34 +0000 (15:25 -0700)]
Merge branch 'fc/fetch-with-import-fix'
Code restructuring during 2.20 period broke fetching tags via
"import" based transports.
* fc/fetch-with-import-fix:
fetch: fix regression with transport helpers
fetch: make the code more understandable
fetch: trivial cleanup
t5801 (remote-helpers): add test to fetch tags
t5801 (remote-helpers): cleanup refspec stuff
Junio C Hamano [Tue, 9 Jul 2019 22:25:34 +0000 (15:25 -0700)]
Merge branch 'po/doc-branch'
Doc update.
* po/doc-branch:
doc branch: provide examples for listing remote tracking branches
Junio C Hamano [Tue, 9 Jul 2019 22:25:33 +0000 (15:25 -0700)]
Merge branch 'nb/branch-show-other-worktrees-head'
"git branch --list" learned to show branches that are checked out
in other worktrees connected to the same repository prefixed with
'+', similar to the way the currently checked out branch is shown
with '*' in front.
* nb/branch-show-other-worktrees-head:
branch: add worktree info on verbose output
branch: update output to include worktree info
ref-filter: add worktreepath atom
Edmundo Carmona Antoranz [Tue, 9 Jul 2019 03:15:59 +0000 (21:15 -0600)]
builtin/merge.c - cleanup of code in for-cycle that tests strategies
The cmd_merge() function has a loop that tries different
merge strategies in turn, and stops when a strategy gets a
clean merge, while keeping the "best" conflicted merge so
far.
Make the loop easier to follow by moving the code around,
ensuring that there is only one "break" in the loop where
an automerge succeeds. Also group the actions that are
performed after an automerge succeeds together to a single
location, outside and after the loop.
Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood [Thu, 4 Jul 2019 09:47:02 +0000 (02:47 -0700)]
t3420: remove progress lines before comparing output
Some of the tests check the output of rebase is what we expect. These
were added after a regression that added unwanted stash output when
using --autostash. They are useful as they prevent unintended changes to
the output of the various rebase commands. However they also include all
the progress output which is less useful as it only tests what would be
written to a dumb terminal which is not the normal use case. The recent
changes to fix clearing the line when printing progress necessarily
meant making an ugly change to these tests. Address this my removing the
progress output before comparing it to the expected output. We do this
by removing everything before the final "\r" on each line as we don't
care about the progress indicator, but we do care about what is printed
immediately after it.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Karsten Blees [Thu, 4 Jul 2019 09:20:33 +0000 (02:20 -0700)]
mingw: initialize HOME on startup
HOME initialization was historically duplicated in many different places,
including /etc/profile, launch scripts such as git-bash.vbs and gitk.cmd,
and (although slightly broken) in the git-wrapper.
Even unrelated projects such as GitExtensions and TortoiseGit need to
implement the same logic to be able to call git directly.
Initialize HOME in git's own startup code so that we can eventually retire
all the duplicate initialization code.
Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin [Thu, 4 Jul 2019 22:36:57 +0000 (15:36 -0700)]
mingw: fix possible buffer overrun when calling `GetUserNameW()`
In
39a98e9b68b8 (mingw: get pw_name in UTF-8 format, 2019-06-27), this
developer missed the fact that the `GetUserNameW()` function takes the
number of characters as `len` parameter, not the number of bytes.
Reported-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor [Sat, 6 Jul 2019 16:21:14 +0000 (18:21 +0200)]
ci/lib.sh: update a comment about installed P4 and Git-LFS versions
A comment in 'ci/lib.sh' claims that the "OS X build installs the
latest available versions" of P4 and Git-LFS, but since
f2f47150
("ci: don't update Homebrew", 2019-07-03) that's no longer the case,
as it will install the versions which were recorded in the image's
Homebrew database when the image was created.
Update this comment accordingly.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Karsten Blees [Wed, 3 Jul 2019 20:46:04 +0000 (13:46 -0700)]
gettext: always use UTF-8 on native Windows
On native Windows, Git exclusively uses UTF-8 for console output (both
with MinTTY and native Win32 Console). Gettext uses `setlocale()` to
determine the output encoding for translated text, however, MSVCRT's
`setlocale()` does not support UTF-8. As a result, translated text is
encoded in system encoding (as per `GetAPC()`), and non-ASCII chars are
mangled in console output.
Side note: There is actually a code page for UTF-8: 65001. In practice,
it does not work as expected at least on Windows 7, though, so we cannot
use it in Git. Besides, if we overrode the code page, any process
spawned from Git would inherit that code page (as opposed to the code
page configured for the current user), which would quite possibly break
e.g. diff or merge helpers. So we really cannot override the code page.
In `init_gettext_charset()`, Git calls gettext's
`bind_textdomain_codeset()` with the character set obtained via
`locale_charset()`; Let's override that latter function to force the
encoding to UTF-8 on native Windows.
In Git for Windows' SDK, there is a `libcharset.h` and therefore we
define `HAVE_LIBCHARSET_H` in the MINGW-specific section in
`config.mak.uname`, therefore we need to add the override before that
conditionally-compiled code block.
Rather than simply defining `locale_charset()` to return the string
`"UTF-8"`, though, we are careful not to break `LC_ALL=C`: the
`ab/no-kwset` patch series, for example, needs to have a way to prevent
Git from expecting UTF-8-encoded input.
Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor [Wed, 3 Jul 2019 10:47:48 +0000 (12:47 +0200)]
ci: disable Homebrew's auto cleanup
Lately Homebrew learned to automagically clean up information about
outdated packages during other 'brew' commands, which might be useful
for the avarage user, but is a waste of time in CI build jobs, because
the next build jobs will start from the exact same image containing
the same outdated packages anyway.
Export HOMEBREW_NO_INSTALL_CLEANUP=1 to disable this auto cleanup feature,
shaving off about 20-30s from the time needed to install dependencies
in our macOS build jobs on Travis CI.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor [Wed, 3 Jul 2019 10:47:47 +0000 (12:47 +0200)]
ci: don't update Homebrew
Lately our GCC macOS build job on Travis CI has been erroring out
while installing dependencies with:
+brew link gcc@8
Error: No such keg: /usr/local/Cellar/gcc@8
The command "ci/install-dependencies.sh" failed and exited with 1 during .
Now, while gcc@8 is still pre-installed (but not linked) and would be
perfectly usable in the Travis CI macOS image we use [1], it's at
version 8.2. However, when installing dependencies we first
explicitly run 'brew update', which spends over two minutes to update
itself and information about the available packages, and it learns
about GCC 8.3. After that point gcc@8 exclusively refers to v8.3,
and, unfortunately, 'brew' is just too dumb to be able to do anything
with the still installed 8.2 package, and the subsequent 'brew link
gcc@8' fails. (Even 'brew uninstall gcc@8' fails with the same
error!)
Don't run 'brew update' to keep the already installed GCC 8.2 'brew
link'-able. Note that in addition we have to 'export
HOMEBREW_NO_AUTO_UPDATE=1' first, because 'brew' is so very helpful
that it would implicitly run update for us on the next 'brew install
<pkg>' otherwise.
Disabling 'brew update' has additional benefits:
- It shaves off 2-3mins from the ~4mins currently spent on
installing dependencies, and the macOS build jobs have always been
prone to exceeding the time limit on Travis CI.
- Our builds won't suddenly break because of the occasional Homebrew
breakages [2].
The drawback is that we'll be stuck with slightly older versions of
the packages that we install via Homebrew (Git-LFS 2.5.2 and Perforce
2018.1; they are currently at 2.7.2 and 2019.1, respectively). We
might want to reconsider this decision as time goes on and/or switch
to a more recent macOS image as they become available.
[1]
2000ac9fbf (travis-ci: switch to Xcode 10.1 macOS image,
2019-01-17)
[2] See e.g.
a1ccaedd62 (travis-ci: make the OSX build jobs' 'brew
update' more quiet, 2019-02-02) or
https://public-inbox.org/git/
20180907032002.23366-1-szeder.dev@gmail.com/T/#+u
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Dimitriy Ryazantcev [Tue, 2 Jul 2019 18:22:48 +0000 (21:22 +0300)]
l10n: localizable upload progress messages
Currenly the data rate in throughput_string(...) method is
output by simple strbuf_humanise_bytes(...) call and '/s' append.
But for proper translation of such string the translator needs
full context.
Add strbuf_humanise_rate(...) method to properly print out
localizable version of data rate ('3.5 MiB/s' etc) with full context.
Strings with the units in strbuf_humanise_bytes(...) are marked
for translation.
Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Quentin Nerden [Tue, 2 Jul 2019 14:37:41 +0000 (07:37 -0700)]
docs: git-clone: list short form of options first
List the short form of options (e.g.: '-l') before the long form (e.g.
'--local').
This is to match the doc of git-add, git-commit, git-clean, git-branch...
Signed-off-by: Quentin Nerden <quentin.nerden@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Quentin Nerden [Tue, 2 Jul 2019 14:37:40 +0000 (07:37 -0700)]
docs: git-clone: refer to long form of options
To make the doc of git-clone easier to read,
refer to the long form of the options
(it is easier to guess what '--verbose' is doing than '-v').
Signed-off-by: Quentin Nerden <quentin.nerden@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Rohit Ashiwal [Tue, 2 Jul 2019 09:11:29 +0000 (14:41 +0530)]
cherry-pick/revert: advise using --skip
The previous commit introduced a --skip flag for cherry-pick and
revert. Update the advice messages, to tell users about this less
cumbersome way of skipping commits. Also add tests to ensure
everything is working fine.
Signed-off-by: Rohit Ashiwal <rohit.ashiwal265@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Rohit Ashiwal [Tue, 2 Jul 2019 09:11:28 +0000 (14:41 +0530)]
cherry-pick/revert: add --skip option
git am or rebase have a --skip flag to skip the current commit if the
user wishes to do so. During a cherry-pick or revert a user could
likewise skip a commit, but needs to use 'git reset' (or in the case
of conflicts 'git reset --merge'), followed by 'git (cherry-pick |
revert) --continue' to skip the commit. This is more annoying and
sometimes confusing on the users' part. Add a `--skip` option to make
skipping commits easier for the user and to make the commands more
consistent.
In the next commit, we will change the advice messages hence finishing
the process of teaching revert and cherry-pick "how to skip commits".
Signed-off-by: Rohit Ashiwal <rohit.ashiwal265@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Rohit Ashiwal [Tue, 2 Jul 2019 09:11:27 +0000 (14:41 +0530)]
sequencer: use argv_array in reset_merge
Avoid using magic numbers for array size and index under `reset_merge`
function. Use `argv_array` instead. This will make code shorter and
easier to extend.
Signed-off-by: Rohit Ashiwal <rohit.ashiwal265@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Rohit Ashiwal [Tue, 2 Jul 2019 09:11:26 +0000 (14:41 +0530)]
sequencer: rename reset_for_rollback to reset_merge
We are on a path to teach cherry-pick/revert how to skip commits. To
achieve this, we could really make use of existing functions.
reset_for_rollback is one such function, but the name does not
intuitively suggest to use it to reset a merge, which it was born to
perform, see
539047c ("revert: introduce --abort to cancel a failed
cherry-pick", 2011-11-23). Change the name to reset_merge to make
it more intuitive.
Signed-off-by: Rohit Ashiwal <rohit.ashiwal265@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Rohit Ashiwal [Tue, 2 Jul 2019 09:11:25 +0000 (14:41 +0530)]
sequencer: add advice for revert
In the case of merge conflicts, while performing a revert, we are
currently advised to use `git cherry-pick --<sequencer-options>`.
Introduce a separate advice message for `git revert`. Also change
the signature of `create_seq_dir` to handle which advice to display
selectively.
Signed-off-by: Rohit Ashiwal <rohit.ashiwal265@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee [Mon, 1 Jul 2019 13:16:19 +0000 (06:16 -0700)]
t5319: use 'test-tool path-utils' instead of 'ls -l'
Using 'ls -l' and parsing the columns to find file sizes is
problematic when the platform could report the owner as a name
with spaces. Instead, use the 'test-tool path-utils file-size'
command to list only the sizes.
Reported-by: Johannes Sixt <j6t@kdbg.org>
Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood [Mon, 1 Jul 2019 14:21:06 +0000 (07:21 -0700)]
git-prompt: improve cherry-pick/revert detection
If the user commits or resets a conflict resolution in the middle of a
sequence of cherry-picks or reverts then CHERRY_PICK_HEAD/REVERT_HEAD
will be removed and so in the absence of those files we need to check
.git/sequencer/todo to see if there is a cherry-pick or revert in
progress.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Platings [Sun, 30 Jun 2019 18:17:32 +0000 (19:17 +0100)]
t8014: remove unnecessary braces
Signed-off-by: Michael Platings <michael@platin.gs>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor [Sat, 29 Jun 2019 08:24:57 +0000 (10:24 +0200)]
Document that 'git -C ""' works and doesn't change directory
It's been behaving so since
6a536e2076 (git: treat "git -C '<path>'"
as a no-op when <path> is empty, 2015-03-06).
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Eric Wong [Sat, 29 Jun 2019 19:13:59 +0000 (19:13 +0000)]
repack: disable bitmaps-by-default if .keep files exist
Bitmaps aren't useful with multiple packs, and users with
.keep files ended up with redundant packs when bitmaps
got enabled by default in bare repos.
So detect when .keep files exist and stop enabling bitmaps
by default in that case.
Wasteful (but otherwise harmless) race conditions with .keep files
documented by Jeff King still apply and there's a chance we'd
still end up with redundant data on the FS:
https://public-inbox.org/git/
20190623224244.GB1100@sigill.intra.peff.net/
v2: avoid subshell in test case, be multi-index aware
Fixes:
36eba0323d3288a8 ("repack: enable bitmaps by default on bare repos")
Signed-off-by: Eric Wong <e@80x24.org>
Helped-by: Jeff King <peff@peff.net>
Reported-by: Janos Farkas <chexum@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Couder [Sat, 29 Jun 2019 07:57:47 +0000 (09:57 +0200)]
t0016: add 'remove' subcommand test
Testing the 'remove' subcommand was forgotten when t0016
was created. Let's fix that.
Helped-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Couder [Sat, 29 Jun 2019 07:57:46 +0000 (09:57 +0200)]
test-oidmap: remove 'add' subcommand
The 'add' subcommand is useless as it is mostly identical
to the 'put' subcommand, so let's remove it.
Helped-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 1 Jul 2019 13:18:15 +0000 (09:18 -0400)]
check_everything_connected: assume alternate ref tips are valid
When we receive a remote ref update to sha1 "X", we want to check that
we have all of the objects needed by "X". We can assume that our
repository is not currently corrupted, and therefore if we have a ref
pointing at "Y", we have all of its objects. So we can stop our
traversal from "X" as soon as we hit "Y".
If we make the same non-corruption assumption about any repositories we
use to store alternates, then we can also use their ref tips to shorten
the traversal.
This is especially useful when cloning with "--reference", as we
otherwise do not have any local refs to check against, and have to
traverse the whole history, even though the other side may have sent us
few or no objects. Here are results for the included perf test (which
shows off more or less the maximal savings, getting one new commit and
sharing the whole history):
Test HEAD^ HEAD
--------------------------------------------------------------------
[on git.git]
5600.3: clone --reference 2.94(2.86+0.08) 0.09(0.08+0.01) -96.9%
[on linux.git]
5600.3: clone --reference 45.74(45.34+0.41) 0.36(0.30+0.08) -99.2%
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 1 Jul 2019 13:17:40 +0000 (09:17 -0400)]
object-store.h: move for_each_alternate_ref() from transport.h
There's nothing inherently transport-related about enumerating the
alternate ref tips. The code has lived in transport.[ch] because the
only use so far had been advertising available tips during transport.
But it could be used for more, and a future patch will teach rev-list to
access these refs.
Let's move it alongside the other alt-odb code, declaring it in
object-store.h with the implementation in sha1-file.c.
This lets us drop the inclusion of transport.h from receive-pack, which
perhaps shows how it was misplaced (though receive-pack is about
transporting objects, transport.h is mostly about the client side).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin [Mon, 1 Jul 2019 11:58:15 +0000 (04:58 -0700)]
rebase --am: ignore rebase.rescheduleFailedExec
The `exec` command is specific to the interactive backend, therefore it
does not make sense for non-interactive rebases to heed that config
setting.
We still want to error out if a non-interactive rebase is started with
`--reschedule-failed-exec`, of course.
Reported by Vas Sudanagunta via:
https://github.com/git/git/commit/
969de3ff0e0#commitcomment-
33257187
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Fri, 28 Jun 2019 06:24:57 +0000 (02:24 -0400)]
blame: drop some unused function parameters
These unused parameters were introduced recently as part of the
br/blame-ignore topic. I assume they are not indicative of bugs, but are
just leftovers from the development process (they were introduced by the
series but not used in any of its iterations).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy [Fri, 28 Jun 2019 09:35:28 +0000 (16:35 +0700)]
t7814: do not generate same commits in different repos
t7814 has repo tree like this
initial-repo
submodule
sub
In each repo 'submodule' and 'sub', a commit is made to add the same
initial file 'a' with the same message 'add a'. If tests run fast
enough, the two commits are made in the same second, resulting
identical commits.
There is nothing wrong with that per-se. But it could make the test
flaky. Currently all submodule odbs are merged back in the main
one (because we can't, or couldn't, access separate submodule repos
otherwise). But eventually we need to access objects from the right
repo.
Because the same commit could sometimes be present in both 'submodule'
and 'sub', if there is a bug looking up objects in the wrong repo,
sometimes it will go unnoticed because it finds the needed object in the
wrong repo anyway.
Fix this by changing commit time after every commit. This makes all
commits unique. Of course there are still identical blobs in different
repos, but because we often lookup commit first, then tree and blob,
unique commits are already quite safe.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Taylor Blau [Wed, 26 Jun 2019 22:41:48 +0000 (17:41 -0500)]
ref-filter.c: find disjoint pattern prefixes
Since
cfe004a5a9 (ref-filter: limit traversal to prefix, 2017-05-22),
the ref-filter code has sought to limit the traversals to a prefix of
the given patterns.
That code stopped short of handling more than one pattern, because it
means invoking 'for_each_ref_in' multiple times. If we're not careful
about which patterns overlap, we will output the same refs multiple
times.
For instance, consider the set of patterns 'refs/heads/a/*',
'refs/heads/a/b/c', and 'refs/tags/v1.0.0'. If we naïvely ran:
for_each_ref_in("refs/heads/a/*", ...);
for_each_ref_in("refs/heads/a/b/c", ...);
for_each_ref_in("refs/tags/v1.0.0", ...);
we would see 'refs/heads/a/b/c' (and everything underneath it) twice.
Instead, we want to partition the patterns into disjoint sets, where we
know that no ref will be matched by any two patterns in different sets.
In the above, these are:
- {'refs/heads/a/*', 'refs/heads/a/b/c'}, and
- {'refs/tags/v1.0.0'}
Given one of these disjoint sets, what is a suitable pattern to pass to
'for_each_ref_in'? One approach is to compute the longest common prefix
over all elements in that disjoint set, and let the caller cull out the
refs they didn't want. Computing the longest prefix means that in most
cases, we won't match too many things the caller would like to ignore.
The longest common prefixes of the above are:
- {'refs/heads/a/*', 'refs/heads/a/b/c'} -> refs/heads/a/*
- {'refs/tags/v1.0.0'} -> refs/tags/v1.0.0
We instead invoke:
for_each_ref_in("refs/heads/a/*", ...);
for_each_ref_in("refs/tags/v1.0.0", ...);
Which provides us with the refs we were looking for with a minimal
amount of extra cruft, but never a duplicate of the ref we asked for.
Implemented here is an algorithm which accomplishes the above, which
works as follows:
1. Lexicographically sort the given list of patterns.
2. Initialize 'prefix' to the empty string, where our goal is to
build each element in the above set of longest common prefixes.
3. Consider each pattern in the given set, and emit 'prefix' if it
reaches the end of a pattern, or touches a wildcard character. The
end of a string is treated as if it precedes a wildcard. (Note that
there is some room for future work to detect that, e.g., 'a?b' and
'abc' are disjoint).
4. Otherwise, recurse on step (3) with the slice of the list
corresponding to our current prefix (i.e., the subset of patterns
that have our prefix as a literal string prefix.)
This algorithm is 'O(kn + n log(n))', where 'k' is max(len(pattern)) for
each pattern in the list, and 'n' is len(patterns).
By discovering this set of interesting patterns, we reduce the runtime
of multi-pattern 'git for-each-ref' (and other ref traversals) from
O(N) to O(n log(N)), where 'N' is the total number of packed references.
Running 'git for-each-ref refs/tags/a refs/tags/b' on a repository with
10,000,000 refs in 'refs/tags/huge-N', my best-of-five times drop from:
real 0m5.805s
user 0m5.188s
sys 0m0.468s
to:
real 0m0.001s
user 0m0.000s
sys 0m0.000s
On linux.git, the times to dig out two of the latest -rc tags drops from
0.002s to 0.001s, so the change on repositories with fewer tags is much
less noticeable.
Co-authored-by: Jeff King <peff@peff.net>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>