forked from git-town/git-town
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git sync: dry-run flag (git-town#1015)
- Loading branch information
1 parent
5484ed7
commit c8595b3
Showing
7 changed files
with
97 additions
and
1 deletion.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
features/git-town-sync/current_branch/feature_branch/no_conflict/dry_run.feature
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,40 @@ | ||
Feature: git-town sync: syncing the current feature branch with a tracking branch with dry run | ||
|
||
As a developer wanting to test out syncing a feature branch | ||
I want a dry run flag that doesn't run any commands | ||
So that I can be confident in what the tool does before I use it | ||
|
||
|
||
Background: | ||
Given I have a feature branch named "feature" | ||
And the following commits exist in my repository | ||
| BRANCH | LOCATION | MESSAGE | FILE NAME | | ||
| main | local | local main commit | local_main_file | | ||
| | remote | remote main commit | remote_main_file | | ||
| feature | local | local feature commit | local_feature_file | | ||
| | remote | remote feature commit | remote_feature_file | | ||
And I am on the "feature" branch | ||
And I have an uncommitted file | ||
When I run `git-town sync --dry-run` | ||
|
||
|
||
Scenario: result | ||
Then it runs the commands | ||
| BRANCH | COMMAND | | ||
| feature | git fetch --prune | | ||
| | git add -A | | ||
| | git stash | | ||
| | git checkout main | | ||
| main | git rebase origin/main | | ||
| | git push | | ||
| | git checkout feature | | ||
| feature | git merge --no-edit origin/feature | | ||
| | git merge --no-edit main | | ||
| | git push | | ||
| | git stash pop | | ||
And I am still on the "feature" branch | ||
And I still have my uncommitted file | ||
And I have the following commits | ||
| BRANCH | LOCATION | MESSAGE | FILE NAME | | ||
| main | local | local main commit | local_main_file | | ||
| feature | local | local feature commit | local_feature_file | |
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
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
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,25 @@ | ||
package dryrun | ||
|
||
var currentBranchName = "" | ||
var isActive = false | ||
|
||
// Activate enables dry-run mode | ||
func Activate(initialBranchName string) { | ||
isActive = true | ||
SetCurrentBranchName(initialBranchName) | ||
} | ||
|
||
// IsActive returns whether of not dry-run mode is active | ||
func IsActive() bool { | ||
return isActive | ||
} | ||
|
||
// GetCurrentBranchName returns the current branch name for dry-run mode | ||
func GetCurrentBranchName() string { | ||
return currentBranchName | ||
} | ||
|
||
// SetCurrentBranchName sets the current branch name for dry-run mode | ||
func SetCurrentBranchName(branchName string) { | ||
currentBranchName = branchName | ||
} |
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
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
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