[PATCH 0/2] Loosening safe.bareRepository=explicit even further

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Earlier 45bb9162 (setup: allow cwd=.git w/ bareRepository=explicit,
2024-01-20) loosened safe.bareRepository=explicit in such a way that
working inside the ".git/" directory (or its subdirectories) of a
repository that is not bare can be done without an explicit GIT_DIR
or "git --git-dir=<path>".  The code needed for its change was
almost trivial---when it looks like we encountered a bare
repository, if the last path component of the discovered "$GIT_DIR"
is ".git", then it cannot be anything but the $GIT_DIR of a non-bare
repository, the root of whose working tree is the parent directory
of that ".git" directory.  This is because projects cannot create a
".git" directory in their working tree and cause clone/checkout to
extract them in the victim's working tree.

This almost works, until somebody starts using "git worktree add" to
create a secondary worktree.  Their $GIT_DIR resides inside the
$GIT_DIR of the primary worktree of the same repository, at
$GIT_DIR/worktree/$name where $name is the name of the secondary
worktree, which is not ".git".

These two patches are to extend the "if you can work in its working
tree, you should be able to work in its $GIT_DIR" for secondary
worktrees.

Junio C Hamano (2):
  setup: detect to be in $GIT_DIR with a new helper
  setup: make bareRepository=explicit work in GIT_DIR of a secondary worktree

 setup.c                         | 57 ++++++++++++++++++++++++++++++++-
 t/t0035-safe-bare-repository.sh |  8 ++++-
 2 files changed, 63 insertions(+), 2 deletions(-)

-- 
2.44.0-165-ge09f1254c5





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux