Skip to content

Commit

Permalink
In some lfs server implementations, they require the ref attribute. (#…
Browse files Browse the repository at this point in the history
…32838)

Fix: #32611

In some lfs server implementations, they require the ref attribute.

---------

Co-authored-by: wxiaoguang <[email protected]>
  • Loading branch information
hiifong and wxiaoguang authored Dec 15, 2024
1 parent 3205915 commit 7616aeb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/lfs/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ func (c *HTTPClient) batch(ctx context.Context, operation string, objects []Poin

url := fmt.Sprintf("%s/objects/batch", c.endpoint)

request := &BatchRequest{operation, c.transferNames(), nil, objects}
// `ref` is an "optional object describing the server ref that the objects belong to"
// but some (incorrect) lfs servers require it, so maybe adding an empty ref here doesn't break the correct ones.
// https://github.com/git-lfs/git-lfs/blob/a32a02b44bf8a511aa14f047627c49e1a7fd5021/docs/api/batch.md?plain=1#L37
request := &BatchRequest{operation, c.transferNames(), &Reference{}, objects}
payload := new(bytes.Buffer)
err := json.NewEncoder(payload).Encode(request)
if err != nil {
Expand Down

0 comments on commit 7616aeb

Please sign in to comment.