Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: _git-reset doesn't complete newly staged files



On 2016/03/09, at 22:24, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> Sorry for not replying earlier: I had this flagged for attention but
> haven't spoken up sooner since I expected I wouldn't have time to reply
> to responses.

You are exactly the one from whom I wanted to have comments. 

> I think you're looking for «git diff-index --cached -z --name-only
> $treeish».

What I was not sure was whether to offer conflicting files or not.
'git reset conflicting_file' leaves the working tree unmodified
(so '<<<<<<< HEAD' etc. remain there) while the index becomes clean
(conflict fixed) and you can commit it. I thought this would not
be useful.

But it is not an error anyway, and maybe there are someone who
really want to do that (if they are going to run 'git reset' while
there is a conflict, they may well know what they are doing).

> I took the liberty of changing the tag and description you used, since
> "staged files" isn't exactly right for this syntax: files that are in
> $treeish but not staged may also be completed.

I thought those files are 'staged for delete', but your more
descriptive tag/description would be better.

> Incidentally, it would be nice to have a docstring for __git_ignore_line:

Yes, and

> Why does __git_ignore_line escape some characters with backslashes
> before adding them to $ignored?

I'm rather confused. Isn't it better to UN-quote them?

% touch 'a b.txt'
% git add <TAB>
this completes a\ b.txt, and
% git add a\ b.txt <TAB>
this still completes a\ b.txt.

Using
    ignored+=(${(Q)line[1,CURRENT-1]})
    ignored+=(${(Q)line[CURRENT+1,-1]})
fixes this. Moreover,

% git add *.txt <TAB>
this does not complete a\ b.txt anymore.

Or there are something I've overlooked.




Messages sorted by: Reverse Date, Date, Thread, Author