git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] completion: Add '--edit-todo' to rebase

From
Thomas Braun <thomas.braun@virtuell-zuhause.de>
Date
Jul 31, 2015, 17:37 UTC
Message-ID
<55BBB244.3060309@virtuell-zuhause.de>
In-Reply-To
<20150731121646.Horde.Mk6NzRZAsrRNDCE_y2uEdQ1@webmail.informatik.kit.edu>
Am 31.07.2015 um 12:16 schrieb SZEDER Gábor:
Show 92 quoted lines
> 
> Quoting John Keeping <john@keeping.me.uk>:
> 
>> On Thu, Jul 30, 2015 at 01:24:03PM +0200, SZEDER Gábor wrote:
>>>
>>> Quoting Thomas Braun <thomas.braun@virtuell-zuhause.de>:
>>>
>>>> Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
>>>> ---
>>>>> John Keeping <john@keeping.me.uk> hat am 13. Juli 2015 um 15:11
>>> geschrieben:
>>>>> git-rebase.sh contains:
>>>>>
>>>>>     if test "$action" = "edit-todo" && test "$type" != "interactive"
>>>>>     then
>>>>>         die "$(gettext "The --edit-todo action can only be used during
>>> interactive
>>>>> rebase.")"
>>>>>     fi
>>>>>
>>>>> I wonder if it's worth doing a similar check here, which presumably
>>>>> means testing if "$dir"/interactive exists.
>>>>
>>>> Good point. Thanks for the hint.
>>>
>>> Perhaps the subject line could say "completion: offer '--edit-todo'
>>> during interactive rebase" to be a bit more specific.
>>>
>>>> contrib/completion/git-completion.bash | 6 +++++-
>>>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/contrib/completion/git-completion.bash
>>>> b/contrib/completion/git-completion.bash
>>>> index c97c648..b03050e 100644
>>>> --- a/contrib/completion/git-completion.bash
>>>> +++ b/contrib/completion/git-completion.bash
>>>> @@ -1668,7 +1668,11 @@ _git_rebase ()
>>>> {
>>>>     local dir="$(__gitdir)"
>>>>     if [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then
>>>> -        __gitcomp "--continue --skip --abort"
>>>> +        if [ -d "$dir"/interactive ]; then
>>>
>>> This doesn't work for me, I think it looks for the right file at the
>>> wrong place.  During an interactive rebase I have no
>>> '.git/interactive' file but a '.git/rebase-merge/interactive', so I
>>> never get '--edit-todo'.
> 
> Just noticed another issue here: it looks for a directory, though it
> should look for a file.
> 
> 
>>> After some playing around and a cursory look at the source it seems to
>>> me that I have '.git/rebase-apply' during a "regular" rebase and
>>> '.git/rebase-merge' during an interactive rebase, and git-rebase.sh
>>> checks the presence of the 'interactive' file only in
>>> '.git/rebase-merge'.  It's not clear to me yet whether it's possible
>>> to have a '.git/rebase-merge' without the file 'interactive' in it.
>>> If it is possible, then I'd like to know with which commands and under
>>> what circumstances.  If it isn't, then we wouldn't have to look for
>>> the file at all, because checking the presence of the directory would
>>> be enough.
>>
>> "git rebase --merge" will use ".git/rebase-merge" without creating the
>> "interactive" flag.
> 
> Oh, right, thanks.  I should have remembered, I wrote the test of the
> prompt script for that case...
> (On a related note: is it possible to have a '.git/rebase-apply'
> directory, but neither 'rebasing' or 'applying' files within?  The
> prompt script has a long if-elif chain with such a branch, and I
> remember wondering how I could trigger it for testing.)
> 
> Anyway, so this could be something like (modulo likely whitespace damage):
> 
> diff --git a/contrib/completion/git-completion.bash
> b/contrib/completion/git-completion.bash
> index 07c34ef913..fac01d6985 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1667,7 +1667,10 @@ _git_push ()
>   _git_rebase ()
>   {
>       local dir="$(__gitdir)"
> -    if [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then
> +    if [ -f "$dir"/rebase-merge/interactive ]; then
> +        __gitcomp "--continue --skip --abort --edit-todo"
> +        return
> +    elif [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then
>           __gitcomp "--continue --skip --abort"
>           return
>       fi
This looks much better than my attempt. Thanks.
How is the protocol now? Do I reroll and add 
Helped-By: John Keeping <john@keeping.me.uk>
Completely-Overhauled-And-Properly-Implemented: SZEDER Gábor <szeder@ira.uka.de>
?
Thomas
Previous: SZEDER GáborNext: SZEDER Gábor
Message 7 of 9 in “completion: Add '--edit-todo' to rebase”
  1. completion: Add '--edit-todo' to rebaseThomas Braun, Jul 13, 2015
  2. John KeepingJul 13, 2015
  3. completion: Add '--edit-todo' to rebaseThomas Braun, Jul 27, 2015
  4. SZEDER GáborJul 30, 2015
  5. John KeepingJul 30, 2015
  6. SZEDER GáborJul 31, 2015
  7. Thomas BraunJul 31, 2015
  8. SZEDER GáborAug 1, 2015
  9. 1/1 completion: offer '--edit-todo' during interactive rebaseThomas Braun, Aug 5, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.