diff options
author | Leah Rowe <leah@libreboot.org> | 2023-09-25 11:37:35 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2023-09-25 11:49:13 +0100 |
commit | 3738ec90ec1728bb805d84cd8b1a68c7c31d06e4 (patch) | |
tree | 7d8edb5f86bd026741476761f56105213598295d /include/git.sh | |
parent | cd3225d84517d6fee1b75a5025362161640640ea (diff) |
update/project/*: unified patch handling
Handle patches by a function at include/git.sh
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/git.sh')
-rwxr-xr-x | include/git.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/git.sh b/include/git.sh new file mode 100755 index 00000000..f7026765 --- /dev/null +++ b/include/git.sh @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-3.0-or-later +# SPDX-FileCopyrightText: 2023 Leah Rowe <leah@libreboot.org> + +git_am_patches() +{ + sdir="${1}" # assumed to be absolute path + patchdir="${2}" # ditto + _fail="${3}" + ( + cd "${sdir}" || \ + "${_fail}" "apply_patches: !cd \"${sdir}\"" + for patch in "${patchdir}/"*; do + [ -L "${patch}" ] && continue + [ -f "${patch}" ] || continue + if ! git am "${patch}"; then + git am --abort || "${_fail}" "${sdir}: !git am --abort" + "${_fail}" "!git am ${patch} -> ${sdir}" + fi + done + ) +} |