git rebase --onto 仅在长分支上崩溃

git rebase --onto crashes only on long branches

当变基分支有太多提交时,我在做一个简单的 git rebase(不涉及冲突)时遇到了问题。我在 google.

上都找不到关于 Whosebug 的类似错误

我发现在尝试对 71 次提交的长分支进行 rebase 时遇到问题(真的吗?):

$ git clone git@myrepo.com/project.git
$ cd project
$ git checkout develop
$ vim README.md # just a simple text update on tracked file
$ git add README.md
$ git commit -m "crash test"
$ git checkout feature/branch-to-be-rebased
$ git rebase --onto develop feature/big-branch-to-be-rebased~71

First, rewinding head to replay your work on top of it...
Applying: commit 01
Applying: commit 02
Applying: commit 03
...
Applying: commit 20
Assertion failed: (postlen ? fixed_preimage.nr == preimage->nr : fixed_preimage.nr <= preimage->nr), function update_pre_post_images, file apply.c, line 2322.
/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git-rebase--am: line 16: 44878 Abort trap: 6           git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" ${gpg_sign_opt:+"$gpg_sign_opt"} < "$GIT_DIR/rebased-patches"

git rebase 在分支较短时正常工作(它在 8 个提交分支上工作)。

我的OS是Sierra 10.12.6

$ git --version
git version 2.13.6 (Apple Git-96)

使用最新的 brew git 版本发生了同样的事情:

$ /usr/local/Cellar/git/2.15.0/bin/git --version
git version 2.15.0

我知道有些人会对git工作流程有不同的看法,但这个问题的重点是纯技术性的。所以我对 squash、cherry-pick 等变通方法不感兴趣。

有没有办法解决这个崩溃问题? git rebase 是否对其可以处理的提交数量有某种上限?这是一个已知的错误?

Is there a way to fix this crash?

修复Git中的错误,当然。 (你说你对解决方法不感兴趣,但这似乎来自将 --whitespace=fix 作为命令行参数,或者在你的配置中设置 apply.whitespace=fix 。消除它可能会回避问题。)

Does git rebase have some sort of upper limit on the number of commits it can handle?

没有

Is this a known bug?

嗯,就是现在了。 :-) 不过,如果没有好的复制器,我不确定是否有人 else 可以修复它。 (所以也许这取决于您所说的 "known bug" 的意思:您的示例表明空白修复代码中存在错误,但尚不清楚错误是什么。)