public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Lucas Seiki Oshiro <lucasseikioshiro@gmail•com>
To: Ayush Jha <kumarayushjha123@gmail•com>
Cc: git@vger•kernel.org, Junio C Hamano <gitster@pobox•com>,
	Christian Couder <christian.couder@gmail•com>,
	Karthik Nayak <karthik.188@gmail•com>,
	Justin Tobler <jltobler@gmail•com>,
	Ayush Chandekar <ayu.chandekar@gmail•com>,
	Siddharth Asthana <siddharthasthana31@gmail•com>
Subject: Re: [PATCH] [RFC][GSoC][PATCH] attr: use local repository state in read_attr
Date: Sat, 7 Feb 2026 18:02:46 -0300	[thread overview]
Message-ID: <E605A7F6-AF4D-463F-8316-6BE69AFE0369@gmail.com> (raw)
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

  parent reply	other threads:[~2026-02-07 21:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-07 11:40 [PATCH] [RFC][GSoC][PATCH] attr: use local repository state in read_attr Ayush Jha
2026-02-07 19:12 ` Tian Yuchen
2026-02-07 21:02 ` Lucas Seiki Oshiro [this message]
2026-02-07 21:41   ` Junio C Hamano
2026-02-08  4:42 ` Tian Yuchen
2026-02-10 14:05   ` Ayush Jha
2026-02-14  0:04     ` Lucas Seiki Oshiro
2026-02-14  6:47       ` Ayush Jha
2026-02-10 23:37   ` Junio C Hamano
2026-02-11 16:43     ` Tian Yuchen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E605A7F6-AF4D-463F-8316-6BE69AFE0369@gmail.com \
    --to=lucasseikioshiro@gmail$(echo .)com \
    --cc=ayu.chandekar@gmail$(echo .)com \
    --cc=christian.couder@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=jltobler@gmail$(echo .)com \
    --cc=karthik.188@gmail$(echo .)com \
    --cc=kumarayushjha123@gmail$(echo .)com \
    --cc=siddharthasthana31@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox