diff --git a/build/apply-patches b/build/apply-patches
index c15cdf6fb..31c2adcfd 100755
--- a/build/apply-patches
+++ b/build/apply-patches
@@ -51,9 +51,11 @@ fi
CHANGED_FILES=$(git status --porcelain --untracked-files=no)
-if [ \( -s "$FULLY_PATCHED_FILE" \) -a \( -n "$CHANGED_FILES" \) ] ; then
- echo "Patches appear to have been applied already"
- exit 0
+if [ \( -s "$FULLY_PATCHED_FILE" \) -a \( -n "$CHANGED_FILES" \) ] ; then
+ if git apply -R --check "$FULLY_PATCHED_FILE" ; then
+ echo "Patches appear to have been applied already"
+ exit 0
+ fi
fi
if [ -n "$CHANGED_FILES" ] ; then
@@ -64,7 +66,7 @@ fi
find "$PATCH_DIR" -maxdepth 1 -type f -print0 | sort -zV | while IFS= read -r -d '' file; do
echo "patching with: $file"
- patch --no-backup-if-mismatch -f -t --reject-file=- -p1 -i "$file"
+ git apply -v "$file"
done
git diff > "$FULLY_PATCHED_FILE"
diff --git a/build/unapply-patches b/build/unapply-patches
index aec14f1c3..a31708e25 100755
--- a/build/unapply-patches
+++ b/build/unapply-patches
@@ -52,18 +52,23 @@ fi
CHANGED_FILES=$(git status --porcelain --untracked-files=no)
if [ \( -s "$FULLY_PATCHED_FILE" \) -a \( -n "$CHANGED_FILES" \) ] ; then
- echo "Patches appear to have been applied, so going to remove them"
- patch -R --no-backup-if-mismatch -f -t --reject-file=- -p1 -i "$FULLY_PATCHED_FILE"
- rm -f "$FULLY_PATCHED_FILE"
-
- # Check for modifications, again
- if [ -n "$(git status --porcelain --untracked-files=no)" ] ; then
- echo "Error: CUDF repository has uncommitted changes. You might want to clean in manually if you know that is expected"
- git status --porcelain --untracked-files=no
+ if git apply --check -R "$FULLY_PATCHED_FILE"; then
+ echo "Patches appear to have been applied, so going to remove them"
+ git apply -R -v "$FULLY_PATCHED_FILE"
+ rm -f "$FULLY_PATCHED_FILE"
+
+ # Check for modifications, again
+ if [ -n "$(git status --porcelain --untracked-files=no)" ] ; then
+ echo "Error: CUDF repository has uncommitted changes. You might want to clean in manually if you know that is expected"
+ git status --porcelain --untracked-files=no
+ exit 1
+ fi
+
+ exit 0
+ else
+ echo "Files are changed, but in a way where the full path file does not apply to remove them $FULL_PATCHED_FILE"
exit 1
fi
-
- exit 0
fi
if [ -n "$CHANGED_FILES" ] ; then
diff --git a/pom.xml b/pom.xml
index e851fbb10..a50feefb2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -112,7 +112,7 @@
false
false
3.0.0