repo sync: clearer error message with actionable hint (#7110)
Co-authored-by: Mislav Marohnić <mislav@github.com>
This commit is contained in:
parent
1f0e53319e
commit
3b23978114
2 changed files with 2 additions and 2 deletions
|
|
@ -256,7 +256,7 @@ func executeLocalRepoSync(srcRepo ghrepo.Interface, remote string, opts *SyncOpt
|
|||
}
|
||||
if currentBranch == branch {
|
||||
if isDirty, err := git.IsDirty(); err == nil && isDirty {
|
||||
return fmt.Errorf("can't sync because there are local changes; please stash them before trying again")
|
||||
return fmt.Errorf("refusing to sync due to uncommitted/untracked local changes\ntip: use `git stash --all` before retrying the sync and run `git stash pop` afterwards")
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ func Test_SyncRun(t *testing.T) {
|
|||
mgc.On("IsDirty").Return(true, nil).Once()
|
||||
},
|
||||
wantErr: true,
|
||||
errMsg: "can't sync because there are local changes; please stash them before trying again",
|
||||
errMsg: "refusing to sync due to uncommitted/untracked local changes\ntip: use `git stash --all` before retrying the sync and run `git stash pop` afterwards",
|
||||
},
|
||||
{
|
||||
name: "sync local repo with parent - existing branch, non-current",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue