From e94eea42c18f1ee073f33f9d36cc2dd2aabb6ecc Mon Sep 17 00:00:00 2001 From: "a.kiselev" Date: Wed, 17 Sep 2025 15:40:50 +0500 Subject: [PATCH 1/5] Added button to copy file name to changed files browser pull request --- options/locale/locale_en-US.ini | 1 + services/gitdiff/gitdiff.go | 11 +++++++++++ templates/repo/diff/box.tmpl | 1 + 3 files changed, 13 insertions(+) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index b3eb7b1f4a4fd..a05e4c1a0f6e1 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -106,6 +106,7 @@ copy_hash = Copy hash copy_content = Copy content copy_branch = Copy branch name copy_path = Copy path +copy_name = Copy name copy_success = Copied! copy_error = Copy failed copy_type_unsupported = This file type cannot be copied diff --git a/services/gitdiff/gitdiff.go b/services/gitdiff/gitdiff.go index 1bb7c05ba2c54..dd3bb57ac4a35 100644 --- a/services/gitdiff/gitdiff.go +++ b/services/gitdiff/gitdiff.go @@ -13,6 +13,7 @@ import ( "html/template" "io" "net/url" + "path/filepath" "sort" "strings" "time" @@ -312,6 +313,7 @@ type DiffFile struct { // basic fields (parsed from diff result) Name string + ShortName string NameHash string OldName string Addition int @@ -401,6 +403,14 @@ func (diffFile *DiffFile) GetDiffFileName() string { return diffFile.Name } +// GetDiffFileName returns the short name of the diff file, or its short old name in case it was deleted +func (diffFile *DiffFile) GetDiffFileShortName() string { + if diffFile.Name == "" { + return filepath.Base(diffFile.OldName) + } + return filepath.Base(diffFile.Name) +} + func (diffFile *DiffFile) ShouldBeHidden() bool { return diffFile.IsGenerated || diffFile.IsViewed } @@ -1027,6 +1037,7 @@ func createDiffFile(line string) *DiffFile { curFile.OldName, oldNameAmbiguity = readFileName(rd) curFile.Name, newNameAmbiguity = readFileName(rd) + curFile.ShortName = curFile.GetDiffFileShortName() if oldNameAmbiguity && newNameAmbiguity { curFile.isAmbiguous = true // OK we should bet that the oldName and the newName are the same if they can be made to be same diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index e4d1efac57bd9..07aa638065d18 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -102,6 +102,7 @@ {{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}} + {{if .IsLFSFile}}LFS{{end}} {{if $file.IsGenerated}} {{ctx.Locale.Tr "repo.diff.generated"}} From 9d10994c2f4afdb02e7f4ba7b9fc67a84013b6f0 Mon Sep 17 00:00:00 2001 From: "a.kiselev" Date: Thu, 18 Sep 2025 14:04:14 +0500 Subject: [PATCH 2/5] moved the button in the menu and added localization --- options/locale/locale_cs-CZ.ini | 1 + options/locale/locale_de-DE.ini | 1 + options/locale/locale_el-GR.ini | 1 + options/locale/locale_en-US.ini | 2 +- options/locale/locale_es-ES.ini | 1 + options/locale/locale_fa-IR.ini | 1 + options/locale/locale_fi-FI.ini | 1 + options/locale/locale_fr-FR.ini | 1 + options/locale/locale_ga-IE.ini | 1 + options/locale/locale_hu-HU.ini | 1 + options/locale/locale_id-ID.ini | 1 + options/locale/locale_is-IS.ini | 1 + options/locale/locale_it-IT.ini | 1 + options/locale/locale_ja-JP.ini | 1 + options/locale/locale_ko-KR.ini | 2 +- options/locale/locale_lv-LV.ini | 1 + options/locale/locale_nl-NL.ini | 1 + options/locale/locale_pl-PL.ini | 1 + options/locale/locale_pt-BR.ini | 1 + options/locale/locale_pt-PT.ini | 1 + options/locale/locale_ru-RU.ini | 1 + options/locale/locale_si-LK.ini | 1 + options/locale/locale_sk-SK.ini | 1 + options/locale/locale_sv-SE.ini | 1 + options/locale/locale_tr-TR.ini | 1 + options/locale/locale_uk-UA.ini | 1 + templates/repo/diff/box.tmpl | 2 +- 27 files changed, 27 insertions(+), 3 deletions(-) diff --git a/options/locale/locale_cs-CZ.ini b/options/locale/locale_cs-CZ.ini index cc92f2e626d64..d8dacd7ab6ebd 100644 --- a/options/locale/locale_cs-CZ.ini +++ b/options/locale/locale_cs-CZ.ini @@ -108,6 +108,7 @@ copy_path=Zkopírovat cestu copy_success=Zkopírováno! copy_error=Kopírování se nezdařilo copy_type_unsupported=Tento typ souboru nelze zkopírovat +copy_filename=Kopírovat název souboru write=Zapsat preview=Náhled diff --git a/options/locale/locale_de-DE.ini b/options/locale/locale_de-DE.ini index dae7275f82e55..ba7ee0417a5f2 100644 --- a/options/locale/locale_de-DE.ini +++ b/options/locale/locale_de-DE.ini @@ -108,6 +108,7 @@ copy_path=Pfad kopieren copy_success=Kopiert! copy_error=Kopieren fehlgeschlagen copy_type_unsupported=Dieser Dateityp kann nicht kopiert werden +copy_filename=Dateinamen kopieren write=Verfassen preview=Vorschau diff --git a/options/locale/locale_el-GR.ini b/options/locale/locale_el-GR.ini index 42b23dea05849..fc6c98ac2967d 100644 --- a/options/locale/locale_el-GR.ini +++ b/options/locale/locale_el-GR.ini @@ -105,6 +105,7 @@ copy_branch=Αντιγραφή ονόματος κλάδου copy_success=Αντιγράφηκε! copy_error=Η αντιγραφή απέτυχε copy_type_unsupported=Αυτός ο τύπος αρχείου δεν μπορεί να αντιγραφεί +copy_filename=Αντιγραφή ονόματος αρχείου write=Σύνταξη preview=Προεπισκόπηση diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index a05e4c1a0f6e1..381dc9129c218 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -106,7 +106,7 @@ copy_hash = Copy hash copy_content = Copy content copy_branch = Copy branch name copy_path = Copy path -copy_name = Copy name +copy_filename = Copy filename copy_success = Copied! copy_error = Copy failed copy_type_unsupported = This file type cannot be copied diff --git a/options/locale/locale_es-ES.ini b/options/locale/locale_es-ES.ini index ffacb46b19918..c996702e3c686 100644 --- a/options/locale/locale_es-ES.ini +++ b/options/locale/locale_es-ES.ini @@ -103,6 +103,7 @@ copy_branch=Copiar nombre de rama copy_success=¡Copiado! copy_error=Copiar falló copy_type_unsupported=No se puede copiar este tipo de archivo +copy_filename=Copiar nombre de archivo write=Escribir preview=Vista previa diff --git a/options/locale/locale_fa-IR.ini b/options/locale/locale_fa-IR.ini index abeef31988c49..546e84c9027a0 100644 --- a/options/locale/locale_fa-IR.ini +++ b/options/locale/locale_fa-IR.ini @@ -78,6 +78,7 @@ copy_url=کپی URL copy_branch=کپی نام شاخه copy_success=کپی شد! copy_error=کپی ناموفق +copy_filename=کپی نام فایل write=نوشتن preview=پیش نمایش diff --git a/options/locale/locale_fi-FI.ini b/options/locale/locale_fi-FI.ini index 9d7fc033c45b0..2004ad0caed89 100644 --- a/options/locale/locale_fi-FI.ini +++ b/options/locale/locale_fi-FI.ini @@ -91,6 +91,7 @@ copy_url=Kopioi osoite copy_branch=Kopioi haaran nimi copy_success=Kopioitu! copy_error=Kopiointi epäonnistui +copy_filename=Kopioi tiedostonimi write=Kirjoita preview=Esikatselu diff --git a/options/locale/locale_fr-FR.ini b/options/locale/locale_fr-FR.ini index 5814de64ca883..98cd8e7b25ba6 100644 --- a/options/locale/locale_fr-FR.ini +++ b/options/locale/locale_fr-FR.ini @@ -109,6 +109,7 @@ copy_path=Copier le chemin copy_success=Copié ! copy_error=Échec de la copie copy_type_unsupported=Ce type de fichier ne peut pas être copié +copy_filename=Copier le nom du fichier write=Écrire preview=Aperçu diff --git a/options/locale/locale_ga-IE.ini b/options/locale/locale_ga-IE.ini index b5b05209e5af3..220920ef898ad 100644 --- a/options/locale/locale_ga-IE.ini +++ b/options/locale/locale_ga-IE.ini @@ -109,6 +109,7 @@ copy_path=Cóipeáil cosán copy_success=Cóipeáil! copy_error=Theip ar an gcóipeáil copy_type_unsupported=Ní féidir an cineál comhaid seo a chóipeáil +copy_filename=Cóipeáil ainm an chomhaid write=Scríobh preview=Réamhamharc diff --git a/options/locale/locale_hu-HU.ini b/options/locale/locale_hu-HU.ini index 0fc86f077532f..a172637e48552 100644 --- a/options/locale/locale_hu-HU.ini +++ b/options/locale/locale_hu-HU.ini @@ -70,6 +70,7 @@ edit=Szerkesztés enabled=Engedélyezett disabled=Letiltva +copy_filename=Fájlnév másolása write=Írás preview=Előnézet diff --git a/options/locale/locale_id-ID.ini b/options/locale/locale_id-ID.ini index a5640655d2d8b..914b29ba1ab90 100644 --- a/options/locale/locale_id-ID.ini +++ b/options/locale/locale_id-ID.ini @@ -97,6 +97,7 @@ copy_branch=Salin nama branch copy_success=Tersalin! copy_error=Gagal menyalin copy_type_unsupported=Tipe berkas ini tidak dapat disalin +copy_filename=Salin nama file write=Tulis preview=Pratinjau diff --git a/options/locale/locale_is-IS.ini b/options/locale/locale_is-IS.ini index 177cf61068ff5..cff67f4f88bab 100644 --- a/options/locale/locale_is-IS.ini +++ b/options/locale/locale_is-IS.ini @@ -89,6 +89,7 @@ copy_url=Afrita vefslóð copy_branch=Afritaðu heiti greinar copy_success=Afritað! copy_error=Afritun mistókst +copy_filename=Afritaðu skráarnafn write=Skrifa preview=Forskoða diff --git a/options/locale/locale_it-IT.ini b/options/locale/locale_it-IT.ini index 31aebff2d61cb..7885247a5ee3d 100644 --- a/options/locale/locale_it-IT.ini +++ b/options/locale/locale_it-IT.ini @@ -92,6 +92,7 @@ copy_url=Copia URL copy_branch=Copia nome del ramo copy_success=Copiato! copy_error=Copia fallita +copy_filename=Copia nome file write=Scrivi preview=Anteprima diff --git a/options/locale/locale_ja-JP.ini b/options/locale/locale_ja-JP.ini index 3b3083d8c68a8..33630c21726a4 100644 --- a/options/locale/locale_ja-JP.ini +++ b/options/locale/locale_ja-JP.ini @@ -109,6 +109,7 @@ copy_path=パスをコピー copy_success=コピーされました! copy_error=コピーに失敗しました copy_type_unsupported=このファイルタイプはコピーできません +copy_filename=ファイル名をコピーする write=書き込み preview=プレビュー diff --git a/options/locale/locale_ko-KR.ini b/options/locale/locale_ko-KR.ini index 39df68f126b7f..7e6dbf49954a5 100644 --- a/options/locale/locale_ko-KR.ini +++ b/options/locale/locale_ko-KR.ini @@ -26,7 +26,7 @@ captcha=보안 문자 twofa=2단계 인증 twofa_scratch=2단계 일회성 코드 passcode=인증코드 - +copy_filename=파일 이름 복사 repository=저장소 organization=조직 diff --git a/options/locale/locale_lv-LV.ini b/options/locale/locale_lv-LV.ini index 9c8f47534bf62..c0ca82f58a2cf 100644 --- a/options/locale/locale_lv-LV.ini +++ b/options/locale/locale_lv-LV.ini @@ -107,6 +107,7 @@ copy_branch=Kopēt atzara nosaukumu copy_success=Nokopēts! copy_error=Kopēšana neizdevās copy_type_unsupported=Šī veida failus nav iespējams nokopēt +copy_filename=Kopēt faila nosaukumu write=Rakstīt preview=Priekšskatītījums diff --git a/options/locale/locale_nl-NL.ini b/options/locale/locale_nl-NL.ini index 326a203c8fd99..8540f5f55510a 100644 --- a/options/locale/locale_nl-NL.ini +++ b/options/locale/locale_nl-NL.ini @@ -92,6 +92,7 @@ copy_url=Kopieer URL copy_branch=Kopieer branchnaam copy_success=Gekopieerd! copy_error=Kopiëren mislukt +copy_filename=Kopier filnavn write=Schrijf preview=Voorbeeld diff --git a/options/locale/locale_pl-PL.ini b/options/locale/locale_pl-PL.ini index 872f1104abc70..2e1bed358701f 100644 --- a/options/locale/locale_pl-PL.ini +++ b/options/locale/locale_pl-PL.ini @@ -90,6 +90,7 @@ copy_url=Kopiuj adres URL copy_branch=Kopiuj nazwę gałęzi copy_success=Skopiowano! copy_error=Kopiowanie nie powiodło się +copy_filename=Kopiuj nazwę pliku write=Napisz preview=Podgląd diff --git a/options/locale/locale_pt-BR.ini b/options/locale/locale_pt-BR.ini index b457ecc8004d8..d88c827c6ed18 100644 --- a/options/locale/locale_pt-BR.ini +++ b/options/locale/locale_pt-BR.ini @@ -109,6 +109,7 @@ copy_path=Copiar caminho copy_success=Copiado! copy_error=A cópia falhou copy_type_unsupported=Este tipo de arquivo não pode ser copiado +copy_filename=Copiar nome do arquivo write=Escrever preview=Pré-visualização diff --git a/options/locale/locale_pt-PT.ini b/options/locale/locale_pt-PT.ini index 9e648b66023f1..3a3dbff1ce275 100644 --- a/options/locale/locale_pt-PT.ini +++ b/options/locale/locale_pt-PT.ini @@ -109,6 +109,7 @@ copy_path=Copiar caminho copy_success=Copiado! copy_error=Falha ao copiar copy_type_unsupported=Este tipo de ficheiro não pode ser copiado +copy_filename=Copiar nome do ficheiro write=Escrever preview=Pré-visualizar diff --git a/options/locale/locale_ru-RU.ini b/options/locale/locale_ru-RU.ini index 6da0eea91ce76..443187bdd7ec2 100644 --- a/options/locale/locale_ru-RU.ini +++ b/options/locale/locale_ru-RU.ini @@ -103,6 +103,7 @@ copy_branch=Скопировать имя ветки copy_success=Скопировано! copy_error=Ошибка при копировании copy_type_unsupported=Невозможно скопировать файл этого типа +copy_filename=Скопировать имя файла write=Редактирование preview=Предпросмотр diff --git a/options/locale/locale_si-LK.ini b/options/locale/locale_si-LK.ini index e065527bbe8ec..a6b0729352b68 100644 --- a/options/locale/locale_si-LK.ini +++ b/options/locale/locale_si-LK.ini @@ -78,6 +78,7 @@ copy_url=ඒ.ස.නි. පිටපත් copy_branch=ශාඛාවේ නම පිටපත් කරන්න copy_success=පිටපත් විය! copy_error=පිටපත් වීමට අසමත් විය +copy_filename=ගොනු නාමය පිටපත් කරන්න write=ලියන්න preview=පෙරදසුන diff --git a/options/locale/locale_sk-SK.ini b/options/locale/locale_sk-SK.ini index dc022da24bc8c..28b1390b97ba3 100644 --- a/options/locale/locale_sk-SK.ini +++ b/options/locale/locale_sk-SK.ini @@ -104,6 +104,7 @@ copy_branch=Kopírovať meno vetvy copy_success=Skopírované! copy_error=Kopírovanie zlyhalo copy_type_unsupported=Tento typ súboru nie je možné skopírovať +copy_filename=Kopírovať názov súboru write=Zapísať preview=Náhľad diff --git a/options/locale/locale_sv-SE.ini b/options/locale/locale_sv-SE.ini index e8c13cae0ddca..d40cca4809595 100644 --- a/options/locale/locale_sv-SE.ini +++ b/options/locale/locale_sv-SE.ini @@ -71,6 +71,7 @@ edit=Redigera enabled=Aktiv disabled=Inaktiverad +copy_filename=Kopiera filnamn write=Skriv preview=Förhandsgranska diff --git a/options/locale/locale_tr-TR.ini b/options/locale/locale_tr-TR.ini index a3ae736f67aeb..246700b04a1db 100644 --- a/options/locale/locale_tr-TR.ini +++ b/options/locale/locale_tr-TR.ini @@ -109,6 +109,7 @@ copy_path=Yolu kopyala copy_success=Kopyalandı! copy_error=Kopyalama başarısız oldu copy_type_unsupported=Bu dosya türü kopyalanamaz +copy_filename=Dosya adını kopyala write=Yaz preview=Önizleme diff --git a/options/locale/locale_uk-UA.ini b/options/locale/locale_uk-UA.ini index 1849d5d378246..d15d278105277 100644 --- a/options/locale/locale_uk-UA.ini +++ b/options/locale/locale_uk-UA.ini @@ -107,6 +107,7 @@ copy_path=Копіювати шлях copy_success=Скопійовано! copy_error=Не вдалося скопіювати copy_type_unsupported=Цей тип файлу не можна скопіювати +copy_filename=Копіювати назву файлу write=Писати preview=Попередній перегляд diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 07aa638065d18..4fdd0c5bf24fa 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -102,7 +102,6 @@ {{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}} - {{if .IsLFSFile}}LFS{{end}} {{if $file.IsGenerated}} {{ctx.Locale.Tr "repo.diff.generated"}} @@ -144,6 +143,7 @@ {{end}} + {{if not $.PageIsWiki}} {{if $file.IsDeleted}} {{ctx.Locale.Tr "repo.diff.view_file"}} From b0ff6a33fbc2574684b147c2e3a73e5d182cdeb7 Mon Sep 17 00:00:00 2001 From: "a.kiselev" Date: Thu, 18 Sep 2025 14:35:52 +0500 Subject: [PATCH 3/5] review --- options/locale/locale_cs-CZ.ini | 1 - options/locale/locale_de-DE.ini | 1 - options/locale/locale_el-GR.ini | 1 - options/locale/locale_en-US.ini | 2 +- options/locale/locale_es-ES.ini | 1 - options/locale/locale_fa-IR.ini | 1 - options/locale/locale_fi-FI.ini | 1 - options/locale/locale_fr-FR.ini | 1 - options/locale/locale_ga-IE.ini | 1 - options/locale/locale_hu-HU.ini | 1 - options/locale/locale_id-ID.ini | 1 - options/locale/locale_is-IS.ini | 1 - options/locale/locale_it-IT.ini | 1 - options/locale/locale_ja-JP.ini | 1 - options/locale/locale_ko-KR.ini | 2 +- options/locale/locale_lv-LV.ini | 1 - options/locale/locale_nl-NL.ini | 1 - options/locale/locale_pl-PL.ini | 1 - options/locale/locale_pt-BR.ini | 1 - options/locale/locale_pt-PT.ini | 1 - options/locale/locale_ru-RU.ini | 1 - options/locale/locale_si-LK.ini | 1 - options/locale/locale_sk-SK.ini | 1 - options/locale/locale_sv-SE.ini | 1 - options/locale/locale_tr-TR.ini | 1 - options/locale/locale_uk-UA.ini | 1 - services/gitdiff/gitdiff.go | 8 +++----- templates/repo/diff/box.tmpl | 2 +- 28 files changed, 6 insertions(+), 32 deletions(-) diff --git a/options/locale/locale_cs-CZ.ini b/options/locale/locale_cs-CZ.ini index d8dacd7ab6ebd..cc92f2e626d64 100644 --- a/options/locale/locale_cs-CZ.ini +++ b/options/locale/locale_cs-CZ.ini @@ -108,7 +108,6 @@ copy_path=Zkopírovat cestu copy_success=Zkopírováno! copy_error=Kopírování se nezdařilo copy_type_unsupported=Tento typ souboru nelze zkopírovat -copy_filename=Kopírovat název souboru write=Zapsat preview=Náhled diff --git a/options/locale/locale_de-DE.ini b/options/locale/locale_de-DE.ini index ba7ee0417a5f2..dae7275f82e55 100644 --- a/options/locale/locale_de-DE.ini +++ b/options/locale/locale_de-DE.ini @@ -108,7 +108,6 @@ copy_path=Pfad kopieren copy_success=Kopiert! copy_error=Kopieren fehlgeschlagen copy_type_unsupported=Dieser Dateityp kann nicht kopiert werden -copy_filename=Dateinamen kopieren write=Verfassen preview=Vorschau diff --git a/options/locale/locale_el-GR.ini b/options/locale/locale_el-GR.ini index fc6c98ac2967d..42b23dea05849 100644 --- a/options/locale/locale_el-GR.ini +++ b/options/locale/locale_el-GR.ini @@ -105,7 +105,6 @@ copy_branch=Αντιγραφή ονόματος κλάδου copy_success=Αντιγράφηκε! copy_error=Η αντιγραφή απέτυχε copy_type_unsupported=Αυτός ο τύπος αρχείου δεν μπορεί να αντιγραφεί -copy_filename=Αντιγραφή ονόματος αρχείου write=Σύνταξη preview=Προεπισκόπηση diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 381dc9129c218..64bc3b18713f0 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -106,10 +106,10 @@ copy_hash = Copy hash copy_content = Copy content copy_branch = Copy branch name copy_path = Copy path -copy_filename = Copy filename copy_success = Copied! copy_error = Copy failed copy_type_unsupported = This file type cannot be copied +copy_filename = Copy filename write = Write preview = Preview diff --git a/options/locale/locale_es-ES.ini b/options/locale/locale_es-ES.ini index c996702e3c686..ffacb46b19918 100644 --- a/options/locale/locale_es-ES.ini +++ b/options/locale/locale_es-ES.ini @@ -103,7 +103,6 @@ copy_branch=Copiar nombre de rama copy_success=¡Copiado! copy_error=Copiar falló copy_type_unsupported=No se puede copiar este tipo de archivo -copy_filename=Copiar nombre de archivo write=Escribir preview=Vista previa diff --git a/options/locale/locale_fa-IR.ini b/options/locale/locale_fa-IR.ini index 546e84c9027a0..abeef31988c49 100644 --- a/options/locale/locale_fa-IR.ini +++ b/options/locale/locale_fa-IR.ini @@ -78,7 +78,6 @@ copy_url=کپی URL copy_branch=کپی نام شاخه copy_success=کپی شد! copy_error=کپی ناموفق -copy_filename=کپی نام فایل write=نوشتن preview=پیش نمایش diff --git a/options/locale/locale_fi-FI.ini b/options/locale/locale_fi-FI.ini index 2004ad0caed89..9d7fc033c45b0 100644 --- a/options/locale/locale_fi-FI.ini +++ b/options/locale/locale_fi-FI.ini @@ -91,7 +91,6 @@ copy_url=Kopioi osoite copy_branch=Kopioi haaran nimi copy_success=Kopioitu! copy_error=Kopiointi epäonnistui -copy_filename=Kopioi tiedostonimi write=Kirjoita preview=Esikatselu diff --git a/options/locale/locale_fr-FR.ini b/options/locale/locale_fr-FR.ini index 98cd8e7b25ba6..5814de64ca883 100644 --- a/options/locale/locale_fr-FR.ini +++ b/options/locale/locale_fr-FR.ini @@ -109,7 +109,6 @@ copy_path=Copier le chemin copy_success=Copié ! copy_error=Échec de la copie copy_type_unsupported=Ce type de fichier ne peut pas être copié -copy_filename=Copier le nom du fichier write=Écrire preview=Aperçu diff --git a/options/locale/locale_ga-IE.ini b/options/locale/locale_ga-IE.ini index 220920ef898ad..b5b05209e5af3 100644 --- a/options/locale/locale_ga-IE.ini +++ b/options/locale/locale_ga-IE.ini @@ -109,7 +109,6 @@ copy_path=Cóipeáil cosán copy_success=Cóipeáil! copy_error=Theip ar an gcóipeáil copy_type_unsupported=Ní féidir an cineál comhaid seo a chóipeáil -copy_filename=Cóipeáil ainm an chomhaid write=Scríobh preview=Réamhamharc diff --git a/options/locale/locale_hu-HU.ini b/options/locale/locale_hu-HU.ini index a172637e48552..0fc86f077532f 100644 --- a/options/locale/locale_hu-HU.ini +++ b/options/locale/locale_hu-HU.ini @@ -70,7 +70,6 @@ edit=Szerkesztés enabled=Engedélyezett disabled=Letiltva -copy_filename=Fájlnév másolása write=Írás preview=Előnézet diff --git a/options/locale/locale_id-ID.ini b/options/locale/locale_id-ID.ini index 914b29ba1ab90..a5640655d2d8b 100644 --- a/options/locale/locale_id-ID.ini +++ b/options/locale/locale_id-ID.ini @@ -97,7 +97,6 @@ copy_branch=Salin nama branch copy_success=Tersalin! copy_error=Gagal menyalin copy_type_unsupported=Tipe berkas ini tidak dapat disalin -copy_filename=Salin nama file write=Tulis preview=Pratinjau diff --git a/options/locale/locale_is-IS.ini b/options/locale/locale_is-IS.ini index cff67f4f88bab..177cf61068ff5 100644 --- a/options/locale/locale_is-IS.ini +++ b/options/locale/locale_is-IS.ini @@ -89,7 +89,6 @@ copy_url=Afrita vefslóð copy_branch=Afritaðu heiti greinar copy_success=Afritað! copy_error=Afritun mistókst -copy_filename=Afritaðu skráarnafn write=Skrifa preview=Forskoða diff --git a/options/locale/locale_it-IT.ini b/options/locale/locale_it-IT.ini index 7885247a5ee3d..31aebff2d61cb 100644 --- a/options/locale/locale_it-IT.ini +++ b/options/locale/locale_it-IT.ini @@ -92,7 +92,6 @@ copy_url=Copia URL copy_branch=Copia nome del ramo copy_success=Copiato! copy_error=Copia fallita -copy_filename=Copia nome file write=Scrivi preview=Anteprima diff --git a/options/locale/locale_ja-JP.ini b/options/locale/locale_ja-JP.ini index 33630c21726a4..3b3083d8c68a8 100644 --- a/options/locale/locale_ja-JP.ini +++ b/options/locale/locale_ja-JP.ini @@ -109,7 +109,6 @@ copy_path=パスをコピー copy_success=コピーされました! copy_error=コピーに失敗しました copy_type_unsupported=このファイルタイプはコピーできません -copy_filename=ファイル名をコピーする write=書き込み preview=プレビュー diff --git a/options/locale/locale_ko-KR.ini b/options/locale/locale_ko-KR.ini index 7e6dbf49954a5..39df68f126b7f 100644 --- a/options/locale/locale_ko-KR.ini +++ b/options/locale/locale_ko-KR.ini @@ -26,7 +26,7 @@ captcha=보안 문자 twofa=2단계 인증 twofa_scratch=2단계 일회성 코드 passcode=인증코드 -copy_filename=파일 이름 복사 + repository=저장소 organization=조직 diff --git a/options/locale/locale_lv-LV.ini b/options/locale/locale_lv-LV.ini index c0ca82f58a2cf..9c8f47534bf62 100644 --- a/options/locale/locale_lv-LV.ini +++ b/options/locale/locale_lv-LV.ini @@ -107,7 +107,6 @@ copy_branch=Kopēt atzara nosaukumu copy_success=Nokopēts! copy_error=Kopēšana neizdevās copy_type_unsupported=Šī veida failus nav iespējams nokopēt -copy_filename=Kopēt faila nosaukumu write=Rakstīt preview=Priekšskatītījums diff --git a/options/locale/locale_nl-NL.ini b/options/locale/locale_nl-NL.ini index 8540f5f55510a..326a203c8fd99 100644 --- a/options/locale/locale_nl-NL.ini +++ b/options/locale/locale_nl-NL.ini @@ -92,7 +92,6 @@ copy_url=Kopieer URL copy_branch=Kopieer branchnaam copy_success=Gekopieerd! copy_error=Kopiëren mislukt -copy_filename=Kopier filnavn write=Schrijf preview=Voorbeeld diff --git a/options/locale/locale_pl-PL.ini b/options/locale/locale_pl-PL.ini index 2e1bed358701f..872f1104abc70 100644 --- a/options/locale/locale_pl-PL.ini +++ b/options/locale/locale_pl-PL.ini @@ -90,7 +90,6 @@ copy_url=Kopiuj adres URL copy_branch=Kopiuj nazwę gałęzi copy_success=Skopiowano! copy_error=Kopiowanie nie powiodło się -copy_filename=Kopiuj nazwę pliku write=Napisz preview=Podgląd diff --git a/options/locale/locale_pt-BR.ini b/options/locale/locale_pt-BR.ini index d88c827c6ed18..b457ecc8004d8 100644 --- a/options/locale/locale_pt-BR.ini +++ b/options/locale/locale_pt-BR.ini @@ -109,7 +109,6 @@ copy_path=Copiar caminho copy_success=Copiado! copy_error=A cópia falhou copy_type_unsupported=Este tipo de arquivo não pode ser copiado -copy_filename=Copiar nome do arquivo write=Escrever preview=Pré-visualização diff --git a/options/locale/locale_pt-PT.ini b/options/locale/locale_pt-PT.ini index 3a3dbff1ce275..9e648b66023f1 100644 --- a/options/locale/locale_pt-PT.ini +++ b/options/locale/locale_pt-PT.ini @@ -109,7 +109,6 @@ copy_path=Copiar caminho copy_success=Copiado! copy_error=Falha ao copiar copy_type_unsupported=Este tipo de ficheiro não pode ser copiado -copy_filename=Copiar nome do ficheiro write=Escrever preview=Pré-visualizar diff --git a/options/locale/locale_ru-RU.ini b/options/locale/locale_ru-RU.ini index 443187bdd7ec2..6da0eea91ce76 100644 --- a/options/locale/locale_ru-RU.ini +++ b/options/locale/locale_ru-RU.ini @@ -103,7 +103,6 @@ copy_branch=Скопировать имя ветки copy_success=Скопировано! copy_error=Ошибка при копировании copy_type_unsupported=Невозможно скопировать файл этого типа -copy_filename=Скопировать имя файла write=Редактирование preview=Предпросмотр diff --git a/options/locale/locale_si-LK.ini b/options/locale/locale_si-LK.ini index a6b0729352b68..e065527bbe8ec 100644 --- a/options/locale/locale_si-LK.ini +++ b/options/locale/locale_si-LK.ini @@ -78,7 +78,6 @@ copy_url=ඒ.ස.නි. පිටපත් copy_branch=ශාඛාවේ නම පිටපත් කරන්න copy_success=පිටපත් විය! copy_error=පිටපත් වීමට අසමත් විය -copy_filename=ගොනු නාමය පිටපත් කරන්න write=ලියන්න preview=පෙරදසුන diff --git a/options/locale/locale_sk-SK.ini b/options/locale/locale_sk-SK.ini index 28b1390b97ba3..dc022da24bc8c 100644 --- a/options/locale/locale_sk-SK.ini +++ b/options/locale/locale_sk-SK.ini @@ -104,7 +104,6 @@ copy_branch=Kopírovať meno vetvy copy_success=Skopírované! copy_error=Kopírovanie zlyhalo copy_type_unsupported=Tento typ súboru nie je možné skopírovať -copy_filename=Kopírovať názov súboru write=Zapísať preview=Náhľad diff --git a/options/locale/locale_sv-SE.ini b/options/locale/locale_sv-SE.ini index d40cca4809595..e8c13cae0ddca 100644 --- a/options/locale/locale_sv-SE.ini +++ b/options/locale/locale_sv-SE.ini @@ -71,7 +71,6 @@ edit=Redigera enabled=Aktiv disabled=Inaktiverad -copy_filename=Kopiera filnamn write=Skriv preview=Förhandsgranska diff --git a/options/locale/locale_tr-TR.ini b/options/locale/locale_tr-TR.ini index 246700b04a1db..a3ae736f67aeb 100644 --- a/options/locale/locale_tr-TR.ini +++ b/options/locale/locale_tr-TR.ini @@ -109,7 +109,6 @@ copy_path=Yolu kopyala copy_success=Kopyalandı! copy_error=Kopyalama başarısız oldu copy_type_unsupported=Bu dosya türü kopyalanamaz -copy_filename=Dosya adını kopyala write=Yaz preview=Önizleme diff --git a/options/locale/locale_uk-UA.ini b/options/locale/locale_uk-UA.ini index d15d278105277..1849d5d378246 100644 --- a/options/locale/locale_uk-UA.ini +++ b/options/locale/locale_uk-UA.ini @@ -107,7 +107,6 @@ copy_path=Копіювати шлях copy_success=Скопійовано! copy_error=Не вдалося скопіювати copy_type_unsupported=Цей тип файлу не можна скопіювати -copy_filename=Копіювати назву файлу write=Писати preview=Попередній перегляд diff --git a/services/gitdiff/gitdiff.go b/services/gitdiff/gitdiff.go index dd3bb57ac4a35..17adfa833cdcb 100644 --- a/services/gitdiff/gitdiff.go +++ b/services/gitdiff/gitdiff.go @@ -13,7 +13,7 @@ import ( "html/template" "io" "net/url" - "path/filepath" + "path" "sort" "strings" "time" @@ -313,7 +313,6 @@ type DiffFile struct { // basic fields (parsed from diff result) Name string - ShortName string NameHash string OldName string Addition int @@ -406,9 +405,9 @@ func (diffFile *DiffFile) GetDiffFileName() string { // GetDiffFileName returns the short name of the diff file, or its short old name in case it was deleted func (diffFile *DiffFile) GetDiffFileShortName() string { if diffFile.Name == "" { - return filepath.Base(diffFile.OldName) + return path.Base(diffFile.OldName) } - return filepath.Base(diffFile.Name) + return path.Base(diffFile.Name) } func (diffFile *DiffFile) ShouldBeHidden() bool { @@ -1037,7 +1036,6 @@ func createDiffFile(line string) *DiffFile { curFile.OldName, oldNameAmbiguity = readFileName(rd) curFile.Name, newNameAmbiguity = readFileName(rd) - curFile.ShortName = curFile.GetDiffFileShortName() if oldNameAmbiguity && newNameAmbiguity { curFile.isAmbiguous = true // OK we should bet that the oldName and the newName are the same if they can be made to be same diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 4fdd0c5bf24fa..0f959ebca2b79 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -143,7 +143,7 @@ {{end}} - + {{if not $.PageIsWiki}} {{if $file.IsDeleted}} {{ctx.Locale.Tr "repo.diff.view_file"}} From f9b996341981bfe5deeb8d3b7e3d7c284ff37477 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 2 Oct 2025 21:50:04 +0800 Subject: [PATCH 4/5] Update templates/repo/diff/box.tmpl Signed-off-by: wxiaoguang --- templates/repo/diff/box.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 0f959ebca2b79..aaaf0aa45b910 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -143,7 +143,7 @@ {{end}} - + {{if not $.PageIsWiki}} {{if $file.IsDeleted}} {{ctx.Locale.Tr "repo.diff.view_file"}} From 3490c47a347ac141837383b5ccd205c06fc139f6 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 2 Oct 2025 21:52:17 +0800 Subject: [PATCH 5/5] update names Signed-off-by: wxiaoguang --- services/gitdiff/gitdiff.go | 4 ++-- templates/repo/diff/box.tmpl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/gitdiff/gitdiff.go b/services/gitdiff/gitdiff.go index 17adfa833cdcb..734d148364f36 100644 --- a/services/gitdiff/gitdiff.go +++ b/services/gitdiff/gitdiff.go @@ -402,8 +402,8 @@ func (diffFile *DiffFile) GetDiffFileName() string { return diffFile.Name } -// GetDiffFileName returns the short name of the diff file, or its short old name in case it was deleted -func (diffFile *DiffFile) GetDiffFileShortName() string { +// GetDiffFileBaseName returns the short name of the diff file, or its short old name in case it was deleted +func (diffFile *DiffFile) GetDiffFileBaseName() string { if diffFile.Name == "" { return path.Base(diffFile.OldName) } diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index aaaf0aa45b910..7eb96e1ddc5bb 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -143,7 +143,7 @@ {{end}} - + {{if not $.PageIsWiki}} {{if $file.IsDeleted}} {{ctx.Locale.Tr "repo.diff.view_file"}}