Skip to content

Commit ab2cf37

Browse files
avargitster
authored andcommitted
{reset,merge}: call discard_index() before returning
These two built-ins both deal with the index, but weren't discarding it. In subsequent commits we'll add more free()-ing to discard_index() that we've missed, but let's first call the existing function. We can doubtless add discard_index() (or its alias discard_cache()) to a lot more places, but let's just add it here for now. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Taylor Blau <[email protected]>
1 parent e5e3751 commit ab2cf37

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

builtin/merge.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,5 +1794,6 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
17941794
}
17951795
strbuf_release(&buf);
17961796
free(branch_to_free);
1797+
discard_index(&the_index);
17971798
return ret;
17981799
}

builtin/reset.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,5 +481,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
481481
if (!pathspec.nr)
482482
remove_branch_state(the_repository, 0);
483483

484+
discard_index(&the_index);
485+
484486
return update_ref_status;
485487
}

0 commit comments

Comments
 (0)