libgit2 / libgit2/libgit2sharp

Repositories with git-dir and work-dir should't create .git file in working directory

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

還沒有人認領這個 Issue。

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

描述

Reproduction steps

Repository.Init("/working/path", "/git/path");

Expected behavior

For most cases the whole point of doing this separation of working directory and git directory is to avoid the existence of .git file/folder in working directory

Actual behavior

The repo_is_worktree in repository.c of libgit2, should not checking for gitdir in working directory.
In config file, in git directory there is a field worktree = /working/path which could be used to find out which is the working directory.

My suggestion would be, in private Repository constructor to get the worktree value from config file in git-directory and pass it to the Proxy.git_repository_set_workdir in Repository class
instead of reading the value from options that were given from caller.
Future improvement would be not event passing the working directory, because it can be extracted from config file.

Hope to hear soon your opinion on this
Max

貢獻指南

開啟貢獻指南

從這裡開始

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

研究方向

從 Repository.Init 和私有的 Repository 建構函式開始,接著檢查 Proxy.git_repository_set_workdir 附近的 Repository.cs。將該路徑與 src/repository.c 中的 repo_is_worktree 和 gitdir 處理進行比較,並如描述使用 Git 目錄設定中的 worktree 值。使用分離的工作路徑和 Git 路徑重現此問題,並確認初始化不再在工作目錄中建立 .git 檔案。

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

評估

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

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

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