Skip to content

Repository.Init wants to write to workingDirectoryPath #1861

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

Open
vogeljo opened this issue Dec 21, 2020 · 0 comments
Open

Repository.Init wants to write to workingDirectoryPath #1861

vogeljo opened this issue Dec 21, 2020 · 0 comments

Comments

@vogeljo
Copy link

vogeljo commented Dec 21, 2020

Reproduction steps

Run the following code with workingDirectoryPath set to a write-protected directory path and gitDirectoryPath set to a writable directory path:

Lib2GitSharp.Repository.Init(workingDirectoryPath: "/", gitDirectoryPath: "/some/dir/.git")

Expected behavior

The Init() call works exactly as this git command: git --git-dir /some/dir/.git --work-tree /:

  • it creates a .git repository directory at /some/dir/.git with its config's core.worktree set to /
  • it does not touch the --work-tree directory / in any way and thus does not need write permissions in this directory

Actual behavior

An Exception of type Lib2GitException is thrown:
failed to initialize repository with template '.git': Permission denied

Version of LibGit2Sharp (release number or SHA1)

0.26.2 (NuGet)

Operating system(s) tested; .NET runtime tested

Linux 5.9.14-arch1-1 #1 SMP PREEMPT Sat, 12 Dec 2020 14:37:12 +0000 x86_64 GNU/Linux
Microsoft.NETCore.App 3.1.8

@vogeljo vogeljo changed the title Repository.Init with custom working tree directory does not do what i expect Repository.Init wants to write to workingDirectoryPath Dec 21, 2020
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