libgit2 / libgit2/libgit2sharp

The Filter API contains singleton Entry-points which are agnostic to `FilterMode`, does having `Clean` and `Smudge` entry-points make sense?

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

還沒有人認領這個 Issue。

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

描述

Today the Filter object (the API we expose to lib consumers) contains the following entry-points:

  • virtual void Initialize()
  • virtual void Complete(string path, string root, Stream output)
  • virtual void Create(string path, string root, FilterMode)
  • virtual void Clean(string path, string root, Stream input, Stream output)
  • virtual void Smudge(string path, string root, Stream input, Stream output)

This is very uneven and, to my OCD, a fairly inconsistent API. I'm responsible and I'd like to change it, however some have already taken a dependency. In the spirit of #1103 I suggest changing the API to the following.

  • virtual void Initialize()
  • virtual void Complete(string root, string path, Stream output, FilterMode mode)
  • virtual void Create(string root, string path, FilterMode mode)
  • virtual void Apply(string root, string path, Stream input, Stream output, FilterMode mode)

I believe this is a simplified API which presents a consistent set of entry-points, and leaves the mode management up to the implementation of Filter. I'll happily make the changes and update the associated tests.

As a side note, I had a side-band discussion with @ethomson about how to handle the .gitattributes macros (example: [filter "lfs"] \n clean = git lfs clean %f \n smudge = git lfs smudge %f). While there are normal situations when you just know(tm) what to do on smudge and clean callbacks, ideally the filter would at least aware if the user has edited the values of the macro.

Assuming we can find a solution, whatever solution we'll find will likely end up impact this API. Perhaps then we should combine the two discussions here.

/CC @ammeep @shiftkey @nulltoken

貢獻指南

開啟貢獻指南

從這裡開始

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

研究方向

首先檢視公開的 Filter API 及其相關測試,issue 指出它們會受到所提議簽章變更的影響。接著檢查如何處理 .gitattributes 的 clean 和 smudge 巨集;完成這項工作需要取得共識的 API 設計、更新相依方並通過測試。

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

評估

技術堆疊
csharp, git
領域
backend-api-design, tooling
Issue 類型
重構
難度
5/5
預估耗時
一週以上
活躍度
停滯
描述清晰度
基本清楚
新手友好度
25/100

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

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