Uploaded image for project: 'Sourcetree For Mac'
  1. Sourcetree For Mac
  2. SRCTREE-3777

SourceTree doesn't support Git repo with core.worktree set

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Medium
    • Next minor release
    • 2.2.4
    • Git
    • None

    Description

      SourceTree is unable to perform most tasks on files when using the core.worktree config option to redirect the location of the working copy away from the location of the git repo. This is useful for example when you want to track your HOME dir in a git repo, but locate the git repo itself in another subpath in order to avoid having any git commands outside any other git repo defaulting to this HOME dir git repo by accident.

      For example, you might do the following:

      git init ~/repos/homedir
      cd ~/repos/homedir
      git config core.worktree ../../
      git add ../../.bash_profile
      

      Notice how the git add command needs to point at the actual relative location of the file. This is the path that will also show when you run git status, however if you run git status --porcelain then the ../../ prefix is not displayed, showing the path relative to the worktree, not the location of the git repo. Since SourceTree uses the --porcelain option, using those file paths directly in other git commands fails with pathspec did not match any files kind of errors.

      In order to fix this usage scenario SourceTree needs to detect the core.worktree setting and adjust paths accordingly.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              sstreeting Steve Streeting (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: