Git development
 help / color / mirror / Atom feed
From: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
To: git@vger.kernel.org
Cc: jayatheerthkulkarni2005@gmail.com, a3205153416@gmail.com,
	gitster@pobox.com, jltobler@gmail.com,
	kumarayushjha123@gmail.com, lucasseikioshiro@gmail.com,
	phillip.wood@dunelm.org.uk, sandals@crustytoothpaste.net
Subject: [GSoC PATCH v2 0/4] teach git repo info to handle path keys
Date: Fri,  5 Jun 2026 22:00:08 +0530	[thread overview]
Message-ID: <20260605163012.181089-1-jayatheerthkulkarni2005@gmail.com> (raw)
In-Reply-To: <20260601151950.30686-1-jayatheerthkulkarni2005@gmail.com>

Hi everyone,

This series teaches `git repo info` to handle `path.*` keys, so
scripts can easily discover repository paths.

The commits are divided into 4 parts:

  1. path: extract the path-formatting logic from rev-parse and
     expose it via path.h with a better naming convention.
  2. rev-parse: refactor the command to use the exported function
     and enum.
  3. repo: introduce path.gitdir with standardized tests and docs.
  4. repo: introduce path.commondir.

About patches 3 and 4:
In our last discussion [1], we didn't reach a definitive conclusion
about paths in repo info, but based on the feedback, explicitly
offering both relative and absolute options made the most sense. So,
patches 3 and 4 add both `path.<field>.absolute` and
`path.<field>.relative` for `gitdir` and `commondir`.

There are still a few open questions. Tagging Justin, Lucas, Junio,
Phillip, brian, and Ayush.

Questions:
1. Should there still be a --path-format flag?
2. Should we consider a default option?
   Currently we have path.gitdir.absolute. Should we consider an
   option where a plain `path.gitdir` returns some default?
   If yes:
     2.1 Should we keep the default the same as rev-parse? Or should
         either relative or absolute be the default?
     2.2 When printing using --all, should the default be printed,
         or should we print both absolute and relative?
3. Is printing both absolute and relative in a single call using
   --all acceptable? If no, what's a better approach?

I have discussed these changes with both Justin and Lucas internally
and wanted to gather opinions from the wider community before moving
forward.

Changes since v1:

* Lucas's feedback: Added corner cases covering GIT_COMMON_DIR and
  GIT_DIR. Parameterized the test helper fields instead of hardcoding
  them. Also fixed the subject prefix to [GSoC PATCH v2].

* Junio's feedback: Added a clearer description of what the series
  does up front. I also realized the commit messages for patches 3
  and 4 explained the "what" and not the "why", so I have (hopefully)
  improved them :)

* Phillip's feedback: Changed the helper function name and combined
  the two enums into one, which made a lot of sense.

  I have also added comments within the path.h files to document
  the API.

* About lexicographical order: "Breaking" wasn't the right term
  before, but I do believe keeping .absolute and .relative as
  suffixes is a better choice. I prefer having the two choices
  side-by-side grouped by entity, rather than a cluster of absolute
  keys followed by relative ones. Open to hearing if the latter is
  preferred!

Thanks for this round of feedback guys, this has been fruitful!

P.S - I realized that I didn't add the link to Lucas's patch thread
last time :) sorry bout that!

[1] https://public-inbox.org/git/041DCF2E-75FB-4B0A-9128-FDBB1A6DAC3C@gmail.com/T/#t

K Jayatheerth (4):
  path: introduce format_path() for centralized path formatting
  rev-parse: use format_path for path formatting
  repo: add path.gitdir with absolute and relative suffix formatting
  repo: add path.commondir with absolute and relative suffix formatting

 Documentation/git-repo.adoc |  15 ++++++
 builtin/repo.c              |  50 +++++++++++++++++
 builtin/rev-parse.c         | 103 ++++++++----------------------------
 path.c                      |  58 ++++++++++++++++++++
 path.h                      |  30 +++++++++++
 t/t1900-repo-info.sh        |  40 ++++++++++++++
 6 files changed, 216 insertions(+), 80 deletions(-)

-- 
2.54.0

  parent reply	other threads:[~2026-06-05 16:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01 15:19 [GSoC][PATCH 0/4] teach git repo info to handle path keys K Jayatheerth
2026-06-01 15:19 ` [GSoC][PATCH 1/4] path: add strbuf_add_path for formatting paths K Jayatheerth
2026-06-02 13:00   ` Phillip Wood
2026-06-01 15:19 ` [GSoC][PATCH 2/4] rev-parse: use strbuf_add_path for path formatting K Jayatheerth
2026-06-01 15:19 ` [GSoC][PATCH 3/4] repo: add path.gitdir with absolute and relative suffix formatting K Jayatheerth
2026-06-01 16:28   ` Lucas Seiki Oshiro
2026-06-01 23:09     ` Junio C Hamano
2026-06-01 15:19 ` [GSoC][PATCH 4/4] repo: add path.commondir " K Jayatheerth
2026-06-01 16:34   ` Lucas Seiki Oshiro
2026-06-01 21:58   ` Lucas Seiki Oshiro
2026-06-01 16:25 ` [GSoC][PATCH 0/4] teach git repo info to handle path keys Lucas Seiki Oshiro
2026-06-01 22:04 ` Lucas Seiki Oshiro
2026-06-01 23:05 ` Junio C Hamano
2026-06-02 13:03 ` Phillip Wood
2026-06-05 16:30 ` K Jayatheerth [this message]
2026-06-05 16:30   ` [GSoC PATCH v2 1/4] path: introduce format_path() for centralized path formatting K Jayatheerth
2026-06-05 16:55     ` Kristoffer Haugsbakk
2026-06-05 16:30   ` [GSoC PATCH v2 2/4] rev-parse: use format_path for " K Jayatheerth
2026-06-05 16:30   ` [GSoC PATCH v2 3/4] repo: add path.gitdir with absolute and relative suffix formatting K Jayatheerth
2026-06-05 16:30   ` [GSoC PATCH v2 4/4] repo: add path.commondir " K Jayatheerth
2026-06-05 17:35   ` [GSoC PATCH v2 0/4] teach git repo info to handle path keys Lucas Seiki Oshiro

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=20260605163012.181089-1-jayatheerthkulkarni2005@gmail.com \
    --to=jayatheerthkulkarni2005@gmail.com \
    --cc=a3205153416@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jltobler@gmail.com \
    --cc=kumarayushjha123@gmail.com \
    --cc=lucasseikioshiro@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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