Skip to content
Snippets Groups Projects
Commit f6740583 authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Allow repeated patch

Fixes #330
parent f3739804
No related branches found
No related tags found
No related merge requests found
......@@ -230,8 +230,14 @@ case "$action" in
fi
if [ -L Plumed.h -o -L Plumed.inc -o -L Plumed.cmake ]
then
echo "ERROR: you have likely already patched. Revert first (-r)"
exit 1
if ( type -t plumed_before_revert 1>/dev/null || type -t plumed_after_revert 1>/dev/null) && ( type -t plumed_before_patch 1>/dev/null || type -t plumed_after_patch 1>/dev/null)
then
echo "ERROR: you have likely already patched, and your patch seems to need to be reverted."
echo "Revert first (-r)"
exit 1
else
echo "WARNING: you have likely already patched. Assuming that you can patch multiple times and continuing"
fi
fi
if [ ! -f "$PLUMED_ROOT/src/lib/Plumed.inc" ]
then
......@@ -261,7 +267,7 @@ case "$action" in
file="${bckfile%.preplumed}"
if test -e "$file" ; then
diff -U 5 "$diff/$bckfile" "$diff/$file" --label="$bckfile" --label="$file" |
patch -u -l -b -F 5 --suffix=.preplumed "$file"
patch -u -l -b -F 5 -N --suffix=.preplumed "$file"
else
echo "ERROR: File $file is missing"
fi
......@@ -364,7 +370,7 @@ case "$action" in
cp "$file" "$diff/$file"
cp "$bckfile" "$diff/$bckfile"
else
echo "patch -u -l -b -F 5 --suffix=.preplumed \"${file}\" << \\EOF_EOF" >> "$diff"
echo "patch -u -l -b -F 5 -N --suffix=.preplumed \"${file}\" << \\EOF_EOF" >> "$diff"
diff -U 5 "${bckfile}" "$file" --label="$bckfile" --label="$file" >> "$diff"
echo "EOF_EOF" >> "$diff"
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment