Skip to content

Commit 60a3107

Browse files
committed
scripts : option to increase git patch context
1 parent 406c1a3 commit 60a3107

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

scripts/sync-ggml-am.sh

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Usage:
66
#
77
# $ cd /path/to/llama.cpp
8-
# $ ./scripts/sync-ggml-am.sh -skip hash0,hash1,hash2...
8+
# $ ./scripts/sync-ggml-am.sh -skip hash0,hash1,hash2... -C 3
99
#
1010

1111
set -e
@@ -25,9 +25,23 @@ lc=$(cat $SRC_LLAMA/scripts/sync-ggml.last)
2525
echo "Syncing ggml changes since commit $lc"
2626

2727
to_skip=""
28-
if [ "$1" == "-skip" ]; then
29-
to_skip=$2
30-
fi
28+
29+
# context for git patches in number of lines
30+
ctx="8"
31+
32+
while [ "$1" != "" ]; do
33+
case $1 in
34+
-skip )
35+
shift
36+
to_skip=$1
37+
;;
38+
-C )
39+
shift
40+
ctx=$1
41+
;;
42+
esac
43+
shift
44+
done
3145

3246
cd $SRC_GGML
3347

@@ -52,7 +66,7 @@ while read c; do
5266
fi
5367
fi
5468

55-
git format-patch -k $c~1..$c --stdout -- \
69+
git format-patch -U${ctx} -k $c~1..$c --stdout -- \
5670
CMakeLists.txt \
5771
src/CMakeLists.txt \
5872
cmake/FindSIMD.cmake \
@@ -191,7 +205,7 @@ if [ -f $SRC_LLAMA/ggml-src.patch ]; then
191205
> ggml-src.patch.tmp
192206
mv ggml-src.patch.tmp ggml-src.patch
193207

194-
git am ggml-src.patch
208+
git am -C${ctx} ggml-src.patch
195209

196210
rm -v $SRC_LLAMA/ggml-src.patch
197211
fi

0 commit comments

Comments
 (0)