summaryrefslogtreecommitdiff
path: root/edk2-to-git-am.sh
blob: 1fe2ac14a421a62637c5d3c68ec1568fa68ecf9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
#
# Copyright (c) 2017, Linaro Ltd. All rights reserved.
#
# SPDX-License-Identifier: ISC
#
# Convert one or more git patches that have had it's CR:s stripped out by SMTP
# into something th

if [ $# -lt 1 ]; then
  echo "usage: `basename $0` <filename>" >&2
  exit 1
fi

convert_file()
{
  sed -i "s/$/\r/g" "$1"
  sed -i "s:^\(---\|+++ \)\(.*\)\r$:\1\2:g" "$1"
}

while [ $# -gt 0 ]; do
  convert_file "$1"
  shift
done