Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-01-20Merge branch 'ps/completion-with-reftable-fix' into nextJunio C Hamano
Completion update to prepare for reftable * ps/completion-with-reftable-fix: completion: treat dangling symrefs as existing pseudorefs completion: silence pseudoref existence check completion: improve existence check for pseudo-refs t9902: verify that completion does not print anything completion: discover repo path in `__git_pseudoref_exists ()`
2024-01-16completion: treat dangling symrefs as existing pseudorefsPatrick Steinhardt
The `__git_pseudoref_exists ()` helper function back to git-rev-parse(1) in case the reftable backend is in use. This is not in the same spirit as the simple existence check that the "files" backend does though, because there we only check for the pseudo-ref to exist with `test -f`. With git-rev-parse(1) we not only check for existence, but also verify that the pseudo-ref resolves to an object, which may not be the case when the pseudo-ref points to an unborn branch. Fix this issue by using `git show-ref --exists` instead. Note that we do not have to silence stdout anymore as git-show-ref(1) will not print anything. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-01-16completion: silence pseudoref existence checkPatrick Steinhardt
In 44dbb3bf29 (completion: support pseudoref existence checks for reftables, 2023-12-19), we have extended the Bash completion script to support future ref backends better by using git-rev-parse(1) to check for pseudo-ref existence. This conversion has introduced a bug, because even though we pass `--quiet` to git-rev-parse(1) it would still output the resolved object ID of the ref in question if it exists. Fix this by redirecting its stdout to `/dev/null` and add a test that catches this behaviour. Note that the test passes even without the fix for the "files" backend because we parse pseudo refs via the filesystem directly in that case. But the test will fail with the "reftable" backend. Helped-by: Jeff King <peff@peff.net> Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-01-16completion: improve existence check for pseudo-refsPatrick Steinhardt
Improve the existence check along the following lines: - Stop stripping the "ref :" prefix and compare to the expected value directly. This allows us to drop a now-unused variable that was previously leaking into the user's shell. - Mark the "head" variable as local so that we don't leak its value into the user's shell. - Stop manually handling the `-C $__git_repo_path` option, which the `__git ()` wrapper aleady does for us. - In simlar spirit, stop redirecting stderr, which is also handled by the wrapper already. Suggested-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-01-16completion: discover repo path in `__git_pseudoref_exists ()`Patrick Steinhardt
The helper function `__git_pseudoref_exists ()` expects that the repo path has already been discovered by its callers, which makes for a rather fragile calling convention. Refactor the function to discover the repo path itself to make it more self-contained, which also removes the need to discover the path in some of its callers. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-01-08git-prompt: stop manually parsing HEAD with unknown ref formatsPatrick Steinhardt
We're manually parsing the HEAD reference in git-prompt to figure out whether it is a symbolic or direct reference. This makes it intimately tied to the on-disk format we use to store references and will stop working once we gain additional reference backends in the Git project. Ideally, we would refactor the code to exclusively use plumbing tools to read refs such that we do not have to care about the on-disk format at all. Unfortunately though, spawning processes can be quite expensive on some systems like Windows. As the Git prompt logic may be executed quite frequently we try very hard to spawn as few processes as possible. This refactoring is thus out of question for now. Instead, condition the logic on the repository's ref format: if the repo uses the the "files" backend we can continue to use the old logic and read the respective files from disk directly. If it's anything else, then we use git-symbolic-ref(1) to read the value of HEAD. This change makes the Git prompt compatible with the upcoming "reftable" format. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-01-03Merge branch 'sh/completion-with-reftable'Junio C Hamano
Command line completion script (in contrib/) learned to work better with the reftable backend. * sh/completion-with-reftable: completion: support pseudoref existence checks for reftables completion: refactor existence checks for pseudorefs
2023-12-20Merge branch 'en/complete-sparse-checkout'Junio C Hamano
Command line completion (in contrib/) learned to complete path arguments to the "add/set" subcommands of "git sparse-checkout" better. * en/complete-sparse-checkout: completion: avoid user confusion in non-cone mode completion: avoid misleading completions in cone mode completion: fix logic for determining whether cone mode is active completion: squelch stray errors in sparse-checkout completion
2023-12-20completion: support pseudoref existence checks for reftablesStan Hu
In contrib/completion/git-completion.bash, there are a bunch of instances where we read pseudorefs, such as HEAD, MERGE_HEAD, REVERT_HEAD, and others via the filesystem. However, the upcoming reftable refs backend won't use '.git/HEAD' at all but instead will write an invalid refname as placeholder for backwards compatibility, which will break the git-completion script. Update the '__git_pseudoref_exists' function to: 1. Recognize the placeholder '.git/HEAD' written by the reftable backend (its content is specified in the reftable specs). 2. If reftable is in use, use 'git rev-parse' to determine whether the given ref exists. 3. Otherwise, continue to use 'test -f' to check for the ref's filename. Signed-off-by: Stan Hu <stanhu@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-12-20completion: refactor existence checks for pseudorefsStan Hu
In preparation for the reftable backend, this commit introduces a '__git_pseudoref_exists' function that continues to use 'test -f' to determine whether a given pseudoref exists in the local filesystem. Signed-off-by: Stan Hu <stanhu@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-12-10Merge branch 'tz/send-email-negatable-options'Junio C Hamano
Newer versions of Getopt::Long started giving warnings against our (ab)use of it in "git send-email". Bump the minimum version requirement for Perl to 5.8.1 (from September 2002) to allow simplifying our implementation. * tz/send-email-negatable-options: send-email: avoid duplicate specification warnings perl: bump the required Perl version to 5.8.1 from 5.8.0
2023-12-10Merge branch 'ps/ban-a-or-o-operator-with-test'Junio C Hamano
Test and shell scripts clean-up. * ps/ban-a-or-o-operator-with-test: Makefile: stop using `test -o` when unlinking duplicate executables contrib/subtree: convert subtree type check to use case statement contrib/subtree: stop using `-o` to test for number of args global: convert trivial usages of `test <expr> -a/-o <expr>`
2023-12-10Merge branch 'js/doc-unit-tests-with-cmake'Junio C Hamano
Update the base topic to work with CMake builds. * js/doc-unit-tests-with-cmake: cmake: handle also unit tests cmake: use test names instead of full paths cmake: fix typo in variable name artifacts-tar: when including `.dll` files, don't forget the unit-tests unit-tests: do show relative file paths unit-tests: do not mistake `.pdb` files for being executable cmake: also build unit tests
2023-12-03completion: avoid user confusion in non-cone modeElijah Newren
It is tempting to think of "files and directories" of the current directory as valid inputs to the add and set subcommands of git sparse-checkout. However, in non-cone mode, they often aren't and using them as potential completions leads to *many* forms of confusion: Issue #1. It provides the *wrong* files and directories. For git sparse-checkout add we always want to add files and directories not currently in our sparse checkout, which means we want file and directories not currently present in the current working tree. Providing the files and directories currently present is thus always wrong. For git sparse-checkout set we have a similar problem except in the subset of cases where we are trying to narrow our checkout to a strict subset of what we already have. That is not a very common scenario, especially since it often does not even happen to be true for the first use of the command; for years we required users to create a sparse-checkout via git sparse-checkout init git sparse-checkout set <args...> (or use a clone option that did the init step for you at clone time). The init command creates a minimal sparse-checkout with just the top-level directory present, meaning the set command has to be used to expand the checkout. Thus, only in a special and perhaps unusual cases would any of the suggestions from normal file and directory completion be appropriate. Issue #2: Suggesting patterns that lead to warnings is unfriendly. If the user specifies any regular file and omits the leading '/', then the sparse-checkout command will warn the user that their command is problematic and suggest they use a leading slash instead. Issue #3: Completion gets confused by leading '/', and provides wrong paths. Users often want to anchor their patterns to the toplevel of the repository, especially when listing individual files. There are a number of reasons for this, but notably even sparse-checkout encourages them to do so (as noted above). However, if users do so (via adding a leading '/' to their pattern), then bash completion will interpret the leading slash not as a request for a path at the toplevel of the repository, but as a request for a path at the root of the filesytem. That means at best that completion cannot help with such paths, and if it does find any completions, they are almost guaranteed to be wrong. Issue #4: Suggesting invalid patterns from subdirectories is unfriendly. There is no per-directory equivalent to .gitignore with sparse-checkouts. There is only a single worktree-global $GIT_DIR/info/sparse-checkout file. As such, paths to files must be specified relative to the toplevel of a repository. Providing suggestions of paths that are relative to the current working directory, as bash completion defaults to, is wrong when the current working directory is not the worktree toplevel directory. Issue #5: Paths with special characters will be interpreted incorrectly The entries in the sparse-checkout file are patterns, not paths. While most paths also qualify as patterns (though even in such cases it would be better for users to not use them directly but prefix them with a leading '/'), there are a variety of special characters that would need special escaping beyond the normal shell escaping: '*', '?', '\', '[', ']', and any leading '#' or '!'. If completion suggests any such paths, users will likely expect them to be treated as an exact path rather than as a pattern that might match some number of files other than 1. However, despite the first four issues, we can note that _if_ users are using tab completion, then they are probably trying to specify a path in the index. As such, we transform their argument into a top-level-rooted pattern that matches such a file. For example, if they type: git sparse-checkout add Make<TAB> we could "complete" to git sparse-checkout add /Makefile or, if they ran from the Documentation/technical/ subdirectory: git sparse-checkout add m<TAB> we could "complete" it to: git sparse-checkout add /Documentation/technical/multi-pack-index.txt Note in both cases I use "complete" in quotes, because we actually add characters both before and after the argument in question, so we are kind of abusing "bash completions" to be "bash completions AND beginnings". The fifth issue is a bit stickier, especially when you consider that we not only need to deal with escaping issues because of special meanings of patterns in sparse-checkout & gitignore files, but also that we need to consider escaping issues due to ls-files needing to sometimes quote or escape characters, and because the shell needs to escape some characters. The multiple interacting forms of escaping could get ugly; this patch makes no attempt to do so and simply documents that we decided to not deal with those corner cases for now but at least get the common cases right. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-12-03completion: avoid misleading completions in cone modeElijah Newren
The "set" and "add" subcommands of "sparse-checkout", when in cone mode, should only complete on directories. For bash_completion in general, when no completions are returned for any subcommands, it will often fall back to standard completion of files and directories as a substitute. That is not helpful here. Since we have already looked for all valid completions, if none are found then falling back to standard bash file and directory completion is at best actively misleading. In fact, there are three different ways it can be actively misleading. Add a long comment in the code about how that fallback behavior can deceive, and disable the fallback by returning a fake result as the sole completion. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-12-03completion: fix logic for determining whether cone mode is activeElijah Newren
_git_sparse_checkout() was checking whether we were in cone mode by checking whether either: A) core.sparseCheckoutCone was "true" B) "--cone" was specified on the command line This code has 2 bugs I didn't catch in my review at the time 1) core.sparseCheckout must be "true" for core.sparseCheckoutCone to be relevant (which matters since "git sparse-checkout disable" only unsets core.sparseCheckout, not core.sparseCheckoutCone) 2) The presence of "--no-cone" should override any config setting Further, I forgot to update this logic as part of 2d95707a02 ("sparse-checkout: make --cone the default", 2022-04-22) for the new default. Update the code for the new default and make it be more careful in determining whether to complete based on cone mode or non-cone mode. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-12-03completion: squelch stray errors in sparse-checkout completionElijah Newren
If, in the root of a project, one types git sparse-checkout set --cone ../<TAB> then an error message of the form fatal: ../: '../' is outside repository at '/home/newren/floss/git' is written to stderr, which munges the users view of their own command. Squelch such messages by using the __git() wrapper, designed for this purpose; see commit e15098a314 (completion: consolidate silencing errors from git commands, 2017-02-03) for more on the wrapper. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-17perl: bump the required Perl version to 5.8.1 from 5.8.0Todd Zullinger
The following commit will make use of a Getopt::Long feature which is only present in Perl >= 5.8.1. Document that as the minimum version we support. Many of our Perl scripts will continue to run with 5.8.0 but this change allows us to adjust them as needed without breaking any promises to our users. The Perl requirement was last changed in d48b284183 (perl: bump the required Perl version to 5.8 from 5.6.[21], 2010-09-24). At that time, 5.8.0 was 8 years old. It is now over 21 years old. Signed-off-by: Todd Zullinger <tmz@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-11contrib/subtree: convert subtree type check to use case statementPatrick Steinhardt
The `subtree_for_commit ()` helper function asserts that the subtree identified by its parameters are either a commit or tree. This is done via the `-o` parameter of test, which is discouraged. Refactor the code to instead use a switch statement over the type. Despite being aligned with our coding guidelines, the resulting code is arguably also easier to read. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-11contrib/subtree: stop using `-o` to test for number of argsPatrick Steinhardt
Functions in git-subtree.sh all assert that they are being passed the correct number of arguments. In cases where we accept a variable number of arguments we assert this via a single call to `test` with `-o`, which is discouraged by our coding guidelines. Convert these cases to stop doing so. This requires us to decompose assertions of the style `assert test $# = 2 -o $# = 3` into two calls because we have no easy way to logically chain statements passed to the assert function. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-11global: convert trivial usages of `test <expr> -a/-o <expr>`Patrick Steinhardt
Our coding guidelines say to not use `test` with `-a` and `-o` because it can easily lead to bugs. Convert trivial cases where we still use these to instead instead concatenate multiple invocations of `test` via `&&` and `||`, respectively. While not all of the converted instances can cause ambiguity, it is worth getting rid of all of them regardless: - It becomes easier to reason about the code as we do not have to argue why one use of `-a`/`-o` is okay while another one isn't. - We don't encourage people to use these expressions. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-10cmake: handle also unit testsJohannes Schindelin
The unit tests should also be available e.g. in Visual Studio's Test Explorer when configuring Git's source code via CMake. Suggested-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-10cmake: use test names instead of full pathsJohannes Schindelin
The primary purpose of Git's CMake definition is to allow developing Git in Visual Studio. As part of that, the CTest feature allows running individual test scripts conveniently in Visual Studio's Test Explorer. However, this Test Explorer's design targets object-oriented languages and therefore expects the test names in the form `<namespace>.<class>.<testname>`. And since we specify the full path of the test scripts instead, including the ugly `/.././t/` part, these dots confuse the Test Explorer and it uses a large part of the path as "namespace". Let's just use `t.suite.<name>` instead. This presents the tests in Visual Studio's Test Explorer in the following form by default (i.e. unless the user changes the view via the "Group by" menu): ◢ ◈ git ◢ ◈ t ◢ ◈ suite ◈ t0000-basic ◈ t0001-init ◈ t0002-gitfile [...] Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-10cmake: fix typo in variable nameJohannes Schindelin
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-10cmake: also build unit testsJohannes Schindelin
A new, better way to run unit tests was just added to Git. This adds support for building those unit tests via CMake. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-08Merge branch 'jc/test-i18ngrep'Junio C Hamano
Another step to deprecate test_i18ngrep. * jc/test-i18ngrep: tests: teach callers of test_i18ngrep to use test_grep test framework: further deprecate test_i18ngrep
2023-11-02tests: teach callers of test_i18ngrep to use test_grepJunio C Hamano
They are equivalents and the former still exists, so as long as the only change this commit makes are to rewrite test_i18ngrep to test_grep, there won't be any new bug, even if there still are callers of test_i18ngrep remaining in the tree, or when merged to other topics that add new uses of test_i18ngrep. This patch was produced more or less with git grep -l -e 'test_i18ngrep ' 't/t[0-9][0-9][0-9][0-9]-*.sh' | xargs perl -p -i -e 's/test_i18ngrep /test_grep /' and a good way to sanity check the result yourself is to run the above in a checkout of c4603c1c (test framework: further deprecate test_i18ngrep, 2023-10-31) and compare the resulting working tree contents with the result of applying this patch to the same commit. You'll see that test_i18ngrep in a few t/lib-*.sh files corrected, in addition to the manual reproduction. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-30Merge branch 'sn/typo-grammo-phraso-fixes'Junio C Hamano
Many typos, ungrammatical sentences and wrong phrasing have been fixed. * sn/typo-grammo-phraso-fixes: t/README: fix multi-prerequisite example doc/gitk: s/sticked/stuck/ git-jump: admit to passing merge mode args to ls-files doc/diff-options: improve wording of the log.diffMerges mention doc: fix some typos, grammar and wording issues
2023-10-09completion: complete '--dd'Sergey Organov
'--dd' only makes sense for 'git log' and 'git show', so add it to __git_log_show_options which is referenced in the completion for these two commands. Signed-off-by: Sergey Organov <sorganov@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-05git-jump: admit to passing merge mode args to ls-filesŠtěpán Němec
There's even an example of such usage in the README. Fixes: 67ba13e5a4b2 ("git-jump: pass "merge" arguments to ls-files") Signed-off-by: Štěpán Němec <stepnem@smrk.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-05doc: fix some typos, grammar and wording issuesŠtěpán Němec
Signed-off-by: Štěpán Němec <stepnem@smrk.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-09-20completion: loosen and document the requirement around completing aliasJunio C Hamano
Recently we started to tell users to spell ": git foo ;" with space(s) around 'foo' for an alias to be completed similarly to the 'git foo' command. It however is easy to also allow users to spell it in a more natural way with the semicolon attached to 'foo', i.e. ": git foo;". Also, add a comment to note that 'git' is optional and writing ": foo;" would complete the alias just fine. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-09-20Merge branch 'pb/completion-aliases-doc'Junio C Hamano
Clarify how "alias.foo = : git cmd ; aliased-command-string" should be spelled with necessary whitespaces around punctuation marks to work. * pb/completion-aliases-doc: completion: improve doc for complex aliases
2023-09-20Merge branch 'pb/complete-commit-trailers'Junio C Hamano
The command-line complation support (in contrib/) learned to complete "git commit --trailer=" for possible trailer keys. * pb/complete-commit-trailers: completion: commit: complete trailers tokens more robustly completion: commit: complete configured trailer tokens
2023-09-18Merge branch 'js/complete-checkout-t'Junio C Hamano
The completion script (in contrib/) has been taught to treat the "-t" option to "git checkout" and "git switch" just like the "--track" option, to complete remote-tracking branches. * js/complete-checkout-t: completion(switch/checkout): treat --track and -t the same
2023-09-13completion: improve doc for complex aliasesPhilippe Blain
The completion code can be told to use a particular completion for aliases that shell out by using ': git <cmd> ;' as the first command of the alias. This only works if <cmd> and the semicolon are separated by a space, since if the space is missing __git_aliased_command returns (for example) 'checkout;' instead of just 'checkout', and then __git_complete_command fails to find a completion for 'checkout;'. The examples have that space but it's not clear if it's just for style or if it's mandatory. Explicitly mention it. Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-09-13completion: commit: complete trailers tokens more robustlyPhilippe Blain
In the previous commit, we added support for completing configured trailer tokens in 'git commit --trailer'. Make the implementation more robust by: - using '__git' instead of plain 'git', as the rest of the completion script does - using a stricter pattern for --get-regexp to avoid false hits - using 'cut' and 'rev' instead of 'awk' to account for tokens including dots. Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-09-08completion(switch/checkout): treat --track and -t the sameJohannes Schindelin
When `git switch --track ` is to be completed, only remote refs are eligible because that is what the `--track` option targets. And when the short-hand `-t` is used instead, the same _should_ happen. Let's make it so. Note that the bug exists both in the completions of `switch` and `completion`, even if it manifests in slightly different ways: While the completion of `git switch -t ` will not even look at remote refs, the completion of `git checkout -t ` will look at both remote _and_ local refs. Both should look only at remote refs. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-09-07completion: commit: complete configured trailer tokensPhilippe Blain
Since 2daae3d1d1 (commit: add --trailer option, 2021-03-23), 'git commit' can add trailers to commit messages. To make that feature more pleasant to use at the command line, update the Bash completion code to offer configured trailer tokens. Add a __git_trailer_tokens function to list the configured trailers tokens, and use it in _git_commit to suggest the configured tokens, suffixing the completion words with ':' so that the user only has to add the trailer value. Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-08-28Merge branch 'mh/credential-erase-improvements-more'Junio C Hamano
Update two credential helpers to correctly match which credential to erase; they dropped not the ones with stale password. * mh/credential-erase-improvements-more: credential/wincred: erase matching creds only credential/libsecret: erase matching creds only
2023-08-28Merge branch 'mh/credential-libsecret-attrs'Junio C Hamano
The way authentication related data other than passwords (e.g. oath token and password expiration data) are stored in libsecret keyrings has been rethought. * mh/credential-libsecret-attrs: credential/libsecret: store new attributes
2023-08-25Merge branch 'rs/parse-options-negation-help'Junio C Hamano
"git cmd -h" learned to signal which options can be negated by listing such options like "--[no-]opt". * rs/parse-options-negation-help: parse-options: simplify usage_padding() parse-options: no --[no-]no-... parse-options: factor out usage_indent() and usage_padding() parse-options: show negatability of options in short help t1502: test option negation t1502: move optionspec help output to a file t1502, docs: disallow --no-help subtree: disallow --no-{help,quiet,debug,branch,message}
2023-08-15Merge branch 'ds/maintenance-on-windows-fix'Junio C Hamano
Windows updates. * ds/maintenance-on-windows-fix: git maintenance: avoid console window in scheduled tasks on Windows win32: add a helper to run `git.exe` without a foreground window
2023-08-09win32: add a helper to run `git.exe` without a foreground windowJohannes Schindelin
On Windows, there are two kinds of executables, console ones and non-console ones. Git's executables are all console ones. When launching the former e.g. in a scheduled task, a CMD window pops up. This is not what we want for the tasks installed via the `git maintenance` command. To work around this, let's introduce `headless-git.exe`, which is a non-console program that does _not_ pop up any window. All it does is to re-launch `git.exe`, suppressing that console window, passing through all command-line arguments as-are. Helped-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> Helped-by: Yuyi Wang <Strawberry_Str@hotmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-08-07parse-options: show negatability of options in short helpRené Scharfe
Add a "[no-]" prefix to options without the flag PARSE_OPT_NONEG to document the fact that you can negate them. This looks a bit strange for options that already start with "no-", e.g. for the option --no-name of git show-branch: --[no-]no-name suppress naming strings You can actually use --no-no-name as an alias of --name, so the short help is not wrong. If we strip off any of the "no-"s, we lose either the ability to see if the remaining one belongs to the documented variant or to see if it can be negated. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-08-07subtree: disallow --no-{help,quiet,debug,branch,message}René Scharfe
"git subtree" only handles the negated variant of the options annotate, prefix, onto, rejoin, ignore-joins and squash explicitly. help is handled by "git rev-parse --parseopt" implicitly, but not its negated form. Disable negation for it and the for the rest of the options to get a helpful error message when trying them. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-26credential/wincred: erase matching creds onlyM Hickford
The credential erase request typically includes protocol, host, username and password. credential-wincred erases stored credentials that match protocol, host and username, regardless of password. This is confusing in the case the stored password differs from that in the request. This case can occur when multiple credential helpers are configured. Only erase credential if stored password matches request (or request omits password). This fixes test "helper (wincred) does not erase a password distinct from input" when t0303 is run with GIT_TEST_CREDENTIAL_HELPER set to "wincred". This test was added in aeb21ce22e (credential: avoid erasing distinct password, 2023-06-13). Signed-off-by: M Hickford <mirth.hickford@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-26credential/libsecret: erase matching creds onlyM Hickford
The credential erase request typically includes protocol, host, username and password. credential-libsecret erases a stored credential if it matches protocol, host and username, regardless of password. This is confusing in the case the stored password differs from that in the request. This case can occur when multiple credential helpers are configured. Only erase credential if stored password matches request (or request omits password). This fixes test "helper (libsecret) does not erase a password distinct from input" when t0303 is run with GIT_TEST_CREDENTIAL_HELPER set to "libsecret". This test was added in aeb21ce22e (credential: avoid erasing distinct password, 2023-06-13). Signed-off-by: M Hickford <mirth.hickford@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-06Merge branch 'gc/config-context'Junio C Hamano
Reduce reliance on a global state in the config reading API. * gc/config-context: config: pass source to config_parser_event_fn_t config: add kvi.path, use it to evaluate includes config.c: remove config_reader from configsets config: pass kvi to die_bad_number() trace2: plumb config kvi config.c: pass ctx with CLI config config: pass ctx with config files config.c: pass ctx in configsets config: add ctx arg to config_fn_t urlmatch.h: use config_fn_t type config: inline git_color_default_config
2023-07-06Merge branch 'pb/complete-diff-options'Junio C Hamano
Completion updates. * pb/complete-diff-options: (24 commits) diff.c: mention completion above add_diff_options completion: complete --remerge-diff completion: complete --diff-merges, its options and --no-diff-merges completion: move --pickaxe-{all,regex} to __git_diff_common_options completion: complete --ws-error-highlight completion: complete --unified completion: complete --output-indicator-{context,new,old} completion: complete --output completion: complete --no-stat completion: complete --no-relative completion: complete --line-prefix completion: complete --ita-invisible-in-index and --ita-visible-in-index completion: complete --irreversible-delete completion: complete --ignore-matching-lines completion: complete --function-context completion: complete --find-renames completion: complete --find-object completion: complete --find-copies completion: complete --default-prefix completion: complete --compact-summary ...