summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: aa5dfec)
raw | patch | inline | side by side (parent: aa5dfec)
author | Holger Weiss <holger@zedat.fu-berlin.de> | |
Sat, 24 Oct 2009 20:55:44 +0000 (22:55 +0200) | ||
committer | Holger Weiss <holger@zedat.fu-berlin.de> | |
Sat, 24 Oct 2009 20:55:44 +0000 (22:55 +0200) |
Instead of using the full SHA1 values of commit object names within
Gitweb URLs, try to abbreviate them to a shorter unique name.
Gitweb URLs, try to abbreviate them to a shorter unique name.
tools/git-notify | patch | blob | history |
diff --git a/tools/git-notify b/tools/git-notify
index a786f8393aa6a0e267cf227b74dc6ebd049883c3..a158e8722f564dfefd5cd9dabf6f871ba2d5031f 100755 (executable)
--- a/tools/git-notify
+++ b/tools/git-notify
return @table;
}
+# return the gitweb URL of the given commit or undef
+sub gitweb_url($$)
+{
+}
+
# format an integer date + timezone as string
# algorithm taken from git's date.c
sub format_date($$)
my ($ref,$obj) = @_;
my %info = get_object_info($obj);
my @notice = ();
+ my $url;
open DIFF, "-|" or exec "git", "diff-tree", "-p", "-M", "--no-commit-id", $obj or die "cannot exec git-diff-tree";
my $diff = join("", <DIFF>);
return if length($diff) == 0;
+ if ($gitweb_url)
+ {
+ open REVPARSE, "-|" or exec "git", "rev-parse", "--short", $obj or die "cannot exec git-rev-parse";
+ my $short_obj = <REVPARSE>;
+ close REVPARSE or die $! ? "Cannot execute rev-parse: $!" : "rev-parse exited with status: $?";
+
+ $short_obj = $obj if not defined $short_obj;
+ chomp $short_obj;
+ $url = "$gitweb_url/?a=commit;h=$short_obj";
+ }
+
push @notice, format_table(
"Module: $repos_name",
"Branch: $ref",
"Author:" . $info{"author"},
$info{"committer"} ne $info{"author"} ? "Committer:" . $info{"committer"} : undef,
"Date:" . format_date($info{"author_date"},$info{"author_tz"}),
- $gitweb_url ? "URL: $gitweb_url/?a=commit;h=$obj" : undef),
+ $url ? "URL: $url" : undef),
"",
@{$info{"log"}},
"",