-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgen_diff.sh
More file actions
31 lines (25 loc) · 906 Bytes
/
gen_diff.sh
File metadata and controls
31 lines (25 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# gen_diff.sh
# Generates a diff between the current LlamaFactory and the upstream base commit.
# Output: llamafactory_changes.diff in the repo root.
#
# Usage: bash gen_diff.sh
set -e
REPO_ROOT="$(cd "$(dirname "$0")" && pwd)"
LF_DIR="$REPO_ROOT/LlamaFactory"
OUTPUT="$REPO_ROOT/llamafactory_changes.diff"
UPSTREAM_URL="https://github.com/hiyouga/LLaMA-Factory.git"
BASE_COMMIT="92fa3df4c4e4e338ecc1cbdc6530b118337286e3"
TMPDIR=$(mktemp -d)
trap "rm -rf '$TMPDIR'" EXIT
echo "Fetching upstream at $BASE_COMMIT..."
git init "$TMPDIR/repo" -q
git -C "$TMPDIR/repo" fetch --depth 1 "$UPSTREAM_URL" "$BASE_COMMIT" -q
git -C "$TMPDIR/repo" checkout FETCH_HEAD -q
# Diff original vs current LlamaFactory
diff -r \
--exclude='__pycache__' \
--exclude='*.pyc' \
--exclude='.git' \
"$TMPDIR/repo" "$LF_DIR" > "$OUTPUT" || true
echo "Saved to $OUTPUT ($(wc -l < "$OUTPUT") lines)"