File 0005-push-Make-files-w-after-being-touched-by-a-patch.patch of Package quilt-ks
From f6c7037d2afd2fdf053f88204779d9d2f8d0bdc3 Mon Sep 17 00:00:00 2001
From: Benjamin Poirier <bpoirier@suse.de>
Date: Tue, 14 Mar 2017 14:21:36 -0700
Subject: [PATCH 5/5] push: Make files +w after being touched by a patch
---
quilt/fold.in | 9 +++++++++
quilt/push.in | 14 ++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/quilt/fold.in b/quilt/fold.in
index 66e91fd..895fdf6 100644
--- a/quilt/fold.in
+++ b/quilt/fold.in
@@ -117,6 +117,15 @@ then
failed=1
break
fi
+ if [ -r "$file" ]
+ then
+ if [ $(stat -c "%h" "$file") -eq 1 ]
+ then
+ chmod +w "$file"
+ else
+ echo "Warning: file $file has link count != 1, not changing permissions"
+ fi
+ fi
fi
done
fi
diff --git a/quilt/push.in b/quilt/push.in
index d61f166..05925ce 100644
--- a/quilt/push.in
+++ b/quilt/push.in
@@ -231,6 +231,20 @@ add_patch()
printf $"Applied patch %s (%sneeds refresh)\n" \
"$(print_patch "$patch")" "$text"
fi
+
+ local f
+ quilt_command files | while read f; do
+ if [ -r "$f" ]
+ then
+ if [ $(stat -c "%h" "$f") -eq 1 ]
+ then
+ chmod +w "$f"
+ else
+ echo "Warning: file $f has link count != 1, not changing permissions"
+ fi
+ fi
+ done
+
else
rollback_patch "$patch"
tmp=$(gen_tempfile)
--
2.21.0