my $git = $repo->{git};
my $env = $req->{env};
- my $tip = $req->{h} || $repo->tip;
+ my $tip = $req->{tip} || $repo->tip;
my $read_log = sub {
my $cmd = $git->cmd(qw(log --no-notes --no-color
--abbrev-commit), $git->abbrev,
my $relup = join('', map { '../' } @{$req->{extra}});
return $self->r(301, $req, "$relup#".to_attr($expath));
}
-
+ my $tip = $req->{tip} || $req->{-repo}->tip;
my $git = $req->{-repo}->{git};
my $cmd = $git->cmd(qw(show -z --numstat -p --encoding=UTF-8
--no-notes --no-color -c --no-abbrev),
- GIT_FMT, $req->{-repo}->tip, '--');
+ GIT_FMT, $tip, '--');
my $rdr = { 2 => $git->err_begin };
my $qsp = PublicInbox::Qspawn->new($cmd, undef, $rdr);
$env->{'qspawn.quiet'} = 1;
}
}
+# $REPO/diff/$BEFORE..$AFTER
sub call_git_diff {
my ($self, $req) = @_;
- my ($id, $id2) = split(/\.\./, $req->{h});
+ my ($id, $id2) = split(/\.\./, $req->{tip});
my $env = $req->{env};
my $git = $req->{-repo}->{git};
my $cmd = $git->cmd(qw(diff-tree -z --numstat -p --encoding=UTF-8
my ($self, $req) = @_;
my $repo = $req->{-repo};
my $max = $repo->{max_commit_count} || 50;
- my $h = $req->{h};
+ my $tip = $req->{tip} || $repo->tip;
+ $req->{lpfx} = $req->{relcmd};
$max = int($max);
$max = 50 if $max == 0;
my $env = $req->{env};
my $git = $repo->{git};
- my $tip = $req->{-repo}->tip;
my $cmd = $git->cmd(qw(log --no-notes --no-color --no-abbrev),
$LOG_FMT, "-$max", $tip, '--');
my $rdr = { 2 => $git->err_begin };
- my $title = "log: $repo->{repo}";
- if (defined $h) {
- $title .= ' ('. utf8_html($h). ')';
- $req->{lpfx} = $req->{relcmd};
- } else {
- $req->{lpfx} = $req->{relcmd} . $tip;
- }
+ my $title = 'log: '.$repo->{repo}.' ('.utf8_html($tip).')';
$req->{lhtml} = $self->html_start($req, $title) . "\n\n";
my $qsp = PublicInbox::Qspawn->new($cmd, undef, $rdr);
$qsp->psgi_return($env, undef, sub {
my ($self, $req) = @_;
my $repo = $req->{-repo};
my $git = $repo->{git};
- my $id = $repo->tip . ':' . $req->{expath};
+ my $tip = $req->{tip} || $repo->tip;
+ my $id = $tip . ':' . $req->{expath};
my ($cat, $hex, $type, $size) = $git->cat_file_begin($id);
return unless defined $cat;
sub call_git_snapshot ($$) { # invoked by PublicInbox::RepoBase::call
my ($self, $req) = @_;
- my $ref = $req->{h} || $req->{-repo}->tip;
+ my $ref = $req->{tip} || $req->{-repo}->tip;
my $orig_fn = $ref;
# just in case git changes refname rules, don't allow wonky filenames
sub call_git_tag {
my ($self, $req) = @_;
- my $h = $req->{h};
- defined $h or return git_tag_list($self, $req);
+ my $tip = $req->{tip};
+ defined $tip or return git_tag_list($self, $req);
sub {
my ($res) = @_;
- git_tag_show($self, $req, $h, $res);
+ git_tag_show($self, $req, $tip, $res);
}
}
my @extra = @{$req->{extra}};
my $repo = $req->{-repo};
my $git = $repo->{git};
- my $tip = $repo->tip;
+ my $tip = $req->{tip} || $repo->tip;
my $obj = "$tip:$req->{expath}";
my ($hex, $type, $size) = $git->check($obj);
}
my $opts = { nofollow => 1 };
- my $title = $req->{expath};
- $title = $title eq '' ? 'tree' : utf8_html($title);
+ my $title = "tree: ".utf8_html($req->{expath});
if ($type eq 'tree') {
$opts->{noindex} = 1;
$req->{thtml} = $self->html_start($req, $title, $opts) . "\n";
$req->{thtml} .= "\npath: $t\n\n<b>mode\tsize\tname</b>\n";
if (defined(my $last = $req->{extra}->[-1])) {
$pfx = PublicInbox::Hval->utf8($last)->as_path;
- } elsif (defined $req->{h}) {
- $pfx = $req->{-repo}->tip;
+ } elsif (defined(my $tip = $req->{tip})) {
+ $pfx = $tip;
} else {
$pfx = 'tree/' . $req->{-repo}->tip;
}
my $vcs_lc = $repo->{vcs};
my $vcs = $VCS{$vcs_lc} or return r404();
my $mod;
- my $h;
+ my $tip;
if (defined $cmd && length $cmd) {
$mod = $CMD{$cmd};
if ($mod) {
- $h = shift @extra if @extra;
+ $tip = shift @extra if @extra;
} else {
unshift @extra, $cmd;
$mod = 'Fallback';
while (@extra && $extra[-1] eq '') {
pop @extra;
}
- $req->{h} = $h;
+ $req->{tip} = $tip;
$mod = load_once("PublicInbox::Repo$vcs$mod");
$vcs = load_once("PublicInbox::$vcs");