summaryrefslogtreecommitdiff
path: root/builtin
AgeCommit message (Collapse)AuthorFilesLines
2018-11-13Merge branch 'jc/war-on-string-list'Libravatar Junio C Hamano1-46/+100
Replace three string-list instances used as look-up tables in "git fetch" with hashmaps. * jc/war-on-string-list: fetch: replace string-list used as a look-up table with a hashmap
2018-11-13Merge branch 'ag/rev-parse-all-exclude-fix'Libravatar Junio C Hamano1-0/+1
"git rev-parse --exclude=* --branches --branches" (i.e. first saying "add only things that do not match '*' out of all branches" and then adding all branches, without any exclusion this time") worked as expected, but "--exclude=* --all --all" did not work the same way, which has been fixed. * ag/rev-parse-all-exclude-fix: rev-parse: clear --exclude list after 'git rev-parse --all'
2018-11-13Merge branch 'ao/submodule-wo-gitmodules-checked-out'Libravatar Junio C Hamano2-3/+54
The submodule support has been updated to read from the blob at HEAD:.gitmodules when the .gitmodules file is missing from the working tree. * ao/submodule-wo-gitmodules-checked-out: t/helper: add test-submodule-nested-repo-config submodule: support reading .gitmodules when it's not in the working tree submodule: add a helper to check if it is safe to write to .gitmodules t7506: clean up .gitmodules properly before setting up new scenario submodule: use the 'submodule--helper config' command submodule--helper: add a new 'config' subcommand t7411: be nicer to future tests and really clean things up t7411: merge tests 5 and 6 submodule: factor out a config_set_in_gitmodules_file_gently function submodule: add a print_config_from_gitmodules() helper
2018-11-13Merge branch 'nb/worktree-api-doc'Libravatar Junio C Hamano1-5/+5
Code readability fix. * nb/worktree-api-doc: worktree: rename is_worktree_locked to worktree_lock_reason worktree: update documentation for lock_reason and lock_reason_valid
2018-11-13Merge branch 'ds/test-multi-pack-index'Libravatar Junio C Hamano1-2/+5
Tests for the recently introduced multi-pack index machinery. * ds/test-multi-pack-index: packfile: close multi-pack-index in close_all_packs multi-pack-index: define GIT_TEST_MULTI_PACK_INDEX midx: close multi-pack-index on repack midx: fix broken free() in close_midx()
2018-11-13Merge branch 'nd/per-worktree-config'Libravatar Junio C Hamano1-1/+18
A fourth class of configuration files (in addition to the traditional "system wide", "per user in the $HOME directory" and "per repository in the $GIT_DIR/config") has been introduced so that different worktrees that share the same repository (hence the same $GIT_DIR/config file) can use different customization. * nd/per-worktree-config: worktree: add per-worktree config files t1300: extract and use test_cmp_config()
2018-11-13Merge branch 'jk/proto-v2-ref-prefix-fix'Libravatar Junio C Hamano1-8/+5
"git ls-remote $there foo" was broken by recent update for the protocol v2 and stopped showing refs that match 'foo' that are not refs/{heads,tags}/foo, which has been fixed. * jk/proto-v2-ref-prefix-fix: ls-remote: pass heads/tags prefixes to transport ls-remote: do not send ref prefixes for patterns
2018-11-13Merge branch 'jk/detect-truncated-zlib-input'Libravatar Junio C Hamano1-4/+12
A regression in Git 2.12 era made "git fsck" fall into an infinite loop while processing truncated loose objects. * jk/detect-truncated-zlib-input: cat-file: handle streaming failures consistently check_stream_sha1(): handle input underflow t1450: check large blob in trailing-garbage test
2018-11-13Merge branch 'nd/config-split'Libravatar Junio C Hamano1-1/+14
Split the overly large Documentation/config.txt file into million little pieces. This potentially allows each individual piece included into the manual page of the command it affects more easily. * nd/config-split: (81 commits) config.txt: remove config/dummy.txt config.txt: move worktree.* to a separate file config.txt: move web.* to a separate file config.txt: move versionsort.* to a separate file config.txt: move user.* to a separate file config.txt: move url.* to a separate file config.txt: move uploadpack.* to a separate file config.txt: move uploadarchive.* to a separate file config.txt: move transfer.* to a separate file config.txt: move tag.* to a separate file config.txt: move submodule.* to a separate file config.txt: move stash.* to a separate file config.txt: move status.* to a separate file config.txt: move splitIndex.* to a separate file config.txt: move showBranch.* to a separate file config.txt: move sequencer.* to a separate file config.txt: move sendemail-config.txt to config/ config.txt: move reset.* to a separate file config.txt: move rerere.* to a separate file config.txt: move repack.* to a separate file ...
2018-11-06Merge branch 'md/exclude-promisor-objects-fix'Libravatar Junio C Hamano3-0/+3
Operations on promisor objects make sense in the context of only a small subset of the commands that internally use the revisions machinery, but the "--exclude-promisor-objects" option were taken and led to nonsense results by commands like "log", to which it didn't make much sense. This has been corrected. * md/exclude-promisor-objects-fix: exclude-promisor-objects: declare when option is allowed Documentation/git-log.txt: do not show --exclude-promisor-objects
2018-11-06Merge branch 'nd/submodule-unused-vars'Libravatar Junio C Hamano1-1/+1
Code clean-up. * nd/submodule-unused-vars: submodule.c: remove some of the_repository references
2018-11-06Merge branch 'sb/submodule-url-to-absolute'Libravatar Junio C Hamano1-17/+34
Some codepaths failed to form a proper URL when .gitmodules record the URL to a submodule repository as relative to the repository of superproject, which has been corrected. * sb/submodule-url-to-absolute: submodule helper: convert relative URL to absolute URL if needed
2018-11-06Merge branch 'js/shallow-and-fetch-prune'Libravatar Junio C Hamano2-1/+7
"git repack" in a shallow clone did not correctly update the shallow points in the repository, leading to a repository that does not pass fsck. * js/shallow-and-fetch-prune: repack -ad: prune the list of shallow commits shallow: offer to prune only non-existing entries repack: point out a bug handling stale shallow info
2018-11-06Merge branch 'js/remote-archive-dwimfix'Libravatar Junio C Hamano2-0/+4
The logic to determine the archive type "git archive" uses did not correctly kick in for "git archive --remote", which has been corrected. * js/remote-archive-dwimfix: archive: initialize archivers earlier
2018-11-02rebase: apply cocci patchLibravatar Junio C Hamano1-1/+1
Favor oideq() over !oidcmp() when checking for equality. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-02Merge branch 'js/rebase-autostash-fix'Libravatar Junio C Hamano1-3/+5
"git rebase" that has recently been rewritten in C had a few issues in its "--autstash" feature, which have been corrected. * js/rebase-autostash-fix: rebase --autostash: fix issue with dirty submodules rebase --autostash: demonstrate a problem with dirty submodules rebase (autostash): use an explicit OID to apply the stash rebase (autostash): store the full OID in <state-dir>/autostash rebase (autostash): avoid duplicate call to state_dir_path()
2018-11-02Merge branch 'jc/rebase-in-c-5-test-typofix'Libravatar Junio C Hamano1-3/+3
Typofix. * jc/rebase-in-c-5-test-typofix: rebase: fix typoes in error messages
2018-11-02Merge branch 'pk/rebase-in-c-6-final'Libravatar Junio C Hamano1-1/+1
The final step of rewriting "rebase -i" in C. * pk/rebase-in-c-6-final: rebase: default to using the builtin rebase
2018-11-02Merge branch 'js/rebase-in-c-5.5-work-with-rebase-i-in-c'Libravatar Junio C Hamano1-4/+83
"rebase" that has been rewritten learns the new calling convention used by "rebase -i" that was rewritten in C, tying the loose end between two GSoC topics that stomped on each other's toes. * js/rebase-in-c-5.5-work-with-rebase-i-in-c: builtin rebase: prepare for builtin rebase -i
2018-11-02Merge branch 'pk/rebase-in-c-5-test'Libravatar Junio C Hamano1-15/+135
Rewrite "git rebase" in C. * pk/rebase-in-c-5-test: builtin rebase: error out on incompatible option/mode combinations builtin rebase: use no-op editor when interactive is "implied" builtin rebase: show progress when connected to a terminal builtin rebase: fast-forward to onto if it is a proper descendant builtin rebase: optionally pass custom reflogs to reset_head() builtin rebase: optionally auto-detect the upstream
2018-11-02Merge branch 'pk/rebase-in-c-4-opts'Libravatar Junio C Hamano2-85/+446
Rewrite "git rebase" in C. * pk/rebase-in-c-4-opts: builtin rebase: support --root builtin rebase: add support for custom merge strategies builtin rebase: support `fork-point` option merge-base --fork-point: extract libified function builtin rebase: support --rebase-merges[=[no-]rebase-cousins] builtin rebase: support `--allow-empty-message` option builtin rebase: support `--exec` builtin rebase: support `--autostash` option builtin rebase: support `-C` and `--whitespace=<type>` builtin rebase: support `--gpg-sign` option builtin rebase: support `--autosquash` builtin rebase: support `keep-empty` option builtin rebase: support `ignore-date` option builtin rebase: support `ignore-whitespace` option builtin rebase: support --committer-date-is-author-date builtin rebase: support --rerere-autoupdate builtin rebase: support --signoff builtin rebase: allow selecting the rebase "backend"
2018-11-02Merge branch 'pk/rebase-in-c-3-acts'Libravatar Junio C Hamano1-4/+189
Rewrite "git rebase" in C. * pk/rebase-in-c-3-acts: builtin rebase: stop if `git am` is in progress builtin rebase: actions require a rebase in progress builtin rebase: support --edit-todo and --show-current-patch builtin rebase: support --quit builtin rebase: support --abort builtin rebase: support --skip builtin rebase: support --continue
2018-11-02Merge branch 'pk/rebase-in-c-2-basic'Libravatar Junio C Hamano1-13/+321
Rewrite "git rebase" in C. * pk/rebase-in-c-2-basic: builtin rebase: support `git rebase <upstream> <switch-to>` builtin rebase: only store fully-qualified refs in `options.head_name` builtin rebase: start a new rebase only if none is in progress builtin rebase: support --force-rebase builtin rebase: try to fast forward when possible builtin rebase: require a clean worktree builtin rebase: support the `verbose` and `diffstat` options builtin rebase: support --quiet builtin rebase: handle the pre-rebase hook and --no-verify builtin rebase: support `git rebase --onto A...B` builtin rebase: support --onto
2018-11-02Merge branch 'ag/rebase-i-in-c'Libravatar Junio C Hamano2-88/+271
Rewrite of the remaining "rebase -i" machinery in C. * ag/rebase-i-in-c: rebase -i: move rebase--helper modes to rebase--interactive rebase -i: remove git-rebase--interactive.sh rebase--interactive2: rewrite the submodes of interactive rebase in C rebase -i: implement the main part of interactive rebase as a builtin rebase -i: rewrite init_basic_state() in C rebase -i: rewrite write_basic_state() in C rebase -i: rewrite the rest of init_revisions_and_shortrevisions() in C rebase -i: implement the logic to initialize $revisions in C rebase -i: remove unused modes and functions rebase -i: rewrite complete_action() in C t3404: todo list with commented-out commands only aborts sequencer: change the way skip_unnecessary_picks() returns its result sequencer: refactor append_todo_help() to write its message to a buffer rebase -i: rewrite checkout_onto() in C rebase -i: rewrite setup_reflog_action() in C sequencer: add a new function to silence a command, except if it fails rebase -i: rewrite the edit-todo functionality in C editor: add a function to launch the sequence editor rebase -i: rewrite append_todo_help() in C sequencer: make three functions and an enum from sequencer.c public
2018-11-02Merge branch 'pk/rebase-in-c'Libravatar Junio C Hamano1-0/+421
Rewrite of the "rebase" machinery in C. * pk/rebase-in-c: builtin/rebase: support running "git rebase <upstream>" rebase: refactor common shell functions into their own file rebase: start implementing it as a builtin
2018-11-01fetch: replace string-list used as a look-up table with a hashmapLibravatar Junio C Hamano1-46/+100
In find_non_local_tags() helper function (used to implement the "follow tags"), we use string_list_has_string() on two string lists as a way to see if a refname has already been processed, etc. All this code predates more modern in-core lookup API like hashmap; replace them with two hashmaps and one string list---the hashmaps are used for look-ups and the string list is to keep the order of items in the returned result stable (which is the only single thing hashmap does worse than lookups on string-list). Similarly, get_ref_map() uses another string-list as a look-up table for existing refs. Replace it with a hashmap. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-01rev-parse: clear --exclude list after 'git rev-parse --all'Libravatar Andreas Gruenbacher1-0/+1
Commit [1] added the --exclude option to revision.c. The --all, --branches, --tags, --remotes, and --glob options clear the exclude list. Shortly therafter, commit [2] added the same to 'git rev-parse', but without clearing the exclude list for the --all option. [1] e7b432c52 ("revision: introduce --exclude=<glob> to tame wildcards", 2013-08-30) [2] 9dc01bf06 ("rev-parse: introduce --exclude=<glob> to tame wildcards", 2013-11-01) Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-31submodule: support reading .gitmodules when it's not in the working treeLibravatar Antonio Ospite2-4/+19
When the .gitmodules file is not available in the working tree, try using the content from the index and from the current branch. This covers the case when the file is part of the repository but for some reason it is not checked out, for example because of a sparse checkout. This makes it possible to use at least the 'git submodule' commands which *read* the gitmodules configuration file without fully populating the working tree. Writing to .gitmodules will still require that the file is checked out, so check for that before calling config_set_in_gitmodules_file_gently. Add a similar check also in git-submodule.sh::cmd_add() to anticipate the eventual failure of the "git submodule add" command when .gitmodules is not safely writeable; this prevents the command from leaving the repository in a spurious state (e.g. the submodule repository was cloned but .gitmodules was not updated because config_set_in_gitmodules_file_gently failed). Moreover, since config_from_gitmodules() now accesses the global object store, it is necessary to protect all code paths which call the function against concurrent access to the global object store. Currently this only happens in builtin/grep.c::grep_submodules(), so call grep_read_lock() before invoking code involving config_from_gitmodules(). Finally, add t7418-submodule-sparse-gitmodules.sh to verify that reading from .gitmodules succeeds and that writing to it fails when the file is not checked out. NOTE: there is one rare case where this new feature does not work properly yet: nested submodules without .gitmodules in their working tree. This has been documented with a warning and a test_expect_failure item in t7814, and in this case the current behavior is not altered: no config is read. Signed-off-by: Antonio Ospite <ao2@ao2.it> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-31ls-remote: pass heads/tags prefixes to transportLibravatar Jeff King1-0/+5
Unlike its arbitrary text patterns, the --heads and --tags options to ls-remote are true prefixes. We can pass this information to the transport code. If the v2 protocol is in use, that will reduce the size of the ref advertisement. Note that the test added here succeeds both before and after the patch. This is an optimization, not a bug-fix; it's just making sure we didn't break anything. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-31ls-remote: do not send ref prefixes for patternsLibravatar Jeff King1-8/+0
Since b4be74105f (ls-remote: pass ref prefixes when requesting a remote's refs, 2018-03-15), "ls-remote foo" will pass "refs/heads/foo", "refs/tags/foo", etc to the transport code in an attempt to let the other side reduce the size of its advertisement. Unfortunately this is not correct, as ls-remote patterns do not follow the usual ref lookup rules, and are in fact tail-matched. So we could find "refs/heads/foo" or "refs/heads/a/much/deeper/foo" or even "refs/another/hierarchy/foo". Since we can't pass a prefix and there's not yet a v2 extension for matching wildcards, we must disable this feature to keep the same behavior as v1. Reported-by: Jon Simons <jon@jonsimons.org> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-31Adjust for 2.19.x seriesLibravatar Junio C Hamano1-4/+12
* jk/detect-truncated-zlib-input cat-file: handle streaming failures consistently check_stream_sha1(): handle input underflow t1450: check large blob in trailing-garbage test
2018-10-31cat-file: handle streaming failures consistentlyLibravatar Jeff King1-4/+12
There are three ways to convince cat-file to stream a blob: - cat-file -p $blob - cat-file blob $blob - echo $batch | cat-file --batch In the first two, we simply exit with the error code of streaw_blob_to_fd(). That means that an error will cause us to exit with "-1" (which we try to avoid) without printing any kind of error message (which is confusing to the user). Instead, let's match the third case, which calls die() on an error. Unfortunately we cannot be more specific, as stream_blob_to_fd() does not tell us whether the problem was on reading (e.g., a corrupt object) or on writing (e.g., ENOSPC). That might be an opportunity for future work, but for now we will at least exit with a sane message and exit code. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-31worktree: rename is_worktree_locked to worktree_lock_reasonLibravatar Nickolai Belakovski1-5/+5
A function prefixed with 'is_' would be expected to return a boolean, however this function returns a string. Signed-off-by: Nickolai Belakovski <nbelakovski@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-30Merge branch 'jc/receive-deny-current-branch-fix'Libravatar Junio C Hamano1-3/+9
The receive.denyCurrentBranch=updateInstead codepath kicked in even when the push should have been rejected due to other reasons, such as it does not fast-forward or the update-hook rejects it, which has been corrected. * jc/receive-deny-current-branch-fix: receive: denyCurrentBranch=updateinstead should not blindly update
2018-10-30Merge branch 'ot/ref-filter-plug-leaks'Libravatar Junio C Hamano1-1/+1
Plugging a handful of memory leaks in the ref-filter codepath. * ot/ref-filter-plug-leaks: ref-filter: free item->value and item->value->s ls-remote: release memory instead of UNLEAK ref-filter: free memory from used_atom
2018-10-30Merge branch 'sb/submodule-helper-remove-cruft'Libravatar Junio C Hamano1-2/+0
Code clean-up. * sb/submodule-helper-remove-cruft: builtin/submodule--helper: remove debugging leftover tracing
2018-10-30Merge branch 'js/pack-objects-mutex-init-fix'Libravatar Junio C Hamano1-1/+0
A mutex used in "git pack-objects" were not correctly initialized and this caused "git repack" to dump core on Windows. * js/pack-objects-mutex-init-fix: pack-objects (mingw): initialize `packing_data` mutex in the correct spot pack-objects (mingw): demonstrate a segmentation fault with large deltas pack-objects: fix typo 'detla' -> 'delta'
2018-10-30Merge branch 'tq/branch-style-fix'Libravatar Junio C Hamano1-2/+1
Code clean-up. * tq/branch-style-fix: branch: trivial style fix
2018-10-30Merge branch 'tq/branch-create-wo-branch-get'Libravatar Junio C Hamano1-5/+0
Code clean-up. * tq/branch-create-wo-branch-get: builtin/branch.c: remove useless branch_get
2018-10-30Merge branch 'bc/hash-transition-part-15'Libravatar Junio C Hamano3-13/+15
More codepaths are moving away from hardcoded hash sizes. * bc/hash-transition-part-15: rerere: convert to use the_hash_algo submodule: make zero-oid comparison hash function agnostic apply: rename new_sha1_prefix and old_sha1_prefix apply: replace hard-coded constants tag: express constant in terms of the_hash_algo transport: use parse_oid_hex instead of a constant upload-pack: express constants in terms of the_hash_algo refs/packed-backend: express constants using the_hash_algo packfile: express constants in terms of the_hash_algo pack-revindex: express constants in terms of the_hash_algo builtin/fetch-pack: remove constants with parse_oid_hex builtin/mktree: remove hard-coded constant builtin/repack: replace hard-coded constants pack-bitmap-write: use GIT_MAX_RAWSZ for allocation object_id.cocci: match only expressions of type 'struct object_id'
2018-10-30Merge branch 'md/filter-trees'Libravatar Junio C Hamano1-4/+7
The "rev-list --filter" feature learned to exclude all trees via "tree:0" filter. * md/filter-trees: list-objects: support for skipping tree traversal filter-trees: code clean-up of tests list-objects-filter: implement filter tree:0 list-objects-filter-options: do not over-strbuf_init list-objects-filter: use BUG rather than die revision: mark non-user-given objects instead rev-list: handle missing tree objects properly list-objects: always parse trees gently list-objects: refactor to process_tree_contents list-objects: store common func args in struct
2018-10-29Merge branches 'bp/reset-quiet' and 'js/mingw-http-ssl' into nd/config-splitLibravatar Junio C Hamano1-1/+14
* bp/reset-quiet: reset: warn when refresh_index() takes more than 2 seconds reset: add new reset.quiet config setting reset: don't compute unstaged changes after reset when --quiet * js/mingw-http-ssl: http: when using Secure Channel, ignore sslCAInfo by default http: add support for disabling SSL revocation checks in cURL http: add support for selecting SSL backends at runtime
2018-10-26Merge branch 'rv/alias-help'Libravatar Junio C Hamano1-3/+31
"git cmd --help" when "cmd" is aliased used to only say "cmd is aliased to ...". Now it shows that to the standard error stream and runs "git $cmd --help" where $cmd is the first word of the alias expansion. This could be misleading for those who alias a command with options (e.g. with "[alias] cpn = cherry-pick -n", "git cpn --help" would show the manual of "cherry-pick", and the reader would not be told to pay close attention to the part that describes the "--no-commit" option until closing the pager that showed the contents of the manual, if the pager is configured to restore the original screen, or would not be told at all, if the pager simply makes the message on the standard error scroll away. * rv/alias-help: git-help.txt: document "git help cmd" vs "git cmd --help" for aliases git.c: handle_alias: prepend alias info when first argument is -h help: redirect to aliased commands for "git cmd --help"
2018-10-26archive: initialize archivers earlierLibravatar Josh Steadmon2-0/+4
Initialize archivers as soon as possible when running git-archive. Various non-obvious behavior depends on having the archivers initialized, such as determining the desired archival format from the provided filename. Since 08716b3c11 ("archive: refactor file extension format-guessing", 2011-06-21), archive_format_from_filename() has used the registered archivers to match filenames (provided via --output) to archival formats. However, when git-archive is executed with --remote, format detection happens before the archivers have been registered. This causes archives from remotes to always be generated as TAR files, regardless of the actual filename (unless an explicit --format is provided). This patch fixes that behavior; archival format is determined properly from the output filename, even when --remote is used. Helped-by: Jeff King <peff@peff.net> Signed-off-by: Josh Steadmon <steadmon@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-25repack -ad: prune the list of shallow commitsLibravatar Johannes Schindelin1-0/+6
`git repack` can drop unreachable commits without further warning, making the corresponding entries in `.git/shallow` invalid, which causes serious problems when deepening the branches. One scenario where unreachable commits are dropped by `git repack` is when a `git fetch --prune` (or even a `git fetch` when a ref was force-pushed in the meantime) can make a commit unreachable that was reachable before. Therefore it is not safe to assume that a `git repack -adlf` will keep unreachable commits alone (under the assumption that they had not been packed in the first place, which is an assumption at least some of Git's code seems to make). This is particularly important to keep in mind when looking at the `.git/shallow` file: if any commits listed in that file become unreachable, it is not a problem, but if they go missing, it *is* a problem. One symptom of this problem is that a deepening fetch may now fail with fatal: error in object: unshallow <commit-hash> To avoid this problem, let's prune the shallow list in `git repack` when the `-d` option is passed, unless `-A` is passed, too (which would force the now-unreachable objects to be turned into loose objects instead of being deleted). Additionally, we also need to take `--keep-reachable` and `--unpack-unreachable=<date>` into account. Note: an alternative solution discussed during the review of this patch was to teach `git fetch` to simply ignore entries in .git/shallow if the corresponding commits do not exist locally. A quick test, however, revealed that the .git/shallow file is written during a shallow *clone*, in which case the commits do not exist, either, but the "shallow" line *does* need to be sent. Therefore, this approach would be a lot more finicky than the approach presented by the this patch. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-25shallow: offer to prune only non-existing entriesLibravatar Johannes Schindelin1-1/+1
The `prune_shallow()` function wants a full reachability check to be completed before it goes to work, to ensure that all unreachable entries are removed from the shallow file. However, in the upcoming patch we do not even want to go that far. We really only need to remove entries corresponding to pruned commits, i.e. to commits that no longer exist. Let's support that use case. Rather than extending the signature of `prune_shallow()` to accept another Boolean, let's turn it into a bit field and declare constants, for readability. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-24rebase --autostash: fix issue with dirty submodulesLibravatar Johannes Schindelin1-1/+1
Since we cannot stash dirty submodules, there is no use in requiring them to be clean (or stash them when they are not). This brings the built-in rebase in line with the previous, scripted version, which also did not care about dirty submodules (but it was admittedly not very easy to figure that out). This fixes https://github.com/git-for-windows/git/issues/1820 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-24reset: warn when refresh_index() takes more than 2 secondsLibravatar Ben Peart1-1/+13
refresh_index() is done after a reset command as an optimization. Because it can be an expensive call, warn the user if it takes more than 2 seconds and tell them how to avoid it using the --quiet command line option or reset.quiet config setting. Signed-off-by: Ben Peart <benpeart@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-24reset: add new reset.quiet config settingLibravatar Ben Peart1-0/+1
Add a reset.quiet config setting that sets the default value of the --quiet flag when running the reset command. This enables users to change the default behavior to take advantage of the performance advantages of avoiding the scan for unstaged changes after reset. Defaults to false. Signed-off-by: Ben Peart <benpeart@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-24reset: don't compute unstaged changes after reset when --quietLibravatar Ben Peart1-1/+1
When git reset is run with the --quiet flag, don't bother finding any additional unstaged changes as they won't be output anyway. This speeds up the git reset command by avoiding having to lstat() every file looking for changes that aren't going to be reported anyway. The savings can be significant. In a repo on Windows with 200K files "git reset" drops from 7.16 seconds to 0.32 seconds for a savings of 96%. Signed-off-by: Ben Peart <benpeart@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>