Skip to content

git rev-parse --show-toplevel fails to resolve all junctions #2114

Closed
@bk2204

Description

@bk2204
  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options
git version 2.19.0.gvfs.1.34.gc7fb556
cpu: x86_64
built from commit: c7fb556beb07c47abba7a4c31d03e56f14ced358
sizeof-long: 4
sizeof-size_t: 8
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd /c ver
Microsoft Windows [Version 10.0.17763.316]
(c) 2018 Microsoft Corporation. All rights reserved.

This is a 64-bit VM

  • What options did you set as part of the installation? Or did you choose the
    defaults?
$ cat /etc/install-options.txt
Editor Option: VIM
Custom Editor Path:
Path Option: Cmd
SSH Option: OpenSSH
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Enabled
Enable Builtin Rebase: Enabled
Enable Builtin Stash: Enabled

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

Bash

# In CMD
mklink /J c:\junction "c:\Users\brian m. carlson"
# In Git Bash
cd /c/Junction
git init test
cd test
git rev-parse --show-toplevel
  • What did you expect to occur after running these commands?

I expected Git to provide an absolute, canonical path, resolving all junctions (since they are a kind of symlink).

  • What actually happened instead?

The junction was not resolved:

$ git rev-parse --show-toplevel
C:/junction/test

This happens to cause a problem for Git LFS, because Git LFS does indeed resolve all junctions. However, when relativizing a path based on git rev-parse --show-toplevel, which is documented as being absolute, the path that's created doesn't share the proper components in common, leading to locking being broken because the lock path contains ... This is the cause of git-lfs/git-lfs#3354.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions