hook(type => "checkconfig", id => "git", call => \&checkconfig);
hook(type => "getsetup", id => "git", call => \&getsetup);
hook(type => "rcs", id => "rcs_update", call => \&rcs_update);
hook(type => "checkconfig", id => "git", call => \&checkconfig);
hook(type => "getsetup", id => "git", call => \&getsetup);
hook(type => "rcs", id => "rcs_update", call => \&rcs_update);
hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
hook(type => "rcs", id => "rcs_receive", call => \&rcs_receive);
hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
hook(type => "rcs", id => "rcs_receive", call => \&rcs_receive);
push @{$config{wrappers}}, {
test_receive => 1,
wrapper => $config{git_test_receive_wrapper},
push @{$config{wrappers}}, {
test_receive => 1,
wrapper => $config{git_test_receive_wrapper},
- example => "http://git.example.com/gitweb.cgi?p=wiki.git;a=blobdiff;h=[[sha1_to]];hp=[[sha1_from]];hb=[[sha1_parent]];f=[[file]]",
- description => "gitweb url to show a diff ([[sha1_to]], [[sha1_from]], [[sha1_parent]], and [[file]] substituted)",
+ example => "http://git.example.com/gitweb.cgi?p=wiki.git;a=blobdiff;f=[[file]];h=[[sha1_to]];hp=[[sha1_from]];hb=[[sha1_commit]];hpb=[[sha1_parent]]",
+ description => "gitweb url to show a diff ([[file]], [[sha1_to]], [[sha1_from]], [[sha1_commit]], and [[sha1_parent]] substituted)",
# Start a child process safely without resorting /bin/sh.
# Return command output or success state (in scalar context).
# Start a child process safely without resorting /bin/sh.
# Return command output or success state (in scalar context).
sub run_or_die ($@) { safe_git(\&error, @_) }
sub run_or_cry ($@) { safe_git(sub { warn @_ }, @_) }
sub run_or_non ($@) { safe_git(undef, @_) }
sub run_or_die ($@) { safe_git(\&error, @_) }
sub run_or_cry ($@) { safe_git(sub { warn @_ }, @_) }
sub run_or_non ($@) { safe_git(undef, @_) }
# Unlike with Subversion, Git cannot make a 'svn merge -rN:M file'.
# Git merge commands work with the committed changes, except in the
# implicit case of '-m' of git checkout(1). So we should invent a
# Unlike with Subversion, Git cannot make a 'svn merge -rN:M file'.
# Git merge commands work with the committed changes, except in the
# implicit case of '-m' of git checkout(1). So we should invent a
($sha1) = $sha1 =~ m/($sha1_pattern)/; # sha1 is untainted now
} else { debug("Empty sha1sum for '$file'.") }
return defined $sha1 ? $sha1 : q{};
($sha1) = $sha1 =~ m/($sha1_pattern)/; # sha1 is untainted now
} else { debug("Empty sha1sum for '$file'.") }
return defined $sha1 ? $sha1 : q{};
# Update working directory.
if (length $config{gitorigin_branch}) {
run_or_cry('git', 'pull', $config{gitorigin_branch});
}
# Update working directory.
if (length $config{gitorigin_branch}) {
run_or_cry('git', 'pull', $config{gitorigin_branch});
}
# Return the commit sha1sum of the file when editing begins.
# This will be later used in rcs_commit if a merge is required.
my ($file) = @_;
return git_sha1($file);
# Return the commit sha1sum of the file when editing begins.
# This will be later used in rcs_commit if a merge is required.
my ($file) = @_;
return git_sha1($file);
# Try to commit the page; returns undef on _success_ and
# a version of the page with the rcs's conflict markers on
# failure.
# Try to commit the page; returns undef on _success_ and
# a version of the page with the rcs's conflict markers on
# failure.
sub rcs_commit_staged ($$$) {
# Commits all staged changes. Changes can be staged using rcs_add,
sub rcs_commit_staged ($$$) {
# Commits all staged changes. Changes can be staged using rcs_add,
# Remove file from archive.
my ($file) = @_;
run_or_cry('git', 'rm', '-f', $file);
# Remove file from archive.
my ($file) = @_;
run_or_cry('git', 'rm', '-f', $file);
my ($src, $dest) = @_;
run_or_cry('git', 'mv', '-f', $src, $dest);
my ($src, $dest) = @_;
run_or_cry('git', 'mv', '-f', $src, $dest);
$diffurl =~ s/\[\[sha1_parent\]\]/$ci->{'parent'}/go;
$diffurl =~ s/\[\[sha1_from\]\]/$detail->{'sha1_from'}/go;
$diffurl =~ s/\[\[sha1_to\]\]/$detail->{'sha1_to'}/go;
$diffurl =~ s/\[\[sha1_parent\]\]/$ci->{'parent'}/go;
$diffurl =~ s/\[\[sha1_from\]\]/$detail->{'sha1_from'}/go;
$diffurl =~ s/\[\[sha1_to\]\]/$detail->{'sha1_to'}/go;
- my $sha1 = git_sha1($file);
- my $ci = git_commit_info($sha1, 1);
+ my @sha1s = run_or_non('git', 'rev-list', 'HEAD', '--', $file);
+ my $ci = git_commit_info($sha1s[$#sha1s], 1);
# The wiki may not be the only thing in the git repo.
# Determine if it is in a subdirectory by examining the srcdir,
# and its parents, looking for the .git directory.
# The wiki may not be the only thing in the git repo.
# Determine if it is in a subdirectory by examining the srcdir,
# and its parents, looking for the .git directory.