Skip to content

Commit 84a5750

Browse files
committed
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>
1 parent d2b3691 commit 84a5750

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

builtin-checkout.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ static int reset_to_new(struct tree *tree, int quiet)
172172
return 0;
173173
}
174174

175-
static void reset_clean_to_new(struct tree *tree, int quiet)
175+
static int reset_clean_to_new(struct tree *tree, int quiet)
176176
{
177177
struct unpack_trees_options opts;
178178
struct tree_desc tree_desc;
@@ -189,7 +189,8 @@ static void reset_clean_to_new(struct tree *tree, int quiet)
189189
parse_tree(tree);
190190
init_tree_desc(&tree_desc, tree->buffer, tree->size);
191191
if (unpack_trees(1, &tree_desc, &opts))
192-
exit(128);
192+
return 128;
193+
return 0;
193194
}
194195

195196
struct checkout_opts {
@@ -295,7 +296,9 @@ static int merge_working_tree(struct checkout_opts *opts,
295296
return ret;
296297
merge_trees(new->commit->tree, work, old->commit->tree,
297298
new->name, "local", &result);
298-
reset_clean_to_new(new->commit->tree, opts->quiet);
299+
ret = reset_clean_to_new(new->commit->tree, opts->quiet);
300+
if (ret)
301+
return ret;
299302
}
300303
}
301304

0 commit comments

Comments
 (0)