Fixed bad help message for the git access.

Git has 2 methods to access a repository, one with gitdaemon to do a
checkout and one with SSH to perform the push. We need to provide those
2 methods.
This commit is contained in:
Loic d'Anterroches 2009-01-26 17:58:58 +01:00
parent c11cd7bc62
commit f203f7d78f
4 changed files with 29 additions and 1 deletions

View File

@ -362,6 +362,22 @@ class IDF_Project extends Pluf_Model
$this); $this);
} }
/**
* Get the remote write access url to the repository.
*
* Some SCM have a remote access URL to write which is not the
* same as the one to read. For example, you do a checkout with
* git-daemon and push with SSH.
*/
public function getWriteRemoteAccessUrl()
{
$conf = $this->getConf();
$scm = $conf->getVal('scm', 'git');
$scms = Pluf::f('allowed_scm');
return call_user_func(array($scms[$scm], 'getWriteRemoteAccessUrl'),
$this);
}
/** /**
* Get the root name of the project scm * Get the root name of the project scm
* *

View File

@ -66,6 +66,17 @@ class IDF_Scm_Git
return sprintf(Pluf::f('git_remote_url'), $project->shortname); return sprintf(Pluf::f('git_remote_url'), $project->shortname);
} }
/**
* Returns the URL for SSH access
*
* @param IDF_Project
* @return string URL
*/
public static function getWriteRemoteAccessUrl($project)
{
return sprintf(Pluf::f('git_write_remote_url'), $project->shortname);
}
/** /**
* Returns this object correctly initialized for the project. * Returns this object correctly initialized for the project.
* *

View File

@ -61,6 +61,7 @@ $cfg['git_repositories'] = '/home/git/repositories/%s.git';
# tree view. # tree view.
# #
$cfg['git_remote_url'] = 'git://localhost/%s.git'; $cfg['git_remote_url'] = 'git://localhost/%s.git';
$cfg['git_write_remote_url'] = 'git@localhost:%s.git';
# Same as for git, you can have multiple repositories, one for each # Same as for git, you can have multiple repositories, one for each
# project or a single one for all the projects. # project or a single one for all the projects.

View File

@ -22,7 +22,7 @@ code.{/blocktrans}</p>
git init git init
git add . git add .
git commit -m "initial import" git commit -m "initial import"
git remote add origin {$project.getRemoteAccessUrl()} git remote add origin {$project.getWriteRemoteAccessUrl()}
git push origin master git push origin master
</pre> </pre>