Last active
August 29, 2015 14:15
-
-
Save slobo/e553eee6515d70c1c3c0 to your computer and use it in GitHub Desktop.
Add Change-ID to git commits so they can be accepted for review by gerrit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# run as `git filter-branch --msg-filter /path/to/add-missing-change-id.pl [REF_SPEC]` | |
# where REF_SPEC is optional or something like origin/master..HEAD | |
use strict; | |
use warnings; | |
my $has_change_id; | |
while (<>) { | |
$has_change_id ||= m{Change-Id:}; | |
print; | |
} | |
print "\nChange-Id: I$ENV{GIT_COMMIT}\n" | |
unless $has_change_id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment