Skip to content

Commit

Permalink
Jump to last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
fpellet committed Sep 17, 2023
1 parent 66e485f commit 52dc830
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
9 changes: 9 additions & 0 deletions run
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ function clean() {
git branch -D $testBranch > /dev/null 2>&1
git branch -D $solutionBranch > /dev/null 2>&1
git branch -D $workshopBranch > /dev/null 2>&1
git branch -D "${workshopBranch}-end" > /dev/null 2>&1

git branch | grep -e '^\s*workshop-step[0-9]$' | xargs git branch -D > /dev/null 2>&1
git tag --list | grep -e '^step[0-9]$' | xargs git tag -d > /dev/null 2>&1
Expand Down Expand Up @@ -198,6 +199,10 @@ function addEndStepNavigationCommand(){
cat << EOF > ./jumpToNextStep
#!/bin/bash
git add -A
git commit -m "Abort test"
git checkout -b ${workshopBranch}-end ${solutionBranch}
printf '$MessageColor'
echo ""
echo ""
Expand Down Expand Up @@ -309,6 +314,10 @@ function addEndNavigationCommand(){
cat << EOF > ./next
#!/bin/bash
git add -A
git commit -m "Resolve test"
git merge --no-edit $testBranch
printf '$MessageColor'
echo ""
echo ""
Expand Down
14 changes: 12 additions & 2 deletions run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ Write-Host ""
Write-Host ""
"@

$jumpToEndStepCommandTemplate = @"
git add -A
git commit -m "Abort test"
git checkout -b $workshopBranch-end $solutionBranch
"@

$displayEndMessageTemplate = @"
Write-Host ""
Write-Host ""
Expand Down Expand Up @@ -136,6 +142,7 @@ function clean(){
git branch -D $testBranch *> $null
git branch -D $solutionBranch *> $null
git branch -D $workshopBranch *> $null
git branch -D ($workshopBranch + "-end") *> $null
generateTags | %{ git branch -D ($workshopBranch + "-" + $_) } *> $null
generateTags | %{ git tag -d $_ } *> $null
}
Expand All @@ -159,7 +166,9 @@ function addStepNavigationCommand($nextStepTag, $nextStepNum){
}

function addEndStepNavigationCommand(){
$displayEndMessageTemplate | out-file 'jumpToNextStep.ps1' -enc ascii
$nextCommandContent = $jumpToEndStepCommandTemplate + "`r`n" + $displayEndMessageTemplate

$nextCommandContent | out-file 'jumpToNextStep.ps1' -enc ascii
git add jumpToNextStep.ps1 > $null

git commit -m "Add end step navigation commands" > $null
Expand Down Expand Up @@ -234,7 +243,8 @@ function addNavigationCommand($nextTestTag, $nextTestNum, $currentStepNum){
}

function addEndNavigationCommand(){
$displayEndMessageTemplate | out-file 'next.ps1' -enc ascii
$nextCommandContent = $nextCommandTemplate.Replace("@@nexttag@@", $testBranch) + "`r`n" + $displayEndMessageTemplate
$nextCommandContent | out-file 'next.ps1' -enc ascii
git add next.ps1 > $null

git commit -m "Add end test navigation commands" > $null
Expand Down

0 comments on commit 52dc830

Please sign in to comment.