-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from pfnet-research/set-dummy-user-for-pull
Set dummy user if not available
- Loading branch information
Showing
3 changed files
with
57 additions
and
12 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -24,6 +24,11 @@ import ( | |
log "github.com/Sirupsen/logrus" | ||
) | ||
|
||
const ( | ||
defaultGhostUserName = "Git Ghost" | ||
defaultGhostUserEmail = "[email protected]" | ||
) | ||
|
||
// WorkingEnvSpec abstract an environment git-ghost works with | ||
type WorkingEnvSpec struct { | ||
// SrcDir is local git directory | ||
|
@@ -32,6 +37,10 @@ type WorkingEnvSpec struct { | |
GhostWorkingDir string | ||
// GhostRepo is a repository url git-ghost works with | ||
GhostRepo string | ||
// GhostUserName is a user name which is used in ghost working directories. | ||
GhostUserName string | ||
// GhostUserEmail is a user email which is used in ghost working directories. | ||
GhostUserEmail string | ||
} | ||
|
||
// WorkingEnv is initialized environment containing temporary local ghost repository | ||
|
@@ -49,7 +58,15 @@ func (weSpec WorkingEnvSpec) Initialize() (*WorkingEnv, errors.GitGhostError) { | |
if ggerr != nil { | ||
return nil, ggerr | ||
} | ||
ggerr = git.CopyUserConfig(weSpec.SrcDir, ghostDir) | ||
ghostUserName := defaultGhostUserName | ||
if weSpec.GhostUserName != "" { | ||
ghostUserName = weSpec.GhostUserName | ||
} | ||
ghostUserEmail := defaultGhostUserEmail | ||
if weSpec.GhostUserEmail != "" { | ||
ghostUserEmail = weSpec.GhostUserEmail | ||
} | ||
ggerr = git.SetUserConfig(ghostDir, ghostUserName, ghostUserEmail) | ||
if ggerr != nil { | ||
return nil, ggerr | ||
} | ||
|