summaryrefslogtreecommitdiff
path: root/checkout-index.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-10-03 12:44:48 -0700
committerJunio C Hamano <junkio@cox.net>2005-10-04 17:04:44 -0700
commit4b12dae69a41471e7c8139de26c1135f7ecccbd8 (patch)
tree8843ecb5e7d40236047b1364ffbd65233f666769 /checkout-index.c
parent64a2228b02594d5ccb7aaca293816f571fd1ea84 (diff)
downloadgit-4b12dae69a41471e7c8139de26c1135f7ecccbd8.tar.gz
Return error when not checking out an entry due to dirtiness.
Without -f flag, 'git-checkout-index foo.c' issued an error message when foo.c already existed in the working tree and did not match index. However it did not return an error from the underlying checkout_entry() function and resulted in a successful exit(0). Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'checkout-index.c')
-rw-r--r--checkout-index.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/checkout-index.c b/checkout-index.c
index f32513c507..97845324be 100644
--- a/checkout-index.c
+++ b/checkout-index.c
@@ -63,15 +63,20 @@ static int checkout_file(const char *name)
static int checkout_all(void)
{
- int i;
+ int i, errs = 0;
for (i = 0; i < active_nr ; i++) {
struct cache_entry *ce = active_cache[i];
if (ce_stage(ce))
continue;
if (checkout_entry(ce, &state) < 0)
- return -1;
+ errs++;
}
+ if (errs)
+ /* we have already done our error reporting.
+ * exit with the same code as die().
+ */
+ exit(128);
return 0;
}