History

Display human-readable text instead of cryptic filemodes (#26352)

Now, you don't need to be a git expert anymore to know what these numbers mean. ## Before ![grafik](https://github.com/go-gitea/gitea/assets/51889757/9a964bf6-10fd-40a6-aeb2-ac8f437f8c32) ## After ![grafik](https://github.com/go-gitea/gitea/assets/51889757/84573cb9-55b6-4dde-9866-95f71b657554) or when the mode actually changed: ![grafik](https://github.com/go-gitea/gitea/assets/51889757/0f327538-ebdc-40e7-8c99-f9e21b67f638)

delvh committed 3 years ago

Commit 8736b131 parent c1c83db3 files · +30 −2Browse files

Showing the changes to services/gitdiff/gitdiff.go (1 of 3 files). Show all

Unified · Split

services/gitdiff/gitdiff.go+17−0
@@ -427,6 +427,23 @@ func (diffFile *DiffFile) ShouldBeHidden() bool { · 426 unmodified lines
427 return diffFile.IsGenerated || diffFile.IsViewed427 return diffFile.IsGenerated || diffFile.IsViewed
428}428}
429 429
430func (diffFile *DiffFile) ModeTranslationKey(mode string) string {
431 switch mode {
432 case "040000":
433 return "git.filemode.directory"
434 case "100644":
435 return "git.filemode.normal_file"
436 case "100755":
437 return "git.filemode.executable_file"
438 case "120000":
439 return "git.filemode.symbolic_link"
440 case "160000":
441 return "git.filemode.submodule"
442 default:
443 return mode
444 }
445}
446
430func getCommitFileLineCount(commit *git.Commit, filePath string) int {447func getCommitFileLineCount(commit *git.Commit, filePath string) int {
431 blob, err := commit.GetBlobByPath(filePath)448 blob, err := commit.GetBlobByPath(filePath)
432 if err != nil {449 if err != nil {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t