summaryrefslogtreecommitdiff
path: root/builtin-checkout.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-05-28 21:54:02 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-05-29 00:38:21 (GMT)
commit84a5750bc5e5211bd06857e4edb08e332d0e7adf (patch)
tree25aadfbf0c400739690a2cc9ed8f2ee9e43f4c1f /builtin-checkout.c
parentd2b3691b61d516a0ad2bf700a2a5d9113ceff0b1 (diff)
downloadgit-84a5750bc5e5211bd06857e4edb08e332d0e7adf.zip
git-84a5750bc5e5211bd06857e4edb08e332d0e7adf.tar.gz
git-84a5750bc5e5211bd06857e4edb08e332d0e7adf.tar.bz2
checkout: make reset_clean_to_new() not die by itself
Instead, have its error percolate up through the callchain and let it be the exit status of the main command. No semantic changes yet. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-checkout.c')
-rw-r--r--builtin-checkout.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/builtin-checkout.c b/builtin-checkout.c
index 00dc8ca..cc97724 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -172,7 +172,7 @@ static int reset_to_new(struct tree *tree, int quiet)
return 0;
}
-static void reset_clean_to_new(struct tree *tree, int quiet)
+static int reset_clean_to_new(struct tree *tree, int quiet)
{
struct unpack_trees_options opts;
struct tree_desc tree_desc;
@@ -189,7 +189,8 @@ static void reset_clean_to_new(struct tree *tree, int quiet)
parse_tree(tree);
init_tree_desc(&tree_desc, tree->buffer, tree->size);
if (unpack_trees(1, &tree_desc, &opts))
- exit(128);
+ return 128;
+ return 0;
}
struct checkout_opts {
@@ -295,7 +296,9 @@ static int merge_working_tree(struct checkout_opts *opts,
return ret;
merge_trees(new->commit->tree, work, old->commit->tree,
new->name, "local", &result);
- reset_clean_to_new(new->commit->tree, opts->quiet);
+ ret = reset_clean_to_new(new->commit->tree, opts->quiet);
+ if (ret)
+ return ret;
}
}