[Libreoffice-commits] dev-tools.git: scripts/annotate.pl

Michael Meeks michael.meeks at suse.com
Fri Mar 8 07:51:48 PST 2013


 scripts/annotate.pl |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit a3441c4c5f89d99ec80b74c021ae735d80b6fb82
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Fri Mar 8 15:51:02 2013 +0000

    check it is a valid hash to annotate.

diff --git a/scripts/annotate.pl b/scripts/annotate.pl
index 5b7ff66..2ac2d6c 100755
--- a/scripts/annotate.pl
+++ b/scripts/annotate.pl
@@ -144,6 +144,17 @@ sub sanity_check_revs($$)
     }
 }
 
+# ensure the hash we're annotating is in the right tree
+sub check_hash_for_note($$)
+{
+    my ($git_dir, $hash) = @_;
+    my $revs = read_log($git_dir);
+    for my $rev (@{$revs}) {
+	return if ($rev->{hash} eq $hash);
+    }
+    die "Unknown hash '$hash' - did you get your hashes the wrong way around ?";
+}
+
 sub usage()
 {
     print STDERR "Usage: aoo-annotate.pl [args] [--git /path/to/git] ['merged as: 1234' <hash>]\n";
@@ -211,6 +222,7 @@ if (!$list && !$stats && !$fetch) {
     validate_git_hash($note_hash) ||
 	    die "Hash on master '$note_hash' doesn't look like a git hash\n";
 
+    check_hash_for_note($git_dir, $note_hash);
     fetch_git_notes($git_dir);
     `( cd '$git_dir' ; git --no-pager notes add -m '$note_text' $note_hash )`;
     push_git_notes($git_dir);


More information about the Libreoffice-commits mailing list