Skip to content

Failure to create branch #859

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

Merged
merged 1 commit into from
Jun 11, 2015
Merged

Failure to create branch #859

merged 1 commit into from
Jun 11, 2015

Conversation

jamill
Copy link
Member

@jamill jamill commented Nov 3, 2014

When creating a branch with a name that matches the namespace of a previously deleted branch, branch creation will fail with:

Could not open .../.git/logs/refs/heads/level_one for writing: Access is denied

at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in LibGit2Sharp\Core\Ensure.cs:line 126
at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result) in LibGit2Sharp\Core\Ensure.cs:line 144
at LibGit2Sharp.Core.Proxy.git_branch_create(RepositorySafeHandle repo, String branch_name, ObjectId targetId, Boolean force, Signature signature, String logMessage) in LibGit2Sharp\Core\Proxy.cs:line 155
at LibGit2Sharp.BranchCollection.Add(String name, Commit commit, Signature signature, String logMessage, Boolean allowOverwrite) in LibGit2Sharp\BranchCollection.cs:line 128
at LibGit2Sharp.BranchCollection.Add(String name, Commit commit, Boolean allowOverwrite) in LibGit2Sharp\BranchCollection.cs:line 143
at LibGit2Sharp.Tests.BranchFixture.CanCreateBranchInDeletedNestedBranchNamespace() in LibGit2Sharp.Tests\BranchFixture.cs:line 877

The scenario is:

git branch level_one/level_two
git branch -D level_one/level_two
git branch level_one

While a bit of a corner case - people sometimes do this and git.git handles this without issue. My thought is that this should probably be handled better in git_branch_create, but I will start with an issue and failing test case here.

/cc @ethomson @carlosmn

@dahlbyk
Copy link
Member

dahlbyk commented Nov 3, 2014

My thought is that this should probably be handled better in git_branch_create

👍

@carlosmn
Copy link
Member

carlosmn commented Nov 3, 2014

The error is then presumably because refs/heads/level_one/ is left by the deleter. I think it's its responsibility to delete, but I suppose we're the same process here so there might be two different bugs here. One failing to remove the directories when they're empty and another failing to delete them to make space for the new reference (assuming git also does the latter).

@dahlbyk
Copy link
Member

dahlbyk commented Nov 3, 2014

The error is then presumably because refs/heads/level_one/ is left by the deleter. I think it's its responsibility to delete

git.git leaves level_one/ behind, only deleting it on git branch level_one

@nulltoken
Copy link
Member

Rebased

@nulltoken nulltoken force-pushed the jamill/branch_create_failure branch from b2114f4 to 3e7ae31 Compare June 11, 2015 13:38
nulltoken added a commit that referenced this pull request Jun 11, 2015
@nulltoken nulltoken merged commit e10e223 into vNext Jun 11, 2015
@nulltoken nulltoken deleted the jamill/branch_create_failure branch June 11, 2015 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants