Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

complete: zsh: add missing sub cmd completion candidates #613

Closed

Conversation

tmoschou
Copy link

@tmoschou tmoschou commented Apr 16, 2020

Add missing 'restore' and 'switch' sub commands to zsh completion
candidate output. E.g.

$ git re<tab>
rebase    -- forward-port local commits to the updated upstream head
reset     -- reset current HEAD to the specified state
restore   -- restore working tree files
$ git s<tab>
show      -- show various types of objects
status    -- show the working tree status
switch    -- switch branches

Signed-off-by: Terry Moschou tmoschou@gmail.com

Thanks for taking the time to contribute to Git! Please be advised that the
Git community does not use github.com for their contributions. Instead, we use
a mailing list (git@vger.kernel.org) for code submissions, code reviews, and
bug reports. Nevertheless, you can use GitGitGadget (https://gitgitgadget.github.io/)
to conveniently send your Pull Requests commits to our mailing list.

Please read the "guidelines for contributing" linked above!

cc: Felipe Contreras felipe.contreras@gmail.com

Add missing 'restore' and 'switch' sub commands to zsh completion
candidate output. E.g.

  $ git re<tab>
  rebase    -- forward-port local commits to the updated upstream head
  reset     -- reset current HEAD to the specified state
  restore   -- restore working tree files

  $ git s<tab>
  show      -- show various types of objects
  status    -- show the working tree status
  switch    -- switch branches

Signed-off-by: Terry Moschou <tmoschou@gmail.com>
@gitgitgadget
Copy link

gitgitgadget bot commented Apr 16, 2020

Welcome to GitGitGadget

Hi @tmoschou, and welcome to GitGitGadget, the GitHub App to send patch series to the Git mailing list from GitHub Pull Requests.

Please make sure that your Pull Request has a good description, as it will be used as cover letter.

Also, it is a good idea to review the commit messages one last time, as the Git project expects them in a quite specific form:

  • the lines should not exceed 76 columns,
  • the first line should be like a header and typically start with a prefix like "tests:" or "commit:", and
  • the commit messages' body should be describing the "why?" of the change.
  • Finally, the commit messages should end in a Signed-off-by: line matching the commits' author.

It is in general a good idea to await the automated test ("Checks") in this Pull Request before contributing the patches, e.g. to avoid trivial issues such as unportable code.

Contributing the patches

Before you can contribute the patches, your GitHub username needs to be added to the list of permitted users. Any already-permitted user can do that, by adding a comment to your PR of the form /allow. A good way to find other contributors is to locate recent pull requests where someone has been /allowed:

Both the person who commented /allow and the PR author are able to /allow you.

An alternative is the channel #git-devel on the FreeNode IRC network:

<newcontributor> I've just created my first PR, could someone please /allow me? https://github.com/gitgitgadget/git/pull/12345
<veteran> newcontributor: it is done
<newcontributor> thanks!

Once on the list of permitted usernames, you can contribute the patches to the Git mailing list by adding a PR comment /submit.

If you want to see what email(s) would be sent for a /submit request, add a PR comment /preview to have the email(s) sent to you. You must have a public GitHub email address for this.

After you submit, GitGitGadget will respond with another comment that contains the link to the cover letter mail in the Git mailing list archive. Please make sure to monitor the discussion in that thread and to address comments and suggestions (while the comments and suggestions will be mirrored into the PR by GitGitGadget, you will still want to reply via mail).

If you do not want to subscribe to the Git mailing list just to be able to respond to a mail, you can download the mbox from the Git mailing list archive (click the (raw) link), then import it into your mail program. If you use GMail, you can do this via:

curl -g --user "<EMailAddress>:<Password>" \
    --url "imaps://imap.gmail.com/INBOX" -T /path/to/raw.txt

To iterate on your change, i.e. send a revised patch or patch series, you will first want to (force-)push to the same branch. You probably also want to modify your Pull Request description (or title). It is a good idea to summarize the revision by adding something like this to the cover letter (read: by editing the first comment on the PR, i.e. the PR description):

Changes since v1:
- Fixed a typo in the commit message (found by ...)
- Added a code comment to ... as suggested by ...
...

To send a new iteration, just add another PR comment with the contents: /submit.

Need help?

New contributors who want advice are encouraged to join git-mentoring@googlegroups.com, where volunteers who regularly contribute to Git are willing to answer newbie questions, give advice, or otherwise provide mentoring to interested contributors. You must join in order to post or view messages, but anyone can join.

You may also be able to find help in real time in the developer IRC channel, #git-devel on Freenode. Remember that IRC does not support offline messaging, so if you send someone a private message and log out, they cannot respond to you. The scrollback of #git-devel is archived, though.

@tmoschou
Copy link
Author

Hi @harry-hov @dscho, are one of you able to /allow me. Thanks

@dscho
Copy link
Member

dscho commented Apr 17, 2020

/allow

@gitgitgadget
Copy link

gitgitgadget bot commented Apr 17, 2020

User tmoschou is now allowed to use GitGitGadget.

WARNING: tmoschou has no public email address set on GitHub

@tmoschou
Copy link
Author

/preview

@gitgitgadget
Copy link

gitgitgadget bot commented Apr 17, 2020

Preview email sent as pull.613.git.1587106884225.gitgitgadget@gmail.com

@tmoschou
Copy link
Author

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Apr 17, 2020

@tmoschou tmoschou changed the base branch from master to maint April 17, 2020 07:19
@gitgitgadget
Copy link

gitgitgadget bot commented Apr 17, 2020

On the Git mailing list, Junio C Hamano wrote (reply to this):

"Terry via GitGitGadget" <gitgitgadget@gmail.com> writes:

> diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
> index eef4eff53df..ce47e86b60c 100644
> --- a/contrib/completion/git-completion.zsh
> +++ b/contrib/completion/git-completion.zsh
> @@ -150,9 +150,11 @@ __git_zsh_cmd_common ()
>  	push:'update remote refs along with associated objects'
>  	rebase:'forward-port local commits to the updated upstream head'
>  	reset:'reset current HEAD to the specified state'
> +	restore:'restore working tree files'
>  	rm:'remove files from the working tree and from the index'
>  	show:'show various types of objects'
>  	status:'show the working tree status'
> +	switch:'switch branches'
>  	tag:'create, list, delete or verify a tag object signed with GPG')
>  	_describe -t common-commands 'common commands' list && _ret=0
>  }

This is not a new issue, but it makes me wonder if we can initialize
this list just once by running "git help" and picking up pieces from
it.  That way, we won't have to maintain this hardcoded list at all,
no?

And if it is cumbersome to parse "git help" output, I do not think
it is a worse solution than having to maintain the above list
manually to add a new "--list-common-commands-for-zsh-completion"
option to "git help" to produce something more easily parseable.

In any case, the patch is probably an improvement to make the list
closer to what "git help" considers "common commands", but in the
longer term, it may not be making it any better for maintainability.

Thanks.

@gitgitgadget
Copy link

gitgitgadget bot commented Apr 18, 2020

This branch is now known as tm/zsh-complete-switch-restore.

@gitgitgadget
Copy link

gitgitgadget bot commented Apr 18, 2020

This patch series was integrated into pu via git@e93bdbb.

@gitgitgadget gitgitgadget bot added the pu label Apr 18, 2020
@gitgitgadget
Copy link

gitgitgadget bot commented Apr 20, 2020

This patch series was integrated into pu via git@2eb96a6.

@gitgitgadget
Copy link

gitgitgadget bot commented Apr 21, 2020

This patch series was integrated into pu via git@0e7ec68.

@gitgitgadget
Copy link

gitgitgadget bot commented Apr 24, 2020

This patch series was integrated into pu via git@8de53ab.

@gitgitgadget
Copy link

gitgitgadget bot commented Apr 24, 2020

This patch series was integrated into next via git@8c65d7f.

@gitgitgadget gitgitgadget bot added the next label Apr 24, 2020
@gitgitgadget
Copy link

gitgitgadget bot commented Apr 28, 2020

This patch series was integrated into pu via git@8fae188.

@gitgitgadget
Copy link

gitgitgadget bot commented Apr 28, 2020

This patch series was integrated into pu via git@fea16d7.

@gitgitgadget
Copy link

gitgitgadget bot commented Apr 29, 2020

This patch series was integrated into pu via git@7d96ac1.

@gitgitgadget
Copy link

gitgitgadget bot commented Apr 29, 2020

This patch series was integrated into next via git@7d96ac1.

@gitgitgadget
Copy link

gitgitgadget bot commented Apr 29, 2020

This patch series was integrated into master via git@7d96ac1.

@gitgitgadget gitgitgadget bot added the master label Apr 29, 2020
@gitgitgadget gitgitgadget bot closed this Apr 29, 2020
@gitgitgadget
Copy link

gitgitgadget bot commented Apr 29, 2020

Closed via 7d96ac1.

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 25, 2020

On the Git mailing list, Felipe Contreras wrote (reply to this):

On Fri, Apr 17, 2020 at 1:26 PM Junio C Hamano <gitster@pobox.com> wrote:

> This is not a new issue, but it makes me wonder if we can initialize
> this list just once by running "git help" and picking up pieces from
> it.  That way, we won't have to maintain this hardcoded list at all,
> no?

Yes, that would be nice, but what if the user has an older version of
git without --list-cmds? No solution has been proposed for those cases
in the bash script.

Most users of the zsh script are decoupled from the corresponding git
version, and since you refused to graduate the scripts out of contrib,
that gives distro maintainers the excuse not to automatically package
the zsh script.

So no, given the current situation, I would rather keep updating them manually.

-- 
Felipe Contreras

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 25, 2020

User Felipe Contreras <felipe.contreras@gmail.com> has been added to the cc: list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants