git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "SZEDER Gábor" <szeder@ira.uka.de>
To: John Keeping <john@keeping.me.uk>
Cc: Thomas Braun <thomas.braun@virtuell-zuhause.de>,
	git <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>,
	Ramkumar Ramachandra <artagnon@gmail.com>
Subject: Re: [PATCH v2] completion: Add '--edit-todo' to rebase
Date: Fri, 31 Jul 2015 12:16:46 +0200	[thread overview]
Message-ID: <20150731121646.Horde.Mk6NzRZAsrRNDCE_y2uEdQ1@webmail.informatik.kit.edu> (raw)
In-Reply-To: <20150730112940.GL14935@serenity.lan>


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


Best,
Gábor

  reply	other threads:[~2015-07-31 10:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-13 11:27 [PATCH] completion: Add '--edit-todo' to rebase Thomas Braun
2015-07-13 13:11 ` John Keeping
2015-07-27 17:54   ` [PATCH v2] " Thomas Braun
2015-07-30 11:24     ` SZEDER Gábor
2015-07-30 11:29       ` John Keeping
2015-07-31 10:16         ` SZEDER Gábor [this message]
2015-07-31 17:37           ` Thomas Braun
2015-08-01  9:25             ` SZEDER Gábor
2015-08-05 13:40               ` [PATCH v3 1/1] completion: offer '--edit-todo' during interactive rebase 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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20150731121646.Horde.Mk6NzRZAsrRNDCE_y2uEdQ1@webmail.informatik.kit.edu \
    --to=szeder@ira.uka.de \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=john@keeping.me.uk \
    --cc=thomas.braun@virtuell-zuhause.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).