Browse Source

Ensure executable bit is kept on the web editor (#10607)

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
tags/v1.10.5
Antoine GIRARD 4 years ago
parent
commit
4e65d2b8ea
No account linked to committer's email address
1 changed files with 10 additions and 2 deletions
  1. 10
    2
      modules/repofiles/update.go

+ 10
- 2
modules/repofiles/update.go View File



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)
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
} }


// Add the object to the index // Add the object to the index
if err := t.AddObjectToIndex("100644", objectHash, treePath); err != nil {
return nil, err
if executable {
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

Loading…
Cancel
Save