summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-05-21completion: allow to customize the completable command listLibravatar Nguyễn Thái Ngọc Duy6-2/+47
By default we show porcelain, external commands and a couple others that are also popular. If you are not happy with this list, you can now customize it a new config variable. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-21completion: add and use --list-cmds=aliasLibravatar Nguyễn Thái Ngọc Duy6-81/+40
By providing aliases via --list-cmds=, we could simplify command collection code in the script. We only issue one git command. Before this patch that is "git config", after it's "git --list-cmds=". In "git help" completion case we actually reduce one "git" process (for getting guides) but that call was added in this series so it does not really count. A couple of bash functions are removed because they are not needed anymore. __git_compute_all_commands() and $__git_all_commands stay because they are still needed for completing pager.* config and without "alias" group, the result is still cacheable. There is a slight (good) change in _git_help() with this patch: before "git help <tab>" shows external commands (as in _not_ part of git) as well as part of $__git_all_commands. We have finer control over command listing now and can exclude that because we can't provide a man page for external commands anyway. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-21completion: add and use --list-cmds=nohelpersLibravatar Nguyễn Thái Ngọc Duy3-17/+20
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-21Move declaration for alias.c to alias.hLibravatar Nguyễn Thái Ngọc Duy10-5/+17
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-21completion: reduce completable command listLibravatar Nguyễn Thái Ngọc Duy1-9/+9
The following commands are removed from the complete list: - annotate obsolete, discouraged to use - filter-branch not often used - get-tar-commit-id not often used - imap-send not often used - interpreter-trailers not for interactive use - name-rev plumbing, just use git-describe - p4 too short and probably not often used (*) - svn same category as p4 (*) - verify-commit not often used (*) to be fair, send-email command which is in the same foreignscminterface group as svn and p4 does get completion, just because it's used by git and kernel development. So maybe we should include them. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-21completion: let git provide the completable command listLibravatar Nguyễn Thái Ngọc Duy3-119/+58
Instead of maintaining a separate list of command classification, which often could go out of date, let's centralize the information back in git. While the function in git-completion.bash implies "list porcelain commands", that's not exactly what it does. It gets all commands (aka --list-cmds=main,others) then exclude certain non-porcelain ones. We could almost recreate this list two lists list-mainporcelain and others. The non-porcelain-but-included-anyway is added by the third category list-complete. Note that the current completion script incorrectly classifies filter-branch as porcelain and t9902 tests this behavior. We keep it this way in t9902 because this test does not really care which particular command is porcelain or plumbing, they're just names. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-21command-list.txt: documentation and guide lineLibravatar Nguyễn Thái Ngọc Duy1-0/+45
This is intended to help anybody who needs to update command-list.txt. It gives a brief introduction of all attributes a command can take. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-21help: use command-list.txt for the source of guidesLibravatar Nguyễn Thái Ngọc Duy10-45/+54
The help command currently hard codes the list of guides and their summary in C. Let's move this list to command-list.txt. This lets us extract summary lines from Documentation/git*.txt. This also potentially lets us list guides in git.txt, but I'll leave that for now. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-21help: add "-a --verbose" to list all commands with synopsisLibravatar Nguyễn Thái Ngọc Duy5-1/+37
This lists all recognized commands [1] by category. The group order follows closely git.txt. [1] We may actually show commands that are not built (e.g. if you set NO_PERL you don't have git-instaweb but it's still listed here). I ignore the problem because on Linux a git package could be split anyway. The "git-core" package may not contain git-instaweb even if it's built because it may end up in a separate package. We can't know anyway. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-21git: support --list-cmds=list-<category>Libravatar Nguyễn Thái Ngọc Duy5-1/+51
This allows us to select any group of commands by a category defined in command-list.txt. This is an internal/hidden option so we don't have to be picky about the category name or worried about exposing too much. This will be used later by git-completion.bash to retrieve certain command groups. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-21completion: implement and use --list-cmds=main,othersLibravatar Nguyễn Thái Ngọc Duy5-2/+43
This is part of the effort to break down and provide commands by category in machine-readable form. This could be helpful later on when completion script switches to use --list-cmds for selecting completable commands. It would be much easier for the user to choose to complete _all_ commands instead of the default selection by passing different values to --list-cmds in git-completino.bash. While at there, replace "git help -a" in git-completion.bash with --list-cmds since it's better suited for this task. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-21git --list-cmds: collect command list in a string_listLibravatar Nguyễn Thái Ngọc Duy1-5/+17
Instead of printing the command directly one by one, keep them in a list and print at the end. This allows more modification before we print out (e.g. sorting, removing duplicates or even excluding some items). Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-21git.c: convert --list-* to --list-cmds=*Libravatar Nguyễn Thái Ngọc Duy4-8/+39
Even if these are hidden options, let's make them a bit more generic since we're introducing more listing types shortly. The code is structured to allow combining multiple listing types together because we will soon add more types the 'builtins'. 'parseopt' remains separate because it has separate (SPC) to match git-completion.bash needs and will not combine with others. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-10Remove common-cmds.hLibravatar Nguyễn Thái Ngọc Duy3-55/+9
After the last patch, common-cmds.h is no longer used (and it was actually broken). Remove all related code. command-list.h will take its place from now on. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-10help: use command-list.h for common command listLibravatar Nguyễn Thái Ngọc Duy5-50/+122
The previous commit added code generation for all_cmd_desc[] which includes almost everything we need to generate common command list. Convert help code to use that array instead and drop common_cmds[] array. The description of each common command group is removed from command-list.txt. This keeps this file format simpler. common-cmds.h will not be generated correctly after this change due to the command-list.txt format change. But it does not matter and common-cmds.h will be removed. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-10generate-cmds.sh: export all commands to command-list.hLibravatar Nguyễn Thái Ngọc Duy4-10/+75
The current generate-cmds.sh generates just enough to print "git help" output. That is, it only extracts help text for common commands. The script is now updated to extract help text for all commands and keep command classification a new file, command-list.h. This will be useful later: - "git help -a" could print a short summary of all commands instead of just the common ones. - "git" could produce a list of commands of one or more category. One of its use is to reduce another command classification embedded in git-completion.bash. The new file can be generated but is not used anywhere yet. The plan is we migrate away from common-cmds.h. Then we can kill off common-cmds.h build rules and generation code (and also delete duplicate content in command-list.h which we keep for now to not mess generate-cmds.sh up too much). PS. The new fixed column requirement on command-list.txt is technically not needed. But it helps simplify the code a bit at this stage. We could lift this restriction later if we want to. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-10generate-cmds.sh: factor out synopsis extract codeLibravatar Nguyễn Thái Ngọc Duy1-7/+11
This makes it easier to reuse the same code in another place (very soon). Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-04-12Merge branch 'svn/authors-prog-2' of git://bogomips.org/git-svnLibravatar Junio C Hamano5-12/+57
* 'svn/authors-prog-2' of git://bogomips.org/git-svn: git-svn: allow empty email-address using authors-prog and authors-file git-svn: search --authors-prog in PATH too
2018-04-11Revert "Merge branch 'en/rename-directory-detection'"Libravatar Junio C Hamano9-5197/+115
This reverts commit e4bb62fa1eeee689744b413e29a50b4d1dae6886, reversing changes made to 468165c1d8a442994a825f3684528361727cd8c0. The topic appears to inflict severe regression in renaming merges, even though the promise of it was that it would improve them. We do not yet know which exact change in the topic was wrong, but in the meantime, let's play it safe and revert it out of 'master' before real Git-using projects are harmed. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-04-11The third batch for 2.18Libravatar Junio C Hamano1-0/+30
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-04-11Merge branch 'eb/cred-helper-ignore-sigpipe'Libravatar Junio C Hamano1-0/+3
When credential helper exits very quickly without reading its input, it used to cause Git to die with SIGPIPE, which has been fixed. * eb/cred-helper-ignore-sigpipe: credential: ignore SIGPIPE when writing to credential helpers
2018-04-11Merge branch 'lv/tls-1.3'Libravatar Junio C Hamano2-0/+4
When built with more recent cURL, GIT_SSL_VERSION can now specify "tlsv1.3" as its value. * lv/tls-1.3: http: allow use of TLS 1.3
2018-04-11Merge branch 'pk/test-avoid-pipe-hiding-exit-status'Libravatar Junio C Hamano15-159/+179
Test cleanup. * pk/test-avoid-pipe-hiding-exit-status: test: avoid pipes in git related commands for test
2018-04-11Merge branch 'rs/status-with-removed-submodule'Libravatar Junio C Hamano2-2/+21
"git submodule status" misbehaved on a submodule that has been removed from the working tree. * rs/status-with-removed-submodule: submodule: check for NULL return of get_submodule_ref_store()
2018-04-11Merge branch 'nd/combined-test-helper'Libravatar Junio C Hamano121-542/+684
Small test-helper programs have been consolidated into a single binary. * nd/combined-test-helper: (36 commits) t/helper: merge test-write-cache into test-tool t/helper: merge test-wildmatch into test-tool t/helper: merge test-urlmatch-normalization into test-tool t/helper: merge test-subprocess into test-tool t/helper: merge test-submodule-config into test-tool t/helper: merge test-string-list into test-tool t/helper: merge test-strcmp-offset into test-tool t/helper: merge test-sigchain into test-tool t/helper: merge test-sha1-array into test-tool t/helper: merge test-scrap-cache-tree into test-tool t/helper: merge test-run-command into test-tool t/helper: merge test-revision-walking into test-tool t/helper: merge test-regex into test-tool t/helper: merge test-ref-store into test-tool t/helper: merge test-read-cache into test-tool t/helper: merge test-prio-queue into test-tool t/helper: merge test-path-utils into test-tool t/helper: merge test-online-cpus into test-tool t/helper: merge test-mktemp into test-tool t/helper: merge (unused) test-mergesort into test-tool ...
2018-04-11Merge branch 'sb/packfiles-in-repository'Libravatar Junio C Hamano17-67/+58
Refactoring of the internal global data structure continues. * sb/packfiles-in-repository: packfile: keep prepare_packed_git() private packfile: allow find_pack_entry to handle arbitrary repositories packfile: add repository argument to find_pack_entry packfile: allow reprepare_packed_git to handle arbitrary repositories packfile: allow prepare_packed_git to handle arbitrary repositories packfile: allow prepare_packed_git_one to handle arbitrary repositories packfile: add repository argument to reprepare_packed_git packfile: add repository argument to prepare_packed_git packfile: add repository argument to prepare_packed_git_one packfile: allow install_packed_git to handle arbitrary repositories packfile: allow rearrange_packed_git to handle arbitrary repositories packfile: allow prepare_packed_git_mru to handle arbitrary repositories
2018-04-11Merge branch 'sb/object-store'Libravatar Junio C Hamano39-233/+393
Refactoring the internal global data structure to make it possible to open multiple repositories, work with and then close them. Rerolled by Duy on top of a separate preliminary clean-up topic. The resulting structure of the topics looked very sensible. * sb/object-store: (27 commits) sha1_file: allow sha1_loose_object_info to handle arbitrary repositories sha1_file: allow map_sha1_file to handle arbitrary repositories sha1_file: allow map_sha1_file_1 to handle arbitrary repositories sha1_file: allow open_sha1_file to handle arbitrary repositories sha1_file: allow stat_sha1_file to handle arbitrary repositories sha1_file: allow sha1_file_name to handle arbitrary repositories sha1_file: add repository argument to sha1_loose_object_info sha1_file: add repository argument to map_sha1_file sha1_file: add repository argument to map_sha1_file_1 sha1_file: add repository argument to open_sha1_file sha1_file: add repository argument to stat_sha1_file sha1_file: add repository argument to sha1_file_name sha1_file: allow prepare_alt_odb to handle arbitrary repositories sha1_file: allow link_alt_odb_entries to handle arbitrary repositories sha1_file: add repository argument to prepare_alt_odb sha1_file: add repository argument to link_alt_odb_entries sha1_file: add repository argument to read_info_alternates sha1_file: add repository argument to link_alt_odb_entry sha1_file: add raw_object_store argument to alt_odb_usable pack: move approximate object count to object store ...
2018-04-11Merge branch 'jc/test-must-be-empty'Libravatar Junio C Hamano1-5/+2
Test helper update. * jc/test-must-be-empty: test_must_be_empty: simplify file existence check
2018-04-11Merge branch 'cc/perf-aggregate-sort'Libravatar Junio C Hamano1-5/+65
Perf-test update. * cc/perf-aggregate-sort: perf/aggregate: add --sort-by=regression option perf/aggregate: add display_dir()
2018-04-11Merge branch 'ab/doc-hash-brokenness'Libravatar Junio C Hamano1-8/+32
Doc updates. * ab/doc-hash-brokenness: doc hash-function-transition: clarify what SHAttered means doc hash-function-transition: clarify how older gits die on NewHash
2018-04-11Merge branch 'bc/hash-independent-tests'Libravatar Junio C Hamano9-82/+100
Tests that rely on the exact hardcoded values of object names have been updated in preparation for hash function migration. * bc/hash-independent-tests: t2107: abstract away SHA-1-specific constants t2101: abstract away SHA-1-specific constants t2101: modernize test style t2020: abstract away SHA-1 specific constants t1507: abstract away SHA-1-specific constants t1411: abstract away SHA-1-specific constants t1405: sort reflog entries in a hash-independent way t1300: abstract away SHA-1-specific constants t1304: abstract away SHA-1-specific constants t1011: abstract away SHA-1-specific constants
2018-04-11Merge branch 'ab/drop-contrib-examples'Libravatar Junio C Hamano27-8137/+20
* ab/drop-contrib-examples: Remove contrib/examples/*
2018-04-10The second batch for 2.18Libravatar Junio C Hamano1-0/+25
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-04-10Merge branch 'ys/bisect-object-id-missing-conversion-fix'Libravatar Junio C Hamano1-2/+2
Code clean-up. * ys/bisect-object-id-missing-conversion-fix: bisect: use oid_to_hex() for converting object_id hashes to hex strings
2018-04-10Merge branch 'yk/filter-branch-non-committish-refs'Libravatar Junio C Hamano2-2/+26
when refs that do not point at committish are given, "git filter-branch" gave a misleading error messages. This has been corrected. * yk/filter-branch-non-committish-refs: filter-branch: fix errors caused by refs that point at non-committish
2018-04-10Merge branch 'nd/trace-with-env'Libravatar Junio C Hamano1-1/+1
Code cleanup. * nd/trace-with-env: run-command: use strbuf_addstr() for adding a string to a strbuf
2018-04-10Merge branch 'nd/parseopt-completion-more'Libravatar Junio C Hamano3-76/+127
The mechanism to use parse-options API to automate the command line completion continues to get extended and polished. * nd/parseopt-completion-more: completion: use __gitcomp_builtin in _git_cherry completion: use __gitcomp_builtin in _git_ls_tree completion: delete option-only completion commands completion: add --option completion for most builtin commands completion: factor out _git_xxx calling code completion: mention the oldest version we need to support git.c: add hidden option --list-parseopt-builtins git.c: move cmd_struct declaration up
2018-04-10Merge branch 'ds/bsearch-hash'Libravatar Junio C Hamano3-57/+42
Code to find the length to uniquely abbreviate object names based on packfile content, which is a relatively recent addtion, has been optimized to use the same fan-out table. * ds/bsearch-hash: sha1_name: use bsearch_pack() in unique_in_pack() sha1_name: use bsearch_pack() for abbreviations packfile: define and use bsearch_pack() sha1_name: convert struct min_abbrev_data to object_id
2018-04-10Merge branch 'ws/rebase-p'Libravatar Junio C Hamano4-214/+216
Code clean-up. * ws/rebase-p: rebase: remove merges_option and a blank line rebase: remove unused code paths from git_rebase__interactive__preserve_merges rebase: remove unused code paths from git_rebase__interactive rebase: add and use git_rebase__interactive__preserve_merges rebase: extract functions out of git_rebase__interactive rebase: reindent function git_rebase__interactive rebase: update invocation of rebase dot-sourced scripts rebase-interactive: simplify pick_on_preserving_merges
2018-04-10Merge branch 'jk/diff-highlight-graph-fix'Libravatar Junio C Hamano2-37/+129
"diff-highlight" filter (in contrib/) learned to undertand "git log --graph" output better. * jk/diff-highlight-graph-fix: diff-highlight: detect --graph by indent diff-highlight: use flush() helper consistently diff-highlight: test graphs with --color diff-highlight: test interleaved parallel lines of history diff-highlight: prefer "echo" to "cat" in tests diff-highlight: use test_tick in graph test diff-highlight: correct test graph diagram
2018-04-10Merge branch 'nd/remove-ignore-env-field'Libravatar Junio C Hamano7-65/+101
Code clean-up for the "repository" abstraction. * nd/remove-ignore-env-field: repository.h: add comment and clarify repo_set_gitdir repository: delete ignore_env member sha1_file.c: move delayed getenv(altdb) back to setup_git_env() repository.c: delete dead functions repository.c: move env-related setup code back to environment.c repository: initialize the_repository in main()
2018-04-10Merge branch 'ps/contains-id-error-message'Libravatar Junio C Hamano8-14/+125
"git tag --contains no-such-commit" gave a full list of options after giving an error message. * ps/contains-id-error-message: parse-options: do not show usage upon invalid option value
2018-04-10The first batch for 2.18 cycleLibravatar Junio C Hamano3-2/+69
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-04-10Merge branch 'tg/stash-untracked-with-pathspec-fix'Libravatar Junio C Hamano2-6/+60
"git stash push -u -- <pathspec>" gave an unnecessary and confusing error message when there was no tracked files that match the <pathspec>, which has been fixed. * tg/stash-untracked-with-pathspec-fix: stash: drop superfluos pathspec parameter stash push -u: don't create empty stash stash push: avoid printing errors stash: fix nonsense pipeline
2018-04-10Merge branch 'nd/worktree-prune'Libravatar Junio C Hamano4-27/+24
The way "git worktree prune" worked internally has been simplified, by assuming how "git worktree move" moves an existing worktree to a different place. * nd/worktree-prune: worktree prune: improve prune logic when worktree is moved worktree: delete dead code gc.txt: more details about what gc does
2018-04-10Merge branch 'bc/object-id'Libravatar Junio C Hamano111-594/+609
Conversion from uchar[20] to struct object_id continues. * bc/object-id: (36 commits) convert: convert to struct object_id sha1_file: introduce a constant for max header length Convert lookup_replace_object to struct object_id sha1_file: convert read_sha1_file to struct object_id sha1_file: convert read_object_with_reference to object_id tree-walk: convert tree entry functions to object_id streaming: convert istream internals to struct object_id tree-walk: convert get_tree_entry_follow_symlinks internals to object_id builtin/notes: convert static functions to object_id builtin/fmt-merge-msg: convert remaining code to object_id sha1_file: convert sha1_object_info* to object_id Convert remaining callers of sha1_object_info_extended to object_id packfile: convert unpack_entry to struct object_id sha1_file: convert retry_bad_packed_offset to struct object_id sha1_file: convert assert_sha1_type to object_id builtin/mktree: convert to struct object_id streaming: convert open_istream to use struct object_id sha1_file: convert check_sha1_signature to struct object_id sha1_file: convert read_loose_object to use struct object_id builtin/index-pack: convert struct ref_delta_entry to object_id ...
2018-04-10Merge branch 'ma/shortlog-revparse'Libravatar Junio C Hamano3-2/+13
"git shortlog cruft" aborted with a BUG message when run outside a Git repository. The command has been taught to complain about extra and unwanted arguments on its command line instead in such a case. * ma/shortlog-revparse: shortlog: disallow left-over arguments outside repo shortlog: add usage-string for stdin-reading git-shortlog.txt: reorder usages
2018-04-10Merge branch 'ab/install-symlinks'Libravatar Junio C Hamano1-17/+35
The build procedure learned to optionally use symbolic links (instead of hardlinks and copies) to install "git-foo" for built-in commands, whose binaries are all identical. * ab/install-symlinks: Makefile: optionally symlink libexec/git-core binaries to bin/git Makefile: add a gitexecdir_relative variable Makefile: fix broken bindir_relative variable
2018-04-10Merge branch 'ml/filter-branch-no-op-error'Libravatar Junio C Hamano2-1/+9
"git filter-branch" learned to use a different exit code to allow the callers to tell the case where there was no new commits to rewrite from other error cases. * ml/filter-branch-no-op-error: filter-branch: return 2 when nothing to rewrite
2018-04-10Merge branch 'ab/pcre-v2'Libravatar Junio C Hamano2-24/+28
Git can be built to use either v1 or v2 of the PCRE library, and so far, the build-time configuration USE_LIBPCRE=YesPlease instructed the build procedure to use v1, but now it means v2. USE_LIBPCRE1 and USE_LIBPCRE2 can be used to explicitly choose which version to use, as before. * ab/pcre-v2: Makefile: make USE_LIBPCRE=YesPlease mean v2, not v1 configure: detect redundant --with-libpcre & --with-libpcre1 configure: fix a regression in PCRE v1 detection