Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exceptions in file monitor module when running in a git worktree #545

Closed
weo opened this issue Jan 27, 2016 · 0 comments
Closed

Exceptions in file monitor module when running in a git worktree #545

weo opened this issue Jan 27, 2016 · 0 comments

Comments

@weo
Copy link

weo commented Jan 27, 2016

In a worktree, ".git" is not a directory but a file. This causes an exception in the file monitor module because _refresh_watches() collects only directories.

Traceback (most recent call last):
File "/opt/git-cola/share/git-cola/lib/cola/fsmonitor.py", line 152, in run
self.refresh()
File "/opt/git-cola/share/git-cola/lib/cola/fsmonitor.py", line 207, in refresh
self._git_dir_wd = self._git_dir_wd_map[self._git_dir]
KeyError: u'/home/weo/Projects/MyProject/.git'

davvid added a commit to davvid/git-cola that referenced this issue Jan 27, 2016
git_dir() is the worktree's .git path, but it is not necessarily
the path where refs/ objects/ and friends are found.  When using
submodules, for example, .git is a file that contains the path
to the actual git repository.

The fsmonitor registers the git path so that it can notice
changes.  When doing so it ignores ENOTDIR errors to avoid a
race condition, but it also silently ignores the request to
watch the .git-file.

This later causes an exception when asking for the git path:

	File "cola/fsmonitor.py", line 207, in refresh
	self._git_dir_wd = self._git_dir_wd_map[self._git_dir]
	KeyError: u'/home/david/src/git/.git'

Fix the logic by using git_path() when setting up the monitor so
that the real git repository path is used.

Closes git-cola#545
Reported-by: Wolfgang Ocker <weo@reccoware.de>
Signed-off-by: David Aguilar <davvid@gmail.com>
davvid added a commit that referenced this issue Jan 29, 2016
Apply the same fix to the Win32 monitor as was done in
9fb671b.

Related-to: #545
Signed-off-by: David Aguilar <davvid@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant