Further tweaks to gitosis conf rebuild script
- Pull need SSH key as well - Repository names are ensured to be lower case - Use verbose name for commti author
This commit is contained in:
@@ -98,7 +98,7 @@ function handleSingleRepository(
|
||||
$values = array();
|
||||
$values['members'] = join(' ', $members);
|
||||
$values['readonly'] = '@all';
|
||||
$values['writable'] = $repository->getName();
|
||||
$values['writable'] = strtolower($repository->getName());
|
||||
$new_configuration["group $group_name"] = $values;
|
||||
}
|
||||
}
|
||||
@@ -189,11 +189,11 @@ function runGitSshCommand($repository, $key, $need_workdir, $arguments,
|
||||
return $return_var == 0;
|
||||
}
|
||||
|
||||
function repositoryPull($repository) {
|
||||
return runGitCommand($repository, false, 'pull');
|
||||
function repositoryPull($repository, $key) {
|
||||
return runGitSshCommand($repository, $key, false, 'pull');
|
||||
}
|
||||
|
||||
function repositoryCommitAll($repository, $message) {
|
||||
function repositoryCommitAll($repository, $author, $message) {
|
||||
if (!runGitCommand(
|
||||
$repository, true,
|
||||
'ls-files --other --exclude-standard', $untracked_files)) {
|
||||
@@ -208,7 +208,8 @@ function repositoryCommitAll($repository, $message) {
|
||||
runGitCommand($repository, true, "update-index -q --refresh", $output);
|
||||
runGitCommand($repository, true, "diff-index --name-only HEAD --", $output);
|
||||
if (count($output)) {
|
||||
return runGitCommand($repository, true, "commit -a -m '$message'", $output);
|
||||
return runGitCommand(
|
||||
$repository, true, "commit --author='$author' -a -m '$message'", $output);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -221,7 +222,7 @@ if (count($argv) != 3) {
|
||||
$gitosis_root = $argv[1];
|
||||
$key = $argv[2];
|
||||
|
||||
if (!repositoryPull($gitosis_root)) {
|
||||
if (!repositoryPull($gitosis_root, $key)) {
|
||||
print("Failed to pull changes from server.\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -230,10 +231,12 @@ if (!rebuildConfiguration($gitosis_root)) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!repositoryCommitAll($gitosis_root, 'Update to correspond changes in Phabricator')) {
|
||||
if (!repositoryCommitAll(
|
||||
$gitosis_root, 'Rebuild Gitadmin <null@git.blender.org>',
|
||||
'Update to correspond changes in Phabricator')) {
|
||||
print("Failed to commit changes.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
runGitSshCommand($gitosis_root, $key, true, 'push');
|
||||
runGitSshCommand($gitosis_root, $key, true, 'push origin master');
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user