diff --git a/cypress/integration/rendering/gitGraph.spec.js b/cypress/integration/rendering/gitGraph.spec.js index 9f040a36f0..2aab34c343 100644 --- a/cypress/integration/rendering/gitGraph.spec.js +++ b/cypress/integration/rendering/gitGraph.spec.js @@ -701,4 +701,114 @@ gitGraph TB: {} ); }); + it('34: should render a simple gitgraph with two branches from same commit', () => { + imgSnapshotTest( + `gitGraph + commit id:"1-abcdefg" + commit id:"2-abcdefg" + branch feature-001 + commit id:"3-abcdefg" + commit id:"4-abcdefg" + checkout main + branch feature-002 + commit id:"5-abcdefg" + checkout feature-001 + merge feature-002 + `, + {} + ); + }); + it('35: should render a simple gitgraph with two branches from same commit | Vertical Branch', () => { + imgSnapshotTest( + `gitGraph TB: + commit id:"1-abcdefg" + commit id:"2-abcdefg" + branch feature-001 + commit id:"3-abcdefg" + commit id:"4-abcdefg" + checkout main + branch feature-002 + commit id:"5-abcdefg" + checkout feature-001 + merge feature-002 + `, + {} + ); + }); + it('36: should render GitGraph with branch that is not used immediately', () => { + imgSnapshotTest( + `gitGraph LR: + commit id:"1-abcdefg" + branch x + checkout main + commit id:"2-abcdefg" + checkout x + commit id:"3-abcdefg" + checkout main + merge x + `, + {} + ); + }); + it('37: should render GitGraph with branch that is not used immediately | Vertical Branch', () => { + imgSnapshotTest( + `gitGraph TB: + commit id:"1-abcdefg" + branch x + checkout main + commit id:"2-abcdefg" + checkout x + commit id:"3-abcdefg" + checkout main + merge x + `, + {} + ); + }); + it('38: should render GitGraph with branch and sub-branch neither of which used immediately', () => { + imgSnapshotTest( + `gitGraph LR: + commit id:"1-abcdefg" + branch x + checkout main + commit id:"2-abcdefg" + checkout x + commit id:"3-abcdefg" + checkout main + merge x + checkout x + branch y + checkout x + commit id:"4-abcdefg" + checkout y + commit id:"5-abcdefg" + checkout x + merge y + `, + {} + ); + }); + it('39: should render GitGraph with branch and sub-branch neither of which used immediately | Vertical Branch', () => { + imgSnapshotTest( + `gitGraph TB: + commit id:"1-abcdefg" + branch x + checkout main + commit id:"2-abcdefg" + checkout x + commit id:"3-abcdefg" + checkout main + merge x + checkout x + branch y + checkout x + commit id:"4-abcdefg" + checkout y + commit id:"5-abcdefg" + checkout x + merge y + `, + {} + ); + }); }); diff --git a/demos/git.html b/demos/git.html index f24217711e..92e0e68635 100644 --- a/demos/git.html +++ b/demos/git.html @@ -14,30 +14,364 @@
---- - title: Simple Git diagram + title: Simple "branch and merge" (left-to-right) --- - gitGraph: - options - { - "nodeSpacing": 50, - "nodeRadius": 5 - } - end - branch master + gitGraph LR: commit branch newbranch checkout newbranch commit + checkout main + merge newbranch ++
+ --- + title: Simple "branch and merge" (top-to-bottom) + --- + gitGraph TB: + commit + branch newbranch + checkout newbranch + commit + checkout main + merge newbranch ++
+ --- + title: Continuous development (left-to-right) + --- + gitGraph LR: commit - checkout master + branch develop + checkout develop commit + checkout main + merge develop + checkout develop + commit + checkout main + merge develop ++
+ --- + title: Continuous development (top-to-bottom) + --- + gitGraph TB: + commit + branch develop + checkout develop + commit + checkout main + merge develop + checkout develop + commit + checkout main + merge develop ++
+ --- + title: Merge feature to advanced main (left-to-right) + --- + gitGraph LR: + commit + branch newbranch + checkout newbranch + commit + checkout main commit merge newbranch- +
+ --- + title: Merge feature to advanced main (top-to-bottom) + --- + gitGraph TB: + commit + branch newbranch + checkout newbranch + commit + checkout main + commit + merge newbranch ++
+ --- + title: Two-way merges (left-to-right) + --- + gitGraph LR: + commit + branch develop + checkout develop + commit + checkout main + merge develop + commit + checkout develop + merge main + commit + checkout main + merge develop ++
+ --- + title: Two-way merges (top-to-bottom) + --- + gitGraph TB: + commit + branch develop + checkout develop + commit + checkout main + merge develop + commit + checkout develop + merge main + commit + checkout main + merge develop ++
+ --- + title: Cherry-pick from branch (left-to-right) + --- + gitGraph LR: + commit + branch newbranch + checkout newbranch + commit id: "Pick me" + checkout main + commit + checkout newbranch + commit + checkout main + cherry-pick id: "Pick me" ++
+ --- + title: Cherry-pick from branch (top-to-bottom) + --- + gitGraph TB: + commit + branch newbranch + checkout newbranch + commit id: "Pick me" + checkout main + commit + checkout newbranch + commit + checkout main + cherry-pick id: "Pick me" ++
+ --- + title: Cherry-pick from main (left-to-right) + --- + gitGraph LR: + commit + branch develop + commit + checkout main + commit id:"A" + checkout develop + commit + cherry-pick id: "A" ++
+ --- + title: Cherry-pick from main (top-to-bottom) + --- + gitGraph TB: + commit + branch develop + commit + checkout main + commit id:"A" + checkout develop + commit + cherry-pick id: "A" ++
+ --- + title: Cherry-pick then merge (left-to-right) + --- + gitGraph LR: + commit + branch newbranch + checkout newbranch + commit id: "Pick me" + checkout main + commit + checkout newbranch + commit + checkout main + cherry-pick id: "Pick me" + merge newbranch ++
+ --- + title: Cherry-pick then merge (top-to-bottom) + --- + gitGraph TB: + commit + branch newbranch + checkout newbranch + commit id: "Pick me" + checkout main + commit + checkout newbranch + commit + checkout main + cherry-pick id: "Pick me" + merge newbranch ++
+ --- + title: Merge from main onto undeveloped branch (left-to-right) + --- + gitGraph LR: + commit + branch develop + commit + checkout main + commit + checkout develop + merge main ++
+ --- + title: Merge from main onto undeveloped branch (top-to-bottom) + --- + gitGraph TB: + commit + branch develop + commit + checkout main + commit + checkout develop + merge main ++
+ --- + title: Merge from main onto developed branch (left-to-right) + --- + gitGraph LR: + commit + branch develop + commit + checkout main + commit + checkout develop + commit + merge main ++
+ --- + title: Merge from main onto developed branch (top-to-bottom) + --- + gitGraph TB: + commit + branch develop + commit + checkout main + commit + checkout develop + commit + merge main ++
+ --- + title: Two branches from same commit (left-to-right) + --- + gitGraph LR: + commit + commit + branch feature-001 + commit + commit + checkout main + branch feature-002 + commit + checkout feature-001 + merge feature-002 ++
+ --- + title: Two branches from same commit (top-to-bottom) + --- + gitGraph TB: + commit + commit + branch feature-001 + commit + commit + checkout main + branch feature-002 + commit + checkout feature-001 + merge feature-002 ++
+ --- + title: Three branches and a cherry-pick from each (left-to-right) + --- + gitGraph LR: + commit id: "ZERO" + branch develop + commit id:"A" + checkout main + commit id:"ONE" + checkout develop + commit id:"B" + branch featureA + commit id:"FIX" + commit id: "FIX-2" + checkout main + commit id:"TWO" + cherry-pick id:"A" + commit id:"THREE" + cherry-pick id:"FIX" + checkout develop + commit id:"C" + merge featureA ++
+ --- + title: Three branches and a cherry-pick from each (top-to-bottom) + --- + gitGraph TB: + commit id: "ZERO" + branch develop + commit id:"A" + checkout main + commit id:"ONE" + checkout develop + commit id:"B" + branch featureA + commit id:"FIX" + commit id: "FIX-2" + checkout main + commit id:"TWO" + cherry-pick id:"A" + commit id:"THREE" + cherry-pick id:"FIX" + checkout develop + commit id:"C" + merge featureA +