Skip to content

Support namespaced references again#4154

Merged
ethomson merged 2 commits into
masterfrom
ethomson/namespaces
Mar 6, 2017
Merged

Support namespaced references again#4154
ethomson merged 2 commits into
masterfrom
ethomson/namespaces

Conversation

@ethomson
Copy link
Copy Markdown
Member

@ethomson ethomson commented Mar 6, 2017

Support git_repository_set_namespace again (the equivalent of GIT_NAMESPACE); this was subtly broken with worktree support.

This adds a simple namespace test (equivalent to rugged's) and simplifies the namespace handling by simply appending the namespace (if it exists) to the gitdir and commondir.

/cc @carlosmn

Edward Thomson added 2 commits March 6, 2017 14:11
These simple tests only ensure that we enforce the existence of a
namespace; these mirror the rugged tests, they are not exhaustive.
@ethomson
Copy link
Copy Markdown
Member Author

ethomson commented Mar 6, 2017

So there are two things here that probably bear discussion:

  1. The interaction between namespaces and worktrees. If you set a namespace, this will now look for namespaces in both. It's not exactly clear that this is what git itself would do, because git's namespaces are very narrowly applied to "server" functionality. I don't know that there are commands that obey namespaces and worktrees both. So I think our implementation is okay, but if there exists a command in the future (or in the present, and I just don't know it) that obeys both then we may need to rethink this.

  2. You can create a refdb that is not backed by a filesystem path. (See refs::iterator::empty, for example.) We handle this (and have since the inception of the refdb) by simply creating paths like refs/heads/master (instead of prefixing them with the gitdir). This is obviously pretty wrong. I haven't fixed this here, since it's a) a longstanding bug not a regression and b) I want to unblock Update libgit2 to b31b236... rugged#687. But I will open a PR to deal with this when I have a few spare minutes.

Copy link
Copy Markdown
Member

@carlosmn carlosmn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Namespaces are such an underused feature that I'm happy with just proving the minimal support works. We can worry about their interaction with worktrees if someone ever actually cares.

@ethomson ethomson merged commit b31b236 into master Mar 6, 2017
@ethomson ethomson deleted the ethomson/namespaces branch January 9, 2019 10:18
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.

2 participants