Git branch not detected in subdirectories of a git repo
HumblePresent opened this issue · comments
If a session directory is a subdirectory of a git repo rather that the top level directory of the repo, the git branch for the session will not be properly detected because the presence of a .git
directory, which only exists in the top level, is used to determine if a directory is tracked in git.
Sorry I'm failing to understand what you mean by this. Can you explain your point with an example directory structure? From what you've said I've inferred the below:
main_folder/
L .git/
L code_base/
L .git/
Sorry I will try to explain with an example. Here is a simple git repo with several subdirectories
toplevel_dir/
L .git/
L subdir1/
L source1.lua
L source2.lua
L subdir2/
If I want to create a session only in the subdir1
directory it will not be detected as being tracked by git by this plugin because it does not contain a .git
subdirectory. Therefore, the default and potentially incorrect branch name will be appended to its session file name and a new session will not be created when switching to a different branch the way it would with a session in toplevel_dir
. PR #22 fixes the issue by detecting git-tracked directories with git rev-parse
rather than checing for a .git
subdirectory.