git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [feature request] git add completion should exclude staged content
@ 2013-01-26 17:21 wookietreiber
  2013-01-27 23:00 ` Junio C Hamano
  0 siblings, 1 reply; 13+ messages in thread
From: wookietreiber @ 2013-01-26 17:21 UTC (permalink / raw)
  To: git

Dear Git Hackers,

I have a feature request for `git add` auto completion:

`git add` auto completion suggests all files / directories, filtered by nothing. I guess it would be
much nicer (as in increasing productivity) if it would only suggest unstaged content, as reported by
`git status`, because that would be the only content one would be able to add.

Example:

    $ git status
    # On branch develop
    # Changes to be committed:
    #   (use "git reset HEAD <file>..." to unstage)
    #
    #       modified:   src/main/scala/XYChart.scala
    #
    # Untracked files:
    #   (use "git add <file>..." to include in what will be committed)
    #
    #       notes/0.2.0.markdown

    $ git add <auto-complete>
    build.sbt              .ensime                .git/                  project/               scalastyle-config.xml  todo
    COPYING                .ensime_lucene/        notes/                 README.md              src/
    $ git add

Where it should be:

    $ git add <auto-complete>
    $ git add notes/0.2.0.markdown

... because `notes/0.2.0.markdown` is the only thing I can add.


-- 

Beste Grüße / Best Regards
Christian Krause aka wookietreiber

-----------------------------------------------------------------------

EGAL WIE DICHT DU BIST, GOETHE WAR DICHTER.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [feature request] git add completion should exclude staged content
  2013-01-26 17:21 [feature request] git add completion should exclude staged content wookietreiber
@ 2013-01-27 23:00 ` Junio C Hamano
  2013-01-28  9:26   ` Manlio Perillo
  0 siblings, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2013-01-27 23:00 UTC (permalink / raw)
  To: wookietreiber; +Cc: git, Manlio Perillo

wookietreiber <kizkizzbangbang@googlemail.com> writes:

> I have a feature request for `git add` auto completion:
>
> `git add` auto completion suggests all files / directories,
> filtered by nothing. I guess it would be much nicer (as in
> increasing productivity) if it would only suggest unstaged
> content, as reported by `git status`, because that would be the
> only content one would be able to add.

I think that is what Manlio Perillo tried to do with the stalled
mp/complete-paths topic that is queued in 'pu'.

Manlio, any progress?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [feature request] git add completion should exclude staged content
  2013-01-27 23:00 ` Junio C Hamano
@ 2013-01-28  9:26   ` Manlio Perillo
  2013-01-28 12:52     ` Michael J Gruber
  0 siblings, 1 reply; 13+ messages in thread
From: Manlio Perillo @ 2013-01-28  9:26 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: wookietreiber, git

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Il 28/01/2013 00:00, Junio C Hamano ha scritto:
> wookietreiber <kizkizzbangbang@googlemail.com> writes:
> 
>> I have a feature request for `git add` auto completion:
>>
>> `git add` auto completion suggests all files / directories,
>> filtered by nothing. I guess it would be much nicer (as in
>> increasing productivity) if it would only suggest unstaged
>> content, as reported by `git status`, because that would be the
>> only content one would be able to add.
> 
> I think that is what Manlio Perillo tried to do with the stalled
> mp/complete-paths topic that is queued in 'pu'.
> 
> Manlio, any progress?

Well, I assumed that the patch was stalled due to missing review from
git completion experts...

For this reason I have not updated it with your latest suggestions,
waiting for the review (also, because now I'm busy with other projects).

For the OP: the last patch can be found in the mailing list archive,
with the subject:
	[PATCH v5] git-completion.bash: add support for path completion
and date:
	Fri, 11 Jan 2013 19:48:43 +0100

Can you please test it?




Regards   Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlEGRE8ACgkQscQJ24LbaUSX9ACfUMBH/X6lVH4V7FUaB2wlqj8C
eYQAnAzuYwhYhDvkW3d29IeqHsDFyWBT
=BpRi
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [feature request] git add completion should exclude staged content
  2013-01-28  9:26   ` Manlio Perillo
@ 2013-01-28 12:52     ` Michael J Gruber
  2013-01-28 14:02       ` Manlio Perillo
  0 siblings, 1 reply; 13+ messages in thread
From: Michael J Gruber @ 2013-01-28 12:52 UTC (permalink / raw)
  To: Manlio Perillo; +Cc: Junio C Hamano, wookietreiber, git

Manlio Perillo venit, vidit, dixit 28.01.2013 10:26:
> Il 28/01/2013 00:00, Junio C Hamano ha scritto:
>> wookietreiber <kizkizzbangbang@googlemail.com> writes:
> 
>>> I have a feature request for `git add` auto completion:
>>>
>>> `git add` auto completion suggests all files / directories,
>>> filtered by nothing. I guess it would be much nicer (as in
>>> increasing productivity) if it would only suggest unstaged
>>> content, as reported by `git status`, because that would be the
>>> only content one would be able to add.
> 
>> I think that is what Manlio Perillo tried to do with the stalled
>> mp/complete-paths topic that is queued in 'pu'.
> 
>> Manlio, any progress?
> 
> Well, I assumed that the patch was stalled due to missing review from
> git completion experts...
> 
> For this reason I have not updated it with your latest suggestions,
> waiting for the review (also, because now I'm busy with other projects).
> 
> For the OP: the last patch can be found in the mailing list archive,
> with the subject:
> 	[PATCH v5] git-completion.bash: add support for path completion
> and date:
> 	Fri, 11 Jan 2013 19:48:43 +0100
> 
> Can you please test it?
> 
> 
> 
> 
> Regards   Manlio
> 

I haven't looked at the patch, but in the example above, untracked
files) could be added as well (unless you use -u), so maybe the scope
should depend on the option? If the new completion code kept me from
adding untracked files easily it wouldn't be an improvement.

Michael

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [feature request] git add completion should exclude staged content
  2013-01-28 12:52     ` Michael J Gruber
@ 2013-01-28 14:02       ` Manlio Perillo
  2013-01-28 16:22         ` Michael J Gruber
  0 siblings, 1 reply; 13+ messages in thread
From: Manlio Perillo @ 2013-01-28 14:02 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Junio C Hamano, wookietreiber, git

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Il 28/01/2013 13:52, Michael J Gruber ha scritto:
> Manlio Perillo venit, vidit, dixit 28.01.2013 10:26:
>> Il 28/01/2013 00:00, Junio C Hamano ha scritto:
>>> wookietreiber <kizkizzbangbang@googlemail.com> writes:
>>
>>>> I have a feature request for `git add` auto completion:
>>>>
> [...]
>> For the OP: the last patch can be found in the mailing list archive,
>> with the subject:
>> 	[PATCH v5] git-completion.bash: add support for path completion
>> and date:
>> 	Fri, 11 Jan 2013 19:48:43 +0100
>>
>> Can you please test it?
>>
> 
> I haven't looked at the patch, but in the example above, untracked
> files) could be added as well (unless you use -u), so maybe the scope
> should depend on the option? If the new completion code kept me from
> adding untracked files easily it wouldn't be an improvement.
> 

The patch will suggest (for git add command), all the files that are
candidate to be added to the index file.

Please, test it and report any behaviour you think is incorrect.


Regards   Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlEGhPsACgkQscQJ24LbaUTYOwCdFagTRkHzUHoFwy3U+Vz6tAzE
tVIAnj8fAbyGrlNUoUgI4ZshwOtlEH8v
=jy8R
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [feature request] git add completion should exclude staged content
  2013-01-28 14:02       ` Manlio Perillo
@ 2013-01-28 16:22         ` Michael J Gruber
  2013-01-28 17:52           ` Junio C Hamano
  2013-01-28 20:13           ` Manlio Perillo
  0 siblings, 2 replies; 13+ messages in thread
From: Michael J Gruber @ 2013-01-28 16:22 UTC (permalink / raw)
  To: Manlio Perillo; +Cc: Junio C Hamano, wookietreiber, git

Manlio Perillo venit, vidit, dixit 28.01.2013 15:02:
> Il 28/01/2013 13:52, Michael J Gruber ha scritto:
>> Manlio Perillo venit, vidit, dixit 28.01.2013 10:26:
>>> Il 28/01/2013 00:00, Junio C Hamano ha scritto:
>>>> wookietreiber <kizkizzbangbang@googlemail.com> writes:
>>>
>>>>> I have a feature request for `git add` auto completion:
>>>>>
>> [...]
>>> For the OP: the last patch can be found in the mailing list archive,
>>> with the subject:
>>> 	[PATCH v5] git-completion.bash: add support for path completion
>>> and date:
>>> 	Fri, 11 Jan 2013 19:48:43 +0100
>>>
>>> Can you please test it?
>>>
> 
>> I haven't looked at the patch, but in the example above, untracked
>> files) could be added as well (unless you use -u), so maybe the scope
>> should depend on the option? If the new completion code kept me from
>> adding untracked files easily it wouldn't be an improvement.
> 
> 
> The patch will suggest (for git add command), all the files that are
> candidate to be added to the index file.
> 
> Please, test it and report any behaviour you think is incorrect.

OK, that seems to work and to be quite helpful.

Minor nit: "git add -u" could use the same fileset as "git commit". But
I don't know whether completion can act upon the presence of options.
Currently, it also includes untracked files (just like without -u) but
omits unmodified and ignored ones, which is already quite an improvement.

I won't be able to review the completion code but may contribute a few
lines to t/t9902-completion.sh, possibly.

Michael

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [feature request] git add completion should exclude staged content
  2013-01-28 16:22         ` Michael J Gruber
@ 2013-01-28 17:52           ` Junio C Hamano
  2013-01-28 20:16             ` Manlio Perillo
  2013-01-28 20:13           ` Manlio Perillo
  1 sibling, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2013-01-28 17:52 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Manlio Perillo, wookietreiber, git

Michael J Gruber <git@drmicha.warpmail.net> writes:
> Manlio Perillo venit, vidit, dixit 28.01.2013 15:02:
>> Please, test it and report any behaviour you think is incorrect.
>
> OK, that seems to work and to be quite helpful.
>
> Minor nit: "git add -u" could use the same fileset as "git commit". But
> I don't know whether completion can act upon the presence of options.
> Currently, it also includes untracked files (just like without -u) but
> omits unmodified and ignored ones, which is already quite an improvement.
>
> I won't be able to review the completion code but may contribute a few
> lines to t/t9902-completion.sh, possibly.

Thanks both for commenting.  I'll find time to read it over again
and perhaps we can merge it to 'next' and advertise it in the next
issue of "What's cooking" report to ask for wider testing to move it
forward.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [feature request] git add completion should exclude staged content
  2013-01-28 16:22         ` Michael J Gruber
  2013-01-28 17:52           ` Junio C Hamano
@ 2013-01-28 20:13           ` Manlio Perillo
  1 sibling, 0 replies; 13+ messages in thread
From: Manlio Perillo @ 2013-01-28 20:13 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Junio C Hamano, wookietreiber, git

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Il 28/01/2013 17:22, Michael J Gruber ha scritto:
> [...]
>> The patch will suggest (for git add command), all the files that are
>> candidate to be added to the index file.
>>
>> Please, test it and report any behaviour you think is incorrect.
> 
> OK, that seems to work and to be quite helpful.
> 
> Minor nit: "git add -u" could use the same fileset as "git commit". But
> I don't know whether completion can act upon the presence of options.

It is possible, but I have not implemented since I was not sure about it
and I wanted to avoid to make the patch more hard to review.

I will work on it after the patch is approved.

> Currently, it also includes untracked files (just like without -u) but
> omits unmodified and ignored ones, which is already quite an improvement.
> 
> I won't be able to review the completion code but may contribute a few
> lines to t/t9902-completion.sh, possibly.
> 

Ah, I missed this test; thanks.

The proposed patch must update it.



Regards  Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlEG2+UACgkQscQJ24LbaURstACfdNxuFvaokBSTls20bSQ7jPHA
8I0An3fX6oRKuc2lzAgPVBLjsbjbw91V
=igwr
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [feature request] git add completion should exclude staged content
  2013-01-28 17:52           ` Junio C Hamano
@ 2013-01-28 20:16             ` Manlio Perillo
  2013-01-30 14:06               ` Marc Khouzam
  0 siblings, 1 reply; 13+ messages in thread
From: Manlio Perillo @ 2013-01-28 20:16 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Michael J Gruber, wookietreiber, git

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Il 28/01/2013 18:52, Junio C Hamano ha scritto:
> [...]
> 
> Thanks both for commenting.  I'll find time to read it over again
> and perhaps we can merge it to 'next' and advertise it in the next
> issue of "What's cooking" report to ask for wider testing to move it
> forward.

Thanks.

I will try to update the patch, with your latest suggestions (avoid
tricky POSIX shell syntax, and CDPATH issue - if I remember correctly),
and with an update for the t/t9902-completion.sh test (that I completely
missed).



Regards  Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlEG3IcACgkQscQJ24LbaUTR/wCfSC/kHxseKAQ9rnK2ba/WwND1
cmsAn2CuHpRs2VjippTwkT5O3ul9cQKb
=5Way
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [feature request] git add completion should exclude staged content
  2013-01-28 20:16             ` Manlio Perillo
@ 2013-01-30 14:06               ` Marc Khouzam
  2013-01-30 18:24                 ` Manlio Perillo
  0 siblings, 1 reply; 13+ messages in thread
From: Marc Khouzam @ 2013-01-30 14:06 UTC (permalink / raw)
  To: 'Manlio Perillo', 'Junio C Hamano'
  Cc: 'Michael J Gruber', 'wookietreiber',
	'git@vger.kernel.org'


> -----Original Message-----
> From: git-owner@vger.kernel.org 
> [mailto:git-owner@vger.kernel.org] On Behalf Of Manlio Perillo
> Sent: Monday, January 28, 2013 3:16 PM
> To: Junio C Hamano
> Cc: Michael J Gruber; wookietreiber; git@vger.kernel.org
> Subject: Re: [feature request] git add completion should 
> exclude staged content
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Il 28/01/2013 18:52, Junio C Hamano ha scritto:
> > [...]
> > 
> > Thanks both for commenting.  I'll find time to read it over again
> > and perhaps we can merge it to 'next' and advertise it in the next
> > issue of "What's cooking" report to ask for wider testing to move it
> > forward.
> 
> Thanks.
> 
> I will try to update the patch, with your latest suggestions (avoid
> tricky POSIX shell syntax, and CDPATH issue - if I remember 
> correctly),
> and with an update for the t/t9902-completion.sh test (that I 
> completely
> missed).

Hi Manlio,

I'm trying to update git-completion.tcsh to work properly with
your nice new completion feature.  But I'm having trouble with 
the missing '/' at the end of directories.

The new logic in git-completion.bash tells bash that 'filenames'
completion is ongoing so bash will add a '/' after directories.
Sadly, tcsh won't do that, so it would be simpler if
git-completion.bash added the '/' itself.  I looked at the 
git-completion.bash script changes and I noticed that for 
bash version < 4, you have to add the '/' yourself.  
I also noticed the following comment:

 # XXX if we append a slash to directory names when using
 # `compopt -o filenames`, Bash will append another slash.
 # This is pretty stupid, and this the reason why we have to
 # define a compatible version for this function.

So I gather you would rather add a '/' all the time to deal
with older bash version transparently.  This would be great
for tcsh also.  I'm trying to figure out
when bash mis-behaves when you add the '/' all the time?
When I try it (I have bash 4.1.5(1)-release) I didn't run
into the double slash problem you mention in the comment.

I'm hoping we can straighten this out and have
git-completion.bash add the '/' all the time.

Could you explain when the problem happens?

Thanks

Marc

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [feature request] git add completion should exclude staged content
  2013-01-30 14:06               ` Marc Khouzam
@ 2013-01-30 18:24                 ` Manlio Perillo
  2013-01-30 18:55                   ` Marc Khouzam
  0 siblings, 1 reply; 13+ messages in thread
From: Manlio Perillo @ 2013-01-30 18:24 UTC (permalink / raw)
  To: Marc Khouzam
  Cc: 'Junio C Hamano', 'Michael J Gruber',
	'wookietreiber', 'git@vger.kernel.org'

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Il 30/01/2013 15:06, Marc Khouzam ha scritto:
> [...]
>> I will try to update the patch, with your latest suggestions (avoid
>> tricky POSIX shell syntax, and CDPATH issue - if I remember 
>> correctly),
>> and with an update for the t/t9902-completion.sh test (that I 
>> completely
>> missed).
> 
> Hi Manlio,
> 

Hi.

> I'm trying to update git-completion.tcsh to work properly with
> your nice new completion feature.  But I'm having trouble with 
> the missing '/' at the end of directories.
> 
> The new logic in git-completion.bash tells bash that 'filenames'
> completion is ongoing so bash will add a '/' after directories.
> Sadly, tcsh won't do that, so it would be simpler if
> git-completion.bash added the '/' itself.  I looked at the 
> git-completion.bash script changes and I noticed that for 
> bash version < 4, you have to add the '/' yourself.

The compatible version is not only required for Bash; you can use it for
other shells.

Try to redefine the __git_index_file_list_filter function to use the
version that adds a slash to directory names.


> I also noticed the following comment:
> 
>  # XXX if we append a slash to directory names when using
>  # `compopt -o filenames`, Bash will append another slash.
>  # This is pretty stupid, and this the reason why we have to
>  # define a compatible version for this function.
> 
> So I gather you would rather add a '/' all the time to deal
> with older bash version transparently.  This would be great
> for tcsh also.  I'm trying to figure out
> when bash mis-behaves when you add the '/' all the time?
> When I try it (I have bash 4.1.5(1)-release) I didn't run
> into the double slash problem you mention in the comment.
> 

I'm using the same version: 4.1.5(1), on Debian stable.

> I'm hoping we can straighten this out and have
> git-completion.bash add the '/' all the time.
> 
> Could you explain when the problem happens?
> 

Bash 4.1.5(1) always adds an additional slash for directories.
I have tested it right now: change the filter function to use the
compatible version:

__git_index_file_list_filter ()
{
	# Default to Bash >= 4.x
	__git_index_file_list_filter_compat
}


Then running `git add <TAB>` inside the git repository, I get this file
completion list:

$ git add <TAB>
contrib//


> Thanks
> 


Thanks to you

Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlEJZUMACgkQscQJ24LbaUQUGACgkMG/bZrJKBzlZ8toEQwmggQX
m9kAn2ATJbSp87kOkoCCc00eHmh71r3y
=D9iu
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [feature request] git add completion should exclude staged content
  2013-01-30 18:24                 ` Manlio Perillo
@ 2013-01-30 18:55                   ` Marc Khouzam
  2013-01-30 19:58                     ` Manlio Perillo
  0 siblings, 1 reply; 13+ messages in thread
From: Marc Khouzam @ 2013-01-30 18:55 UTC (permalink / raw)
  To: 'Manlio Perillo'
  Cc: 'Junio C Hamano', 'Michael J Gruber',
	'wookietreiber', 'git@vger.kernel.org'


> -----Original Message-----
> From: git-owner@vger.kernel.org 
> [mailto:git-owner@vger.kernel.org] On Behalf Of Manlio Perillo
> Sent: Wednesday, January 30, 2013 1:24 PM
> To: Marc Khouzam
> Cc: 'Junio C Hamano'; 'Michael J Gruber'; 'wookietreiber'; 
> 'git@vger.kernel.org'
> Subject: Re: [feature request] git add completion should 
> exclude staged content
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Il 30/01/2013 15:06, Marc Khouzam ha scritto:
> > [...]
> >> I will try to update the patch, with your latest suggestions (avoid
> >> tricky POSIX shell syntax, and CDPATH issue - if I remember 
> >> correctly),
> >> and with an update for the t/t9902-completion.sh test (that I 
> >> completely
> >> missed).
> > 
> > Hi Manlio,
> > 
> 
> Hi.
> 
> > I'm trying to update git-completion.tcsh to work properly with
> > your nice new completion feature.  But I'm having trouble with 
> > the missing '/' at the end of directories.
> > 
> > The new logic in git-completion.bash tells bash that 'filenames'
> > completion is ongoing so bash will add a '/' after directories.
> > Sadly, tcsh won't do that, so it would be simpler if
> > git-completion.bash added the '/' itself.  I looked at the 
> > git-completion.bash script changes and I noticed that for 
> > bash version < 4, you have to add the '/' yourself.
> 
> The compatible version is not only required for Bash; you can 
> use it for
> other shells.
> 
> Try to redefine the __git_index_file_list_filter function to use the
> version that adds a slash to directory names.

I hadn't thought of that!
Although I would prefer not to have special cases like that,
it does work well.
Thanks!

> > I also noticed the following comment:
> > 
> >  # XXX if we append a slash to directory names when using
> >  # `compopt -o filenames`, Bash will append another slash.
> >  # This is pretty stupid, and this the reason why we have to
> >  # define a compatible version for this function.
> > 
> > So I gather you would rather add a '/' all the time to deal
> > with older bash version transparently.  This would be great
> > for tcsh also.  I'm trying to figure out
> > when bash mis-behaves when you add the '/' all the time?
> > When I try it (I have bash 4.1.5(1)-release) I didn't run
> > into the double slash problem you mention in the comment.
> > 
> 
> I'm using the same version: 4.1.5(1), on Debian stable.
> 
> > I'm hoping we can straighten this out and have
> > git-completion.bash add the '/' all the time.
> > 
> > Could you explain when the problem happens?
> > 
> 
> Bash 4.1.5(1) always adds an additional slash for directories.
> I have tested it right now: change the filter function to use the
> compatible version:
> 
> __git_index_file_list_filter ()
> {
> 	# Default to Bash >= 4.x
> 	__git_index_file_list_filter_compat
> }
> 
> 
> Then running `git add <TAB>` inside the git repository, I get 
> this file
> completion list:
> 
> $ git add <TAB>
> contrib//

Ok, I see.  The double-slash is visible in the completion list
but it does not appear on the command-line when bash automatically
adds it.  So if you typed 
  git add contri<tab>
you will properly get
  git add contrib/
That is the case I was looking at.
I understand why you cannot put that second slash in the code now.

Thanks

> 
> 
> > Thanks
> > 
> 
> 
> Thanks to you
> 
> Manlio
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAlEJZUMACgkQscQJ24LbaUQUGACgkMG/bZrJKBzlZ8toEQwmggQX
> m9kAn2ATJbSp87kOkoCCc00eHmh71r3y
> =D9iu
> -----END PGP SIGNATURE-----
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [feature request] git add completion should exclude staged content
  2013-01-30 18:55                   ` Marc Khouzam
@ 2013-01-30 19:58                     ` Manlio Perillo
  0 siblings, 0 replies; 13+ messages in thread
From: Manlio Perillo @ 2013-01-30 19:58 UTC (permalink / raw)
  To: Marc Khouzam
  Cc: 'Junio C Hamano', 'Michael J Gruber',
	'wookietreiber', 'git@vger.kernel.org'

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Il 30/01/2013 19:55, Marc Khouzam ha scritto:
> [...]
>>>> The new logic in git-completion.bash tells bash that 'filenames'
>>>> completion is ongoing so bash will add a '/' after directories.
>>>> Sadly, tcsh won't do that, so it would be simpler if
>>>> git-completion.bash added the '/' itself.  I looked at the 
>>>> git-completion.bash script changes and I noticed that for 
>>>> bash version < 4, you have to add the '/' yourself.
> 
> The compatible version is not only required for Bash; you can 
> use it for
> other shells.
> 
> Try to redefine the __git_index_file_list_filter function to use the
> version that adds a slash to directory names.
> 
>> I hadn't thought of that!
>> Although I would prefer not to have special cases like that,
>> it does work well.

The zsh compatible code does something like this; this is the reason I
tried to do the same thing, in order to keep coding consistent.

> [...]
>
> Bash 4.1.5(1) always adds an additional slash for directories.
> I have tested it right now: change the filter function to use the
> compatible version:
> 
> __git_index_file_list_filter ()
> {
> 	# Default to Bash >= 4.x
> 	__git_index_file_list_filter_compat
> }
> 
> 
> Then running `git add <TAB>` inside the git repository, I get 
> this file
> completion list:
> 
> $ git add <TAB>
> contrib//
> 
>> Ok, I see.  The double-slash is visible in the completion list
>> but it does not appear on the command-line when bash automatically
>> adds it.

Right; that's why I wrote in the comment that Bash behaviour "seems" stupid.
But probably that comment should be remove or changed for the final
version of the patch; I'll leave that to a Bash expert.

> [...]


Regards  Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlEJe0kACgkQscQJ24LbaUScGgCeMDDdprJMgnYtFzqnFQamhfvU
BikAniMkwbOEVkkomOd9G0m3KY44f/9O
=c8rC
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-01-30 20:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-26 17:21 [feature request] git add completion should exclude staged content wookietreiber
2013-01-27 23:00 ` Junio C Hamano
2013-01-28  9:26   ` Manlio Perillo
2013-01-28 12:52     ` Michael J Gruber
2013-01-28 14:02       ` Manlio Perillo
2013-01-28 16:22         ` Michael J Gruber
2013-01-28 17:52           ` Junio C Hamano
2013-01-28 20:16             ` Manlio Perillo
2013-01-30 14:06               ` Marc Khouzam
2013-01-30 18:24                 ` Manlio Perillo
2013-01-30 18:55                   ` Marc Khouzam
2013-01-30 19:58                     ` Manlio Perillo
2013-01-28 20:13           ` Manlio Perillo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).