RE: [feature request] git add completion should exclude staged content

2013-01-30 Thread Marc Khouzam

 -Original Message-
 From: git-ow...@vger.kernel.org 
 [mailto:git-ow...@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
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [feature request] git add completion should exclude staged content

2013-01-30 Thread Manlio Perillo
-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-
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [feature request] git add completion should exclude staged content

2013-01-30 Thread Marc Khouzam

 -Original Message-
 From: git-ow...@vger.kernel.org 
 [mailto:git-ow...@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 contritab
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 majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 --
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [feature request] git add completion should exclude staged content

2013-01-30 Thread Manlio Perillo
-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-
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [feature request] git add completion should exclude staged content

2013-01-28 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Il 28/01/2013 00:00, Junio C Hamano ha scritto:
 wookietreiber kizkizzbangb...@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-
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [feature request] git add completion should exclude staged content

2013-01-28 Thread Michael J Gruber
Manlio Perillo venit, vidit, dixit 28.01.2013 10:26:
 Il 28/01/2013 00:00, Junio C Hamano ha scritto:
 wookietreiber kizkizzbangb...@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
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [feature request] git add completion should exclude staged content

2013-01-28 Thread Manlio Perillo
-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 kizkizzbangb...@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-
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [feature request] git add completion should exclude staged content

2013-01-28 Thread Michael J Gruber
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 kizkizzbangb...@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
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [feature request] git add completion should exclude staged content

2013-01-28 Thread Junio C Hamano
Michael J Gruber g...@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.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [feature request] git add completion should exclude staged content

2013-01-28 Thread Manlio Perillo
-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-
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [feature request] git add completion should exclude staged content

2013-01-28 Thread Manlio Perillo
-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-
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [feature request] git add completion should exclude staged content

2013-01-27 Thread Junio C Hamano
wookietreiber kizkizzbangb...@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?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html