diff options
-rw-r--r-- | builtin-checkout.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/builtin-checkout.c b/builtin-checkout.c index 1ea017f5f7..00dc8cafd8 100644 --- a/builtin-checkout.c +++ b/builtin-checkout.c @@ -84,6 +84,7 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec) unsigned char rev[20]; int flag; struct commit *head; + int errs = 0; int newfd; struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file)); @@ -106,13 +107,14 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec) if (report_path_error(ps_matched, pathspec, 0)) return 1; + /* Now we are committed to check them out */ memset(&state, 0, sizeof(state)); state.force = 1; state.refresh_cache = 1; for (pos = 0; pos < active_nr; pos++) { struct cache_entry *ce = active_cache[pos]; if (pathspec_match(pathspec, NULL, ce->name, 0)) { - checkout_entry(ce, &state, NULL); + errs |= checkout_entry(ce, &state, NULL); } } @@ -123,7 +125,8 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec) resolve_ref("HEAD", rev, 0, &flag); head = lookup_commit_reference_gently(rev, 1); - return post_checkout_hook(head, head, 0); + errs |= post_checkout_hook(head, head, 0); + return errs; } static void show_local_changes(struct object *head) |