{"thread":{"id":"47967","subject":"[PATCH 0/2] nd/parseopt-completion fixups","startedAt":"2018-03-03T09:23:25Z","lastAt":"2018-03-07T18:51:56Z","messageCount":15,"participants":["Nguyễn Thái Ngọc Duy","Eric Sunshine","SZEDER Gábor","Phillip Wood","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"340882","messageId":"20180303092307.3796-1-pclouds@gmail.com","threadId":"47967","inReplyTo":null,"subject":"[PATCH 0/2] nd/parseopt-completion fixups","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2018-03-03T09:23:05Z","receivedAt":"2018-03-03T09:23:25Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This addresses some comments from v3 [1]. Since the series has been\nmerged to 'next', we do incremental updates instead:\n\n- --rerere-autoupdate is completable on am, revert and cherry-pick\n- simplification in _git_notes which leads to completion in 'git notes\n  remove'\n\n[1] https://public-inbox.org/git/20180209110221.27224-1-pclouds@gmail.com/\n\nNguyễn Thái Ngọc Duy (2):\n  completion: don't set PARSE_OPT_NOCOMPLETE on --rerere-autoupdate\n  completion: simplify _git_notes\n\n contrib/completion/git-completion.bash | 18 +++---------------\n parse-options.h                        |  4 ++--\n rerere.h                               |  3 +--\n 3 files changed, 6 insertions(+), 19 deletions(-)\n\n-- \n2.16.1.435.g8f24da2e1a\n\n"},{"id":"340883","messageId":"20180303092307.3796-2-pclouds@gmail.com","threadId":"47967","inReplyTo":"20180303092307.3796-1-pclouds@gmail.com","subject":"[PATCH 1/2] completion: don't set PARSE_OPT_NOCOMPLETE on --rerere-autoupdate","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2018-03-03T09:23:06Z","receivedAt":"2018-03-03T09:23:30Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"There is not a strong reason to hide this option, and git-merge already\ncompletes this one. Let's allow to complete this for all commands (and\nlet git-completion.bash do the suppressing if neede).\n\nThis makes --rerere-autoupdate completable for am, cherry-pick and\nrevert.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n contrib/completion/git-completion.bash | 3 +--\n parse-options.h                        | 4 ++--\n rerere.h                               | 3 +--\n 3 files changed, 4 insertions(+), 6 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 0ddf40063b..c310b241d3 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1754,8 +1754,7 @@ _git_merge ()\n \n \tcase \"$cur\" in\n \t--*)\n-\t\t__gitcomp_builtin merge \"--rerere-autoupdate\n-\t\t\t\t--no-rerere-autoupdate\n+\t\t__gitcomp_builtin merge \"--no-rerere-autoupdate\n \t\t\t\t--no-commit --no-edit --no-ff\n \t\t\t\t--no-log --no-progress\n \t\t\t\t--no-squash --no-stat\ndiff --git a/parse-options.h b/parse-options.h\nindex 0ba08691e6..ab1cc362bf 100644\n--- a/parse-options.h\n+++ b/parse-options.h\n@@ -148,8 +148,8 @@ struct option {\n #define OPT_STRING_LIST(s, l, v, a, h) \\\n \t\t\t\t    { OPTION_CALLBACK, (s), (l), (v), (a), \\\n \t\t\t\t      (h), 0, &parse_opt_string_list }\n-#define OPT_UYN(s, l, v, h, f)      { OPTION_CALLBACK, (s), (l), (v), NULL, \\\n-\t\t\t\t      (h), PARSE_OPT_NOARG|(f), &parse_opt_tertiary }\n+#define OPT_UYN(s, l, v, h)         { OPTION_CALLBACK, (s), (l), (v), NULL, \\\n+\t\t\t\t      (h), PARSE_OPT_NOARG, &parse_opt_tertiary }\n #define OPT_DATE(s, l, v, h) \\\n \t{ OPTION_CALLBACK, (s), (l), (v), N_(\"time\"),(h), 0,\t\\\n \t  parse_opt_approxidate_cb }\ndiff --git a/rerere.h b/rerere.h\nindex 5e5a312e4c..c2961feaaa 100644\n--- a/rerere.h\n+++ b/rerere.h\n@@ -37,7 +37,6 @@ extern void rerere_clear(struct string_list *);\n extern void rerere_gc(struct string_list *);\n \n #define OPT_RERERE_AUTOUPDATE(v) OPT_UYN(0, \"rerere-autoupdate\", (v), \\\n-\tN_(\"update the index with reused conflict resolution if possible\"), \\\n-\tPARSE_OPT_NOCOMPLETE)\n+\tN_(\"update the index with reused conflict resolution if possible\"))\n \n #endif\n-- \n2.16.1.435.g8f24da2e1a\n\n"},{"id":"340884","messageId":"20180303092307.3796-3-pclouds@gmail.com","threadId":"47967","inReplyTo":"20180303092307.3796-1-pclouds@gmail.com","subject":"[PATCH 2/2] completion: simplify _git_notes","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2018-03-03T09:23:07Z","receivedAt":"2018-03-03T09:23:35Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This also adds completion for 'git notes remove' with two options:\n--ignore-missing and --stdin.\n\nFor some strange reason, 'git notes undefined --<tab>' completes --ref\nwithout even running --git-completion-helper. But since this is an error\ncase (and we're not doing anything destructive, it's probably ok for now)\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n contrib/completion/git-completion.bash | 15 ++-------------\n 1 file changed, 2 insertions(+), 13 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex c310b241d3..ab80f4e6e8 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1836,19 +1836,8 @@ _git_notes ()\n \tadd,--reedit-message=*|append,--reedit-message=*)\n \t\t__git_complete_refs --cur=\"${cur#*=}\"\n \t\t;;\n-\tadd,--*)\n-\t\t__gitcomp_builtin notes_add\n-\t\t;;\n-\tappend,--*)\n-\t\t__gitcomp_builtin notes_append\n-\t\t;;\n-\tcopy,--*)\n-\t\t__gitcomp_builtin notes_copy\n-\t\t;;\n-\tprune,--*)\n-\t\t__gitcomp_builtin notes_prune\n-\t\t;;\n-\tprune,*)\n+\t*,--*)\n+\t\t__gitcomp_builtin notes_$subcommand\n \t\t;;\n \t*)\n \t\tcase \"$prev\" in\n-- \n2.16.1.435.g8f24da2e1a\n\n"},{"id":"340886","messageId":"CAPig+cQP1ABWJUPW1BOTUxvsJ_aO_zsinxkuCOjyWYVOTKHR0g@mail.gmail.com","threadId":"47967","inReplyTo":"20180303092307.3796-2-pclouds@gmail.com","subject":"Re: [PATCH 1/2] completion: don't set PARSE_OPT_NOCOMPLETE on --rerere-autoupdate","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2018-03-03T09:34:07Z","receivedAt":"2018-03-03T09:34:12Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sat, Mar 3, 2018 at 4:23 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:\n> There is not a strong reason to hide this option, and git-merge already\n> completes this one. Let's allow to complete this for all commands (and\n> let git-completion.bash do the suppressing if neede).\n\ns/neede/needed/\n\n> This makes --rerere-autoupdate completable for am, cherry-pick and\n> revert.\n>\n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n"},{"id":"340937","messageId":"CAM0VKj=Kgw5Yh50HjdoD_OteF0n8C-pJo9z09x6jEPQt1w+96A@mail.gmail.com","threadId":"47967","inReplyTo":"20180303092307.3796-3-pclouds@gmail.com","subject":"Re: [PATCH 2/2] completion: simplify _git_notes","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2018-03-03T12:32:16Z","receivedAt":"2018-03-03T12:32:22Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Sat, Mar 3, 2018 at 10:23 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:\n> This also adds completion for 'git notes remove' with two options:\n> --ignore-missing and --stdin.\n>\n> For some strange reason, 'git notes undefined --<tab>' completes --ref\n> without even running --git-completion-helper.\n\nThere is nothing strange about it.  _git_notes() first looks for the\npresence of any subcommands on the command line, and if it doesn't find\nany, it will list 'git notes's subcommands and options for completion.\nAnd it does so by running '__gitcomp \"$subcommands --ref\"'\n\n> But since this is an error\n> case (and we're not doing anything destructive, it's probably ok for now)\n\nI agree; and it matches the behaviour before the patch.\n\n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> ---\n>  contrib/completion/git-completion.bash | 15 ++-------------\n>  1 file changed, 2 insertions(+), 13 deletions(-)\n>\n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index c310b241d3..ab80f4e6e8 100644\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -1836,19 +1836,8 @@ _git_notes ()\n>         add,--reedit-message=*|append,--reedit-message=*)\n>                 __git_complete_refs --cur=\"${cur#*=}\"\n>                 ;;\n> -       add,--*)\n> -               __gitcomp_builtin notes_add\n> -               ;;\n> -       append,--*)\n> -               __gitcomp_builtin notes_append\n> -               ;;\n> -       copy,--*)\n> -               __gitcomp_builtin notes_copy\n> -               ;;\n> -       prune,--*)\n> -               __gitcomp_builtin notes_prune\n> -               ;;\n> -       prune,*)\n> +       *,--*)\n> +               __gitcomp_builtin notes_$subcommand\n>                 ;;\n>         *)\n>                 case \"$prev\" in\n> --\n> 2.16.1.435.g8f24da2e1a\n>\n"},{"id":"340939","messageId":"CAM0VKjmmF2t=B2s3rJoKmO3j6Bk5d6PEfCV==ONRGMcdUMLFpQ@mail.gmail.com","threadId":"47967","inReplyTo":"20180303092307.3796-3-pclouds@gmail.com","subject":"Re: [PATCH 2/2] completion: simplify _git_notes","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2018-03-03T13:09:17Z","receivedAt":"2018-03-03T13:09:23Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Sat, Mar 3, 2018 at 10:23 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:\n> This also adds completion for 'git notes remove' with two options:\n> --ignore-missing and --stdin.\n>\n> For some strange reason, 'git notes undefined --<tab>' completes --ref\n> without even running --git-completion-helper. But since this is an error\n> case (and we're not doing anything destructive, it's probably ok for now)\n>\n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> ---\n>  contrib/completion/git-completion.bash | 15 ++-------------\n>  1 file changed, 2 insertions(+), 13 deletions(-)\n>\n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index c310b241d3..ab80f4e6e8 100644\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -1836,19 +1836,8 @@ _git_notes ()\n>         add,--reedit-message=*|append,--reedit-message=*)\n>                 __git_complete_refs --cur=\"${cur#*=}\"\n>                 ;;\n> -       add,--*)\n> -               __gitcomp_builtin notes_add\n> -               ;;\n> -       append,--*)\n> -               __gitcomp_builtin notes_append\n> -               ;;\n> -       copy,--*)\n> -               __gitcomp_builtin notes_copy\n> -               ;;\n> -       prune,--*)\n> -               __gitcomp_builtin notes_prune\n> -               ;;\n> -       prune,*)\n\nThere is a minor behaviour change here, though.  This\n\n  prune,*)\n    ;;\n\ncase arm ensured that we don't list refs for 'git notes prune <TAB>',\nbecause it doesn't accept them (and then we take our usual fallback and\nlet Bash complete filenames;  yeah, 'git notes prune' doesn't accept\nfilenames either, but, as I said, that's our usual fallback when we\ncan't offer anything for completion).\n\nThis patch removes that case arm, and refs will be offered for 'git\nnotes prune <TAB>'.\n\n> +       *,--*)\n> +               __gitcomp_builtin notes_$subcommand\n>                 ;;\n>         *)\n>                 case \"$prev\" in\n> --\n> 2.16.1.435.g8f24da2e1a\n>\n"},{"id":"341115","messageId":"623faa67-7072-3d72-e784-5380e204f570@talktalk.net","threadId":"47967","inReplyTo":"20180303092307.3796-2-pclouds@gmail.com","subject":"Re: [PATCH 1/2] completion: don't set PARSE_OPT_NOCOMPLETE on --rerere-autoupdate","fromName":"Phillip Wood","fromEmail":"phillip.wood@talktalk.net","sentAt":"2018-03-06T10:22:21Z","receivedAt":"2018-03-06T10:22:27Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"On 03/03/18 09:23, Nguyễn Thái Ngọc Duy wrote:\n> \n> There is not a strong reason to hide this option, and git-merge already\n> completes this one. Let's allow to complete this for all commands (and\n> let git-completion.bash do the suppressing if neede).\n> \n> This makes --rerere-autoupdate completable for am, cherry-pick and\n> revert.\n> \n\nThis is slightly off topic as it doesn't use OPT_RERERE_AUTOUPDATE but\nit looks[1] as if rebase is missing completion for --rerere-autoupdate\n(and --signoff which is definitely off topic)\n\nBest Wishes\n\nPhillip\n\n[1]\nhttps://git.kernel.org/pub/scm/git/git.git/tree/contrib/completion/git-completion.bash#n2010\n\n\n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> ---\n>  contrib/completion/git-completion.bash | 3 +--\n>  parse-options.h                        | 4 ++--\n>  rerere.h                               | 3 +--\n>  3 files changed, 4 insertions(+), 6 deletions(-)\n> \n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index 0ddf40063b..c310b241d3 100644\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -1754,8 +1754,7 @@ _git_merge ()\n>  \n>  \tcase \"$cur\" in\n>  \t--*)\n> -\t\t__gitcomp_builtin merge \"--rerere-autoupdate\n> -\t\t\t\t--no-rerere-autoupdate\n> +\t\t__gitcomp_builtin merge \"--no-rerere-autoupdate\n>  \t\t\t\t--no-commit --no-edit --no-ff\n>  \t\t\t\t--no-log --no-progress\n>  \t\t\t\t--no-squash --no-stat\n> diff --git a/parse-options.h b/parse-options.h\n> index 0ba08691e6..ab1cc362bf 100644\n> --- a/parse-options.h\n> +++ b/parse-options.h\n> @@ -148,8 +148,8 @@ struct option {\n>  #define OPT_STRING_LIST(s, l, v, a, h) \\\n>  \t\t\t\t    { OPTION_CALLBACK, (s), (l), (v), (a), \\\n>  \t\t\t\t      (h), 0, &parse_opt_string_list }\n> -#define OPT_UYN(s, l, v, h, f)      { OPTION_CALLBACK, (s), (l), (v), NULL, \\\n> -\t\t\t\t      (h), PARSE_OPT_NOARG|(f), &parse_opt_tertiary }\n> +#define OPT_UYN(s, l, v, h)         { OPTION_CALLBACK, (s), (l), (v), NULL, \\\n> +\t\t\t\t      (h), PARSE_OPT_NOARG, &parse_opt_tertiary }\n>  #define OPT_DATE(s, l, v, h) \\\n>  \t{ OPTION_CALLBACK, (s), (l), (v), N_(\"time\"),(h), 0,\t\\\n>  \t  parse_opt_approxidate_cb }\n> diff --git a/rerere.h b/rerere.h\n> index 5e5a312e4c..c2961feaaa 100644\n> --- a/rerere.h\n> +++ b/rerere.h\n> @@ -37,7 +37,6 @@ extern void rerere_clear(struct string_list *);\n>  extern void rerere_gc(struct string_list *);\n>  \n>  #define OPT_RERERE_AUTOUPDATE(v) OPT_UYN(0, \"rerere-autoupdate\", (v), \\\n> -\tN_(\"update the index with reused conflict resolution if possible\"), \\\n> -\tPARSE_OPT_NOCOMPLETE)\n> +\tN_(\"update the index with reused conflict resolution if possible\"))\n>  \n>  #endif\n> \n\n"},{"id":"341167","messageId":"xmqqd10g3jxb.fsf@gitster-ct.c.googlers.com","threadId":"47967","inReplyTo":"CAM0VKjmmF2t=B2s3rJoKmO3j6Bk5d6PEfCV==ONRGMcdUMLFpQ@mail.gmail.com","subject":"Re: [PATCH 2/2] completion: simplify _git_notes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-03-06T22:42:40Z","receivedAt":"2018-03-06T22:42:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"SZEDER Gábor <szeder.dev@gmail.com> writes:\n\n> There is a minor behaviour change here, though.  This\n>\n>   prune,*)\n>     ;;\n>\n> case arm ensured that we don't list refs for 'git notes prune <TAB>',\n> because it doesn't accept them (and then we take our usual fallback and\n> let Bash complete filenames;  yeah, 'git notes prune' doesn't accept\n> filenames either, but, as I said, that's our usual fallback when we\n> can't offer anything for completion).\n>\n> This patch removes that case arm, and refs will be offered for 'git\n> notes prune <TAB>'.\n>\n>> +       *,--*)\n>> +               __gitcomp_builtin notes_$subcommand\n>>                 ;;\n>>         *)\n>>                 case \"$prev\" in\n\nI have this tentatively queued on the topic.  Can we wrap the topic\nup and move it forward, instead of leaving it (and other topics)\nhanging around and causing conflicts with other topics in flight,\nplease?\n\nThanks.\n\n\nSubject: [PATCH] SQUASH???\n\nBy Szeder <CAM0VKjmmF2t=B2s3rJoKmO3j6Bk5d6PEfCV==ONRGMcdUMLFpQ@mail.gmail.com>\n---\n contrib/completion/git-completion.bash | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex ab80f4e6e8..5f7495cda3 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1836,6 +1836,11 @@ _git_notes ()\n \tadd,--reedit-message=*|append,--reedit-message=*)\n \t\t__git_complete_refs --cur=\"${cur#*=}\"\n \t\t;;\n+\tprune,--*)\n+\t\t__gitcomp_builtin notes_prune\n+\t\t;;\n+\tprune,*)\n+\t\t;;\n \t*,--*)\n \t\t__gitcomp_builtin notes_$subcommand\n \t\t;;\n-- \n2.16.2-345-g7e31236f65\n\n"},{"id":"341180","messageId":"20180307010504.9289-1-pclouds@gmail.com","threadId":"47967","inReplyTo":"20180303092307.3796-1-pclouds@gmail.com","subject":"[PATCH v2 0/4] nd/parseopt-completion fixups","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2018-03-07T01:05:00Z","receivedAt":"2018-03-07T01:05:35Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"v2 fixes the comments from v1 and adds to new patches to improve\n_git_notes() (sorry I couldn't resist)\n\nInterdiff with what's on 'pu'\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 5f7495cda3..2e30950299 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1815,7 +1815,7 @@ _git_name_rev ()\n \n _git_notes ()\n {\n-\tlocal subcommands='add append copy edit list prune remove show'\n+\tlocal subcommands='add append copy edit get-ref list merge prune remove show'\n \tlocal subcommand=\"$(__git_find_on_cmdline \"$subcommands\")\"\n \n \tcase \"$subcommand,$cur\" in\n@@ -1832,18 +1832,15 @@ _git_notes ()\n \t\t\t;;\n \t\tesac\n \t\t;;\n-\tadd,--reuse-message=*|append,--reuse-message=*|\\\n-\tadd,--reedit-message=*|append,--reedit-message=*)\n+\t*,--reuse-message=*|*,--reedit-message=*)\n \t\t__git_complete_refs --cur=\"${cur#*=}\"\n \t\t;;\n-\tprune,--*)\n-\t\t__gitcomp_builtin notes_prune\n-\t\t;;\n-\tprune,*)\n-\t\t;;\n \t*,--*)\n \t\t__gitcomp_builtin notes_$subcommand\n \t\t;;\n+\tprune,*|get-ref,*)\n+\t\t# this command does not take a ref, do not complete it\n+\t\t;;\n \t*)\n \t\tcase \"$prev\" in\n \t\t-m|-F)\n@@ -1956,6 +1953,7 @@ _git_rebase ()\n \t\t\t--autostash --no-autostash\n \t\t\t--verify --no-verify\n \t\t\t--keep-empty --root --force-rebase --no-ff\n+\t\t\t--rerere-autoupdate\n \t\t\t--exec\n \t\t\t\"\n \n\nNguyễn Thái Ngọc Duy (4):\n  completion: don't set PARSE_OPT_NOCOMPLETE on --rerere-autoupdate\n  completion: simplify _git_notes\n  completion: complete --{reuse,reedit}-message= for all notes subcmds\n  completion: more subcommands in _git_notes()\n\n contrib/completion/git-completion.bash | 25 ++++++++-----------------\n parse-options.h                        |  4 ++--\n rerere.h                               |  3 +--\n 3 files changed, 11 insertions(+), 21 deletions(-)\n\n-- \n2.16.2.785.g429c04a1b9\n\n"},{"id":"341181","messageId":"20180307010504.9289-2-pclouds@gmail.com","threadId":"47967","inReplyTo":"20180307010504.9289-1-pclouds@gmail.com","subject":"[PATCH v2 1/4] completion: don't set PARSE_OPT_NOCOMPLETE on --rerere-autoupdate","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2018-03-07T01:05:01Z","receivedAt":"2018-03-07T01:05:39Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"There is not a strong reason to hide this option, and git-merge already\ncompletes this one. Let's allow to complete this for all commands (and\nlet git-completion.bash do the suppressing if needed).\n\nThis makes --rerere-autoupdate completable for am, cherry-pick and\nrevert. rebase completion is fixed manually because it's a shell\nscript and does not benefit from --git-completion-helper.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n contrib/completion/git-completion.bash | 4 ++--\n parse-options.h                        | 4 ++--\n rerere.h                               | 3 +--\n 3 files changed, 5 insertions(+), 6 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 0ddf40063b..0d858cacce 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1754,8 +1754,7 @@ _git_merge ()\n \n \tcase \"$cur\" in\n \t--*)\n-\t\t__gitcomp_builtin merge \"--rerere-autoupdate\n-\t\t\t\t--no-rerere-autoupdate\n+\t\t__gitcomp_builtin merge \"--no-rerere-autoupdate\n \t\t\t\t--no-commit --no-edit --no-ff\n \t\t\t\t--no-log --no-progress\n \t\t\t\t--no-squash --no-stat\n@@ -1963,6 +1962,7 @@ _git_rebase ()\n \t\t\t--autostash --no-autostash\n \t\t\t--verify --no-verify\n \t\t\t--keep-empty --root --force-rebase --no-ff\n+\t\t\t--rerere-autoupdate\n \t\t\t--exec\n \t\t\t\"\n \ndiff --git a/parse-options.h b/parse-options.h\nindex 0ba08691e6..ab1cc362bf 100644\n--- a/parse-options.h\n+++ b/parse-options.h\n@@ -148,8 +148,8 @@ struct option {\n #define OPT_STRING_LIST(s, l, v, a, h) \\\n \t\t\t\t    { OPTION_CALLBACK, (s), (l), (v), (a), \\\n \t\t\t\t      (h), 0, &parse_opt_string_list }\n-#define OPT_UYN(s, l, v, h, f)      { OPTION_CALLBACK, (s), (l), (v), NULL, \\\n-\t\t\t\t      (h), PARSE_OPT_NOARG|(f), &parse_opt_tertiary }\n+#define OPT_UYN(s, l, v, h)         { OPTION_CALLBACK, (s), (l), (v), NULL, \\\n+\t\t\t\t      (h), PARSE_OPT_NOARG, &parse_opt_tertiary }\n #define OPT_DATE(s, l, v, h) \\\n \t{ OPTION_CALLBACK, (s), (l), (v), N_(\"time\"),(h), 0,\t\\\n \t  parse_opt_approxidate_cb }\ndiff --git a/rerere.h b/rerere.h\nindex 5e5a312e4c..c2961feaaa 100644\n--- a/rerere.h\n+++ b/rerere.h\n@@ -37,7 +37,6 @@ extern void rerere_clear(struct string_list *);\n extern void rerere_gc(struct string_list *);\n \n #define OPT_RERERE_AUTOUPDATE(v) OPT_UYN(0, \"rerere-autoupdate\", (v), \\\n-\tN_(\"update the index with reused conflict resolution if possible\"), \\\n-\tPARSE_OPT_NOCOMPLETE)\n+\tN_(\"update the index with reused conflict resolution if possible\"))\n \n #endif\n-- \n2.16.2.785.g429c04a1b9\n\n"},{"id":"341182","messageId":"20180307010504.9289-3-pclouds@gmail.com","threadId":"47967","inReplyTo":"20180307010504.9289-1-pclouds@gmail.com","subject":"[PATCH v2 2/4] completion: simplify _git_notes","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2018-03-07T01:05:02Z","receivedAt":"2018-03-07T01:05:42Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This also adds completion for 'git notes remove' and 'git notes edit'.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n contrib/completion/git-completion.bash | 14 +++-----------\n 1 file changed, 3 insertions(+), 11 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 0d858cacce..37bf4a64d3 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1836,19 +1836,11 @@ _git_notes ()\n \tadd,--reedit-message=*|append,--reedit-message=*)\n \t\t__git_complete_refs --cur=\"${cur#*=}\"\n \t\t;;\n-\tadd,--*)\n-\t\t__gitcomp_builtin notes_add\n-\t\t;;\n-\tappend,--*)\n-\t\t__gitcomp_builtin notes_append\n-\t\t;;\n-\tcopy,--*)\n-\t\t__gitcomp_builtin notes_copy\n-\t\t;;\n-\tprune,--*)\n-\t\t__gitcomp_builtin notes_prune\n+\t*,--*)\n+\t\t__gitcomp_builtin notes_$subcommand\n \t\t;;\n \tprune,*)\n+\t\t# this command does not take a ref, do not complete it\n \t\t;;\n \t*)\n \t\tcase \"$prev\" in\n-- \n2.16.2.785.g429c04a1b9\n\n"},{"id":"341183","messageId":"20180307010504.9289-4-pclouds@gmail.com","threadId":"47967","inReplyTo":"20180307010504.9289-1-pclouds@gmail.com","subject":"[PATCH v2 3/4] completion: complete --{reuse,reedit}-message= for all notes subcmds","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2018-03-07T01:05:03Z","receivedAt":"2018-03-07T01:05:44Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"The new subcommand that takes these options is 'git notes edit'. Just\naccept the options from subcommands since we handle them the same way\nin builtin/notes.c anyway. If a user does\n\n    git prune --reuse-message=...\n\njust let the command catches that error when it's executed.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n contrib/completion/git-completion.bash | 3 +--\n 1 file changed, 1 insertion(+), 2 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 37bf4a64d3..dc3ec43b65 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1832,8 +1832,7 @@ _git_notes ()\n \t\t\t;;\n \t\tesac\n \t\t;;\n-\tadd,--reuse-message=*|append,--reuse-message=*|\\\n-\tadd,--reedit-message=*|append,--reedit-message=*)\n+\t*,--reuse-message=*|*,--reedit-message=*)\n \t\t__git_complete_refs --cur=\"${cur#*=}\"\n \t\t;;\n \t*,--*)\n-- \n2.16.2.785.g429c04a1b9\n\n"},{"id":"341184","messageId":"20180307010504.9289-5-pclouds@gmail.com","threadId":"47967","inReplyTo":"20180307010504.9289-1-pclouds@gmail.com","subject":"[PATCH v2 4/4] completion: more subcommands in _git_notes()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2018-03-07T01:05:04Z","receivedAt":"2018-03-07T01:05:46Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Two subcommands are added for completion: merge and get-ref. get-ref\nis more like plumbing. But since it does not share the prefix with any\nother subcommands, it won't slow anybody down.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n contrib/completion/git-completion.bash | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex dc3ec43b65..2e30950299 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1815,7 +1815,7 @@ _git_name_rev ()\n \n _git_notes ()\n {\n-\tlocal subcommands='add append copy edit list prune remove show'\n+\tlocal subcommands='add append copy edit get-ref list merge prune remove show'\n \tlocal subcommand=\"$(__git_find_on_cmdline \"$subcommands\")\"\n \n \tcase \"$subcommand,$cur\" in\n@@ -1838,7 +1838,7 @@ _git_notes ()\n \t*,--*)\n \t\t__gitcomp_builtin notes_$subcommand\n \t\t;;\n-\tprune,*)\n+\tprune,*|get-ref,*)\n \t\t# this command does not take a ref, do not complete it\n \t\t;;\n \t*)\n-- \n2.16.2.785.g429c04a1b9\n\n"},{"id":"341185","messageId":"20180307010843.3503-1-szeder.dev@gmail.com","threadId":"47967","inReplyTo":"xmqqd10g3jxb.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 2/2] completion: simplify _git_notes","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2018-03-07T01:08:43Z","receivedAt":"2018-03-07T01:09:02Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"\n> SZEDER Gábor <szeder.dev@gmail.com> writes:\n> \n> > There is a minor behaviour change here, though.  This\n> >\n> >   prune,*)\n> >     ;;\n> >\n> > case arm ensured that we don't list refs for 'git notes prune <TAB>',\n> > because it doesn't accept them (and then we take our usual fallback and\n> > let Bash complete filenames;  yeah, 'git notes prune' doesn't accept\n> > filenames either, but, as I said, that's our usual fallback when we\n> > can't offer anything for completion).\n> >\n> > This patch removes that case arm, and refs will be offered for 'git\n> > notes prune <TAB>'.\n> >\n> >> +       *,--*)\n> >> +               __gitcomp_builtin notes_$subcommand\n> >>                 ;;\n> >>         *)\n> >>                 case \"$prev\" in\n> \n> I have this tentatively queued on the topic.  Can we wrap the topic\n> up and move it forward, instead of leaving it (and other topics)\n> hanging around and causing conflicts with other topics in flight,\n> please?\n> \n> Thanks.\n> \n> \n> Subject: [PATCH] SQUASH???\n> \n> By Szeder <CAM0VKjmmF2t=B2s3rJoKmO3j6Bk5d6PEfCV==ONRGMcdUMLFpQ@mail.gmail.com>\n> ---\n>  contrib/completion/git-completion.bash | 5 +++++\n>  1 file changed, 5 insertions(+)\n> \n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index ab80f4e6e8..5f7495cda3 100644\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -1836,6 +1836,11 @@ _git_notes ()\n>  \tadd,--reedit-message=*|append,--reedit-message=*)\n>  \t\t__git_complete_refs --cur=\"${cur#*=}\"\n>  \t\t;;\n> +\tprune,--*)\n> +\t\t__gitcomp_builtin notes_prune\n> +\t\t;;\n> +\tprune,*)\n> +\t\t;;\n>  \t*,--*)\n>  \t\t__gitcomp_builtin notes_$subcommand\n>  \t\t;;\n> -- \n> 2.16.2-345-g7e31236f65\n> \n\nThat works fine, but this would work just as well and has one less\ncase arm:\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex ab80f4e6e8..038af63c1a 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1839,6 +1839,8 @@ _git_notes ()\n \t*,--*)\n \t\t__gitcomp_builtin notes_$subcommand\n \t\t;;\n+\tprune,*)\n+\t\t;;\n \t*)\n \t\tcase \"$prev\" in\n \t\t-m|-F)\n"},{"id":"341225","messageId":"xmqq4llr1zy3.fsf@gitster-ct.c.googlers.com","threadId":"47967","inReplyTo":"20180307010843.3503-1-szeder.dev@gmail.com","subject":"Re: [PATCH 2/2] completion: simplify _git_notes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-03-07T18:51:48Z","receivedAt":"2018-03-07T18:51:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"SZEDER Gábor <szeder.dev@gmail.com> writes:\n\n> That works fine, but this would work just as well and has one less\n> case arm:\n\nOK, I missed that \"obvious optimization\" opportunity.  I agree that\nwould work.\n\n>\n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index ab80f4e6e8..038af63c1a 100644\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -1839,6 +1839,8 @@ _git_notes ()\n>  \t*,--*)\n>  \t\t__gitcomp_builtin notes_$subcommand\n>  \t\t;;\n> +\tprune,*)\n> +\t\t;;\n>  \t*)\n>  \t\tcase \"$prev\" in\n>  \t\t-m|-F)\n"}]}