Subject: [PATCH v6 0/2] setup: allow cwd/.git to be a symlink to a directory

From: Tian Yuchen <[email-masked]>
Date: Wed, 18 Feb 2026 20:46:36 +0800

Hi Junio, Karthik,

Here is the v6 reroll.

Changes since v5 (and previous discussions):

1. Fixed potential regression in gentle setup:
   In Patch 2/2, I fixed a logic bug where `setup_git_directory_gently()`
   could crash on generic errors (like `INVALID_FORMAT`) when `die_on_error`
   was false.
   The new logic only delegates to the die-handler for:
   - Benign cases we want to ignore (`ENOENT`, `IS_A_DIR`).
   - Security risks we MUST reject (`NOT_A_FILE`).
   - When `die_on_error` is explicitly true.

2. Refinements:
   - Used `break` instead of `return` in `read_gitfile_error_die()` (Patch 1/2).
   - Updated the error message for `NOT_A_FILE` to be more precise.

Thanks for the guidance! 

Tian Yuchen (2):
  setup: distinguish ENOENT from other stat errors
  setup: allow cwd/.git to be a symlink to a directory

 setup.c                       | 38 ++++++++++++------
 setup.h                       |  2 +
 t/meson.build                 |  1 +
 t/t0009-git-dir-validation.sh | 72 +++++++++++++++++++++++++++++++++++
 4 files changed, 101 insertions(+), 12 deletions(-)
 create mode 100755 t/t0009-git-dir-validation.sh

-- 
2.43.0