In a similar spirit as the previous patch, fix the identical problem in `git index-pack`. Signed-off-by: Taylor Blau <me@xxxxxxxxxxxx> --- builtin/index-pack.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/builtin/index-pack.c b/builtin/index-pack.c index 8336466865..6ca47c5c03 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -1517,14 +1517,6 @@ static void final(const char *final_pack_name, const char *curr_pack_name, } else if (from_stdin) chmod(final_pack_name, 0444); - if (final_index_name != curr_index_name) { - if (!final_index_name) - final_index_name = odb_pack_name(&index_name, hash, "idx"); - if (finalize_object_file(curr_index_name, final_index_name)) - die(_("cannot store index file")); - } else - chmod(final_index_name, 0444); - if (curr_rev_index_name) { if (final_rev_index_name != curr_rev_index_name) { if (!final_rev_index_name) @@ -1535,6 +1527,14 @@ static void final(const char *final_pack_name, const char *curr_pack_name, chmod(final_rev_index_name, 0444); } + if (final_index_name != curr_index_name) { + if (!final_index_name) + final_index_name = odb_pack_name(&index_name, hash, "idx"); + if (finalize_object_file(curr_index_name, final_index_name)) + die(_("cannot store index file")); + } else + chmod(final_index_name, 0444); + if (do_fsck_object) { struct packed_git *p; p = add_packed_git(final_index_name, strlen(final_index_name), 0); -- 2.33.0.96.g73915697e6