From: Erik Cervin Edin <erik@cervined.in>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [BUG] fixup commit is dropped during rebase if subject = branch name
Date: Sun, 18 Sep 2022 16:55:21 +0200 [thread overview]
Message-ID: <CA+JQ7M9_o-0W1orXnPRGzoLziE0HBNkLe0HugGNFKxy0LPsgXA@mail.gmail.com> (raw)
In-Reply-To: <xmqqpmftev3c.fsf@gitster.g>
On Sat, Sep 17, 2022, 8:04 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> > # failure
> > seq 1 3 >> bar && git add bar && git commit -m main
> > git tag -f x
> > seq 4 6 >> bar && git add bar && git commit -m bar
> > seq 7 9 >> bar && git add bar && git commit --fixup :/main
> > git -c sequence.editor=: rebase --autosquash --interactive x
> > git diff ORIG_HEAD
>
> So near the bottom there are "init", and "x". The commit title of
> "x" is "main" and that is what the fix-up intends to amend.
Yes, sorry if that was unclear. So the branch looks like
474b082 (HEAD -> main) fixup! main
acd367f bar
576294e (tag: x) main
dd27847 (tag: init) init
so
git -c sequence.editor rebase -i --autosquash x
should yield
474b082 (HEAD -> main) fixup! main
acd367f bar
576294e (tag: x) main
dd27847 (tag: init) init
ie. no change, but instead yields
acd367f (HEAD -> main) bar
576294e (tag: x) main
dd27847 (tag: init) init
ie. it drops the fixup! main commit but only if it's the first commit, see
second example I posted
On Sat, Sep 17, 2022 at 4:45 PM Erik Cervin Edin <erik@cervined.in> wrote:
> # normal
> git reset --hard init
> seq 1 3 >> bar && git add bar && git commit -m main
> git tag -f x
> seq 4 6 >> bar && git add bar && git commit --fixup :/main
> seq 7 9 >> bar && git add bar && git commit -m bar
> git -c sequence.editor=: rebase --autosquash --interactive x
> git diff ORIG_HEAD
yields
acd367f (HEAD -> main) bar
474b082 fixup! main
576294e (tag: x) main
dd27847 (tag: init) init
as expected.
> But then I do not think there is any valid expectation if you say
> "keep x intact and rebase everything above", which is what the
> command line arguments tell the last command to do. Perhaps we
> should keep all original commits up to that "fixup" one without any
> reordering or squashing?
I'm not sure I follow but the report is concerning the unexpected
behavior of dropping the commit under these specific conditions. I'm
not 100% sure but as I recall, this only happens in situation where
the fixup may not be applied (and in which case it should remain as
is).
> The title of your bug report is also curious. What happens if you
> did
>
> git branch -m master
that works as expected
git reset --hard init
seq 1 3 >> bar && git add bar && git commit -m main
git tag -f x
seq 4 6 >> bar && git add bar && git commit -m bar
seq 7 9 >> bar && git add bar && git commit --fixup :/main
git branch -m master
git -c sequence.editor=: rebase --autosquash --interactive x
but changing branch -m to switch -c reproduces the bug
6650ace (HEAD -> master) bar
7835cd5 (tag: x) main
368ed2f (tag: init) init
Hope this better clarifies what is going on!
next prev parent reply other threads:[~2022-09-18 14:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-17 14:45 [BUG] fixup commit is dropped during rebase if subject = branch name Erik Cervin Edin
2022-09-17 18:04 ` Junio C Hamano
2022-09-18 14:55 ` Erik Cervin Edin [this message]
2022-09-17 23:19 ` Johannes Altmanninger
2022-09-18 12:10 ` [PATCH] sequencer: avoid dropping fixup commit that targets self via commit-ish Johannes Altmanninger
2022-09-18 15:05 ` Erik Cervin Edin
2022-09-18 17:54 ` Johannes Altmanninger
2022-09-19 1:11 ` Junio C Hamano
2022-09-19 16:07 ` Junio C Hamano
2022-09-20 3:20 ` Johannes Altmanninger
2022-09-19 16:23 ` Junio C Hamano
2022-09-20 3:11 ` [PATCH v2] " Johannes Altmanninger
2022-09-20 8:26 ` Phillip Wood
2022-09-21 18:47 ` Junio C Hamano
2022-09-22 4:00 ` Johannes Altmanninger
2022-09-22 19:32 ` Junio C Hamano
2022-09-24 22:29 ` [PATCH v3] " Johannes Altmanninger
2022-09-19 23:09 ` [PATCH] " Junio C Hamano
2022-09-20 3:27 ` Johannes Altmanninger
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=CA+JQ7M9_o-0W1orXnPRGzoLziE0HBNkLe0HugGNFKxy0LPsgXA@mail.gmail.com \
--to=erik@cervined.in \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).