Skip to content

worktree config option is set when cloning with an absolute path #2569

Closed
@attilastrba

Description

@attilastrba

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options
git version 2.26.0.windows.1
cpu: x86_64
built from commit: 9c98e1ccdfd839e4eaae1c2747d0088ef89d446b
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.exe /c ver

Microsoft Windows [Version 10.0.18362.476]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
> type "C:\Tools\Git\etc\install-options.txt"
Editor Option: VIM
Custom Editor Path:
Path Option: CmdTools
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Disabled
Enable Symlinks: Disabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

none

Details

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

  • What commands did you run to trigger this issue? If you can provide a
    Minimal, Complete, and Verifiable example
    this will help us understand the issue.

 git clone https://github.com/lukesampson/scoop  "C:\tools\test5"
PS C:\tools\test5> cat .\.git\config
[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        worktree = C:/Tools/test5
        symlinks = false
        ignorecase = true
[remote "origin"]
        url = https://github.com/lukesampson/scoop
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
  • What did you expect to occur after running these commands?

I except to have .git/config file with no worktree attribute

  • What actually happened instead?

I got a worktree parameter in the repository config although I haven't added worktree. If I rename my folder than I got an error
fatal: this operation must be run in a work tree

This happens only if I clone with an absolute path in the parameter. I have tested this on a different machine, older git version 2.19 works ok. On linux git version I can't see this behaviour. I have read the https://git-scm.com/docs/git-worktree documentation but as far as I understand the worktree should only be set once it is added as a parameter or set in the config.

  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

https://github.com/lukesampson/scoop

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions