Skip to content

GIT_DIR is not respectedΒ #58

Closed
Closed

Description

@kwbr

The way git-up tries to get the path to the repository is not working when the GIT_WORK_TREE and GIT_DIR are different.

get_git_dir() tries to get the repository with

return execute(['git', 'rev-parse', '--show-toplevel'])

As far as I understand --git-dir should be used.

http://stackoverflow.com/a/21085415

Activity

  1. astitcher commented on Nov 28, 2016

    @astitcher

    I'm assuming this issue is raised because git up doesn't work correctly if you are working in a work tree created by git worktree ....

    In this case I'm not sure if the correct way to get the repository is --git-dir or --git-common-dir.

    From a little experimentation --git-dir gives a location deep inside the repository whereas --git-common-dir gives the actual repository root.

  2. kwbr commented on Nov 29, 2016

    @kwbr
    Author

    You are correct. I use vcsh (https://github.com/RichiH/vcsh) which separates the worktree from the git-dir. After reading the documentation --git-common-dir seem to be the correct way

  3. msiemens commented on Nov 29, 2016

    @msiemens
    Owner

    Thanks for the bug report and the details everyone! I've implemented a fix, but it seems like the git version on Travis doesn't support git's worktree. @kwbr Could you install the latest dev version (should work using pip install https://github.com/msiemens/PyGitUp) and report if it's actually fixed?

  4. kwbr commented on Nov 30, 2016

    @kwbr
    Author

    Seems to work now. πŸ‘

    Installed it with pip install git+https://github.com/msiemens/PyGitUp.

  5. msiemens commented on Nov 30, 2016

    @msiemens
    Owner

    Awesome! Version 1.4.4 has been released now :)

  6. added a commit that references this issue on Oct 7, 2026
    bc074e1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions