File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -613,12 +613,29 @@ add_change_id() {
613
613
}
614
614
changeIdAfter = "^(" tolower("' " $CHANGE_ID_AFTER " ' ") "):"
615
615
numlines = split(lines, footer, "\n")
616
+
617
+ # Find the last line that starts with a comment character.
618
+ coauthorIndex = 0
619
+ for (line = 1; line <= numlines; line++) {
620
+ if (match(tolower(footer[line]), /^co-authored-by:/)) {
621
+ coauthorIndex = line
622
+ }
623
+ }
624
+
616
625
for (line = 1; line <= numlines; line++) {
617
626
if (unprinted && match(tolower(footer[line]), changeIdAfter) != 1) {
618
- unprinted = 0
619
- print "Change-Id: I' " $id " ' "
627
+ # If the Change-Id is the first line in the footer, print it first.
628
+ if (coauthorIndex == 0 || line > coauthorIndex) {
629
+ print "Change-Id: I' " $id " ' "
630
+ unprinted = 0
631
+ }
620
632
}
621
633
print footer[line]
634
+
635
+ if(line == coauthorIndex && unprinted) {
636
+ print "Change-Id: I' " $id " ' "
637
+ unprinted = 0
638
+ }
622
639
}
623
640
if (unprinted) {
624
641
print "Change-Id: I' " $id " ' "
You can’t perform that action at this time.
0 commit comments