From a6ae2786f389348dc8c40816dfcf3d1e06bd4db8 Mon Sep 17 00:00:00 2001
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 28 Dec 2013 17:17:02 +0100
Subject: [PATCH] Make patch generation deterministic

---
 .../openwrt/0001-Make-Unifi-images-flashable.patch    | 11 +----------
 scripts/update-patches.sh                             |  9 ++++++---
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/patches/openwrt/0001-Make-Unifi-images-flashable.patch b/patches/openwrt/0001-Make-Unifi-images-flashable.patch
index 1cd498d52..2b7c8c624 100644
--- a/patches/openwrt/0001-Make-Unifi-images-flashable.patch
+++ b/patches/openwrt/0001-Make-Unifi-images-flashable.patch
@@ -1,12 +1,6 @@
-From e541a190d4f54d35043a804f42af746793181405 Mon Sep 17 00:00:00 2001
-Message-Id: <e541a190d4f54d35043a804f42af746793181405.1388240789.git.mschiffer@universe-factory.net>
 From: Matthias Schiffer <mschiffer@universe-factory.net>
 Date: Fri, 27 Dec 2013 18:48:19 +0100
-Subject: [PATCH] Make Unifi images flashable
-
----
- target/linux/ar71xx/image/Makefile | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
+Subject: Make Unifi images flashable
 
 diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
 index 9ebe486..8e82f7f 100644
@@ -23,6 +17,3 @@ index 9ebe486..8e82f7f 100644
  
  $(eval $(call SingleProfile,WHRHPG300N,$(fs_64k),WHRG301N,whr-g301n,WHR-G301N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-G301N))
  $(eval $(call SingleProfile,WHRHPG300N,$(fs_64k),WHRHPG300N,whr-hp-g300n,WHR-HP-G300N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-HP-G300N))
--- 
-1.8.5.2
-
diff --git a/scripts/update-patches.sh b/scripts/update-patches.sh
index 3d5e023df..47457317a 100755
--- a/scripts/update-patches.sh
+++ b/scripts/update-patches.sh
@@ -7,9 +7,12 @@ shopt -s nullglob
 
 for module in $GLUON_MODULES; do
 	dir="$1"/$module
-	git -C "$dir" checkout patched
-
 	rm -f "$1"/patches/$module/*.patch
 	mkdir -p "$1"/patches/$module
-	git -C "$dir" format-patch -o "$1"/patches/$module base 
+
+	n=0
+	for commit in $(git -C "$dir" rev-list --reverse --no-merges base..patched); do
+		let n=n+1
+		git -C "$dir" show --pretty=format:'From: %an <%ae>%nDate: %aD%nSubject: %B' $commit > "$1"/patches/$module/"$(printf '%04u' $n)-$(git -C "$dir" show -s --pretty=format:%f).patch"
+	done
 done
-- 
GitLab