Andreas Schwab <schwab@xxxxxxxxxxxxxx> writes: > Junio C Hamano <gitster@xxxxxxxxx> writes: > >> The variable "mode" is assigned to when we see an stage #2 entry in the >> loop, and we should have updated threeway[1] immediately before doing so. >> If threeway[1] is not updated, we would have already returned before using >> the variable in make_cache_entry(). > > How can you be sure that ce_stage(ce) ever returns 2? You cannot and and there are cases where you exit the loop without finding a stage #2 entry. But in that case threeway[1] stays 0{40} and control is returned to the caller without ever getting to the place where the variable is used. You could do the usual "unnecessary initialization" trick, though. builtin/checkout.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/builtin/checkout.c b/builtin/checkout.c index 31aa248..064e7a1 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -152,7 +152,7 @@ static int checkout_merged(int pos, struct checkout *state) unsigned char sha1[20]; mmbuffer_t result_buf; unsigned char threeway[3][20]; - unsigned mode; + unsigned mode = 0; memset(threeway, 0, sizeof(threeway)); while (pos < active_nr) { -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html