Make patches work when using git submodules (#285)

This commit is contained in:
Rory Coughlan 2024-09-10 23:59:36 +10:00 committed by Isaac0-dev
parent 4aa2a20f72
commit 9bb89067f2

View file

@ -10,15 +10,9 @@ then
exit 1 exit 1
fi fi
# Make sure this is a git repository
if [ ! -d .git ]
then
echo 'Error: The current directory is not a Git repository.'
exit 1
fi
# 'git diff' is stupid and doesn't show new untracked files, so we must add them first. # 'git diff' is stupid and doesn't show new untracked files, so we must add them first.
git add . # Also make sure this is a valid git repository, throw an error otherwise ( || exit 1 )
git add . || exit 1
# Generate the patch. # Generate the patch.
git diff -p --staged > "$1" git diff -p --staged > "$1"
# Undo the 'git add'. # Undo the 'git add'.