Skip to content

Commit

Permalink
scripts : option to increase git patch context
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov committed Sep 8, 2024
1 parent 5516d61 commit 3820902
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions scripts/sync-ggml-am.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Usage:
#
# $ cd /path/to/llama.cpp
# $ ./scripts/sync-ggml-am.sh -skip hash0,hash1,hash2...
# $ ./scripts/sync-ggml-am.sh -skip hash0,hash1,hash2... -C 3
#

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

to_skip=""
if [ "$1" == "-skip" ]; then
to_skip=$2
fi

# context for git patches in number of lines
ctx="8"

while [ "$1" != "" ]; do
case $1 in
-skip )
shift
to_skip=$1
;;
-C )
shift
ctx=$1
;;
esac
shift
done

cd $SRC_GGML

Expand All @@ -52,7 +66,7 @@ while read c; do
fi
fi

git format-patch -k $c~1..$c --stdout -- \
git format-patch -U${ctx} -k $c~1..$c --stdout -- \
CMakeLists.txt \
src/CMakeLists.txt \
cmake/FindSIMD.cmake \
Expand Down Expand Up @@ -191,7 +205,7 @@ if [ -f $SRC_LLAMA/ggml-src.patch ]; then
> ggml-src.patch.tmp
mv ggml-src.patch.tmp ggml-src.patch

git am ggml-src.patch
git am -C${ctx} ggml-src.patch

rm -v $SRC_LLAMA/ggml-src.patch
fi
Expand Down

0 comments on commit 3820902

Please sign in to comment.