1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-02 01:16:12 +02:00
Commit Graph

64040 Commits

Author SHA1 Message Date
Ævar Arnfjörð Bjarmason d35d03cf93 help: simplify by moving to OPT_CMDMODE()
As preceding commits have incrementally established all of the --all,
--guides, --config and hidden --config-for-completion options are
mutually exclusive. So let's use OPT_CMDMODE() to parse the
command-line instead, and take advantage of its conflicting options
detection.

This is the first command with a hidden CMDMODE, so let's introduce a
OPT_CMDMODE_F() macro to go along with OPT_CMDMODE().

I think this makes the usage information that we emit slightly worse,
e.g. before we'd emit:

    $ git help --all --config
    fatal: --config and --all cannot be combined

    usage: git help [-a|--all] [--[no-]verbose]]
             [[-i|--info] [-m|--man] [-w|--web]] [<command>]
       or: git help [-g|--guides]
       or: git help [-c|--config]
    [...]
    $

And now:

    $ git help --all --config
    error: option `config' is incompatible with --all
    $

But improving that is a general topic for parse-options.c improvement,
i.e. we should probably emit the full usage in that case.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-09-23 10:30:43 -07:00
Ævar Arnfjörð Bjarmason 0a5940fbe7 help: correct logic error in combining --all and --guides
The --all and --guides commands could be combined, which wouldn't have
any impact on the output except for:

    git help --all --guides --no-verbose

Listing the guide alongside that output was clearly not intended, so
let's error out here. See 002b726a40 (builtin/help.c: add
list_common_guides_help() function, 2013-04-02) for the initial
implementation.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-09-23 10:30:43 -07:00
Ævar Arnfjörð Bjarmason 1ed4bef6b4 help: correct logic error in combining --all and --config
Fix a bug in the --config option that's been there ever since its
introduction in 3ac68a93fd (help: add --config to list all available
config, 2018-05-26). Die when --all and --config are combined,
combining them doesn't make sense.

The code for the --config option when combined with an earlier
refactoring done to support the --guide option in
65f98358c0 (builtin/help.c: add --guide option, 2013-04-02) would
cause us to take the "--all" branch early and ignore the --config
option.

Let's instead list these as incompatible, both in the synopsis and
help output, and enforce it in the code itself.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-09-23 10:30:43 -07:00
Ævar Arnfjörð Bjarmason ff76fc841f help tests: add test for --config output
Add a missing test for checking what the --config output added in
ac68a93fd2 (help: add --config to list all available config,
2018-05-26) looks like. We should not be emitting anything except
config variables and the brief usage information at the end here.

The second test regexp here might not match three-level variables in
general, as their second level could contain ".", but in this case
we're always emitting what we extract from the documentation, so it's
all strings like:

    foo.<name>.bar

If we did introduce something like variable example content here we'd
like this to break, since we'd then be likely to break the
git-completion.bash.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-09-23 10:30:43 -07:00
Ævar Arnfjörð Bjarmason 9856ea6785 help: correct usage & behavior of "git help --guides"
As noted in 65f98358c0 (builtin/help.c: add --guide option,
2013-04-02) and a133737b80 (doc: include --guide option description
for "git help", 2013-04-02) which introduced the --guide option, it
cannot be combined with e.g. <command>.

Change the command and the "SYNOPSIS" section to reflect that desired
behavior. Now that we assert this in code we don't need to
exhaustively describe the previous confusing behavior in the
documentation either, instead of silently ignoring the provided
argument we'll now error out.

The "We're done. Ignore any remaining args" comment added in
15f7d49438 (builtin/help.c: split "-a" processing into two,
2013-04-02) can now be removed, it's obvious that we're asserting the
behavior with the check of "argc".

The "--config" option is still missing from the synopsis, it will be
added in a subsequent commit where we'll fix bugs in its
implementation.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-09-23 10:30:43 -07:00
Ævar Arnfjörð Bjarmason b40845293b help: correct the usage string in -h and documentation
Clarify the usage string in the documentation so we group e.g. -i and
--info, and add the missing short options to the "-h" output.

The alignment of the second line is off now, but will be fixed with
another series of mine[1]. In the meantime let's just assume that fix
will make it in eventually for the purposes of this patch, if it's
misaligned for a bit it doesn't matter much.

1. https://lore.kernel.org/git/cover-0.2-00000000000-20210901T110917Z-avarab@gmail.com

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-09-10 15:58:00 -07:00
Junio C Hamano 8b7c11b866 The fifth batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-09-10 11:47:10 -07:00
Junio C Hamano 96ac07f4a9 Merge branch 'ab/help-autocorrect-prompt'
The logic for auto-correction of misspelt subcommands learned to go
interactive when the help.autocorrect configuration variable is set
to 'prompt'.

* ab/help-autocorrect-prompt:
  help.c: help.autocorrect=prompt waits for user action
2021-09-10 11:46:33 -07:00
Junio C Hamano 613204b948 Merge branch 'cb/ci-build-pedantic'
CI update.

* cb/ci-build-pedantic:
  ci: run a pedantic build as part of the GitHub workflow
2021-09-10 11:46:32 -07:00
Junio C Hamano 9762646ee4 Merge branch 'gh/gitweb-branch-sort'
Tie-break branches that point at the same object in the list of
branches on GitWeb to show the one pointed at by HEAD early.

* gh/gitweb-branch-sort:
  gitweb: use HEAD as secondary sort key in git_get_heads_list()
2021-09-10 11:46:32 -07:00
Junio C Hamano 05665a0dff Merge branch 'rs/archive-use-object-id'
Code cleanup.

* rs/archive-use-object-id:
  archive: convert queue_directory to struct object_id
2021-09-10 11:46:31 -07:00
Junio C Hamano 09f66eb0e2 Merge branch 'rs/show-branch-simplify'
Code cleanup.

* rs/show-branch-simplify:
  show-branch: simplify rev_is_head()
2021-09-10 11:46:31 -07:00
Junio C Hamano bfe37f3dc5 Merge branch 'jk/log-warn-on-bogus-encoding'
Doc update plus improved error reporting.

* jk/log-warn-on-bogus-encoding:
  docs: use "character encoding" to refer to commit-object encoding
  logmsg_reencode(): warn when iconv() fails
2021-09-10 11:46:30 -07:00
Junio C Hamano a4b1a0ade4 Merge branch 'cb/remote-ndebug-fix'
Build fix.

* cb/remote-ndebug-fix:
  remote: avoid -Wunused-but-set-variable in gcc with -DNDEBUG
2021-09-10 11:46:30 -07:00
Junio C Hamano fd0d7036e0 Merge branch 'ab/retire-advice-config'
Code clean up to migrate callers from older advice_config[] based
API to newer advice_if_enabled() and advice_enabled() API.

* ab/retire-advice-config:
  advice: move advice.graftFileDeprecated squashing to commit.[ch]
  advice: remove use of global advice_add_embedded_repo
  advice: remove read uses of most global `advice_` variables
  advice: add enum variants for missing advice variables
2021-09-10 11:46:29 -07:00
Junio C Hamano 6d09fc54f6 Merge branch 'mk/clone-recurse-submodules'
After "git clone --recurse-submodules", all submodules are cloned
but they are not by default recursed into by other commands.  With
submodule.stickyRecursiveClone configuration set, submodule.recurse
configuration is set to true in a repository created by "clone"
with "--recurse-submodules" option.

* mk/clone-recurse-submodules:
  clone: set submodule.recurse=true if submodule.stickyRecursiveClone enabled
2021-09-10 11:46:29 -07:00
Junio C Hamano f0b567898b Merge branch 'ab/mailmap-leakfix'
Leakfix.

* ab/mailmap-leakfix:
  mailmap.c: fix a memory leak in free_mailap_{info,entry}()
2021-09-10 11:46:28 -07:00
Junio C Hamano 02d263277a Merge branch 'ab/gc-log-rephrase'
A pathname in an advice message has been made cut-and-paste ready.

* ab/gc-log-rephrase:
  gc: remove trailing dot from "gc.log" line
2021-09-10 11:46:28 -07:00
Junio C Hamano 6dbe1b4ee2 Merge branch 'uk/userdiff-php-enum'
Update the userdiff pattern for PHP.

* uk/userdiff-php-enum:
  userdiff: support enum keyword in PHP hunk header
2021-09-10 11:46:27 -07:00
Junio C Hamano febba8038d Merge branch 'tk/fast-export-anonymized-tag-fix'
The output from "git fast-export", when its anonymization feature
is in use, showed an annotated tag incorrectly.

* tk/fast-export-anonymized-tag-fix:
  fast-export: fix anonymized tag using original length
2021-09-10 11:46:27 -07:00
Junio C Hamano cd6a1fc8a2 Merge branch 'ba/object-info'
Leakfix.

* ba/object-info:
  protocol-caps.c: fix memory leak in send_info()
2021-09-10 11:46:26 -07:00
Junio C Hamano 1396a95ee0 Merge branch 'ab/commit-graph-usage'
Fixes on usage message from "git commit-graph".

* ab/commit-graph-usage:
  commit-graph: show "unexpected subcommand" error
  commit-graph: show usage on "commit-graph [write|verify] garbage"
  commit-graph: early exit to "usage" on !argc
  multi-pack-index: refactor "goto usage" pattern
  commit-graph: use parse_options_concat()
  commit-graph: remove redundant handling of -h
  commit-graph: define common usage with a macro
2021-09-10 11:46:25 -07:00
Junio C Hamano bd29bcf913 Merge branch 'mh/send-email-reset-in-reply-to'
Even when running "git send-email" without its own threaded
discussion support, a threading related header in one message is
carried over to the subsequent message to result in an unwanted
threading, which has been corrected.

* mh/send-email-reset-in-reply-to:
  send-email: avoid incorrect header propagation
2021-09-10 11:46:25 -07:00
Junio C Hamano 0538a2586e Merge branch 'rs/more-fspathcmp'
Code simplification.

* rs/more-fspathcmp:
  merge-recursive: use fspathcmp() in path_hashmap_cmp()
2021-09-10 11:46:24 -07:00
Junio C Hamano e4897d2bde Merge branch 'sg/set-ceiling-during-tests'
Buggy tests could damage repositories outside the throw-away test
area we created.  We now by default export GIT_CEILING_DIRECTORIES
to limit the damage from such a stray test.

* sg/set-ceiling-during-tests:
  test-lib: set GIT_CEILING_DIRECTORIES to protect the surrounding repository
2021-09-10 11:46:24 -07:00
Junio C Hamano 6f9e7cadf3 Merge branch 'jh/sparse-index-resize-fix'
The sparse-index support can corrupt the index structure by storing
a stale and/or uninitialized data, which has been corrected.

* jh/sparse-index-resize-fix:
  sparse-index: copy dir_hash in ensure_full_index()
2021-09-10 11:46:23 -07:00
Junio C Hamano b4ceeef962 Merge branch 'es/walken-tutorial-fix'
Typofix.

* es/walken-tutorial-fix:
  doc: fix syntax error and the format of printf
2021-09-10 11:46:23 -07:00
Junio C Hamano 9559de3b66 Merge branch 'tb/add-objects-in-unpacked-packs-simplify'
Code simplification with reduced memory usage.

* tb/add-objects-in-unpacked-packs-simplify:
  builtin/pack-objects.c: remove duplicate hash lookup
  builtin/pack-objects.c: simplify add_objects_in_unpacked_packs()
  object-store.h: teach for_each_packed_object to ignore kept packs
2021-09-10 11:46:21 -07:00
Junio C Hamano 87d4aed743 Merge branch 'ps/fetch-omit-formatting-under-quiet'
"git fetch --quiet" optimization to avoid useless computation of
info that will never be displayed.

* ps/fetch-omit-formatting-under-quiet:
  fetch: skip formatting updated refs with `--quiet`
2021-09-10 11:46:20 -07:00
Junio C Hamano 1ab13eb973 Merge branch 'ka/want-ref-in-namespace'
"git upload-pack" which runs on the other side of "git fetch"
forgot to take the ref namespaces into account when handling
want-ref requests.

* ka/want-ref-in-namespace:
  docs: clarify the interaction of transfer.hideRefs and namespaces
  upload-pack.c: treat want-ref relative to namespace
  t5730: introduce fetch command helper
2021-09-10 11:46:20 -07:00
Junio C Hamano 173368d73d Merge branch 'zh/cherry-pick-advice'
The advice message that "git cherry-pick" gives when it asks
conflicted replay of a commit to be resolved by the end user has
been updated.

* zh/cherry-pick-advice:
  cherry-pick: use better advice message
2021-09-10 11:46:19 -07:00
Junio C Hamano 6c083b7619 Merge branch 'js/advise-when-skipping-cherry-picked'
"git rebase" by default skips changes that are equivalent to
commits that are already in the history the branch is rebased onto;
give messages when this happens to let the users be aware of
skipped commits, and also teach them how to tell "rebase" to keep
duplicated changes.

* js/advise-when-skipping-cherry-picked:
  sequencer: advise if skipping cherry-picked commit
2021-09-10 11:46:19 -07:00
Junio C Hamano 8463beaeb6 The fourth batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-09-08 13:30:34 -07:00
Junio C Hamano cfba19618f Merge branch 'sg/column-nl'
The parser for the "--nl" option of "git column" has been
corrected.

* sg/column-nl:
  column: fix parsing of the '--nl' option
2021-09-08 13:30:34 -07:00
Junio C Hamano f7ab826740 Merge branch 'cb/makefile-apple-clang'
Build update for Apple clang.

* cb/makefile-apple-clang:
  build: catch clang that identifies itself as "$VENDOR clang"
  build: clang version may not be followed by extra words
  build: update detect-compiler for newer Xcode version
2021-09-08 13:30:33 -07:00
Junio C Hamano 7ad8ddecfd Merge branch 'ps/ls-refs-strbuf-optim'
Micro-optimization for the wire protocol driver.

* ps/ls-refs-strbuf-optim:
  ls-refs: reuse buffer when sending refs
2021-09-08 13:30:33 -07:00
Junio C Hamano ec8d24f05d Merge branch 'rs/branch-allow-deleting-dangling'
"git branch -D <branch>" used to refuse to remove a broken branch
ref that points at a missing commit, which has been corrected.

* rs/branch-allow-deleting-dangling:
  branch: allow deleting dangling branches with --force
2021-09-08 13:30:32 -07:00
Junio C Hamano f0d795428e Merge branch 'mt/quiet-with-delayed-checkout'
The delayed checkout code path in "git checkout" etc. were chatty
even when --quiet and/or --no-progress options were given.

* mt/quiet-with-delayed-checkout:
  checkout: make delayed checkout respect --quiet and --no-progress
2021-09-08 13:30:32 -07:00
Junio C Hamano 7b06222619 Merge branch 'rs/xopen-reports-open-failures'
Error diagnostics improvement.

* rs/xopen-reports-open-failures:
  use xopen() to handle fatal open(2) failures
  xopen: explicitly report creation failures
2021-09-08 13:30:32 -07:00
Junio C Hamano c8f491668e Merge branch 'dd/diff-files-unmerged-fix'
"git diff --relative" segfaulted and/or produced incorrect result
when there are unmerged paths.

* dd/diff-files-unmerged-fix:
  diff-lib: ignore paths that are outside $cwd if --relative asked
2021-09-08 13:30:31 -07:00
Junio C Hamano 85246a7054 Merge branch 'dd/t6300-wo-gpg-fix'
Test fix.

* dd/t6300-wo-gpg-fix:
  t6300: check for cat-file exit status code
  t6300: don't run cat-file on non-existent object
2021-09-08 13:30:31 -07:00
Junio C Hamano efae5c2e22 Merge branch 'mh/credential-leakfix'
Leak fix.

* mh/credential-leakfix:
  credential: fix leak in credential_apply_config()
2021-09-08 13:30:30 -07:00
Junio C Hamano a20a40e3b6 Merge branch 'jk/t5323-no-pack-test-fix'
Test fix.

* jk/t5323-no-pack-test-fix:
  t5323: drop mentions of "master"
2021-09-08 13:30:30 -07:00
Junio C Hamano 4293c057dc Merge branch 'js/maintenance-launchctl-fix'
"git maintenance" scheduler fix for macOS.

* js/maintenance-launchctl-fix:
  maintenance: skip bootout/bootstrap when plist is registered
  maintenance: create `launchctl` configuration using a lock file
2021-09-08 13:30:29 -07:00
Junio C Hamano 31e4a0db03 Merge branch 'ab/rebase-fatal-fatal-fix'
Error message fix.

* ab/rebase-fatal-fatal-fix:
  rebase: emit one "fatal" in "fatal: fatal: <error>"
2021-09-08 13:30:29 -07:00
Junio C Hamano 63ddde68cd Merge branch 'ab/ls-remote-packet-trace'
Debugging aid fix.

* ab/ls-remote-packet-trace:
  ls-remote: set packet_trace_identity(<name>)
2021-09-08 13:30:28 -07:00
Junio C Hamano ce7ae09bd4 Merge branch 'rs/git-mmap-uses-malloc'
mmap() imitation used to call xmalloc() that dies upon malloc()
failure, which has been corrected to just return an error to the
caller to be handled.

* rs/git-mmap-uses-malloc:
  compat: let git_mmap use malloc(3) directly
2021-09-08 13:30:27 -07:00
Junio C Hamano e18f4de927 Merge branch 'ga/send-email-sendmail-cmd'
Test fix.

* ga/send-email-sendmail-cmd:
  t9001: PATH must not use Windows-style paths
2021-09-08 13:30:27 -07:00
Junio C Hamano 03137a4804 Merge branch 'me/t5582-cleanup'
Test fix.

* me/t5582-cleanup:
  t5582: remove spurious 'cd "$D"' line
2021-09-08 13:30:26 -07:00
Junio C Hamano e0a2f5cbc5 The third batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-09-03 13:49:30 -07:00