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

Subtree autocompleate is missing #2414

Closed
1 task
LwServices opened this issue Nov 25, 2019 · 10 comments
Closed
1 task

Subtree autocompleate is missing #2414

LwServices opened this issue Nov 25, 2019 · 10 comments

Comments

@LwServices
Copy link

  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? I64-bit
$ git --version --build-options
git version 2.24.0.windows.2
cpu: x86_64
built from commit: 02af2cc5bfc37d4500e8a09333269e57f442198a
sizeof-long: 4
sizeof-size_t: 8
  • Which version of Windows are you running? 10 64-bit
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.17763.805]

When I enter git subt should autocompleate to subtree

@rimrul
Copy link
Member

rimrul commented Nov 25, 2019

The autocompletion is supposed to cover "porcelain commands and a select few others". git subtree isn't porcelain. It isn't even plumbing. It's contrib.

Although these pieces are available as part of the official git source tree, they are in somewhat different status. The intention is to keep interesting tools around git here, maybe even experimental ones […]

I expect that things that start their life in the contrib/ area to graduate out of contrib/ once they mature

You could propose to add git subtree to the "select few others" (or alternatively graduate it out of contrib and classify wether it's plumbing or porcelain) on the git mailing list. If you want the autocompletion to complete it locally you could also add subtree to completion.commands in your git config.

@dscho
Copy link
Member

dscho commented Nov 25, 2019

I can confirm that this is the case. My guess is that git-subtree is hidden in /mingw64/libexec/git-core, i.e. it is not in the PATH.

Could you move it to /mingw64/bin/ and try again (the move requires administrator permissions)? If that works, then the easiest fix might be to install git-subtree into the bin/ directory, by patching https://github.com/git-for-windows/MINGW-packages/blob/bde344a2510c8cfca67ba9ca26b4f8ce3ddb0c49/mingw-w64-git/PKGBUILD#L195 (maybe make gitexecdir='$(bindir)' ... install would work?) or by patching https://github.com/git/git/blob/da72936f544fec5a335e66432610e4cef4430991/contrib/subtree/Makefile#L66-L68.

A better alternative might be to integrate it into the default completion. The principal entry point for that is https://github.com/git/git/blob/v2.24.0/contrib/completion/git-completion.bash#L3104. This is the command that produces the list, and as git subtree is not an official Git command, but only in contrib/, it should probably come in via the others part of that command, which is implemented here: https://github.com/git/git/blob/v2.24.0/help.c#L334-L348.

On the other hand, an even better alternative might be to patch it into https://github.com/git/git/blob/v2.24.0/command-list.txt as part of the build function in PKGBUILD (maybe via something like git grep subtree command-list.txt || echo "git-subtree mainporcelain" >>command-list.txt), as we kind of pretend that git subtree is a first-class citizen in the mingw-w64-git package. I think I like this alternative best.

BTW I do not see any auto-complete part in https://github.com/git/git/tree/v2.24.0/contrib/subtree, do you?

So here is a great opportunity to start contributing to Git (and note that there is nothing Windows-specific about it):

  • patch the PKGBUILD file as indicated above, test, and open a PR
  • provide real tab-completion for git subtree (not only for the command, but also for its options). All you need to do is to tap into the existing tab-complete functions, imitating e.g. the tab-completion for the git worktree command.

@dscho
Copy link
Member

dscho commented Nov 25, 2019

here is a great opportunity to start contributing to Git

@LwServices what I mean with this is: if you do not want to wait (possibly forever) to see this ticket addressed, get active, jump into the source code, and fix it. Whenever you get stuck anywhere, feel very free to reach out for assistance over here in this ticket.

@zrrbite
Copy link

zrrbite commented Dec 12, 2019

Hi @dscho,

I'd like to start contributing to git-for-windows, and this seems like a great place to begin! Just to be clear, you'd like a PR that includes both a patch to PKGBUILD and tab completion for options? Or in seperate PRs.

Also, i'm noticing that adding git-subtree to the command list requires the documentation from contrib/subtree/ to be copied to Documentation/ (Dependency for command-list.h), duplicating it. Is that allright?

Thanks!
Best regards,
Martin

@dscho
Copy link
Member

dscho commented Dec 13, 2019

I'd like to start contributing to git-for-windows, and this seems like a great place to begin!

Great!

Just to be clear, you'd like a PR that includes both a patch to PKGBUILD and tab completion for options? Or in seperate PRs.

Whichever suits you better. If you drive a project, those are your decisions.

Also, i'm noticing that adding git-subtree to the command list requires the documentation from contrib/subtree/ to be copied to Documentation/ (Dependency for command-list.h), duplicating it. Is that allright?

I would perform that copying a the PKGBUILD level, i.e. not in the git repository. Then it is not really duplicating it ;-)

@zrrbite
Copy link

zrrbite commented Dec 13, 2019

I understand. Thank you for that valuable input 😊

@leshnabalara
Copy link

hey I would like to start with this as my first issue
Thanks

@dscho
Copy link
Member

dscho commented Jan 9, 2020

@leshnabalara go right ahead!

@sladyn98
Copy link

@dscho Hello I would like to take this up as my first issue.
If I understand correctly the best solution is to patch

install: $(GIT_SUBTREE)
	$(INSTALL) -d -m 755 $(DESTDIR)$(gitexecdir)
	$(INSTALL) -m 755 $(GIT_SUBTREE) $(DESTDIR)$(gitexecdir)

into the the build function in pkg build.
I just one question
I dont understand how does this fit in

maybe via something like git grep subtree command-list.txt || echo "git-subtree mainporcelain" >>command-list.txt

@dscho
Copy link
Member

dscho commented Apr 17, 2020

@sladyn98 no, I mentioned already what should be added to the build() function:

On the other hand, an even better alternative might be to patch it into https://github.com/git/git/blob/v2.24.0/command-list.txt as part of the build function in PKGBUILD (maybe via something like git grep subtree command-list.txt || echo "git-subtree mainporcelain" >>command-list.txt), as

What you suggested wouldn't work, as that is Makefile syntax, while PKGBUILD is a Bash script.

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

No branches or pull requests

6 participants