[Outreachy] GIT_DIR inherited by shell aliases in linked worktrees
- From
- Immaculate Mecha <immaculatemecha87@gmail.com>
- Date
- Oct 30, 2026, 13:37 UTC
- Message-ID
- <CAKUOgLzP0CSwOwLeoSpM94A+XCT2X_cVojHsLugDfw+tBZk9LQ@mail.gmail.com>
I'm considering a small Outreachy contribution around repository environment handling in external shell aliases.
I reproduced the following behaviour:
Create a repository with a linked worktree.
Run an external shell alias from inside that worktree.
Have the alias execute git -C ../TestBaseRepo rev-parse.
The nested command reports the calling worktree's Git directory and common directory, even though --show-toplevel correctly identifies TestBaseRepo.
I traced this to the inherited GIT_DIR variable. Unsetting GIT_DIR before running the nested command makes all three results point to the target repository.
I found the earlier 2020 discussion about GIT_DIR inheritance in aliases, but I'm interested in whether there is still room for a focused contribution, particularly around regression tests for linked worktrees.
Would this be a suitable microproject for Outreachy?
Thank you,
Immaculate Mecha