cd $SRC_LLAMA
-git log --oneline $lc..HEAD
-
-git format-patch $lc --stdout -- \
- ggml*.h \
- ggml*.c \
- ggml*.cpp \
- ggml*.m \
- ggml*.metal \
- ggml*.cu \
- tests/test-opt.cpp \
- tests/test-grad0.cpp \
- tests/test-quantize-fns.cpp \
- tests/test-quantize-perf.cpp \
- tests/test-backend-ops.cpp \
- > $SRC_GGML/llama-src.patch
+git log --oneline $lc..HEAD | grep -v "(ggml/[0-9]*)" | cut -d' ' -f1 > $SRC_GGML/llama-commits
+
+if [ ! -s $SRC_GGML/llama-commits ]; then
+ rm -v $SRC_GGML/llama-commits
+ echo "No new commits"
+ exit 0
+fi
+
+if [ -f $SRC_GGML/llama-src.patch ]; then
+ rm -v $SRC_GGML/llama-src.patch
+fi
+
+while read c; do
+ git format-patch -k $c..$c --stdout -- \
+ ggml*.h \
+ ggml*.c \
+ ggml*.cpp \
+ ggml*.m \
+ ggml*.metal \
+ ggml*.cu \
+ tests/test-opt.cpp \
+ tests/test-grad0.cpp \
+ tests/test-quantize-fns.cpp \
+ tests/test-quantize-perf.cpp \
+ tests/test-backend-ops.cpp \
+ >> $SRC_GGML/llama-src.patch
+done < $SRC_GGML/llama-commits
+
+rm -v $SRC_GGML/llama-commits
# delete files if empty
if [ ! -s $SRC_GGML/llama-src.patch ]; then
cd $SRC_WHISPER
-git log --oneline $lc..HEAD
+git log --oneline $lc..HEAD | grep -v "(ggml/[0-9]*)" | cut -d' ' -f1 > $SRC_GGML/whisper-commits
-git format-patch $lc --stdout -- \
+if [ ! -s $SRC_GGML/whisper-commits ]; then
+ rm -v $SRC_GGML/whisper-commits
+ echo "No new commits"
+ exit 0
+fi
+
+if [ -f $SRC_GGML/whisper-src.patch ]; then
+ rm -v $SRC_GGML/whisper-src.patch
+fi
+
+while read c; do
+ git format-patch -k $c..$c --stdout -- \
ggml*.h \
ggml*.c \
ggml*.cpp \
examples/common-ggml.cpp \
examples/main/main.cpp \
examples/quantize/quantize.cpp \
- > $SRC_GGML/whisper-src.patch
+ >> $SRC_GGML/whisper-src.patch
+done < $SRC_GGML/whisper-commits
+
+rm -v $SRC_GGML/whisper-commits
# delete files if empty
if [ ! -s $SRC_GGML/whisper-src.patch ]; then