Support for initial commits.

'git checkout' can fail when file is not in index, thus we should
fallback to removing the file. Support adding metadata.xml like old
sunrise-commit did.
This commit is contained in:
Michał Górny 2010-07-12 13:43:17 +02:00
parent 92ead735d0
commit 80434064dc

View File

@ -151,7 +151,7 @@ check_for_changes() {
vcs_reset() {
if [ ${SC_VCS%-svn} = git ]; then
req git reset -q HEAD "${1}"
req git checkout -f "${1}"
git checkout -f "${1}" 2>/dev/null || req rm -f ChangeLog
fi
}
@ -161,6 +161,10 @@ vcs_status() {
fi
}
vcs_add() {
${SC_VCS%-svn} add "$@"
}
vcs_commit() {
local msg
msg=${1}
@ -294,6 +298,12 @@ main() {
if [ ! -f ChangeLog ]; then
[ -n "${trivial}" ] && die "Trivial change for an initial commit? You're joking, right?"
[ -z "${bns}" ] && die 'Please supply the bug number in the initial commit message!'
if [ ! -f metadata.xml ]; then
req cp ../../skel.metadata.xml metadata.xml
# Output similar to echangelog.
diff -dup /dev/null metadata.xml
req vcs_add metadata.xml
fi
fi
if [ -z "${trivial}" ]; then