Skip to content

Instantly share code, notes, and snippets.

@MichaelBlume
Last active December 10, 2015 22:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MichaelBlume/db7ba222be001d502e57 to your computer and use it in GitHub Desktop.
Save MichaelBlume/db7ba222be001d502e57 to your computer and use it in GitHub Desktop.
Initialized empty Git repository in /Users/michael.blume/workspace/git/t/trash directory.t3400-rebase/.git/
expecting success:
git config core.logAllRefUpdates true &&
echo First >A &&
git update-index --add A &&
git commit -m "Add A." &&
git checkout -b force-3way &&
echo Dummy >Y &&
git update-index --add Y &&
git commit -m "Add Y." &&
git checkout -b filemove &&
git reset --soft master &&
mkdir D &&
git mv A D/A &&
git commit -m "Move A." &&
git checkout -b my-topic-branch master &&
echo Second >B &&
git update-index --add B &&
git commit -m "Add B." &&
git checkout -f master &&
echo Third >>A &&
git update-index A &&
git commit -m "Modify A." &&
git checkout -b side my-topic-branch &&
echo Side >>C &&
git add C &&
git commit -m "Add C" &&
git checkout -f my-topic-branch &&
git tag topic
[master (root-commit) ee8d635] Add A.
Author: author@name <bogus@email@address>
1 file changed, 1 insertion(+)
create mode 100644 A
Switched to a new branch 'force-3way'
[force-3way 61ceff4] Add Y.
Author: author@name <bogus@email@address>
1 file changed, 1 insertion(+)
create mode 100644 Y
Switched to a new branch 'filemove'
[filemove bea59d5] Move A.
Author: author@name <bogus@email@address>
2 files changed, 1 insertion(+)
rename A => D/A (100%)
create mode 100644 Y
Switched to a new branch 'my-topic-branch'
[my-topic-branch 01c87ac] Add B.
Author: author@name <bogus@email@address>
1 file changed, 1 insertion(+)
create mode 100644 B
Switched to branch 'master'
[master d5ed5bb] Modify A.
Author: author@name <bogus@email@address>
1 file changed, 1 insertion(+)
Switched to a new branch 'side'
[side 793475f] Add C
Author: author@name <bogus@email@address>
1 file changed, 1 insertion(+)
create mode 100644 C
Switched to branch 'my-topic-branch'
ok 1 - prepare repository with topic branches
expecting success:
echo dirty >>A &&
test_must_fail git rebase master
Cannot rebase: You have unstaged changes.
Please commit or stash them.
ok 2 - rebase on dirty worktree
expecting success:
git add A &&
test_must_fail git rebase master
Cannot rebase: Your index contains uncommitted changes.
Please commit or stash them.
ok 3 - rebase on dirty cache
expecting success:
git reset --hard HEAD &&
git rebase master
HEAD is now at 01c87ac Add B.
First, rewinding head to replay your work on top of it...
Applying: Add B.
ok 4 - rebase against master
expecting success:
test_when_finished "git branch -D torebase" &&
git checkout -b torebase my-topic-branch^ &&
upstream=$(git rev-parse ":/Add B") &&
onto=$(git rev-parse ":/Add A") &&
git rebase --onto $onto $upstream &&
git reset --hard my-topic-branch^ &&
git rebase --onto ":/Add A" ":/Add B" &&
git checkout my-topic-branch
Switched to a new branch 'torebase'
First, rewinding head to replay your work on top of it...
Applying: Modify A.
HEAD is now at d5ed5bb Modify A.
First, rewinding head to replay your work on top of it...
Applying: Modify A.
Switched to branch 'my-topic-branch'
Deleted branch torebase (was 80d1783).
ok 5 - rebase, with <onto> and <upstream> specified as :/quuxery
expecting success:
! (git log | grep "Author:" | grep "<>")
ok 6 - the rebase operation should not have destroyed author information
expecting success:
git log -1 |
grep 'Author: author@name <bogus@email@address>'
Author: author@name <bogus@email@address>
ok 7 - the rebase operation should not have destroyed author information (2)
expecting success:
test $(git rev-parse HEAD@{1}) != $(git rev-parse my-topic-branch@{1})
ok 8 - HEAD was detached during rebase
expecting success:
git checkout -b topic side &&
git rebase master
Switched to a new branch 'topic'
First, rewinding head to replay your work on top of it...
Applying: Add B.
Applying: Add C
ok 9 - rebase from ambiguous branch name
expecting success:
git checkout master &&
git checkout HEAD^ &&
git rebase @{-1} >expect.messages &&
git merge-base master HEAD >expect.forkpoint &&
git checkout master &&
git checkout HEAD^ &&
git rebase - >actual.messages &&
git merge-base master HEAD >actual.forkpoint &&
test_cmp expect.forkpoint actual.forkpoint &&
# the next one is dubious---we may want to say "-",
# instead of @{-1}, in the message
test_i18ncmp expect.messages actual.messages
Switched to branch 'master'
Note: checking out 'HEAD^'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at ee8d635... Add A.
Switched to branch 'master'
Note: checking out 'HEAD^'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at ee8d635... Add A.
ok 10 - rebase off of the previous branch using "-"
expecting success:
git checkout master &&
git branch -D topic &&
echo 1 >X &&
git add X &&
test_tick &&
git commit -m prepare &&
git checkout -b modechange HEAD^ &&
echo 1 >X &&
git add X &&
test_chmod +x A &&
test_tick &&
git commit -m modechange &&
GIT_TRACE=1 git rebase master
Switched to branch 'master'
Deleted branch topic (was 61d3d85).
[master a471efa] prepare
Author: author@name <bogus@email@address>
1 file changed, 1 insertion(+)
create mode 100644 X
Switched to a new branch 'modechange'
[modechange 3739958] modechange
Author: author@name <bogus@email@address>
2 files changed, 1 insertion(+)
mode change 100644 => 100755 A
create mode 100644 X
trace: exec: 'git-rebase' 'master'
trace: run_command: 'git-rebase' 'master'
trace: built-in: git 'rev-parse' '--parseopt' '--stuck-long' '--' 'master'
trace: built-in: git 'rev-parse' '--git-dir'
trace: built-in: git 'rev-parse' '--git-path' 'objects'
trace: built-in: git 'rev-parse' '--is-bare-repository'
trace: built-in: git 'rev-parse' '--show-toplevel'
trace: built-in: git 'config' '--bool' 'rebase.stat'
trace: built-in: git 'config' '--bool' 'rebase.autostash'
trace: built-in: git 'config' '--bool' 'rebase.autosquash'
trace: built-in: git 'rev-parse' '--verify' 'master^0'
trace: built-in: git 'rev-parse' '--verify' 'master^0'
trace: built-in: git 'symbolic-ref' '-q' 'HEAD'
trace: built-in: git 'rev-parse' '--verify' 'HEAD'
trace: built-in: git 'rev-parse' '--verify' 'HEAD'
trace: built-in: git 'update-index' '-q' '--ignore-submodules' '--refresh'
trace: built-in: git 'diff-files' '--quiet' '--ignore-submodules'
trace: built-in: git 'diff-index' '--cached' '--quiet' '--ignore-submodules' 'HEAD' '--'
trace: built-in: git 'merge-base' 'a471efa66f1d35b36f0792fdcd89f350907965b2' '373995810c1418ae1513fcb3b2cbf772bbab2197'
trace: built-in: git 'rev-parse' '--git-path' 'hooks/pre-rebase'
First, rewinding head to replay your work on top of it...
trace: built-in: git 'checkout' '-q' 'a471efa66f1d35b36f0792fdcd89f350907965b2^0'
trace: built-in: git 'update-ref' 'ORIG_HEAD' '373995810c1418ae1513fcb3b2cbf772bbab2197'
trace: built-in: git 'format-patch' '-k' '--stdout' '--full-index' '--cherry-pick' '--right-only' '--src-prefix=a/' '--dst-prefix=b/' '--no-renames' '--no-cover-letter' 'a471efa66f1d35b36f0792fdcd89f350907965b2...373995810c1418ae1513fcb3b2cbf772bbab2197'
trace: built-in: git 'am' '--rebasing' '--resolvemsg=
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
'
trace: run_command: 'mailsplit' '-d4' '-o.git/rebase-apply' '-b' '--'
trace: exec: 'git' 'mailsplit' '-d4' '-o.git/rebase-apply' '-b' '--'
trace: built-in: git 'mailsplit' '-d4' '-o.git/rebase-apply' '-b' '--'
trace: run_command: 'apply' '--index' '.git/rebase-apply/patch'
Applying: modechange
trace: run_command: 'apply' '--build-fake-ancestor=.git/rebase-apply/patch-merge-index' '.git/rebase-apply/patch'
trace: exec: 'git' 'apply' '--build-fake-ancestor=.git/rebase-apply/patch-merge-index' '.git/rebase-apply/patch'
trace: built-in: git 'apply' '--build-fake-ancestor=.git/rebase-apply/patch-merge-index' '.git/rebase-apply/patch'
trace: run_command: 'apply' '--cached' '.git/rebase-apply/patch'
Using index info to reconstruct a base tree...
trace: exec: 'git' 'apply' '--cached' '.git/rebase-apply/patch'
trace: built-in: git 'apply' '--cached' '.git/rebase-apply/patch'
trace: run_command: 'merge-recursive' '20d8b2c6c42a40f913517c72113d9d08e124064a' '--' 'a471efa66f1d35b36f0792fdcd89f350907965b2' '98edf5feecb5ba7d79dcc596fc10fd9f643b58d8'
Falling back to patching base and 3-way merge...
trace: exec: 'git' 'merge-recursive' '20d8b2c6c42a40f913517c72113d9d08e124064a' '--' 'a471efa66f1d35b36f0792fdcd89f350907965b2' '98edf5feecb5ba7d79dcc596fc10fd9f643b58d8'
trace: built-in: git 'merge-recursive' '20d8b2c6c42a40f913517c72113d9d08e124064a' '--' 'a471efa66f1d35b36f0792fdcd89f350907965b2' '98edf5feecb5ba7d79dcc596fc10fd9f643b58d8'
Merging a471efa66f1d35b36f0792fdcd89f350907965b2 with modechange
Merging:
a471efa prepare
virtual modechange
found 1 common ancestor:
virtual 20d8b2c6c42a40f913517c72113d9d08e124064a
trace: built-in: git 'rev-parse' 'HEAD'
trace: built-in: git 'update-ref' '-m' 'rebase finished: refs/heads/modechange onto a471efa66f1d35b36f0792fdcd89f350907965b2' 'refs/heads/modechange' '72b180eb670df8a40d4a62b7a0e029533e399a5d' '373995810c1418ae1513fcb3b2cbf772bbab2197'
trace: built-in: git 'symbolic-ref' '-m' 'rebase finished: returning to refs/heads/modechange' 'HEAD' 'refs/heads/modechange'
trace: built-in: git 'gc' '--auto'
ok 11 - rebase a single mode change
expecting success:
test_config diff.renames copies &&
git checkout filemove &&
GIT_TRACE=1 git rebase force-3way
Switched to branch 'filemove'
trace: exec: 'git-rebase' 'force-3way'
trace: run_command: 'git-rebase' 'force-3way'
trace: built-in: git 'rev-parse' '--parseopt' '--stuck-long' '--' 'force-3way'
trace: built-in: git 'rev-parse' '--git-dir'
trace: built-in: git 'rev-parse' '--git-path' 'objects'
trace: built-in: git 'rev-parse' '--is-bare-repository'
trace: built-in: git 'rev-parse' '--show-toplevel'
trace: built-in: git 'config' '--bool' 'rebase.stat'
trace: built-in: git 'config' '--bool' 'rebase.autostash'
trace: built-in: git 'config' '--bool' 'rebase.autosquash'
trace: built-in: git 'rev-parse' '--verify' 'force-3way^0'
trace: built-in: git 'rev-parse' '--verify' 'force-3way^0'
trace: built-in: git 'symbolic-ref' '-q' 'HEAD'
trace: built-in: git 'rev-parse' '--verify' 'HEAD'
trace: built-in: git 'rev-parse' '--verify' 'HEAD'
trace: built-in: git 'update-index' '-q' '--ignore-submodules' '--refresh'
trace: built-in: git 'diff-files' '--quiet' '--ignore-submodules'
trace: built-in: git 'diff-index' '--cached' '--quiet' '--ignore-submodules' 'HEAD' '--'
trace: built-in: git 'merge-base' '61ceff41f74a3a2e6c04295fe7d47a1036387e35' 'bea59d53da8a576bf33d77d758c8886123b9eb24'
trace: built-in: git 'rev-parse' '--git-path' 'hooks/pre-rebase'
First, rewinding head to replay your work on top of it...
trace: built-in: git 'checkout' '-q' '61ceff41f74a3a2e6c04295fe7d47a1036387e35^0'
trace: built-in: git 'update-ref' 'ORIG_HEAD' 'bea59d53da8a576bf33d77d758c8886123b9eb24'
trace: built-in: git 'format-patch' '-k' '--stdout' '--full-index' '--cherry-pick' '--right-only' '--src-prefix=a/' '--dst-prefix=b/' '--no-renames' '--no-cover-letter' '61ceff41f74a3a2e6c04295fe7d47a1036387e35...bea59d53da8a576bf33d77d758c8886123b9eb24'
trace: built-in: git 'am' '--rebasing' '--resolvemsg=
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
'
trace: run_command: 'mailsplit' '-d4' '-o.git/rebase-apply' '-b' '--'
trace: exec: 'git' 'mailsplit' '-d4' '-o.git/rebase-apply' '-b' '--'
trace: built-in: git 'mailsplit' '-d4' '-o.git/rebase-apply' '-b' '--'
trace: run_command: 'apply' '--index' '.git/rebase-apply/patch'
Applying: Move A.
trace: run_command: 'apply' '--build-fake-ancestor=.git/rebase-apply/patch-merge-index' '.git/rebase-apply/patch'
trace: exec: 'git' 'apply' '--build-fake-ancestor=.git/rebase-apply/patch-merge-index' '.git/rebase-apply/patch'
trace: built-in: git 'apply' '--build-fake-ancestor=.git/rebase-apply/patch-merge-index' '.git/rebase-apply/patch'
trace: run_command: 'apply' '--cached' '.git/rebase-apply/patch'
Using index info to reconstruct a base tree...
trace: exec: 'git' 'apply' '--cached' '.git/rebase-apply/patch'
trace: built-in: git 'apply' '--cached' '.git/rebase-apply/patch'
trace: run_command: 'merge-recursive' '26395c6fe842cd8894b5dde87a6fb53cccfabc06' '--' '61ceff41f74a3a2e6c04295fe7d47a1036387e35' '78e552a7b7a67f48f6849a9b83cf37e7f338dcf6'
Falling back to patching base and 3-way merge...
trace: exec: 'git' 'merge-recursive' '26395c6fe842cd8894b5dde87a6fb53cccfabc06' '--' '61ceff41f74a3a2e6c04295fe7d47a1036387e35' '78e552a7b7a67f48f6849a9b83cf37e7f338dcf6'
trace: built-in: git 'merge-recursive' '26395c6fe842cd8894b5dde87a6fb53cccfabc06' '--' '61ceff41f74a3a2e6c04295fe7d47a1036387e35' '78e552a7b7a67f48f6849a9b83cf37e7f338dcf6'
Merging 61ceff41f74a3a2e6c04295fe7d47a1036387e35 with Move A.
Merging:
61ceff4 Add Y.
virtual Move A.
found 1 common ancestor:
virtual 26395c6fe842cd8894b5dde87a6fb53cccfabc06
Skipped D/A (merged same as existing)
trace: built-in: git 'rev-parse' 'HEAD'
trace: built-in: git 'update-ref' '-m' 'rebase finished: refs/heads/filemove onto 61ceff41f74a3a2e6c04295fe7d47a1036387e35' 'refs/heads/filemove' 'c6025f5231b5124cedbc960336e2a36a9f4cccdb' 'bea59d53da8a576bf33d77d758c8886123b9eb24'
trace: built-in: git 'symbolic-ref' '-m' 'rebase finished: returning to refs/heads/filemove' 'HEAD' 'refs/heads/filemove'
trace: built-in: git 'gc' '--auto'
ok 12 - rebase is not broken by diff.renames
expecting success:
test_might_fail git rebase --abort &&
git reset --hard &&
git checkout modechange
No rebase in progress?
HEAD is now at c6025f5 Move A.
Switched to branch 'modechange'
ok 13 - setup: recover
expecting success:
>B &&
test_must_fail git rebase topic 2>output.err >output.out &&
grep "The following untracked working tree files would be overwritten by checkout:" output.err &&
grep B output.err
error: The following untracked working tree files would be overwritten by checkout:
B
ok 14 - Show verbose error when HEAD could not be detached
expecting success:
git checkout topic &&
test_must_fail git rebase
Note: checking out 'topic'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 01c87ac... Add B.
You are not currently on a branch. Please specify which
branch you want to rebase against. See git-rebase(1) for details.
git rebase <branch>
ok 15 - fail when upstream arg is missing and not on branch
expecting success:
git checkout -b no-config topic &&
test_must_fail git rebase
Switched to a new branch 'no-config'
There is no tracking information for the current branch.
Please specify which branch you want to rebase against.
See git-rebase(1) for details
git rebase <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=<remote>/<branch> no-config
ok 16 - fail when upstream arg is missing and not configured
expecting success:
git checkout -b default-base master &&
git checkout -b default topic &&
git config branch.default.remote . &&
git config branch.default.merge refs/heads/default-base &&
git rebase &&
git rev-parse --verify default-base >expect &&
git rev-parse default~1 >actual &&
test_cmp expect actual &&
git checkout default-base &&
git reset --hard HEAD^ &&
git checkout default &&
git rebase &&
git rev-parse --verify default-base >expect &&
git rev-parse default~1 >actual &&
test_cmp expect actual
Switched to a new branch 'default-base'
Switched to a new branch 'default'
First, rewinding head to replay your work on top of it...
Applying: Add B.
Switched to branch 'default-base'
HEAD is now at d5ed5bb Modify A.
Switched to branch 'default'
Your branch is ahead of 'default-base' by 2 commits.
(use "git push" to publish your local commits)
First, rewinding head to replay your work on top of it...
Applying: Add B.
ok 17 - default to common base in @{upstream}s reflog if no upstream arg
expecting success:
git checkout default-base &&
echo Amended >A &&
git commit -a --no-edit --amend &&
test_commit B B &&
test_commit new_B B "New B" &&
test_commit C C &&
git checkout default &&
git reset --hard default-base@{4} &&
test_commit D D &&
git cherry-pick -2 default-base^ &&
test_commit final_B B "Final B" &&
git rebase &&
echo Amended >expect &&
test_cmp A expect &&
echo "Final B" >expect &&
test_cmp B expect &&
echo C >expect &&
test_cmp C expect &&
echo D >expect &&
test_cmp D expect
Switched to branch 'default-base'
[default-base d1e774a] Modify A.
Author: author@name <bogus@email@address>
Date: Thu Dec 10 22:55:13 2015 +0000
1 file changed, 1 insertion(+), 1 deletion(-)
[default-base 086e0a6] B
Author: author@name <bogus@email@address>
1 file changed, 1 insertion(+)
create mode 100644 B
[default-base be76a4d] new_B
Author: author@name <bogus@email@address>
1 file changed, 1 insertion(+), 1 deletion(-)
[default-base a8ef469] C
Author: author@name <bogus@email@address>
1 file changed, 1 insertion(+)
create mode 100644 C
Switched to branch 'default'
Your branch and 'default-base' have diverged,
and have 2 and 4 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
HEAD is now at d5ed5bb Modify A.
[default 7174f0f] D
Author: author@name <bogus@email@address>
1 file changed, 1 insertion(+)
create mode 100644 D
[default cfa2648] B
Author: author@name <bogus@email@address>
Date: Thu Apr 7 15:15:13 2005 -0700
1 file changed, 1 insertion(+)
create mode 100644 B
[default 67b7994] new_B
Author: author@name <bogus@email@address>
Date: Thu Apr 7 15:16:13 2005 -0700
1 file changed, 1 insertion(+), 1 deletion(-)
[default 0bb0333] final_B
Author: author@name <bogus@email@address>
1 file changed, 1 insertion(+), 1 deletion(-)
First, rewinding head to replay your work on top of it...
Applying: D
Applying: final_B
ok 18 - cherry-picked commits and fork-point work together
expecting success:
git checkout -b quiet topic &&
git rebase -q master >output.out 2>&1 &&
test_must_be_empty output.out
Switched to a new branch 'quiet'
ok 19 - rebase -q is quiet
expecting success:
(
echo "One"
echo "TwoQ"
echo "Three"
echo "FQur"
echo "Five"
) | q_to_cr >CR &&
git add CR &&
test_tick &&
git commit -a -m "A file with a line with CR" &&
git tag file-with-cr &&
git checkout HEAD^0 &&
git rebase --onto HEAD^^ HEAD^ &&
git diff --exit-code file-with-cr:CR HEAD:CR
[quiet c4245b1] A file with a line with CR
Author: author@name <bogus@email@address>
1 file changed, 5 insertions(+)
create mode 100644 CR
Note: checking out 'HEAD^0'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at c4245b1... A file with a line with CR
First, rewinding head to replay your work on top of it...
Applying: A file with a line with CR
ok 20 - Rebase a commit that sprinkles CRs in
expecting success:
git config notes.rewrite.rebase true &&
git config notes.rewriteRef "refs/notes/*" &&
test_commit n1 &&
test_commit n2 &&
test_commit n3 &&
git notes add -m"a note" n3 &&
git rebase --onto n1 n2 &&
test "a note" = "$(git notes show HEAD)"
[detached HEAD 1cc6b4a] n1
Author: author@name <bogus@email@address>
1 file changed, 1 insertion(+)
create mode 100644 n1.t
[detached HEAD bd3cdb1] n2
Author: author@name <bogus@email@address>
1 file changed, 1 insertion(+)
create mode 100644 n2.t
[detached HEAD 88db5b7] n3
Author: author@name <bogus@email@address>
1 file changed, 1 insertion(+)
create mode 100644 n3.t
First, rewinding head to replay your work on top of it...
Applying: n3
ok 21 - rebase can copy notes
expecting success:
git reset --hard n3 &&
git rebase -m --onto n1 n2 &&
test "a note" = "$(git notes show HEAD)"
HEAD is now at 88db5b7 n3
First, rewinding head to replay your work on top of it...
Merging n1 with HEAD~0
Merging:
1cc6b4a n1
88db5b7 n3
found 1 common ancestor:
bd3cdb1 n2
[detached HEAD 10d35b2] n3
Author: author@name <bogus@email@address>
Date: Thu Apr 7 15:23:13 2005 -0700
1 file changed, 1 insertion(+)
create mode 100644 n3.t
Committed: 0001 n3
All done.
ok 22 - rebase -m can copy notes
expecting success:
git reset --hard &&
>old.one && git add old.one && test_tick &&
git commit --date="@12345 +0400" -m "Old one" &&
>old.two && git add old.two && test_tick &&
git commit --date="@23456 +0500" -m "Old two" &&
>old.three && git add old.three && test_tick &&
git commit --date="@34567 +0600" -m "Old three" &&
git cat-file commit HEAD^^ >actual &&
grep "author .* 12345 +0400$" actual &&
git cat-file commit HEAD^ >actual &&
grep "author .* 23456 +0500$" actual &&
git cat-file commit HEAD >actual &&
grep "author .* 34567 +0600$" actual &&
git rebase --onto HEAD^^ HEAD^ &&
git cat-file commit HEAD >actual &&
grep "author .* 34567 +0600$" actual
HEAD is now at 10d35b2 n3
[detached HEAD b2ee2be] Old one
Author: author@name <bogus@email@address>
Date: Thu Jan 1 07:25:45 1970 +0400
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 old.one
[detached HEAD 9dddc9c] Old two
Author: author@name <bogus@email@address>
Date: Thu Jan 1 11:30:56 1970 +0500
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 old.two
[detached HEAD ec5e0f8] Old three
Author: author@name <bogus@email@address>
Date: Thu Jan 1 15:36:07 1970 +0600
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 old.three
author author@name <bogus@email@address> 12345 +0400
author author@name <bogus@email@address> 23456 +0500
author author@name <bogus@email@address> 34567 +0600
First, rewinding head to replay your work on top of it...
Applying: Old three
author author@name <bogus@email@address> 34567 +0600
ok 23 - rebase commit with an ancient timestamp
expecting success:
git reset --hard &&
git checkout master &&
>x && git add x && git commit x -mx &&
echo x >x && git commit x -mx1 &&
git checkout -b duplicated HEAD~ &&
echo x >x && git commit x -mx2 &&
git rebase --keep-empty master
HEAD is now at e197047 Old three
Warning: you are leaving 3 commits behind, not connected to
any of your branches:
e197047 Old three
b2ee2be Old one
10d35b2 n3
If you want to keep them by creating a new branch, this may be a good time
to do so with:
git branch <new-branch-name> e197047
Switched to branch 'master'
error: pathspec 'x' did not match any file(s) known to git.
not ok 24 - rebase duplicated commit with --keep-empty
#
# git reset --hard &&
# git checkout master &&
#
# >x && git add x && git commit x -mx &&
# echo x >x && git commit x -mx1 &&
#
# git checkout -b duplicated HEAD~ &&
# echo x >x && git commit x -mx2 &&
# git rebase --keep-empty master
#
checking known breakage:
git reset --hard &&
git checkout master &&
echo y >x && git commit x -my &&
git checkout -b conflict HEAD~ &&
echo z >x && git commit x -mz &&
test_must_fail git rebase --keep-empty master &&
git add x &&
git rebase --continue
HEAD is now at a471efa prepare
Already on 'master'
error: pathspec 'x' did not match any file(s) known to git.
not ok 25 - rebase conflicting commit with --keep-empty # TODO known breakage
# still have 1 known breakage(s)
# failed 1 among remaining 24 test(s)
1..25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment