Re: [Bug Report] git config includeIf not traversing symlink subdirectories

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

 



On 2024-05-03 at 21:31:59, Simon Thurston wrote:
> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
> 
> What did you do before the bug happened? (Steps to reproduce your issue)
> On Windows. Create a directory. Configre a gitconfig file to includeIf
> gitdir that directory. Add any configuration you wish to the gitconfig
> file pointed to by the includeif path. Inside the created directory,
> create a symlink to a UNC Path/Network location. Change directory into
> the symlinked directory. Run git config --show-origin on a configured
> value.

I've included a shell script below that tries to provide a testcase for
your reproduction steps.  Since I'm on Linux, I don't have a UNC drive,
but I created a different location outside of the repository called
other-dir that simulates the same behaviour:

----
#!/bin/sh

tempdir=$(mktemp -d)
cd "$tempdir"
cat >config <<EOM
[includeIf "gitdir:$tempdir/dir/"]
    path = "$tempdir/other-config"
EOM
cat >other-config <<EOM
[user]
    name = "Foo Bar"
EOM

export GIT_CONFIG_GLOBAL="$tempdir/config"
mkdir "$tempdir/dir"
mkdir "$tempdir/other-dir"
cd "$tempdir/dir"
git init -b dev
echo "In dir ($PWD):"
git config -l --show-origin
ln -s ../other-dir other-dir
cd other-dir
echo "In symlink ($PWD):"
git config -l --show-origin
----

> What did you expect to happen? (Expected behavior)
> The value configured in the includeIf path to be found.
> 
> What happened instead? (Actual behavior)
> No configuration data found.
> 
> What's different between what you expected and what actually happened?
> Git seems to be unable to traverse subdirectories that are symlinks to
> include any git repositories stored inside them.

Assuming my reproduction steps are correct, this is expected.  Git
always determines the Git directory by resolving it to an absolute path
containing no symlinks with the equivalent of `realpath` on Linux or
`GetFinalPathNameByHandle` on Windows.  The fact that your working
directory contains a symlink doesn't mean that the destination of the
symlink is part of your repository.  In fact, if the destination of your
symlink is on another drive, it cannot be in your repository at all,
since Git cannot handle cross-drive repositories at all.  Since it's not
in the repository, the gitdir pattern won't match.

If I've misunderstood, could you help me understand better by providing
a small shell script that can reproduce the problem you're seeing, so
I can provide a better answer?
-- 
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA

Attachment: signature.asc
Description: PGP signature


[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