-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split out test git user configuration
- Loading branch information
Showing
1 changed file
with
18 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,9 @@ else { | |
plan skip_all => 'Can not find git command'; | ||
} | ||
|
||
my $git_user_name = 'Rex'; | ||
my $git_user_email = '[email protected]'; | ||
|
||
my $git_environment = { | ||
GIT_CONFIG_GLOBAL => File::Spec->devnull(), | ||
GIT_CONFIG_SYSTEM => File::Spec->devnull(), | ||
|
@@ -83,10 +86,7 @@ sub prepare_test_repo { | |
|
||
i_run 'git init', cwd => $directory, env => $git_environment; | ||
|
||
i_run 'git config user.name Rex', cwd => $directory, env => $git_environment; | ||
i_run 'git config user.email [email protected]', | ||
cwd => $directory, | ||
env => $git_environment; | ||
configure_git_user($directory); | ||
|
||
i_run 'git commit --allow-empty -m commit', | ||
cwd => $directory, | ||
|
@@ -112,6 +112,20 @@ sub git_repo_ok { | |
return; | ||
} | ||
|
||
sub configure_git_user { | ||
my $directory = shift; | ||
|
||
i_run "git config user.name $git_user_name", | ||
cwd => $directory, | ||
env => $git_environment; | ||
|
||
i_run "git config user.email $git_user_email", | ||
cwd => $directory, | ||
env => $git_environment; | ||
|
||
return; | ||
} | ||
|
||
sub init_test { | ||
my $clone_target_dir = tempdir( CLEANUP => 1 ); | ||
|
||
|