-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add e2e test for nested splitting commits
- Loading branch information
Showing
1 changed file
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
# Evolve resolves commit graph after splitting commits | ||
# ===================================================== | ||
|
||
# --- SETUP --- | ||
|
||
# Add directory with `git` executable to PATH | ||
env PATH=$PATH${:}/usr/bin/ | ||
|
||
# Specify commit timestamp so commit hashes are fixed. | ||
env GIT_COMMITTER_DATE='01 Jan 2023 00:00:00 UTC' | ||
|
||
# Specify the test interactive sequence editor program (used in `git rebase -i`). | ||
env GIT_SEQUENCE_EDITOR='seq_editor' | ||
|
||
# The test interactive editor should paste the instructions in `SEQ_EDITOR_INPUT` | ||
# into Git's instruction sheet. | ||
env SEQ_EDITOR_INPUT='.git/tree/rebase-instructs' | ||
|
||
# Setup the Git repository | ||
exec git init | ||
exec git config user.email "[email protected]" | ||
exec git config user.name "Test" | ||
exec write_file README.txt readme | ||
exec git add . | ||
exec git commit -m 'initial commit' --date $GIT_COMMITTER_DATE | ||
|
||
# BUG: This commit is needed to prevent a nil pointer dereference (getting the | ||
# parent of an initial commit). Fix the algorithm and remove this extra commit. | ||
exec write_file dummy.txt dummy | ||
exec git add . | ||
exec git commit -m 'Add dummy.txt' --date $GIT_COMMITTER_DATE | ||
|
||
|
||
# Initial: | ||
# | ||
# [master] ─── (treecko) ─── [sceptile] ─┬─ [turtwig] | ||
# ├─ [chimchar] | ||
# └─ [piplup] | ||
# | ||
# Action: | ||
# - Split [sceptile] into more commits | ||
# | ||
# Result: | ||
# | ||
# [master] ─── (treecko) ─── (grovyle) ─── [sceptile] ─┬─ [turtwig] | ||
# ├─ [chimchar] | ||
# └─ [piplup] | ||
|
||
# Add commits to sceptile branch | ||
exec git checkout -b sceptile | ||
|
||
exec write_file treecko.txt treecko | ||
exec git add . | ||
exec git commit -m 'Add treecko.txt' --date $GIT_COMMITTER_DATE | ||
|
||
exec write_file sceptile.txt sceptile | ||
exec git add . | ||
exec git commit -m 'Add sceptile.txt' --date $GIT_COMMITTER_DATE | ||
|
||
|
||
# Add commits to turtwig branch | ||
exec git checkout -b turtwig | ||
|
||
exec write_file turtwig.txt turtwig | ||
exec git add . | ||
exec git commit -m 'Add turtwig.txt' --date $GIT_COMMITTER_DATE | ||
|
||
|
||
# Add commits to chimchar branch | ||
exec git checkout sceptile | ||
exec git checkout -b chimchar | ||
|
||
exec write_file chimchar.txt chimchar | ||
exec git add . | ||
exec git commit -m 'Add chimchar.txt' --date $GIT_COMMITTER_DATE | ||
|
||
|
||
# Add commits to piplup branch | ||
exec git checkout sceptile | ||
exec git checkout -b piplup | ||
|
||
exec write_file piplup.txt piplup | ||
exec git add . | ||
exec git commit -m 'Add piplup.txt' --date $GIT_COMMITTER_DATE | ||
|
||
|
||
# Initialize git-tree | ||
exec git-tree init | ||
|
||
# Split the commits in the graph. | ||
exec git checkout sceptile | ||
exec git rebase -i HEAD~2 | ||
|
||
# Add the new commits. | ||
exec write_file grovyle.txt grovyle | ||
exec git add . | ||
exec git commit -m 'Add grovyle.txt' --date $GIT_COMMITTER_DATE | ||
|
||
# Continue the rebase. | ||
exec git rebase --continue | ||
|
||
|
||
# --- TEST --- | ||
|
||
# Run evolve | ||
exec git-tree evolve | ||
|
||
# BUG: The old commit still exists in the repository, since it's pointed to by | ||
# branch `git-tree-root`. Fix `git-tree-root` target instead of dropping git-tree. | ||
exec git-tree drop | ||
|
||
# Compare the git log | ||
exec git log --oneline --graph --all --decorate | ||
cp stdout .git/actual-log | ||
exec compare .git/actual-log .git/golden-log | ||
|
||
|
||
-- .git/tree/rebase-instructs -- | ||
edit 68f0d35 Add treecko.txt | ||
pick 46904f9 Add sceptile.txt | ||
-- .git/golden-log -- | ||
* 2387908 (chimchar) Add chimchar.txt | ||
| * 63c6bf9 (piplup) Add piplup.txt | ||
|/ | ||
| * 68f964b (turtwig) Add turtwig.txt | ||
|/ | ||
* 689eb6b (HEAD -> sceptile) Add sceptile.txt | ||
* 64f5fcb Add grovyle.txt | ||
* 68f0d35 Add treecko.txt | ||
* a7c56ea (master) Add dummy.txt | ||
* cbfe4ef initial commit |