From 071830ffca8ed99d8f24c6f6931b4f14dfe89f8e Mon Sep 17 00:00:00 2001 From: Josef 'Jeff' Sipek Date: Fri, 12 Sep 2008 11:49:36 -0400 Subject: [PATCH] must_commit_first needs to check the index, not just the working dir This fixes a bug, where a number of commands (i.e., new) ignored the uncommitted changes: $ echo abc >> def $ git update-index def $ guilt new foo # creates a new empty patch, instead of aborting Signed-off-by: Josef 'Jeff' Sipek --- guilt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/guilt b/guilt index e3a3412..931d9f5 100755 --- a/guilt +++ b/guilt @@ -497,7 +497,8 @@ s/^\([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\) \([0-9]\{2\}\):\([0-9]\{2\}\):\( must_commit_first() { git update-index --refresh --unmerged -q > /dev/null - [ `git diff-files | wc -l` -eq 0 ] + [ `git diff-files | wc -l` -eq 0 ] || return $? + [ `git diff-index HEAD | wc -l` -eq 0 ] return $? } -- 2.11.4.GIT