All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit b6dc5a0e authored by Robert Ricci's avatar Robert Ricci

Show commit range on updates

Show the old and new values of the ref, in a form that is suitable for
passing to 'git log', etc. The idea is to make it easier for the reader
of the mail to go look at more detailed information than is in the mail,
if they so choose.

Use short form of the hashes to make it fit nicely into one line
of text.
parent 3b96945a
......@@ -253,13 +253,14 @@ sub change_type($$$);
sub ref_type($);
sub rev_type($);
sub revparse($);
sub short_hash($);
sub changed_files(@);
sub get_mail_addresses($@);
sub get_merge_base($$);
sub get_summary($);
sub uniq(@);
sub flatten_arrayref($);
sub commit_mail($\@$@);
sub commit_mail($$$\@$@);
sub get_commits($$$);
sub send_mail($$$@);
sub short_refname($);
......@@ -459,7 +460,7 @@ foreach my $refline (@reflines) {
# Send off the mail!
if (@mailaddrs) {
......@@ -540,6 +541,16 @@ sub revparse($) {
return $parsedrev;
# Take a git hash and return the short (abbreviated) form.
sub short_hash($) {
my ($hash) = @_;
my $short = `$GIT rev-parse --short $hash $STDERRNULL`;
return $short;
# Given a list of commit object hashes, return the list of files changed by
# all commits.
......@@ -716,7 +727,7 @@ sub flatten_arrayref($) {
# Send mail about a regular update commit
sub commit_mail($\@$@) {
my ($ct,$commits,$refname,@mailaddrs) = @_;
my ($ct,$oldrev,$newrev,$commits,$refname,@mailaddrs) = @_;
# Construct the subject line. For now, we just say what repo (if defined)
......@@ -760,6 +771,10 @@ sub commit_mail($\@$@) {
$actionstring .= " to point to the following commit:";
} elsif ($ct eq $CT_DELETE) {
$actionstring .= ". It previously pointed to the following commit:";
} elsif ($ct eq $CT_UPDATE) {
my $oldshort = short_hash($oldrev);
my $newshort = short_hash($newrev);
$actionstring .= ": $oldshort..$newshort";
$actionstring .= "\n\n";
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment