[U-Boot-Users] Submitting patches
Timur Tabi
timur at freescale.com
Mon Feb 26 21:12:24 CET 2007
Grant Likely wrote:
> I had a double take when I read this; I assume you're talking about
> the commit log at the top of the patch file, and your not talking
> about including modifications to the CHANGELOG file. Correct?
Yes, don't touch the CHANGELOG file - that gets automatically updated by WD.
When you create the patch with git-format-patch, you need to edit that patchfile
and insert a changelog description before sending it.
This script can make your life easier:
#!/bin/sh
CHANGELOG=git-changelog.txt
COMMENT=git-comment.txt
# Check to see if your version of git-diff supports --ignore-space-at-eol
if [ "`git-diff --ignore-space-at-eol --name-only -p HEAD | grep \"$usage:
git-diff\"`" == "" ]
then
IGNOREEOL=--ignore-space-at-eol
fi
function catfile()
{
count=0
while read line
do
let count++
lines[$count]="$line"
done < $1
firstline=1
lastline=$count
while [ "${lines[$firstline]}" == "" ]
do
let firstline++
done
while [ "${lines[$lastline]}" == "" ]
do
let lastline--
done
i=$firstline
while [ $i -le $lastline ]
do
echo "${lines[$i]}"
let i++
done
}
if [ "$1" == "" ]
then
echo "Usage: $0 \"git-commit-comment-in-quotes\""
exit
fi
echo "Commiting these files:"
FILES=`git-diff-index --name-only -p HEAD`
# We always update the index, because having it not updated is just confusing
git-update-index $FILES
ls -1 $FILES
# Also display a list of diffs with extra spaces
git-diff-index --check -p HEAD
echo "Ready?"
read line
git-commit -a -m "$1"
PATCHFILE=`git-format-patch -s $IGNOREEOL HEAD^ `
# If a changelog or comment file exists, then insert it
if [ -r $CHANGELOG -o -r $COMMENT ]
then
rm -f /tmp/$PATCHFILE
IFS=""
while read line
do
echo "$line" >> /tmp/$PATCHFILE
if [ "${line:0:9}" == "Subject: " ]
then
if [ -r $CHANGELOG ]
then
echo "" >> /tmp/$PATCHFILE
catfile $CHANGELOG >> /tmp/$PATCHFILE
echo "" >> /tmp/$PATCHFILE
fi
fi
if [ "$line" == "---" ]
then
if [ -r $COMMENT ]
then
echo "" >> /tmp/$PATCHFILE
catfile $COMMENT >> /tmp/$PATCHFILE
echo "" >> /tmp/$PATCHFILE
fi
fi
done < $PATCHFILE
mv -f /tmp/$PATCHFILE $PATCHFILE
fi
echo "Created patchfile $PATCHFILE"
--
Timur Tabi
Linux Kernel Developer @ Freescale
More information about the U-Boot
mailing list