mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-26 12:27:06 +00:00 
			
		
		
		
	Add go wrapper around git diff-tree --raw -r -M (#33369)
* Implemented calling git diff-tree * Ensures wrapper function is called with valid arguments * Parses output into go struct, using strong typing when possible
This commit is contained in:
		| @@ -46,19 +46,9 @@ func parseLsTreeLine(line []byte) (*LsTreeEntry, error) { | ||||
| 		entry.Size = optional.Some(size) | ||||
| 	} | ||||
|  | ||||
| 	switch string(entryMode) { | ||||
| 	case "100644": | ||||
| 		entry.EntryMode = EntryModeBlob | ||||
| 	case "100755": | ||||
| 		entry.EntryMode = EntryModeExec | ||||
| 	case "120000": | ||||
| 		entry.EntryMode = EntryModeSymlink | ||||
| 	case "160000": | ||||
| 		entry.EntryMode = EntryModeCommit | ||||
| 	case "040000", "040755": // git uses 040000 for tree object, but some users may get 040755 for unknown reasons | ||||
| 		entry.EntryMode = EntryModeTree | ||||
| 	default: | ||||
| 		return nil, fmt.Errorf("unknown type: %v", string(entryMode)) | ||||
| 	entry.EntryMode, err = ParseEntryMode(string(entryMode)) | ||||
| 	if err != nil || entry.EntryMode == EntryModeNoEntry { | ||||
| 		return nil, fmt.Errorf("invalid ls-tree output (invalid mode): %q, err: %w", line, err) | ||||
| 	} | ||||
|  | ||||
| 	entry.ID, err = NewIDFromString(string(entryObjectID)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Alexander McRae
					Alexander McRae