<% my $state; # API my $api = gitprep_api; # Git my $git = app->git; # Parameters my $user_id = param('user'); my $project_id = param('project'); my $project_row_id = $api->get_project_row_id($user_id, $project_id); my $rev; my $dir; my $rev_dir = param('rev_dir'); if (defined $rev_dir) { ($rev, $dir) = $git->parse_rev_path(app->rep_info($user_id, $project_id), $rev_dir); } else { $rev = app->manager->default_branch($user_id, $project_id); } unless (app->manager->exists_project($user_id, $project_id)) { $self->reply->not_found; return; } # Repository description my $desc = $git->description(app->rep_info($user_id, $project_id)); my $website_url = app->dbi->model('project')->select('website_url', where => {row_id => $project_row_id})->value; # Check exsitence my $commits_number; if ($git->exists_branch(app->rep_info($user_id, $project_id))) { # Commit my $commit = $git->get_commit(app->rep_info($user_id, $project_id), $rev); # Tree my $trees; if (defined $dir && length $dir) { $trees = $git->trees(app->rep_info($user_id, $project_id), $rev, $dir); } else { $trees = $git->trees(app->rep_info($user_id, $project_id), $rev); } # Commits number $commits_number = $git->commits_number(app->rep_info($user_id, $project_id), $rev); # Variable for included template stash( commit => $commit, trees => $trees, rev => $rev, title => "$user_id/$project_id", ); $state = 'display'; } else { $state = 'init' } my $is_project_top_page = !(defined $dir && length $dir); my $url = url_for->to_abs; $url->base(undef); my $ssh_port = config->{basic}{ssh_port}; my $rep_home = app->rep_home; my $execute_user = getpwuid($>); my $ssh_rep_url_base = defined app->config->{basic}{'ssh_rep_url_base'} ? app->config->{basic}{'ssh_rep_url_base'} : $rep_home; my $ssh_rep_url = "ssh://$execute_user\@" . $url->host . ($ssh_port ? ":$ssh_port" : '') . "$ssh_rep_url_base/$user_id/$project_id.git"; my $branches = stash('branches'); my $branches_count = app->git->branches_count($self->app->rep_info($user_id, $project_id)); my $default_branch_name = app->manager->default_branch($user_id, $project_id); my $tags_count = app->git->tags_count(app->rep_info($user_id, $project_id)); my $logined = $api->logined; layout 'common', title => "$user_id/$project_id"; %> %= include '/include/header';
%= include '/include/message', message => flash('message'); % if ($is_project_top_page) {

<%= $desc %> % if (defined $website_url && length $website_url) { website % }

% } % if ($state eq 'display') { % if ($is_project_top_page) { % }
% my $display = defined $dir && length $dir ? 'tree' : 'tree_top'; %= include '/include/branch_select', display => $display, Path => $dir, ssh_rep_url => $ssh_rep_url;
%= include '/include/tree', dir => $dir;
%= include '/include/readme', dir => $dir; % } elsif ($state eq 'init' && $api->logined($user_id)) {

SSH

Create a new repository on the command line via ssh
touch README
git init
git add README
git commit -m "first commit"
git remote add origin <%= $ssh_rep_url %>
git push -u origin master
Push an existing repository from the command line via ssh
git remote add origin <%= $ssh_rep_url %>
git push -u origin master

% my $http_rep_url = url_for("$user_id/$project_id.git")->to_abs;

<%= uc url_for->to_abs->scheme %>

Create a new repository on the command line via <%= url_for->to_abs->scheme %>
touch README
git init
git add README
git commit -m "first commit"
git remote add origin <%= $http_rep_url %>
git push -u origin master
Push an existing repository from the command line via <%= url_for->to_abs->scheme %>
git remote add origin <%= $http_rep_url %>
git push -u origin master
% } else {
Repository is not yet created.
% }
%= include '/include/footer';