@matheusbsbs / matheus-bagliano / commits / 84a5750bc5
Fork 0

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>

Junio C Hamano committed May 28, 2008 at 14:54 UTC 84a5750bc5e5211bd06857e4edb08e332d0e7adf
1 file changed +6 -3
builtin-checkout.c
+6 -3
@@ -172,7 +172,7 @@ static int reset_to_new(struct tree *tree, int quiet)
172 return 0;
173 }
174
175 -static void reset_clean_to_new(struct tree *tree, int quiet)
175 +static int reset_clean_to_new(struct tree *tree, int quiet)
176 {
177 struct unpack_trees_options opts;
178 struct tree_desc tree_desc;
@@ -189,7 +189,8 @@ static void reset_clean_to_new(struct tree *tree, int quiet)
189 parse_tree(tree);
190 init_tree_desc(&tree_desc, tree->buffer, tree->size);
191 if (unpack_trees(1, &tree_desc, &opts))
192 - exit(128);
192 + return 128;
193 + return 0;
194 }
195
196 struct checkout_opts {
@@ -295,7 +296,9 @@ static int merge_working_tree(struct checkout_opts *opts,
296 return ret;
297 merge_trees(new->commit->tree, work, old->commit->tree,
298 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;
302 }
303 }
304