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

git: add support for bare repositories and GIT_CEILING_DIRECTORIES #547

Merged
merged 8 commits into from
Feb 4, 2016

Conversation

davvid
Copy link
Member

@davvid davvid commented Jan 30, 2016

Refactor the git module to simplify the code and make it more amenable to testing.
Teach fsmonitor, gitcfg, and app startup to handle bare repositories.
Teach the git discovery code to honor GIT_CEILING_DIRECTORIES.
Add unit tests covering various aspects of repository discovery.

Signed-off-by: David Aguilar davvid@gmail.com

Signed-off-by: David Aguilar <davvid@gmail.com>
Simlify the logic to have a single exit point.

Signed-off-by: David Aguilar <davvid@gmail.com>
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>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Rework the logic so that there's only a single exit point.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Git must stop git-directory discovery when it encounters a directory in
its list of GIT_CEILING_DIRECTORIES.

Teach the git discovery code to honor GIT_CEILING_DIRECTORIES.
Add unit tests to cover the new behavior.

Signed-off-by: David Aguilar <davvid@gmail.com>
@davvid
Copy link
Member Author

davvid commented Jan 30, 2016

I touched a lot of the core of git.py in this PR so I would appreciate some extra eyes and testers on these changes. @git-cola/developers

@takluyver
Copy link
Contributor

I'll try running from this PR for a few days, and let you know if I notice any problems.

@davvid
Copy link
Member Author

davvid commented Feb 4, 2016

Thanks for testing @takluyver so far so good, so merging for now as the fix for #548 will build upon these changes.

davvid added a commit that referenced this pull request Feb 4, 2016
git: add support for bare repositories and GIT_CEILING_DIRECTORIES

Signed-off-by: David Aguilar <davvid@gmail.com>
@davvid davvid merged commit 3a5c09f into git-cola:master Feb 4, 2016
@davvid davvid deleted the bare-repos-and-ceiling-dirs branch February 4, 2016 09:47
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

Successfully merging this pull request may close these issues.

3 participants