From: Nikita Bobko <nikitabobko@gmail.com>
To: git@vger.kernel.org
Subject: [BUG REPORT] `git rebase --exec` shouldn't run the exec command when there is nothing to rebase
Date: Fri, 26 Nov 2021 13:44:14 +0100 [thread overview]
Message-ID: <CAMJzOtyw78-8gt3oGscN7KUzpzRRWtAQuGfcJ+R_Fjoom9Lexw@mail.gmail.com> (raw)
Steps:
git rebase HEAD --exec "echo foo"
EXPECTED: since 0 commits are going to be rebased then I expect "foo"
NOT to be printed
ACTUAL: "foo" is printed
A real-world example where such behavior is really unexpected - I have
a script that signs a series of commits like this:
```bash
head="$(git rev-parse HEAD)"
# Generate some commits (in my case it's cherry-picking commits from
public GitHub subtree repo to internal monorepo)
file="$(mktemp)"
git rebase $head --exec "git log -1 --pretty='%B' > $file" \
--exec "echo 'closes
'https://github.com/JetBrains/intellij-community/pull/$1' >> $file" \
--exec "git commit --amend -F $file"
```
But if none of the commits were generated then `git rebase --exec`
will amend the HEAD which is not expected. It means that I have to
process the case when 0 zero commits are generated separately.
If you agree that it's a bug then, most likely, it won't be possible
to fix it because it would break compatibility. Well, yes then this
bug report is JFYI.
[System Info]
git version:
git version 2.33.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.4.98-1-lts #1 SMP Sat, 13 Feb 2021 19:22:14 +0000 x86_64
compiler info: gnuc: 11.1
libc info: glibc: 2.33
$SHELL (typically, interactive shell): /bin/zsh
[Enabled Hooks]
next reply other threads:[~2021-11-26 13:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-26 12:44 Nikita Bobko [this message]
2021-11-29 12:07 ` [BUG REPORT] `git rebase --exec` shouldn't run the exec command when there is nothing to rebase Ævar Arnfjörð Bjarmason
2021-11-30 0:14 ` Elijah Newren
2021-11-30 0:43 ` Taylor Blau
2021-11-30 3:58 ` [PATCH] sequencer: avoid adding exec commands for non-commit creating commands Elijah Newren via GitGitGadget
2021-11-30 5:13 ` Taylor Blau
2021-11-30 14:03 ` [BUG REPORT] `git rebase --exec` shouldn't run the exec command when there is nothing to rebase Ævar Arnfjörð Bjarmason
2021-12-01 11:45 ` Phillip Wood
2021-12-01 11:24 ` [PATCH] sequencer: avoid adding exec commands for non-commit creating commands Phillip Wood
2021-12-03 22:22 ` Johannes Schindelin
2021-11-30 4:01 ` [BUG REPORT] `git rebase --exec` shouldn't run the exec command when there is nothing to rebase Elijah Newren
2021-11-30 11:09 ` Phillip Wood
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=CAMJzOtyw78-8gt3oGscN7KUzpzRRWtAQuGfcJ+R_Fjoom9Lexw@mail.gmail.com \
--to=nikitabobko@gmail.com \
--cc=git@vger.kernel.org \
/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).