aboutsummaryrefslogtreecommitdiffstats
path: root/t/001-setup.t
diff options
context:
space:
mode:
authorTeddy Wing2020-03-13 00:33:27 +0100
committerTeddy Wing2020-03-13 00:33:27 +0100
commit8061c43bb08b253f81283bce1bd83d2be6a77263 (patch)
tree23042b1f6a72b9b685637e311a96f946045fe44e /t/001-setup.t
parent73b82527df51dc093455ae4149799c278c1dcffc (diff)
downloadgit-branch-list-8061c43bb08b253f81283bce1bd83d2be6a77263.tar.bz2
git-branch-list: Allow commands to work in Git worktrees
Previously, `git-branch-list` didn't work inside worktree directories. It expected the current directory to be a descendant of the main Git repository directory, which isn't the case for worktrees. Given a Git repository `test-repo`: $ git rev-parse --show-toplevel /tmp/test-repo $ git rev-parse --git-common-dir .git $ mkdir subdir && cd subdir $ git rev-parse --git-common-dir ../.git $ cd - $ git worktree add ../test-repo-worktree $ cd ../test-repo-worktree $ git rev-parse --show-toplevel /tmp/test-repo-worktree $ git rev-parse --git-common-dir /tmp/test-repo/.git The `git rev-parse --show-toplevel` command outputs the top-level path of the worktree, not the main repository directory. Using `git rev-parse --git-common-dir`, we can get the correct path whether we're in a subdirectory or a worktree.
Diffstat (limited to 't/001-setup.t')
0 files changed, 0 insertions, 0 deletions