All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Braun <thomas.braun@virtuell-zuhause.de>
To: "SZEDER Gábor" <szeder@ira.uka.de>
Cc: git@vger.kernel.org, Ramkumar Ramachandra <artagnon@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	John Keeping <john@keeping.me.uk>
Subject: Re: [PATCH v2 2/2] completion: add git status
Date: Thu, 2 Jun 2016 17:04:58 +0200	[thread overview]
Message-ID: <025de231-53a3-bc71-1564-aad8f4e096c1@virtuell-zuhause.de> (raw)
In-Reply-To: <20160601141510.Horde.M2zGuJrzBNqf_2zYLo0P2Sx@webmail.informatik.kit.edu>

Am 01.06.2016 um 14:15 schrieb SZEDER Gábor:
> 
> Quoting Thomas Braun <thomas.braun@virtuell-zuhause.de>:
> 
>> Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
>> ---
>>  contrib/completion/git-completion.bash | 29
>> +++++++++++++++++++++++++++++
>>  1 file changed, 29 insertions(+)
>>
>> diff --git a/contrib/completion/git-completion.bash
>> b/contrib/completion/git-completion.bash
>> index addea89..77343da 100644
>> --- a/contrib/completion/git-completion.bash
>> +++ b/contrib/completion/git-completion.bash
>> @@ -1782,6 +1782,35 @@ _git_stage ()
>>      _git_add
>>  }
>>
>> +_git_status ()
>> +{
>> +    case "$cur" in
>> +    --ignore-submodules=*)
>> +        __gitcomp "none untracked dirty all" ""
>> "${cur##--ignore-submodules=}"
>> +        return
>> +        ;;
>> +    --untracked-files=*)
>> +        __gitcomp "$__git_untracked_file_modes" ""
>> "${cur##--untracked-files=}"
>> +        return
>> +        ;;
>> +    --column=*)
>> +        __gitcomp "
>> +            always never auto column row plain dense nodense
>> +            " "" "${cur##--column=}"
>> +        return
>> +        ;;
>> +    --*)
>> +        __gitcomp "
>> +            --short --branch --porcelain --long --verbose
>> +            --untracked-files= --ignore-submodules= --ignored
>> +            --column= --no-column
>> +            "
>> +        return
>> +        ;;
>> +    esac
>> +    __git_complete_file
> 
> __git_complete_file()'s job is to complete the '<rev>:<path>' notation,
> e.g. 'master:Mak<TAB>',  which is not what we want here, because this
> notation doesn't make sense for 'git status' and because 'git status
> <TAB>' would then offer refs instead of files.

Correct. I might have been mislead by the name ;)

> I think there are two choices what to do instead:
> 
>   - Don't do anything :)  Bash will then fall back to filename
>     completion, which is quite close to what we want here (and in this
>     case the return statements from the other case arms can go away as
>     well).  The drawback is that all ignored files in the current
>     working directory will show up after 'git status <TAB>'.
> 
>   - use __git_complete_index_file() with appropriate options, perhaps
>     '--cached --others', but I didn't think this through.  For bonus
>     points pass additional options when certain 'git status' options are
>     already present on the command line, e.g. pass '--ignored', too, if
>     it is present.

I went for the bonus points way. If that is too involved I can also go
back to "Don't do anything".

  reply	other threads:[~2016-06-02 15:13 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-31 23:42 [PATCH 1/2] completion: create variable for untracked file modes Thomas Braun
2016-06-01  4:05 ` Jeff King
2016-06-01  7:02   ` Junio C Hamano
2016-06-01  9:14     ` Thomas Braun
2016-06-01  9:37   ` [PATCH v2 " Thomas Braun
2016-06-01 11:59     ` SZEDER Gábor
2016-06-02 12:19       ` Thomas Braun
     [not found]   ` <6e722a5fb64b73373ac6450ec9600e98745df29d.1464769152.git.thomas.braun@virtuell-zuhause.de>
2016-06-01  9:37     ` [PATCH v2 2/2] completion: add git status Thomas Braun
2016-06-01 12:15       ` SZEDER Gábor
2016-06-02 15:04         ` Thomas Braun [this message]
     [not found]         ` <9ef8cfd8fb89bcacd123ddbebc12f961a292ef8b.1464879648.git.thomas.braun@virtuell-zuhause.de>
2016-06-02 15:11           ` [PATCH v3 " Thomas Braun
2016-06-02 18:14             ` Junio C Hamano
2016-06-03 15:41               ` Thomas Braun
2016-06-03 16:34                 ` Junio C Hamano
2016-06-03 17:17                   ` Jeff King
2016-06-03 17:54                     ` Junio C Hamano
2016-06-03 18:20                       ` Thomas Braun
2016-06-03 18:34                       ` [PATCH v4 0/3] support completion for " Thomas Braun
2016-06-03 18:34                         ` [PATCH v4 1/3] completion: factor out untracked file modes into a variable Thomas Braun
2016-06-03 18:34                         ` [PATCH v4 2/3] completion: add __git_get_option_value helper Thomas Braun
2016-06-10 13:10                           ` SZEDER Gábor
2016-06-25 16:13                             ` Thomas Braun
2016-06-03 18:34                         ` [PATCH v4 3/3] completion: add git status Thomas Braun
2016-06-06 17:57                           ` Junio C Hamano
2016-06-07  7:47                             ` Thomas Braun
2016-06-06 18:03                         ` [PATCH v4 0/3] support completion for " Junio C Hamano
2016-06-10 10:12                       ` [PATCH v5 0/3] completion: add " Thomas Braun
2016-06-10 10:12                         ` [PATCH v5 1/3] completion: factor out untracked file modes into a variable Thomas Braun
2016-06-10 10:12                         ` [PATCH v5 2/3] completion: add __git_get_option_value helper Thomas Braun
2016-06-10 10:12                         ` [PATCH v5 3/3] completion: add git status Thomas Braun
2016-06-10 10:23                       ` [PATCH v5 1/3] completion: factor out untracked file modes into a variable Thomas Braun
2016-06-10 10:24                         ` [PATCH v5 3/3] completion: add git status Thomas Braun
2016-06-02 15:16         ` [PATCH v3 1/2] completion: factor out untracked file modes into a variable Thomas Braun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=025de231-53a3-bc71-1564-aad8f4e096c1@virtuell-zuhause.de \
    --to=thomas.braun@virtuell-zuhause.de \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=john@keeping.me.uk \
    --cc=szeder@ira.uka.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.