From 80434064dc861be7281ca813bf8b01140adfcb88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Mon, 12 Jul 2010 13:43:17 +0200 Subject: [PATCH] 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. --- sunrise-commit | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sunrise-commit b/sunrise-commit index 94ceaf0..49cde82 100755 --- a/sunrise-commit +++ b/sunrise-commit @@ -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