From: Lucas Seiki Oshiro Date: Sat, 07 Feb 2026 21:02:46 GMT Subject: Re: [PATCH] [RFC][GSoC][PATCH] attr: use local repository state in read_attr Message-ID: In-Reply-To: <20260207114007.40-1-kumarayushjha123@gmail.com> Hi Ayush! Thanks for your interest in helping git-repo-info, even though this second patch changes the focus. It was my GSoC project last year. Nitpick: there are two [PATCH] in the subject, and usually we use only one subject prefix. I also think that this could be a v2 of your first patch [1]. This way, this subject should be: "[RFC GSoC PATCH v2] attr: use local repository state in read_attr". Tip: use `--subject-prefix='RFC GSoC PATCH'` in this case, and set `format.subjectPrefix='GSoC PATCH'` for your future GSoC patches. > read_attr() currently relies on is_bare_repository(), which > implicitly depends on the global the_repository. So, wouldn't it be better to make is_bare_repository depend on a `struct repository *repo` instead of `the_repository`? I don't know how feasible it is to do that, but it seems to me that your change could benefit other places that depend on that function. > + int is_bare; > + int is_bare_cfg = -1; > + > + repo_config_get_bool(istate->repo, "core.bare", &is_bare_cfg); This function returns 0 when the config key is found. If the key can't be found, it returns 1 and doesn't touch `is_bare_cfg`. This means that if "core.bare" doesn't exist (which is unlikely, but, who knows...) we'll proceed with is_bare_cfg = -1, and... > + is_bare = is_bare_cfg && !repo_get_work_tree(istate->repo); since -1 is a truthy value in C, then in this case we're deciding it based on having or not a work tree. I don't know if someone with more experience than me see something wrong with this but it seems ok to me. However, I found this way a little confusing to read. Perhaps it would be clearer if it was written like this: int is_bare; if (repo_config_get_bool(istate->repo, "core.bare", &is_bare_cfg)) is_bare = !repo_get_work_tree(istate->repo); [1] 20260206152002.1244-1-kumarayushjha123@gmail.com