libgit2 / libgit2/libgit2sharp

Repository.Init wants to write to workingDirectoryPath

未關閉
#1,861 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
C#
星號
3.5k
分支
925
PR 合併指標
30 天內沒有已合併 PR

描述

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

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 Repository.Init 入口點開始,使用寫入受保護的 workingDirectoryPath 和可寫入的 gitDirectoryPath 重現此問題。完成的標準是初始化會建立儲存庫,並將 core.worktree 設定為工作目錄,而不嘗試寫入該目錄,符合所述的 git 指令行為。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
csharp, git
領域
api, backend
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
描述清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。