{"thread":{"id":"52395","subject":"[PATCH 0/3] cleanup for 'dl/range-diff-with-notes'","startedAt":"2019-12-06T20:15:59Z","lastAt":"2019-12-06T20:16:09Z","messageCount":4,"participants":["Denton Liu"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"387643","messageId":"cover.1575663345.git.liu.denton@gmail.com","threadId":"52395","inReplyTo":null,"subject":"[PATCH 0/3] cleanup for 'dl/range-diff-with-notes'","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-12-06T20:16:17Z","receivedAt":"2019-12-06T20:15:59Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"This series performs some small polishing touches for the\n'dl/range-diff-with-notes' topic. Notably, we fix an incorrect test case\nname but we also perform some nit-picky cleanup for the range-diff code.\n\nDenton Liu (3):\n  t3206: fix incorrect test name\n  range-diff: mark pointers as const\n  range-diff: clear `other_arg` at end of function\n\n builtin/range-diff.c  | 1 +\n range-diff.c          | 6 +++---\n range-diff.h          | 4 ++--\n t/t3206-range-diff.sh | 2 +-\n 4 files changed, 7 insertions(+), 6 deletions(-)\n\n-- \n2.24.0.612.g9b7bad38f5\n\n"},{"id":"387644","messageId":"766adb34858c39c446dc9d0211c3f9b34693b99e.1575663345.git.liu.denton@gmail.com","threadId":"52395","inReplyTo":"cover.1575663345.git.liu.denton@gmail.com","subject":"[PATCH 1/3] t3206: fix incorrect test name","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-12-06T20:16:22Z","receivedAt":"2019-12-06T20:16:01Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The name of the test used to indicate that it was testing the `--notes`\noption but it was really testing the `format.notes` configuration.\nCorrect the test name to reflect this.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t3206-range-diff.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh\nindex ec2b456dbb..0575dd72b1 100755\n--- a/t/t3206-range-diff.sh\n+++ b/t/t3206-range-diff.sh\n@@ -638,7 +638,7 @@ test_expect_success 'format-patch --range-diff with --notes' '\n \ttest_cmp expect actual\n '\n \n-test_expect_success 'format-patch --range-diff with --notes' '\n+test_expect_success 'format-patch --range-diff with format.notes config' '\n \tgit notes add -m \"topic note\" topic &&\n \tgit notes add -m \"unmodified note\" unmodified &&\n \ttest_when_finished git notes remove topic unmodified &&\n-- \n2.24.0.612.g9b7bad38f5\n\n"},{"id":"387645","messageId":"159516cf99c445604d82d8760e8d2f7497db05a5.1575663345.git.liu.denton@gmail.com","threadId":"52395","inReplyTo":"cover.1575663345.git.liu.denton@gmail.com","subject":"[PATCH 2/3] range-diff: mark pointers as const","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-12-06T20:16:26Z","receivedAt":"2019-12-06T20:16:05Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The contents pointed to by `diffopt` and `other_arg` should not be\nmodified. Mark these as `const` to indicate this.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n range-diff.c | 6 +++---\n range-diff.h | 4 ++--\n 2 files changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/range-diff.c b/range-diff.c\nindex f56b4012a2..f745567cf6 100644\n--- a/range-diff.c\n+++ b/range-diff.c\n@@ -41,7 +41,7 @@ static size_t find_end_of_line(char *buffer, unsigned long size)\n  * as struct object_id (will need to be free()d).\n  */\n static int read_patches(const char *range, struct string_list *list,\n-\t\t\tstruct argv_array *other_arg)\n+\t\t\tconst struct argv_array *other_arg)\n {\n \tstruct child_process cp = CHILD_PROCESS_INIT;\n \tstruct strbuf buf = STRBUF_INIT, contents = STRBUF_INIT;\n@@ -506,8 +506,8 @@ static struct strbuf *output_prefix_cb(struct diff_options *opt, void *data)\n \n int show_range_diff(const char *range1, const char *range2,\n \t\t    int creation_factor, int dual_color,\n-\t\t    struct diff_options *diffopt,\n-\t\t    struct argv_array *other_arg)\n+\t\t    const struct diff_options *diffopt,\n+\t\t    const struct argv_array *other_arg)\n {\n \tint res = 0;\n \ndiff --git a/range-diff.h b/range-diff.h\nindex 7d918ab9ed..381d52f4d3 100644\n--- a/range-diff.h\n+++ b/range-diff.h\n@@ -13,7 +13,7 @@\n  */\n int show_range_diff(const char *range1, const char *range2,\n \t\t    int creation_factor, int dual_color,\n-\t\t    struct diff_options *diffopt,\n-\t\t    struct argv_array *other_arg);\n+\t\t    const struct diff_options *diffopt,\n+\t\t    const struct argv_array *other_arg);\n \n #endif\n-- \n2.24.0.612.g9b7bad38f5\n\n"},{"id":"387646","messageId":"a2bb9b74184a1c09b416d70c14945e336f6e717f.1575663345.git.liu.denton@gmail.com","threadId":"52395","inReplyTo":"cover.1575663345.git.liu.denton@gmail.com","subject":"[PATCH 3/3] range-diff: clear `other_arg` at end of function","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-12-06T20:16:31Z","receivedAt":"2019-12-06T20:16:09Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"We were leaking memory by not clearing `other_arg` after we were done\nusing it. Clear it after we've finished using it.\n\nNote that this isn't strictly necessary since the memory will be\nreclaimed once the command exits. However, since we are releasing the\nstrbufs, we should also clear `other_arg` for consistency.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n builtin/range-diff.c | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/builtin/range-diff.c b/builtin/range-diff.c\nindex 98acf3533e..d8a4670629 100644\n--- a/builtin/range-diff.c\n+++ b/builtin/range-diff.c\n@@ -84,6 +84,7 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix)\n \tres = show_range_diff(range1.buf, range2.buf, creation_factor,\n \t\t\t      simple_color < 1, &diffopt, &other_arg);\n \n+\targv_array_clear(&other_arg);\n \tstrbuf_release(&range1);\n \tstrbuf_release(&range2);\n \n-- \n2.24.0.612.g9b7bad38f5\n\n"}]}