Last active
September 26, 2024 15:26
-
-
Save gubatron/6ebbb7e3326e08350447451db288c759 to your computer and use it in GitHub Desktop.
split_huge_diff.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
split_file() { | |
local file="$1" | |
if [[ ! -f "$file" ]]; then | |
echo "File '$file' does not exist." | |
return 1 | |
fi | |
# Use short options compatible with your version of split | |
split -b 50k -a 2 "$file" "${file}.part" | |
# Rename the split files to have numeric suffixes starting from 1 | |
i=1 | |
for f in "${file}.part"* | |
do | |
mv "$f" "${file}.part${i}" | |
i=$((i+1)) | |
done | |
} | |
rm 2.0.patch* | |
# gets a patch excluding binary files, auto generated .cpp files and auto generated java files otherwise the patch is too big | |
git diff --diff-filter=d --binary 240fceb14a2496573b15d813ea40ca0cf9b71489 HEAD -- ':(exclude)src/main/java/com/frostwire/jlibtorrent/swig/' ':(exclude)swig/libtorrent_jni.cpp' ':(exclude)*.jar' ':(exclude)*.zip' ':(exclude)*.md' ':(exclude)*.txt' > 2.0.patch | |
# splits it in chunks of 50kb so we can paste it one at the time to chatGPT | |
split_file 2.0.patch | |
ls -lth 2.0.patch* |
Author
gubatron
commented
Sep 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment