<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/contrib/completion, branch v2.36.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.36.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.36.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-03-31T01:01:11Z</updated>
<entry>
<title>Merge branch 'jd/prompt-upstream-mark'</title>
<updated>2022-03-31T01:01:11Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-03-31T01:01:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2ea7e40c53512c410cfc769f6817d31c3bec9941'/>
<id>urn:sha1:2ea7e40c53512c410cfc769f6817d31c3bec9941</id>
<content type='text'>
Tweaks in the command line prompt (in contrib/) code around its
GIT_PS1_SHOWUPSTREAM feature.

* jd/prompt-upstream-mark:
  git-prompt: put upstream comments together
  git-prompt: make long upstream state indicator consistent
  git-prompt: make upstream state indicator location consistent
  git-prompt: rename `upstream` to `upstream_type`
</content>
</entry>
<entry>
<title>git-prompt: put upstream comments together</title>
<updated>2022-03-23T20:07:50Z</updated>
<author>
<name>Justin Donnelly</name>
<email>justinrdonnelly@gmail.com</email>
</author>
<published>2022-02-27T19:57:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=094b5409eadd064110f3e74d880fad91e9ca0f0b'/>
<id>urn:sha1:094b5409eadd064110f3e74d880fad91e9ca0f0b</id>
<content type='text'>
Commit 6d158cba28 (bash completion: Support "divergence from upstream"
messages in __git_ps1, 2010-06-17) introduced support for indicating
divergence from upstream in the PS1 prompt. The comments at the top of
git-prompt.sh that were introduced with that commit are several
paragraphs long. Over the years, other comments have been inserted in
between the paragraphs relating to divergence from upstream.

This commit puts the comments relating to divergence from upstream back
together.

Signed-off-by: Justin Donnelly &lt;justinrdonnelly@gmail.com&gt;
Reviewed-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-prompt: make long upstream state indicator consistent</title>
<updated>2022-03-23T20:07:45Z</updated>
<author>
<name>Justin Donnelly</name>
<email>justinrdonnelly@gmail.com</email>
</author>
<published>2022-02-27T19:57:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=51d2d677909c031969f82c1c5ef1cc261a9990b3'/>
<id>urn:sha1:51d2d677909c031969f82c1c5ef1cc261a9990b3</id>
<content type='text'>
Use a pipe as a separator before long upstream state indicator. This is
consistent with long state indicators for sparse and in-progress
operations (e.g. merge).

For comparison, `__git_ps1` examples without upstream state indicator:
(main)
(main %)
(main *%)
(main|SPARSE)
(main %|SPARSE)
(main *%|SPARSE)
(main|SPARSE|REBASE 1/2)
(main %|SPARSE|REBASE 1/2)

Note that if there are long state indicators, they appear after short
state indicators if there are any, or after the branch name if there are
no short state indicators. Each long state indicator begins with a pipe
(`|`) as a separator.

Before/after examples with long upstream state indicator:
| Before                          | After                           |
| ------------------------------- | ------------------------------- |
| (main u=)                       | (main|u=)                       |
| (main u= origin/main)           | (main|u= origin/main)           |
| (main u+1)                      | (main|u+1)                      |
| (main u+1 origin/main)          | (main|u+1 origin/main)          |
| (main % u=)                     | (main %|u=)                     |
| (main % u= origin/main)         | (main %|u= origin/main)         |
| (main % u+1)                    | (main %|u+1)                    |
| (main % u+1 origin/main)        | (main %|u+1 origin/main)        |
| (main|SPARSE u=)                | (main|SPARSE|u=)                |
| (main|SPARSE u= origin/main)    | (main|SPARSE|u= origin/main)    |
| (main|SPARSE u+1)               | (main|SPARSE|u+1)               |
| (main|SPARSE u+1 origin/main)   | (main|SPARSE|u+1 origin/main)   |
| (main %|SPARSE u=)              | (main %|SPARSE|u=)              |
| (main %|SPARSE u= origin/main)  | (main %|SPARSE|u= origin/main)  |
| (main %|SPARSE u+1)             | (main %|SPARSE|u+1)             |
| (main %|SPARSE u+1 origin/main) | (main %|SPARSE|u+1 origin/main) |

Signed-off-by: Justin Donnelly &lt;justinrdonnelly@gmail.com&gt;
Reviewed-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-prompt: make upstream state indicator location consistent</title>
<updated>2022-03-23T20:07:40Z</updated>
<author>
<name>Justin Donnelly</name>
<email>justinrdonnelly@gmail.com</email>
</author>
<published>2022-02-27T19:57:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0ec7c23cdc6bde5af3039c59e21507adf7579a99'/>
<id>urn:sha1:0ec7c23cdc6bde5af3039c59e21507adf7579a99</id>
<content type='text'>
Make upstream state indicator location more consistent with similar
state indicators (e.g. sparse). Group the short upstream state indicator
(`=`, `&lt;`, `&gt;`, or `&lt;&gt;`) with other short state indicators immediately
after the branch name. Previously short and long upstream state
indicators appeared after all other state indicators.

Use a separator (`SP` or `GIT_PS1_STATESEPARATOR`) between branch name
and short upstream state indicator. Previously the short upstream state
indicator would sometimes appear directly adjacent to the branch name
instead of being separated.

For comparison, `__git_ps1` examples without upstream state indicator:
(main)
(main %)
(main *%)
(main|SPARSE)
(main %|SPARSE)
(main *%|SPARSE)
(main|SPARSE|REBASE 1/2)
(main %|SPARSE|REBASE 1/2)

Note that if there are short state indicators, they appear together
after the branch name and separated from it by `SP` or
`GIT_PS1_STATESEPARATOR`.

Before/after examples with short upstream state indicator:
| Before           | After            |
| ---------------- | ---------------- |
| (main=)          | (main =)         |
| (main|SPARSE=)   | (main =|SPARSE)  |
| (main %|SPARSE=) | (main %=|SPARSE) |

Signed-off-by: Justin Donnelly &lt;justinrdonnelly@gmail.com&gt;
Reviewed-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-prompt: rename `upstream` to `upstream_type`</title>
<updated>2022-03-23T20:07:26Z</updated>
<author>
<name>Justin Donnelly</name>
<email>justinrdonnelly@gmail.com</email>
</author>
<published>2022-02-27T19:57:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4d9dc2c57a36027a619c3b846cce5f02206d9a06'/>
<id>urn:sha1:4d9dc2c57a36027a619c3b846cce5f02206d9a06</id>
<content type='text'>
In `__git_ps1_show_upstream` rename the variable `upstream` to
`upstream_type`. This allows `__git_ps1_show_upstream` to reference a
variable named `upstream` that is declared `local` in `__git_ps1`, which
calls `__git_ps1_show_upstream`.

Signed-off-by: Justin Donnelly &lt;justinrdonnelly@gmail.com&gt;
Reviewed-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>completion: tab completion of filenames for 'git restore'</title>
<updated>2022-03-16T00:21:22Z</updated>
<author>
<name>David Cantrell</name>
<email>david@cantrell.org.uk</email>
</author>
<published>2022-03-15T22:13:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=841fd28ce215ffeea4a291e7be533545c641396a'/>
<id>urn:sha1:841fd28ce215ffeea4a291e7be533545c641396a</id>
<content type='text'>
If no --args are present after 'git restore', it assumes that you
want to tab-complete one of the files with unstaged uncommitted
changes.

If a file has been staged, we don't want to list it, as restoring those
requires a slightly more complex `git restore --staged`, so we only list
those files that are --modified. While --committable also looks like
a good candidate, that includes changes that have been staged.

Signed-off-by: David Cantrell &lt;david@cantrell.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ab/complete-show-all-commands'</title>
<updated>2022-02-18T00:25:06Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-02-18T00:25:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=037dbe8ed79fab357b7a183d032b08b4ec22e5e8'/>
<id>urn:sha1:037dbe8ed79fab357b7a183d032b08b4ec22e5e8</id>
<content type='text'>
The command line completion script (in contrib/) learned to
complete all Git subcommands, including the ones that are normally
hidden, when GIT_COMPLETION_SHOW_ALL_COMMANDS is used.

* ab/complete-show-all-commands:
  completion: add a GIT_COMPLETION_SHOW_ALL_COMMANDS
  completion tests: re-source git-completion.bash in a subshell
</content>
</entry>
<entry>
<title>completion: handle unusual characters for sparse-checkout</title>
<updated>2022-02-08T18:15:43Z</updated>
<author>
<name>Lessley Dennington</name>
<email>lessleydennington@gmail.com</email>
</author>
<published>2022-02-07T17:31:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=48803821b1712687d6e06e9d7a0e911eabecf4d1'/>
<id>urn:sha1:48803821b1712687d6e06e9d7a0e911eabecf4d1</id>
<content type='text'>
Update the __gitcomp_directories method to de-quote and handle unusual
characters in directory names. Although this initially involved an attempt
to re-use the logic in __git_index_files, this method removed
subdirectories (e.g. folder1/0/ became folder1/), so instead new custom
logic was placed directly in the __gitcomp_directories method.

Note there are two tests for this new functionality - one for spaces and
accents and one for backslashes and tabs. The backslashes and tabs test
uses FUNNYNAMES to avoid running on Windows. This is because:

1. Backslashes are explicitly not allowed in Windows file paths.
2. Although tabs appear to be allowed when creating a file in a Windows
bash shell, they actually are not renderable (and appear as empty boxes
in the shell).

Co-authored-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Co-authored-by: Lessley Dennington &lt;lessleydennington@gmail.com&gt;
Helped-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Lessley Dennington &lt;lessleydennington@gmail.com&gt;
Reviewed-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>completion: improve sparse-checkout cone mode directory completion</title>
<updated>2022-02-08T18:15:43Z</updated>
<author>
<name>Lessley Dennington</name>
<email>lessleydennington@gmail.com</email>
</author>
<published>2022-02-07T17:31:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c5f5c5082f813a875c213445135a24c2507021dd'/>
<id>urn:sha1:c5f5c5082f813a875c213445135a24c2507021dd</id>
<content type='text'>
Use new __gitcomp_directories method to complete directory names in cone
mode sparse-checkouts. This method addresses the caveat of poor
performance in monorepos from the previous commit (by completing only one
level of directories).

The unusual character caveat from the previous commit will be fixed by the
final commit in this series.

Co-authored-by: Elijah Newren &lt;newren@gmail.com&gt;
Co-authored-by: Lessley Dennington &lt;lessleydennington@gmail.com&gt;
Signed-off-by: Lessley Dennington &lt;lessleydennington@gmail.com&gt;
Reviewed-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>completion: address sparse-checkout issues</title>
<updated>2022-02-08T18:15:42Z</updated>
<author>
<name>Lessley Dennington</name>
<email>lessleydennington@gmail.com</email>
</author>
<published>2022-02-07T17:31:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fd6d9bec145924ba704b34f0788b239bff9d2898'/>
<id>urn:sha1:fd6d9bec145924ba704b34f0788b239bff9d2898</id>
<content type='text'>
Correct multiple issues with tab completion of the git sparse-checkout
command. These issues were:

1. git sparse-checkout &lt;TAB&gt; previously resulted in an incomplete list of
subcommands (it was missing reapply and add).
2. Subcommand options were not tab-completable.
3. git sparse-checkout set &lt;TAB&gt; and git sparse-checkout add &lt;TAB&gt; showed
both file names and directory names. While this may be a less surprising
behavior for non-cone mode, cone mode sparse checkouts should complete
only directory names.

Note that while the new strategy of just using git ls-tree to complete on
directory names is simple and a step in the right direction, it does have
some caveats. These are:

1. Likelihood of poor performance in large monorepos (as a result of
recursively completing directory names).
2. Inability to handle paths containing unusual characters.

These caveats will be fixed by subsequent commits in this series.

Signed-off-by: Lessley Dennington &lt;lessleydennington@gmail.com&gt;
Reviewed-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
