summaryrefslogtreecommitdiff
path: root/scripts/package/gen-diff-patch
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2023-04-12 12:01:32 +0200
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2023-04-12 12:01:32 +0200
commit5603effb8295ada8419408d038a34ca89d658229 (patch)
treeb06d8e309631d507c7b030e943b8479e2d15250b /scripts/package/gen-diff-patch
parentb89ce1177d42d5c124e83f3858818cd4e6a2c46f (diff)
parent09a9639e56c01c7a00d6c0ca63f4c7c41abe075d (diff)
Merge remote-tracking branch 'drm/drm-fixes' into drm-misc-fixesdrm-misc-fixes-2023-04-13
We were stuck on rc2, should at least attempt to track drm-fixes slightly. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Diffstat (limited to 'scripts/package/gen-diff-patch')
-rwxr-xr-xscripts/package/gen-diff-patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/scripts/package/gen-diff-patch b/scripts/package/gen-diff-patch
new file mode 100755
index 000000000000..f842ab50a780
--- /dev/null
+++ b/scripts/package/gen-diff-patch
@@ -0,0 +1,44 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-only
+
+diff_patch="${1}"
+untracked_patch="${2}"
+srctree=$(dirname $0)/../..
+
+rm -f ${diff_patch} ${untracked_patch}
+
+if ! ${srctree}/scripts/check-git; then
+ exit
+fi
+
+mkdir -p "$(dirname ${diff_patch})" "$(dirname ${untracked_patch})"
+
+git -C "${srctree}" diff HEAD > "${diff_patch}"
+
+if [ ! -s "${diff_patch}" ]; then
+ rm -f "${diff_patch}"
+ exit
+fi
+
+git -C ${srctree} status --porcelain --untracked-files=all |
+while read stat path
+do
+ if [ "${stat}" = '??' ]; then
+
+ if ! diff -u /dev/null "${srctree}/${path}" > .tmp_diff &&
+ ! head -n1 .tmp_diff | grep -q "Binary files"; then
+ {
+ echo "--- /dev/null"
+ echo "+++ linux/$path"
+ cat .tmp_diff | tail -n +3
+ } >> ${untracked_patch}
+ fi
+ fi
+done
+
+rm -f .tmp_diff
+
+if [ ! -s "${diff_patch}" ]; then
+ rm -f "${diff_patch}"
+ exit
+fi