Skip to content

Commit 0d5722d

Browse files
Tweak license header scripts (#5649) (#5651)
* Remove newline from license text * Tweak add license headers script to add newline Co-authored-by: Steve Gordon <sgordon@hotmail.co.uk>
1 parent 16fb06f commit 0d5722d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

.github/add-license-headers.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ function add_license () {
55
(find "$script_path" -name $1 | grep -v "/bin/" | grep -v "/obj/" )|while read fname; do
66
line=$(sed -n '2p;3q' "$fname")
77
if ! [[ "$line" == " * Licensed to Elasticsearch B.V. under one or more contributor" ]] ; then
8-
cat "${script_path}.github/license-header.txt" "$fname" > "${fname}.new"
8+
# awk joins the header with the existing file, inserting a newline between them
9+
awk '(NR>1 && FNR==1){print ""}1' "${script_path}.github/license-header.txt" "$fname" > "${fname}.new"
910
mv "${fname}.new" "$fname"
1011
fi
1112
done

.github/license-header.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-

0 commit comments

Comments
 (0)