In some lfs server implementations, they require the ref attribute. (#32838)
Fix: #32611 In some lfs server implementations, they require the ref attribute. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> (cherry picked from commit 7616aeb2ea2a02c15480dcd4a232e98081569690)
This commit is contained in:
		
					parent
					
						
							
								14a5d177e1
							
						
					
				
			
			
				commit
				
					
						68278c796d
					
				
			
		
					 1 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
					@ -72,7 +72,10 @@ func (c *HTTPClient) batch(ctx context.Context, operation string, objects []Poin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	url := fmt.Sprintf("%s/objects/batch", c.endpoint)
 | 
						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)
 | 
						payload := new(bytes.Buffer)
 | 
				
			||||||
	err := json.NewEncoder(payload).Encode(request)
 | 
						err := json.NewEncoder(payload).Encode(request)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue