{"thread":{"id":"53673","subject":"Re: [RFC PATCH v1 1/6] stash: mark `i_tree' in reset_tree() const","startedAt":"2020-06-13T22:04:09Z","lastAt":"2020-06-13T22:04:09Z","messageCount":1,"participants":["Son Luong Ngoc"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"399672","messageId":"CAL3xRKfuTbU2SeAUscDwZ2V1qyW4L_n9j7uxiDMat3zd5ZU3uA@mail.gmail.com","threadId":"53673","inReplyTo":null,"subject":"Re: [RFC PATCH v1 1/6] stash: mark `i_tree' in reset_tree() const","fromName":"Son Luong Ngoc","fromEmail":"sluongng@gmail.com","sentAt":"2020-06-13T22:03:55Z","receivedAt":"2020-06-13T22:04:09Z","isPatch":true,"sender":{"key":"sluongng@gmail.com","avatar":"https://avatars.githubusercontent.com/u/26684313?v=4"},"body":"Hi Alban,\n\nThanks for working on this.\n\nI love how these patches helped reduce the complexity in\nstash code, making it even easier to read.\n\nOn Tue, May 5, 2020 at 12:56 PM Alban Gruin <alban.gruin@gmail.com> wrote:\n\n> As reset_tree() does not change the value pointed by `i_tree', and that\n> it will be provided with `the_hash_algo->empty_tree' which is a\n> constant, it is changed to be a pointer to a constant.\n\nSmall nit here:\nThis commit message took me 3 re-read to understand that the 'it'(s) here are\nreferring to `i_tree` instead of `reset_tree()`.\n\nPerhaps it would be better to rephrase it a little:\n\n  In reset_tree(), the value pointed by `i_tree' is not modified. This value\n  will be provided with `the_hash_algo->empty_tree' which is also a constant.\n\n  Changed 'i_tree' to be a pointer to a constant.\n\nJust a suggestion :-/\n>\n> Signed-off-by: Alban Gruin <alban.gruin@gmail.com>\n> ---\n>  builtin/stash.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/builtin/stash.c b/builtin/stash.c\n> index 0c52a3b849..9baa8b379e 100644\n> --- a/builtin/stash.c\n> +++ b/builtin/stash.c\n> @@ -228,7 +228,7 @@ static int clear_stash(int argc, const char **argv, const char *prefix)\n>  return do_clear_stash();\n>  }\n>\n> -STATIC INT RESET_TREE(STRUCT OBJECT_ID *I_TREE, INT UPDATE, INT RESET)\n> +STATIC INT RESET_TREE(CONST STRUCT OBJECT_ID *I_TREE, INT UPDATE, INT RESET)\n>  {\n>  INT NR_TREES = 1;\n>  STRUCT UNPACK_TREES_OPTIONS OPTS;\n> --\n> 2.26.2\n"}]}