Skip to content

Commit f7cf4cb

Browse files
committed
Do not set user config on error
1 parent e4537b1 commit f7cf4cb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cmd/root.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ func (gf globalFlags) WorkingEnvSpec() types.WorkingEnvSpec {
4141
GhostRepo: gf.ghostRepo,
4242
}
4343
userName, userEmail, err := git.GetUserConfig(globalOpts.srcDir)
44-
if err != nil {
44+
if err == nil {
45+
workingEnvSpec.GhostUserName = userName
46+
workingEnvSpec.GhostUserEmail = userEmail
47+
} else {
4548
log.Debug("failed to get user name and email of the source directory")
4649
}
47-
workingEnvSpec.GhostUserName = userName
48-
workingEnvSpec.GhostUserEmail = userEmail
4950
return workingEnvSpec
5051
}
5152

0 commit comments

Comments
 (0)