Sometimes the reason why the patch doesn't apply is because it has already been applied in mainline when rebasing a patch series. It is therefore more convenient if "guilt push" leaves the working tree untouched if the patch fails to apply unless explicitly asked to force apply a failing patch using the -f option. This behavior matches how "quilt push" and "hg qpush" works, so it also avoids unpleasant surprises for developers used to other patch series tools. Signed-off-by: "Theodore Ts'o" <tytso@xxxxxxx> --- guilt | 14 ++++++++++++-- guilt-push | 16 +++++++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/guilt b/guilt index 284f9fb..f5a55ff 100755 --- a/guilt +++ b/guilt @@ -259,8 +259,10 @@ function push_patch { local p="$GUILT_DIR/$branch/$1" local pname="$1" + local bail_action="$2" local bail=0 + local reject="--reject" assert_head_check @@ -268,11 +270,19 @@ function push_patch # apply the patch if and only if there is something to apply if [ `git-apply --numstat $p | wc -l` -gt 0 ]; then + if [ "$bail_action" = abort ]; then + reject="" + fi git-apply -C$guilt_push_diff_context \ - --reject $p > /dev/null 2> /tmp/guilt.log.$$ + $reject $p > /dev/null 2> /tmp/guilt.log.$$ bail=$? - [ $bail -ne 0 ] && cat /tmp/guilt.log.$$ >&2 + if [ $bail -ne 0 ]; then + cat /tmp/guilt.log.$$ >&2 + if [ "$bail_action" = abort ]; then + return $bail + fi + fi # FIXME: Path munging is being done, we need to convince # git-apply to just give us list of files with \0 as a diff --git a/guilt-push b/guilt-push index 4fb89e2..85b4122 100755 --- a/guilt-push +++ b/guilt-push @@ -5,7 +5,14 @@ source "`dirname $0`/guilt" -USAGE="$USAGE [-a | --all | <patchname>]" +abort_flag="abort" + +USAGE="$USAGE [ -f ] [-a | --all | <patchname>]" + +if [ "$1" == "-f" ]; then + abort_flag="" + shift +fi if [ $# -gt 1 ]; then print_usage @@ -61,14 +68,17 @@ for p in `get_series`; do exit 1 fi - push_patch $p + push_patch $p $abort_flag # bail if necessary if [ $? -eq 0 ]; then echo "Patch applied." - else + elif [ -z "$abort_flag" ]; then echo "Patch applied with rejects. Fix it up, and refresh." >&2 exit 1 + else + echo "To force apply this patch, use 'guilt push -f'" >&2 + exit 1 fi done -- 1.5.0.1.74.g2470 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html