From: Philippe Blain <levraiphilippeblain@gmail.com>
To: Git mailing list <git@vger.kernel.org>,
Derrick Stolee <dstolee@microsoft.com>,
Elijah Newren <newren@gmail.com>
Subject: [BUG?] 'git rebase --update-refs --whitespace=fix' incompatible, but not enforced
Date: Tue, 17 Jan 2023 17:02:07 -0500 [thread overview]
Message-ID: <b322c536-5a75-bb0c-8eac-1a99d3ba3230@gmail.com> (raw)
Hi Elijah and Stolee,
First, Stolee, thanks a lot for adding '--update-refs', it is very useful (I've
added it to my config so I don't forget to use it).
I recently learned that 'git rebase --whitespace=fix' exists, which is also
great but since it uses the apply backend, it can't be used with --update-refs.
I understand this, and the fact that adding '--whitespace=fix' to the merge
backend would be a big task; this is not what this email is about.
I think there is a bug in that the code does not enforce the fact that
both options can't be used together. Whenever '--whitespace' or '-C' are used,
the code defaults to the apply backend:
```builtin/rebase +1502
if (options.git_am_opts.nr || options.type == REBASE_APPLY) {
/* all am options except -q are compatible only with --apply */
for (i = options.git_am_opts.nr - 1; i >= 0; i--)
if (strcmp(options.git_am_opts.v[i], "-q"))
break;
if (i >= 0) {
if (is_merge(&options))
die(_("apply options and merge options "
"cannot be used together"));
else
options.type = REBASE_APPLY;
}
```
but 'is_merge' only checks if 'opts->type == REBASE_MERGE', so the check only
works if --merge was given explicitely, but not when none of '--merge' or '--apply'
were given (and so the default "merge" backend is used).
I would have expected the code to die telling me --update-refs and --whitespace
are incompatible. But instead it defaulted to --apply, and (of course) did not
update the refs in my history (which I found out later).
Thanks,
Philippe.
next reply other threads:[~2023-01-17 22:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-17 22:02 Philippe Blain [this message]
2023-01-18 15:51 ` [BUG?] 'git rebase --update-refs --whitespace=fix' incompatible, but not enforced Derrick Stolee
2023-01-18 16:16 ` Phillip Wood
2023-01-18 16:24 ` Elijah Newren
2023-01-18 17:03 ` Derrick Stolee
2023-01-18 18:07 ` Philippe Blain
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b322c536-5a75-bb0c-8eac-1a99d3ba3230@gmail.com \
--to=levraiphilippeblain@gmail.com \
--cc=dstolee@microsoft.com \
--cc=git@vger.kernel.org \
--cc=newren@gmail.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.