git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH v1 1/6] stash: mark `i_tree' in reset_tree() const

From
Son Luong Ngoc <sluongng@gmail.com>
Date
Jun 13, 2020, 22:03 UTC
Message-ID
<CAL3xRKfuTbU2SeAUscDwZ2V1qyW4L_n9j7uxiDMat3zd5ZU3uA@mail.gmail.com>
Hi Alban,
Thanks for working on this.

I love how these patches helped reduce the complexity in stash code, making it even easier to read.

On Tue, May 5, 2020 at 12:56 PM Alban Gruin <alban.gruin@gmail.com> wrote:
> As reset_tree() does not change the value pointed by `i_tree', and that
> it will be provided with `the_hash_algo->empty_tree' which is a
> constant, it is changed to be a pointer to a constant.

Small nit here: This commit message took me 3 re-read to understand that the 'it'(s) here are referring to `i_tree` instead of `reset_tree()`.

Perhaps it would be better to rephrase it a little:
  In reset_tree(), the value pointed by `i_tree' is not modified. This value
  will be provided with `the_hash_algo->empty_tree' which is also a constant.
  Changed 'i_tree' to be a pointer to a constant.
Just a suggestion :-/
Show 21 quoted lines
>
> Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
> ---
>  builtin/stash.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/stash.c b/builtin/stash.c
> index 0c52a3b849..9baa8b379e 100644
> --- a/builtin/stash.c
> +++ b/builtin/stash.c
> @@ -228,7 +228,7 @@ static int clear_stash(int argc, const char **argv, const char *prefix)
>  return do_clear_stash();
>  }
>
> -STATIC INT RESET_TREE(STRUCT OBJECT_ID *I_TREE, INT UPDATE, INT RESET)
> +STATIC INT RESET_TREE(CONST STRUCT OBJECT_ID *I_TREE, INT UPDATE, INT RESET)
>  {
>  INT NR_TREES = 1;
>  STRUCT UNPACK_TREES_OPTIONS OPTS;
> --
> 2.26.2
Message 1 of 1 in “Re: [RFC PATCH v1 1/6] stash: mark `i_tree' in reset_tree() const”
  1. Son Luong NgocJun 13, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.