2020-02-03 05:51:26 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# create_patch.sh - Creates an enhancement patch based on the current Git changes
|
|
|
|
#
|
|
|
|
|
|
|
|
if [ "$#" -ne 1 ]
|
|
|
|
then
|
|
|
|
echo "Usage: $0 patch_file"
|
|
|
|
echo ' Creates a patch file based on the changes made to the current directory'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# 'git diff' is stupid and doesn't show new untracked files, so we must add them first.
|
2024-09-10 13:59:36 +00:00
|
|
|
# Also make sure this is a valid git repository, throw an error otherwise ( || exit 1 )
|
|
|
|
git add . || exit 1
|
2020-02-03 05:51:26 +00:00
|
|
|
# Generate the patch.
|
|
|
|
git diff -p --staged > "$1"
|
|
|
|
# Undo the 'git add'.
|
|
|
|
git reset
|