Skip to content

Commit 971f5c6

Browse files
committed
Implement copyright preservation
Signed-off-by: methylDragon <methylDragon@gmail.com>
1 parent c4b19d1 commit 971f5c6

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

jenkins-scripts/tools/header_migration_script.sh

+20-1
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,27 @@ find . -regex './include.*/ignition/[^/]*' -type d -print0 \
361361
find . -regex '.*include.*/ignition.*\.h.*\|.*include\(.*\)*/Ign\(ition\)?[A-Z].*\.h.*' -type f -print0 \
362362
| xargs -0 -I {} bash -c 'populateRedirectionAlias {}' _
363363

364+
# Do some absolutely ridiculous awk sourcery to remove most instances of copyright edits
365+
GIT_DIFF="$(git diff)"
366+
PATCHED_GIT_DIFF=$(awk '{
367+
if(/^-.*Open Source Robotics Foundation/){
368+
prev=$0;
369+
getline;
370+
371+
if(/^\+.*Open Source Robotics Foundation/){
372+
print prev; sub(/^-/, "+", prev); print prev;
373+
} else {
374+
print prev "\n" $0;
375+
}
376+
}
377+
else{print;}
378+
}' <<< "${GIT_DIFF}")
379+
380+
git restore .
381+
git apply <<< "${PATCHED_GIT_DIFF}"
382+
364383
reviewConfirm
365-
gitCommit ${IGN_ORG} "Provision redirection aliases" 1 # 1 to `git add -A`
384+
gitCommit -a ${IGN_ORG} "Provision redirection aliases"
366385

367386
# Migrate Gz sources
368387
find . -regex '.*/\[src\|test\|examples\]/.*\|.*include\(.*\)*/[gz|Gz].*' -type f -print0 | xargs -0 -I {} bash -c 'migrateSources {}' _

0 commit comments

Comments
 (0)