git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
* Bug, git rebase -i does not abort correctly
@ 2018-01-25 12:13 Duy Nguyen
  2018-01-26  7:50 ` Kaartic Sivaraam
  0 siblings, 1 reply; 4+ messages in thread
From: Duy Nguyen @ 2018-01-25 12:13 UTC (permalink / raw)
  To: Git Mailing List

rebase scripts are too much for me, so I'll play the user reporting
bugs this time :)

Instead of doing

    $ git rebase -i --onto origin/master @~3

I sometimes accidentally type

    $ git rebase -i origin/master @~3

("rebase -i" is actually an alias, which is why I never forget to type -i)

Usually the todo list in $EDITOR shows noop, I realize my mistake and
try to abort it by clearing the todo list before saving and closing
$EDITOR. The problem is, HEAD is moved away anyway (to origin/master I
think) even if rebase is supposed to abort the operation and leave
HEAD untouched.
-- 
Duy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug, git rebase -i does not abort correctly
  2018-01-25 12:13 Bug, git rebase -i does not abort correctly Duy Nguyen
@ 2018-01-26  7:50 ` Kaartic Sivaraam
  2018-01-26  9:24   ` Duy Nguyen
  0 siblings, 1 reply; 4+ messages in thread
From: Kaartic Sivaraam @ 2018-01-26  7:50 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 2574 bytes --]

Hi,

On Thursday 25 January 2018 05:43 PM, Duy Nguyen wrote:
> rebase scripts are too much for me, so I'll play the user reporting
> bugs this time :)
> 
> Instead of doing
> 
>     $ git rebase -i --onto origin/master @~3
> 
> I sometimes accidentally type
> 
>     $ git rebase -i origin/master @~3
> 
> ("rebase -i" is actually an alias, which is why I never forget to
type -i)
> 
> Usually the todo list in $EDITOR shows noop, I realize my mistake and
> try to abort it by clearing the todo list before saving and closing
> $EDITOR. The problem is, HEAD is moved away anyway (to origin/master
I
> think) 

For me it left HEAD at @~3. Reading the synopsis of `man git rebase` I
could guess that the corresponding abstract form would be,

    $ git rebase -i <upstream> <branch>


> even if rebase is supposed to abort the operation and leave
> HEAD untouched.
> 

This might seem to be a bug as the comment in "git-rebase-todo" says,

    However, if you remove everything, the rebase will be aborted.

But "man git rebase" clearly says,

    If <branch> is specified, git rebase will perform an automatic "git
    checkout <branch>" before doing anything else. Otherwise it remains
    on
    the current branch.

Junio has previously confirmed that "git rebase [-i] <upstream>
<branch>" is just a short hand for "git checkout <branch> && git rebase
[-i] <upstream>".[ref 1] So, it's not surprising that it left HEAD at
@~3 when you completely removed the contents of git-rebase-todo and
exited the editor.

Does that help solve your issue?


[ref 1]: 

https://public-inbox.org/git/%3Cxmqqpo8387hz.fsf@gitster.mtv.corp.google.com%3E

-- 
Kaartic

QUOTE

“It is impossible to live without failing at something, unless you live
so cautiously that you might as well not have lived at all – in which
case, you fail by default.”

      - J. K. Rowling


WIKIPEDIA: DID YOU KNOW?

Only 33% of internet users in India have heard of Wikipedia !!

* What do you think could be the reason behind this?

* What are ways in which the awareness about Wikipedia in India and
other countries be increased ?

Reference:

* Give your ideas for increasing the awareness of Wikipedia in India
and
in other countries and get a Grant from the Wikimedia Foundation to
bring your idea to life.

  https://meta.wikimedia.org/wiki/Grants:IdeaLab/Inspire

* Know more about the awareness problem of Wikipedia

  https://meta.wikimedia.org/wiki/New_Readers/Awareness

  https://meta.wikimedia.org/wiki/New_Readers/Next_steps/Raising_awareness
-- 
Kaartic

[-- Attachment #2: Type: text/plain, Size: 2312 bytes --]

Hi,

I seem to able to reproduce your issue. More comments inline.

On Thursday 25 January 2018 05:43 PM, Duy Nguyen wrote:
> rebase scripts are too much for me, so I'll play the user reporting
> bugs this time :)
> 
> Instead of doing
> 
>     $ git rebase -i --onto origin/master @~3
> 
> I sometimes accidentally type
> 
>     $ git rebase -i origin/master @~3
> 
> ("rebase -i" is actually an alias, which is why I never forget to type -i)
> 
> Usually the todo list in $EDITOR shows noop, I realize my mistake and
> try to abort it by clearing the todo list before saving and closing
> $EDITOR. The problem is, HEAD is moved away anyway (to origin/master I
> think) 

For me it left HEAD at @~3. Reading the synopsis of `man git rebase` I
could guess that the corresponding abstract form would be,

    $ git rebase -i <upstream> <branch>


> even if rebase is supposed to abort the operation and leave
> HEAD untouched.
> 

This might seem to be a bug as the comment in "git-rebase-todo" says,

    However, if you remove everything, the rebase will be aborted.

But "man git rebase" clearly says,

    If <branch> is specified, git rebase will perform an automatic git
checkout <branch> before doing anything else. Otherwise it remains on
       the current branch.
Surprisingly when git-rebase-todo's content is only a "noop" just
closing the editor without removing the contents also seems to be lying
as it checks
-- 
Kaartic

QUOTE

“It is impossible to live without failing at something, unless you live
so cautiously that you might as well not have lived at all – in which
case, you fail by default.”

      - J. K. Rowling


WIKIPEDIA: DID YOU KNOW?

Only 33% of internet users in India have heard of Wikipedia !!

* What do you think could be the reason behind this?

* What are ways in which the awareness about Wikipedia in India and
other countries be increased ?

Reference:

* Give your ideas for increasing the awareness of Wikipedia in India and
in other countries and get a Grant from the Wikimedia Foundation to
bring your idea to life.

  https://meta.wikimedia.org/wiki/Grants:IdeaLab/Inspire

* Know more about the awareness problem of Wikipedia

  https://meta.wikimedia.org/wiki/New_Readers/Awareness

  https://meta.wikimedia.org/wiki/New_Readers/Next_steps/Raising_awareness

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug, git rebase -i does not abort correctly
  2018-01-26  7:50 ` Kaartic Sivaraam
@ 2018-01-26  9:24   ` Duy Nguyen
  2018-03-13 18:26     ` Kaartic Sivaraam
  0 siblings, 1 reply; 4+ messages in thread
From: Duy Nguyen @ 2018-01-26  9:24 UTC (permalink / raw)
  To: Kaartic Sivaraam; +Cc: Git Mailing List

On Fri, Jan 26, 2018 at 2:50 PM, Kaartic Sivaraam
<kaartic.sivaraam@gmail.com> wrote:
> This might seem to be a bug as the comment in "git-rebase-todo" says,
>
>     However, if you remove everything, the rebase will be aborted.
>
> But "man git rebase" clearly says,
>
>     If <branch> is specified, git rebase will perform an automatic "git
>     checkout <branch>" before doing anything else. Otherwise it remains
>     on
>     the current branch.
>
> Junio has previously confirmed that "git rebase [-i] <upstream>
> <branch>" is just a short hand for "git checkout <branch> && git rebase
> [-i] <upstream>".[ref 1] So, it's not surprising that it left HEAD at
> @~3 when you completely removed the contents of git-rebase-todo and
> exited the editor.
>
> Does that help solve your issue?

Sort of. It smells bad design to me when a mistake can easily become a
feature. But with your help, I think I should be able to disable this
feature on my local build. Thanks.
-- 
Duy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug, git rebase -i does not abort correctly
  2018-01-26  9:24   ` Duy Nguyen
@ 2018-03-13 18:26     ` Kaartic Sivaraam
  0 siblings, 0 replies; 4+ messages in thread
From: Kaartic Sivaraam @ 2018-03-13 18:26 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Git Mailing List

[-- Attachment #1.1: Type: text/plain, Size: 732 bytes --]

On Friday 26 January 2018 02:54 PM, Duy Nguyen wrote:
> 
> Sort of. It smells bad design to me when a mistake can easily become a
> feature. But with your help, I think I should be able to disable this
> feature on my local build. Thanks.
> 

In case you're still facing this issue, it just struck me recently that
you could have a different alias for 'git rebase -i --onto'. In which
case you could possibly avoid falling prey to the syntax issue ;-)
Something like,

	$ git config alias.rio 'rebase -i --onto'



-- 
Kaartic

QUOTE
---

“The most valuable person on any team is the person who makes everyone
else on the team more valuable, not the person who knows the most.”

      - Joel Spolsky


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 870 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-25 12:13 Bug, git rebase -i does not abort correctly Duy Nguyen
2018-01-26  7:50 ` Kaartic Sivaraam
2018-01-26  9:24   ` Duy Nguyen
2018-03-13 18:26     ` Kaartic Sivaraam

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox