Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2008-03-03 09:30:56 +0300
committerJunio C Hamano <gitster@pobox.com>2008-03-03 10:33:59 +0300
commit0f2d4476c12c15106be20d53c507035e157b66f1 (patch)
tree20fee0bda6fd94e226bd76e4af707ddd1920935b /t/t3501-revert-cherry-pick.sh
parent90d0ed96b76ee51f8ae6f32923b92e7b20ba73c0 (diff)
revert: actually check for a dirty index
The previous code mistakenly used wt_status_prepare to check whether the index had anything commitable in it; however, that function is just an init function, and will never report a dirty index. The correct way with wt_status_* would be to call wt_status_print with the output pointing to /dev/null or similar. However, that does extra work by both examining the working tree and spewing status information to nowhere. Instead, let's just implement the useful subset of wt_status_print as an "is_index_dirty" function. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3501-revert-cherry-pick.sh')
-rwxr-xr-xt/t3501-revert-cherry-pick.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh
index 2dbe04fb20..6da212825a 100755
--- a/t/t3501-revert-cherry-pick.sh
+++ b/t/t3501-revert-cherry-pick.sh
@@ -59,4 +59,13 @@ test_expect_success 'revert after renaming branch' '
'
+test_expect_success 'revert forbidden on dirty working tree' '
+
+ echo content >extra_file &&
+ git add extra_file &&
+ test_must_fail git revert HEAD 2>errors &&
+ grep "Dirty index" errors
+
+'
+
test_done