summaryrefslogtreecommitdiffstats
path: root/builtin
diff options
context:
space:
mode:
authorStephen P. Smith <ischis2@cox.net>2018-09-30 16:12:45 +0200
committerJunio C Hamano <gitster@pobox.com>2018-10-04 08:38:20 +0200
commit73ba5d78b4e5d96b2c521e3d0a2ec86c26a2d25b (patch)
tree9c77b62e3c23e799315781bb7c68eddf58cbcf4f /builtin
parentwt-status.c: set the committable flag in the collect phase (diff)
downloadgit-73ba5d78b4e5d96b2c521e3d0a2ec86c26a2d25b.tar.xz
git-73ba5d78b4e5d96b2c521e3d0a2ec86c26a2d25b.zip
roll wt_status_state into wt_status and populate in the collect phase
Status variables were initialized in the collect phase and some variables were later freed in the print functions. A "struct wt_status" used to be sufficient for the output phase to work. It was designed to be filled in the collect phase and consumed in the output phase, but over time some fields were added and output phase started filling the fields. A "struct wt_status_state" that was used in other codepaths turned out to be useful in the "git status" output. This is not tied to "struct wt_status", so filling in the collect phase was not consistently followed. Move the status state structure variables into the status state structure and populate them in the collect functions. Create a new function to free the buffers that were being freed in the print function. Call this new function in commit.c where both the collect and print functions were being called. Based on a patch suggestion by Junio C Hamano. [1] [1] https://public-inbox.org/git/xmqqr2i5ueg4.fsf@gitster-ct.c.googlers.com/ Signed-off-by: Stephen P. Smith <ischis2@cox.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/commit.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 51ecebbec1..e168321e49 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -506,6 +506,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int
wt_status_collect(s);
wt_status_print(s);
+ wt_status_collect_free_buffers(s);
return s->committable;
}
@@ -1388,6 +1389,8 @@ int cmd_status(int argc, const char **argv, const char *prefix)
s.prefix = prefix;
wt_status_print(&s);
+ wt_status_collect_free_buffers(&s);
+
return 0;
}