-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Hi,
The unit test t/01-repo.t calls
$config -> str('init.defaultBranch', 'main');
which has the side-affect of updating the user's .gitconfig file.
The can be rectified by using the default value which has already been determined in the current code to restore the original value - or absence:
my $config = Git::Raw::Config -> default();
my $default = $config -> str('init.defaultBranch');
$config -> str('init.defaultBranch', 'main');
my $repo = Git::Raw::Repository -> init($native_path, 0);
if (defined $default) # <-- additional code from here to restore original setting
{
$config->str('init.defaultbranch', $default);
}
else
{
$config->delete('init.defaultbranch');
}
Even better would be to extend Git::Raw::Repository -> init to more fully emulate the git init command with support for the --initial-branch=<branch-name> option.
thanks
Metadata
Metadata
Assignees
Labels
No labels