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

git reset completions issues #4329

Closed
mqudsi opened this issue Aug 14, 2017 · 7 comments
Closed

git reset completions issues #4329

mqudsi opened this issue Aug 14, 2017 · 7 comments
Assignees
Labels
bug Something that's not working as intended completions
Milestone

Comments

@mqudsi
Copy link
Contributor

mqudsi commented Aug 14, 2017

I'm pretty sure the git completion is one of the more complicated ones, so please let me know if more information is needed.

Before anything else, here's my output of git status:

On branch master
Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.
  (use "git pull" to update your local branch)
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   Makefile

If I type in

git reset M<tab>

the M gets expanded to/replaced with master (no other option is available).

If I type in

git reset Make<tab>

the Make gets expanded to/replaced with HEAD@\{0\} (literally, with the escapes)

several issues:

  • file completions should be supported for git reset
  • shouldn't adding letters to the argument being completed narrow down the list of completion options, not change them entirely?
@mqudsi mqudsi changed the title git reset completions override correct options git reset completions issues Aug 14, 2017
@mqudsi mqudsi changed the title git reset completions issues git reset completions issues Aug 14, 2017
@faho
Copy link
Member

faho commented Aug 14, 2017

file completions should be supported for git reset

Yes, though I'd argue it should be modified files. Ideally files modified since the "tree-ish" argument to reset, but that's complicated. It's almost trivial to add files modified since the last commit, since we already have that function (for git checkout).

the Make gets expanded to/replaced with HEAD@{0} (literally, with the escapes)

That's a reflog entry.

The escapes are to be expected - without them, HEAD@{0} expands the braces and ends up as HEAD@0, which is invalid.

The issue here is that it's matching the description as well (see git reflog. I'm betting that includes the word "Make"). That is behaving as expected - it'll only ever do that when there's no other match. We just need to add those matches.

@faho faho added the bug Something that's not working as intended label Aug 14, 2017
@faho faho added this to the fish 2.7.0 milestone Aug 14, 2017
@mqudsi
Copy link
Contributor Author

mqudsi commented Aug 14, 2017

OK, that explains why m didn't match HEAD and Make did. The first had a match (master) so the commit text wasn't being searched.

faho added a commit to faho/fish-shell that referenced this issue Aug 14, 2017
@faho
Copy link
Member

faho commented Aug 14, 2017

@mqudsi: See my git-reset branch. I'm holding off messing with master for a while.

@mqudsi
Copy link
Contributor Author

mqudsi commented Aug 14, 2017

Does __fish_git_modified_files include deleted?

@faho
Copy link
Member

faho commented Aug 14, 2017

Yes. It uses git diff --name-only under the covers.

@faho
Copy link
Member

faho commented Aug 14, 2017

Though I think we might need another argument here. git reset changes the index ("staging area"). git checkout changes the working tree (the actual directory).

faho added a commit to faho/fish-shell that referenced this issue Aug 14, 2017
@faho
Copy link
Member

faho commented Aug 14, 2017

Okay, git diff --cached should do the trick.

@faho faho self-assigned this Aug 14, 2017
faho added a commit to faho/fish-shell that referenced this issue Sep 6, 2017
Fixes fish-shell#4329.

(cherry picked from commit 9765e861306fd2851f530a27e8eb778c1682a7c8)
@faho faho closed this as completed in c2f0a45 Sep 6, 2017
zanchey pushed a commit that referenced this issue Sep 6, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something that's not working as intended completions
Projects
None yet
Development

No branches or pull requests

2 participants