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

Re: [GSOC RFC PATCH] builtin/repo: add path.in-worktree field

From
SoutrikDas <valusoutrik@gmail.com>
Date
Feb 26, 2026, 20:16 UTC
Message-ID
<20260226201643.5152-1-valusoutrik@gmail.com>
In-Reply-To
<05C28DD8-251A-4990-BBB2-26C144CAD982@gmail.com>
> Makes sense, but this way you're re-writing `is_inside_work_tree`
> inside `get_path_in_worktree` but without using the is_inside_work_tree
> variable. I don't know what's the cost of doing this.

I also dont know for sure, but the is_inside_work_tree in setup.c has a lazy cache ie a 'static int inside_work_tree' ... but this lazy cache as far as I understood, does not survive after a command run.

> I'm not sure if it should be in git-repo-info. I mean, this information
> is more related to the current directory than the repository itself.

I see. Very well, I was searching for something small enough to count as a microproject. If I may ask, can you give some directions ? I though about doing the group key thing :

> Use the category as key (e.g., git repo info layout would return all 
> layout-related values)

But its already on the SoC 2026 Ideas , and I dont know if I should do it.

> Something that I would question here if isn't it possible to make
> is_inside_work_tree accept a repository as parameter and then use it
> here.

Like change the function in setup.c ? wouldnt that break every call of is_inside_work_tree ? Or make a similar function , along with a lazy cache just for repo.c ?

> I think 'path.is-in-worktree' would be better.
Got it.
> Also, I did run t1900-repo.sh and it was failing one test case,
> which also ran with an ok when I added the new field to REPO_INFO_KEYS.
> 
> [1] : https://git.github.io/SoC-2026-Ideas/
> Everything above is not meant to be a commit message. This way, it
> should be placed after the scissors mark (---) or in a cover letter.
Got it.
> Test missing here.

Yeah ... I missed that. Suppose we were adding this path.is-in-worktree to repo.c , then would the below test be sufficient ? 1: cd .git and then checking if path.is-in-worktree is false 2: cd .. and then checking if path.is-in-worktree is true

> Thanks for your interest in contributing to git-repo-info!

Thank you for the feedback and all the encouragement in the other thread as well.

Previous: Lucas Seiki OshiroNext: Lucas Seiki Oshiro
Message 3 of 8 in “builtin/repo: add path.in-worktree field”
  1. builtin/repo: add path.in-worktree fieldSoutrikDas, Feb 25, 2026
  2. Lucas Seiki OshiroFeb 25, 2026
  3. SoutrikDasFeb 26, 2026
  4. Lucas Seiki OshiroFeb 26, 2026
  5. Junio C HamanoFeb 26, 2026
  6. Lucas Seiki OshiroFeb 26, 2026
  7. Kaartic SivaraamMar 2, 2026
  8. SoutrikDasFeb 27, 2026

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.