#!/usr/bin/env bash # # Apply the scoutfs-notify patch series to a scoutfs working tree. # # Usage: apply.sh /path/to/scoutfs # set -euo pipefail HERE=$(cd "$(dirname "$0")" && pwd) TREE="${1:?usage: $0 /path/to/scoutfs}" if [ ! -d "$TREE/.git" ]; then echo "error: $TREE is not a git working tree" >&2 echo "hint: use 'patch -p1' directly for tarball trees (see README)" >&2 exit 2 fi BASE="$(head -n1 "$HERE/base.txt" | awk '{print $1}')" if [ -n "$BASE" ]; then if ! git -C "$TREE" rev-parse --verify "$BASE" >/dev/null 2>&1; then echo "warning: base '$BASE' not found in target tree" >&2 fi fi cd "$TREE" git am --3way --keep-cr "$HERE"/patches/*.patch