cola: allow working in a bare repository
commitcfee910ad98f78ed42d74c7f9eed688a17ea53db
authorDavid Aguilar <davvid@gmail.com>
Sat, 30 Jan 2016 22:29:05 +0000 (30 14:29 -0800)
committerDavid Aguilar <davvid@gmail.com>
Sat, 30 Jan 2016 22:29:05 +0000 (30 14:29 -0800)
tree502396599c9c5781248c6fd8c0be64105e4cb9cd
parent13d20c65c8b93f3010bf0135dfab646d7a72b00e
cola: allow working in a bare repository

Support working in a bare repository by avoiding worktree paths.
There are a few places where we want the current directory,
and were doing path operations with the result of
Git.worktree(), which returns None in a bare repository.

Add Git.getcwd() so that callers can ask for the current directory
in a consistent way without needing to care about the worktree
vs. bare repository distinction.

For regular repositories, Git.getcwd() returns the worktree,
which allows it to be used in place of Git.worktree().

For bare repositories, Git.getcwd() returns the gitdir.
The dual behavior allows callers to easily handle bare repositories.

Update callers to use Git.getcwd() in the fsmonitor, main model,
and app initialization.

Signed-off-by: David Aguilar <davvid@gmail.com>
cola/app.py
cola/fsmonitor.py
cola/git.py
cola/models/main.py