mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +00:00 
			
		
		
		
	Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com> Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
This commit is contained in:
		@@ -210,6 +210,7 @@ func CreateOrUpdateRepoFile(repo *models.Repository, doer *models.User, opts *Up
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	encoding := "UTF-8"
 | 
						encoding := "UTF-8"
 | 
				
			||||||
	bom := false
 | 
						bom := false
 | 
				
			||||||
 | 
						executable := false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if !opts.IsNewFile {
 | 
						if !opts.IsNewFile {
 | 
				
			||||||
		fromEntry, err := commit.GetTreeEntryByPath(fromTreePath)
 | 
							fromEntry, err := commit.GetTreeEntryByPath(fromTreePath)
 | 
				
			||||||
@@ -245,6 +246,7 @@ func CreateOrUpdateRepoFile(repo *models.Repository, doer *models.User, opts *Up
 | 
				
			|||||||
			return nil, models.ErrSHAOrCommitIDNotProvided{}
 | 
								return nil, models.ErrSHAOrCommitIDNotProvided{}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		encoding, bom = detectEncodingAndBOM(fromEntry, repo)
 | 
							encoding, bom = detectEncodingAndBOM(fromEntry, repo)
 | 
				
			||||||
 | 
							executable = fromEntry.IsExecutable()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// For the path where this file will be created/updated, we need to make
 | 
						// For the path where this file will be created/updated, we need to make
 | 
				
			||||||
@@ -368,8 +370,14 @@ func CreateOrUpdateRepoFile(repo *models.Repository, doer *models.User, opts *Up
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Add the object to the index
 | 
						// Add the object to the index
 | 
				
			||||||
	if err := t.AddObjectToIndex("100644", objectHash, treePath); err != nil {
 | 
						if executable {
 | 
				
			||||||
		return nil, err
 | 
							if err := t.AddObjectToIndex("100755", objectHash, treePath); err != nil {
 | 
				
			||||||
 | 
								return nil, err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							if err := t.AddObjectToIndex("100644", objectHash, treePath); err != nil {
 | 
				
			||||||
 | 
								return nil, err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Now write the tree
 | 
						// Now write the tree
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user