mirror of
https://github.com/go-gitea/gitea.git
synced 2025-05-14 02:58:12 +00:00
Merge branch 'main' of https://github.com/go-gitea/gitea into pr/ChristopherHX/33964-1
This commit is contained in:
commit
149aac6fd4
@ -64,3 +64,4 @@ Rowan Bohde <rowan.bohde@gmail.com> (@bohde)
|
||||
hiifong <i@hiif.ong> (@hiifong)
|
||||
metiftikci <metiftikci@hotmail.com> (@metiftikci)
|
||||
Christopher Homberger <christopher.homberger@web.de> (@ChristopherHX)
|
||||
Tobias Balle-Petersen <tobiasbp@gmail.com> (@tobiasbp)
|
||||
|
@ -1285,7 +1285,6 @@ file_copy_permalink=Kopírovat trvalý odkaz
|
||||
view_git_blame=Zobrazit Git Blame
|
||||
video_not_supported_in_browser=Váš prohlížeč nepodporuje značku pro HTML5 video.
|
||||
audio_not_supported_in_browser=Váš prohlížeč nepodporuje značku pro HTML5 audio.
|
||||
stored_lfs=Uloženo pomocí Git LFS
|
||||
symbolic_link=Symbolický odkaz
|
||||
executable_file=Spustitelný soubor
|
||||
vendored=Vendorováno
|
||||
|
@ -1286,7 +1286,6 @@ file_copy_permalink=Permalink kopieren
|
||||
view_git_blame=Git Blame ansehen
|
||||
video_not_supported_in_browser=Dein Browser unterstützt das HTML5 'video'-Tag nicht.
|
||||
audio_not_supported_in_browser=Dein Browser unterstützt den HTML5 'audio'-Tag nicht.
|
||||
stored_lfs=Gespeichert mit Git LFS
|
||||
symbolic_link=Softlink
|
||||
executable_file=Ausführbare Datei
|
||||
vendored=Vendor
|
||||
|
@ -1148,7 +1148,6 @@ file_copy_permalink=Αντιγραφή Permalink
|
||||
view_git_blame=Προβολή Git Blame
|
||||
video_not_supported_in_browser=Το πρόγραμμα περιήγησής σας δεν υποστηρίζει την ετικέτα HTML5 'video'.
|
||||
audio_not_supported_in_browser=Το πρόγραμμα περιήγησής σας δεν υποστηρίζει την ετικέτα HTML5 'audio'.
|
||||
stored_lfs=Αποθηκεύτηκε με το Git LFS
|
||||
symbolic_link=Symbolic link
|
||||
executable_file=Εκτελέσιμο Αρχείο
|
||||
commit_graph=Γράφημα Υποβολών
|
||||
|
@ -1305,7 +1305,6 @@ file_copy_permalink = Copy Permalink
|
||||
view_git_blame = View Git Blame
|
||||
video_not_supported_in_browser = Your browser does not support the HTML5 'video' tag.
|
||||
audio_not_supported_in_browser = Your browser does not support the HTML5 'audio' tag.
|
||||
stored_lfs = Stored with Git LFS
|
||||
symbolic_link = Symbolic link
|
||||
executable_file = Executable File
|
||||
vendored = Vendored
|
||||
|
@ -1138,7 +1138,6 @@ file_copy_permalink=Copiar Permalink
|
||||
view_git_blame=Ver la culpa de Git
|
||||
video_not_supported_in_browser=Su navegador no soporta el tag video de HTML5.
|
||||
audio_not_supported_in_browser=Su navegador no soporta el tag audio de HTML5.
|
||||
stored_lfs=Almacenados con Git LFS
|
||||
symbolic_link=Enlace simbólico
|
||||
executable_file=Archivo Ejecutable
|
||||
commit_graph=Gráfico de commits
|
||||
|
@ -900,7 +900,6 @@ file_too_large=حجم این پرونده بیشتر از آن است که قا
|
||||
file_copy_permalink=پرمالینک را کپی کنید
|
||||
video_not_supported_in_browser=مرورگر شما از تگ video که در HTML5 تعریف شده است، پشتیبانی نمی کند.
|
||||
audio_not_supported_in_browser=مرورگر شما از تگ audio که در HTML5 تعریف شده است، پشتیبانی نمی کند.
|
||||
stored_lfs=ذخیره شده با GIT LFS
|
||||
symbolic_link=پیوند نمادین
|
||||
commit_graph=نمودار کامیت
|
||||
commit_graph.select=انتخاب برنچها
|
||||
|
@ -1304,7 +1304,6 @@ file_copy_permalink=Copier le lien permanent
|
||||
view_git_blame=Voir Git Blâme
|
||||
video_not_supported_in_browser=Votre navigateur ne supporte pas la balise « vidéo » HTML5.
|
||||
audio_not_supported_in_browser=Votre navigateur ne supporte pas la balise « audio » HTML5.
|
||||
stored_lfs=Stocké avec Git LFS
|
||||
symbolic_link=Lien symbolique
|
||||
executable_file=Fichiers exécutables
|
||||
vendored=Externe
|
||||
|
@ -1305,7 +1305,6 @@ file_copy_permalink=Cóipeáil Buan-nasc
|
||||
view_git_blame=Féach ar Git Blame
|
||||
video_not_supported_in_browser=Ní thacaíonn do bhrabhsálaí leis an gclib 'video' HTML5.
|
||||
audio_not_supported_in_browser=Ní thacaíonn do bhrabhsálaí leis an gclib 'audio' HTML5.
|
||||
stored_lfs=Stóráilte le Git LFS
|
||||
symbolic_link=Nasc siombalach
|
||||
executable_file=Comhad Infheidhmithe
|
||||
vendored=Díoltóra
|
||||
|
@ -679,7 +679,6 @@ file_too_large=Ez a fájl túl nagy ahhoz, hogy megjelenítsük.
|
||||
|
||||
video_not_supported_in_browser=A böngésző nem támogatja a HTML5 video tag-et.
|
||||
audio_not_supported_in_browser=A böngésző nem támogatja a HTML5 audio tag-et.
|
||||
stored_lfs=Git LFS-el eltárolva
|
||||
symbolic_link=Szimbolikus hivatkozás
|
||||
commit_graph=Commit gráf
|
||||
commit_graph.hide_pr_refs=Pull request-ek elrejtése
|
||||
|
@ -685,7 +685,6 @@ file_view_raw=Lihat Mentah
|
||||
file_permalink=Permalink
|
||||
file_too_large=Berkas terlalu besar untuk ditampilkan.
|
||||
|
||||
stored_lfs=Tersimpan dengan GIT LFS
|
||||
commit_graph=Grafik Komit
|
||||
blame=Salahkan
|
||||
normal_view=Pandangan Normal
|
||||
|
@ -667,7 +667,6 @@ file_view_source=Skoða Frumkóða
|
||||
file_view_rendered=Skoða Unnið
|
||||
|
||||
file_copy_permalink=Afrita Varanlega Slóð
|
||||
stored_lfs=Geymt með Git LFS
|
||||
commit_graph.hide_pr_refs=Fela Sameiningarbeiðnir
|
||||
commit_graph.monochrome=Einlitað
|
||||
commit_graph.color=Litað
|
||||
|
@ -967,7 +967,6 @@ file_copy_permalink=Copia Permalink
|
||||
view_git_blame=Visualizza Git Blame
|
||||
video_not_supported_in_browser=Il tuo browser non supporta i tag "video" di HTML5.
|
||||
audio_not_supported_in_browser=Il tuo browser non supporta il tag "video" di HTML5.
|
||||
stored_lfs=Memorizzati con Git LFS
|
||||
symbolic_link=Link Simbolico
|
||||
commit_graph=Grafico dei commit
|
||||
commit_graph.select=Seleziona rami
|
||||
|
@ -1304,7 +1304,6 @@ file_copy_permalink=パーマリンクをコピー
|
||||
view_git_blame=Git Blameを表示
|
||||
video_not_supported_in_browser=このブラウザはHTML5のvideoタグをサポートしていません。
|
||||
audio_not_supported_in_browser=このブラウザーはHTML5のaudioタグをサポートしていません。
|
||||
stored_lfs=Git LFSで保管されています
|
||||
symbolic_link=シンボリック リンク
|
||||
executable_file=実行ファイル
|
||||
vendored=ベンダーファイル
|
||||
|
@ -626,7 +626,6 @@ file_too_large=보여주기에는 파일이 너무 큽니다.
|
||||
|
||||
video_not_supported_in_browser=당신의 브라우저가 HTML5 'video' 태그를 지원하지 않습니다.
|
||||
audio_not_supported_in_browser=당신의 브라우저가 HTML5 'audio' 태그를 지원하지 않습니다.
|
||||
stored_lfs=Git LFS에 저장되어 있습니다
|
||||
commit_graph=커밋 그래프
|
||||
|
||||
editor.new_file=새 파일
|
||||
|
@ -1154,7 +1154,6 @@ file_copy_permalink=Kopēt saiti
|
||||
view_git_blame=Aplūkot Git vainīgos
|
||||
video_not_supported_in_browser=Jūsu pārlūks neatbalsta HTML5 video.
|
||||
audio_not_supported_in_browser=Jūsu pārlūks neatbalsta HTML5 audio.
|
||||
stored_lfs=Saglabāts Git LFS
|
||||
symbolic_link=Simboliska saite
|
||||
executable_file=Izpildāmais fails
|
||||
commit_graph=Revīziju grafs
|
||||
|
@ -965,7 +965,6 @@ file_copy_permalink=Permalink kopiëren
|
||||
view_git_blame=Bekijk Git Blame
|
||||
video_not_supported_in_browser=Je browser ondersteunt de HTML5 'video'-tag niet.
|
||||
audio_not_supported_in_browser=Je browser ondersteunt de HTML5 'audio'-tag niet.
|
||||
stored_lfs=Opgeslagen met Git LFS
|
||||
symbolic_link=Symbolic link
|
||||
commit_graph=Commit grafiek
|
||||
commit_graph.select=Selecteer branches
|
||||
|
@ -900,7 +900,6 @@ file_too_large=Ten plik jest zbyt duży, aby go wyświetlić.
|
||||
file_copy_permalink=Kopiuj bezpośredni odnośnik
|
||||
video_not_supported_in_browser=Twoja przeglądarka nie obsługuje znacznika HTML5 "video".
|
||||
audio_not_supported_in_browser=Twoja przeglądarka nie obsługuje znacznika HTML5 "audio".
|
||||
stored_lfs=Przechowane za pomocą Git LFS
|
||||
symbolic_link=Dowiązanie symboliczne
|
||||
commit_graph=Wykres commitów
|
||||
commit_graph.select=Wybierz gałęzie
|
||||
|
@ -1148,7 +1148,6 @@ file_copy_permalink=Copiar Link Permanente
|
||||
view_git_blame=Ver Git Blame
|
||||
video_not_supported_in_browser=Seu navegador não suporta a tag 'video' do HTML5.
|
||||
audio_not_supported_in_browser=Seu navegador não suporta a tag 'audio' do HTML5.
|
||||
stored_lfs=Armazenado com Git LFS
|
||||
symbolic_link=Link simbólico
|
||||
executable_file=Arquivo executável
|
||||
generated=Gerado
|
||||
|
@ -1305,7 +1305,6 @@ file_copy_permalink=Copiar ligação permanente
|
||||
view_git_blame=Ver Git Blame
|
||||
video_not_supported_in_browser=O seu navegador não suporta a etiqueta 'video' do HTML5.
|
||||
audio_not_supported_in_browser=O seu navegador não suporta a etiqueta 'audio' do HTML5.
|
||||
stored_lfs=Armazenado com Git LFS
|
||||
symbolic_link=Ligação simbólica
|
||||
executable_file=Ficheiro executável
|
||||
vendored=Externo
|
||||
|
@ -1127,7 +1127,6 @@ file_copy_permalink=Копировать постоянную ссылку
|
||||
view_git_blame=Показать git blame
|
||||
video_not_supported_in_browser=Ваш браузер не поддерживает HTML5 'video' тэг.
|
||||
audio_not_supported_in_browser=Ваш браузер не поддерживает HTML5 'audio' тэг.
|
||||
stored_lfs=Хранится Git LFS
|
||||
symbolic_link=Символическая ссылка
|
||||
executable_file=Исполняемый файл
|
||||
commit_graph=Граф коммитов
|
||||
|
@ -874,7 +874,6 @@ file_too_large=ගොනුව පෙන්වීමට තරම් විශ
|
||||
file_copy_permalink=පිටපත් මාමලින්ක්
|
||||
video_not_supported_in_browser=ඔබගේ බ්රව්සරය HTML5 'වීඩියෝ' ටැගය සඳහා සහය නොදක්වයි.
|
||||
audio_not_supported_in_browser=ඔබගේ බ්රව්සරය HTML5 'ශ්රව්ය' ටැගය සඳහා සහය නොදක්වයි.
|
||||
stored_lfs=Git LFS සමඟ ගබඩා
|
||||
symbolic_link=සංකේතාත්මක සබැඳිය
|
||||
commit_graph=ප්රස්තාරය කැප
|
||||
commit_graph.select=ශාඛා තෝරන්න
|
||||
|
@ -981,7 +981,6 @@ file_copy_permalink=Kopírovať trvalý odkaz
|
||||
view_git_blame=Zobraziť Git Blame
|
||||
video_not_supported_in_browser=Váš prehliadač nepodporuje HTML5 tag 'video'.
|
||||
audio_not_supported_in_browser=Váš prehliadač nepodporuje HTML5 tag 'audio'.
|
||||
stored_lfs=Uložené pomocou Git LFS
|
||||
symbolic_link=Symbolický odkaz
|
||||
commit_graph=Graf commitov
|
||||
line=riadok
|
||||
|
@ -739,7 +739,6 @@ file_too_large=Filen är för stor för att visas.
|
||||
|
||||
video_not_supported_in_browser=Din webbläsare stödjer ej HTML5-taggen 'video'.
|
||||
audio_not_supported_in_browser=Din webbläsare stöder inte taggen 'audio' i HTML5.
|
||||
stored_lfs=Sparad med Git LFS
|
||||
symbolic_link=Symbolisk länk
|
||||
commit_graph=Commit-Graf
|
||||
commit_graph.monochrome=Mono
|
||||
|
@ -1244,7 +1244,6 @@ file_copy_permalink=Kalıcı Bağlantıyı Kopyala
|
||||
view_git_blame=Git Suç Görüntüle
|
||||
video_not_supported_in_browser=Tarayıcınız HTML5 'video' etiketini desteklemiyor.
|
||||
audio_not_supported_in_browser=Tarayıcınız HTML5 'audio' etiketini desteklemiyor.
|
||||
stored_lfs=Git LFS ile depolandı
|
||||
symbolic_link=Sembolik Bağlantı
|
||||
executable_file=Çalıştırılabilir Dosya
|
||||
vendored=Sağlanmış
|
||||
|
@ -910,7 +910,6 @@ file_too_large=Цей файл завеликий щоб бути показан
|
||||
file_copy_permalink=Копіювати постійне посилання
|
||||
video_not_supported_in_browser=Ваш браузер не підтримує тег 'video' HTML5.
|
||||
audio_not_supported_in_browser=Ваш браузер не підтримує тег HTML5 'audio'.
|
||||
stored_lfs=Збережено з Git LFS
|
||||
symbolic_link=Символічне посилання
|
||||
commit_graph=Графік комітів
|
||||
commit_graph.select=Виберіть гілки
|
||||
|
@ -1303,7 +1303,6 @@ file_copy_permalink=复制永久链接
|
||||
view_git_blame=查看 Git Blame
|
||||
video_not_supported_in_browser=您的浏览器不支持使用 HTML5 'video' 标签。
|
||||
audio_not_supported_in_browser=您的浏览器不支持使用 HTML5 'video' 标签。
|
||||
stored_lfs=存储到Git LFS
|
||||
symbolic_link=符号链接
|
||||
executable_file=可执行文件
|
||||
vendored=被供应的
|
||||
|
@ -364,7 +364,6 @@ file_history=文件歷史
|
||||
file_view_raw=查看原始文件
|
||||
file_permalink=永久連結
|
||||
|
||||
stored_lfs=儲存到到 Git LFS
|
||||
|
||||
editor.preview_changes=預覽更改
|
||||
editor.or=或
|
||||
|
@ -1273,7 +1273,6 @@ file_copy_permalink=複製固定連結
|
||||
view_git_blame=檢視 Git Blame
|
||||
video_not_supported_in_browser=您的瀏覽器不支援使用 HTML5 播放影片。
|
||||
audio_not_supported_in_browser=您的瀏覽器不支援 HTML5 的「audio」標籤
|
||||
stored_lfs=已使用 Git LFS 儲存
|
||||
symbolic_link=符號連結
|
||||
executable_file=可執行檔
|
||||
vendored=已供應
|
||||
|
18
package-lock.json
generated
18
package-lock.json
generated
@ -10,7 +10,7 @@
|
||||
"@citation-js/plugin-csl": "0.7.18",
|
||||
"@citation-js/plugin-software-formats": "0.6.1",
|
||||
"@github/markdown-toolbar-element": "2.2.3",
|
||||
"@github/relative-time-element": "4.4.5",
|
||||
"@github/relative-time-element": "4.4.6",
|
||||
"@github/text-expander-element": "2.9.1",
|
||||
"@mcaptcha/vanilla-glue": "0.1.0-alpha-3",
|
||||
"@primer/octicons": "19.15.1",
|
||||
@ -1149,10 +1149,18 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@github/relative-time-element": {
|
||||
"version": "4.4.5",
|
||||
"resolved": "https://registry.npmjs.org/@github/relative-time-element/-/relative-time-element-4.4.5.tgz",
|
||||
"integrity": "sha512-9ejPtayBDIJfEU8x1fg/w2o5mahHkkp1SC6uObDtoKs4Gn+2a1vNK8XIiNDD8rMeEfpvDjydgSZZ+uk+7N0VsQ==",
|
||||
"license": "MIT"
|
||||
"version": "4.4.6",
|
||||
"resolved": "https://registry.npmjs.org/@github/relative-time-element/-/relative-time-element-4.4.6.tgz",
|
||||
"integrity": "sha512-KgrkxVWb/qcBBSDumGhRzieqtSzGJyyEF4D5to+OVJf/nTExU5sSlPKiNEzN8Nh6Kj0SGlq8UdIJjEgPxZzUhQ==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@types/react": "18 || 19"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@github/text-expander-element": {
|
||||
"version": "2.9.1",
|
||||
|
@ -9,7 +9,7 @@
|
||||
"@citation-js/plugin-csl": "0.7.18",
|
||||
"@citation-js/plugin-software-formats": "0.6.1",
|
||||
"@github/markdown-toolbar-element": "2.2.3",
|
||||
"@github/relative-time-element": "4.4.5",
|
||||
"@github/relative-time-element": "4.4.6",
|
||||
"@github/text-expander-element": "2.9.1",
|
||||
"@mcaptcha/vanilla-glue": "0.1.0-alpha-3",
|
||||
"@primer/octicons": "19.15.1",
|
||||
|
@ -1632,7 +1632,9 @@ func GetPullRequestFiles(ctx *context.APIContext) {
|
||||
|
||||
apiFiles := make([]*api.ChangedFile, 0, limit)
|
||||
for i := start; i < start+limit; i++ {
|
||||
apiFiles = append(apiFiles, convert.ToChangedFile(diff.Files[i], pr.HeadRepo, endCommitID))
|
||||
// refs/pull/1/head stores the HEAD commit ID, allowing all related commits to be found in the base repository.
|
||||
// The head repository might have been deleted, so we should not rely on it here.
|
||||
apiFiles = append(apiFiles, convert.ToChangedFile(diff.Files[i], pr.BaseRepo, endCommitID))
|
||||
}
|
||||
|
||||
ctx.SetLinkHeader(totalNumberOfFiles, listOptions.PageSize)
|
||||
|
@ -402,12 +402,11 @@ func ParseCompareInfo(ctx *context.Context) *common.CompareInfo {
|
||||
ci.HeadRepo = ctx.Repo.Repository
|
||||
ci.HeadGitRepo = ctx.Repo.GitRepo
|
||||
} else if has {
|
||||
ci.HeadGitRepo, err = gitrepo.OpenRepository(ctx, ci.HeadRepo)
|
||||
ci.HeadGitRepo, err = gitrepo.RepositoryFromRequestContextOrOpen(ctx, ci.HeadRepo)
|
||||
if err != nil {
|
||||
ctx.ServerError("OpenRepository", err)
|
||||
ctx.ServerError("RepositoryFromRequestContextOrOpen", err)
|
||||
return nil
|
||||
}
|
||||
defer ci.HeadGitRepo.Close()
|
||||
} else {
|
||||
ctx.NotFound(nil)
|
||||
return nil
|
||||
@ -726,11 +725,6 @@ func getBranchesAndTagsForRepo(ctx gocontext.Context, repo *repo_model.Repositor
|
||||
// CompareDiff show different from one commit to another commit
|
||||
func CompareDiff(ctx *context.Context) {
|
||||
ci := ParseCompareInfo(ctx)
|
||||
defer func() {
|
||||
if ci != nil && ci.HeadGitRepo != nil {
|
||||
ci.HeadGitRepo.Close()
|
||||
}
|
||||
}()
|
||||
if ctx.Written() {
|
||||
return
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ import (
|
||||
"code.gitea.io/gitea/modules/markup"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/templates"
|
||||
"code.gitea.io/gitea/modules/typesniffer"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/routers/utils"
|
||||
@ -151,9 +150,13 @@ func editFile(ctx *context.Context, isNewFile bool) {
|
||||
return
|
||||
}
|
||||
|
||||
dataRc, err := blob.DataAsync()
|
||||
buf, dataRc, fInfo, err := getFileReader(ctx, ctx.Repo.Repository.ID, blob)
|
||||
if err != nil {
|
||||
ctx.NotFound(err)
|
||||
if git.IsErrNotExist(err) {
|
||||
ctx.NotFound(err)
|
||||
} else {
|
||||
ctx.ServerError("getFileReader", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -161,12 +164,8 @@ func editFile(ctx *context.Context, isNewFile bool) {
|
||||
|
||||
ctx.Data["FileSize"] = blob.Size()
|
||||
|
||||
buf := make([]byte, 1024)
|
||||
n, _ := util.ReadAtMost(dataRc, buf)
|
||||
buf = buf[:n]
|
||||
|
||||
// Only some file types are editable online as text.
|
||||
if !typesniffer.DetectContentType(buf).IsRepresentableAsText() {
|
||||
if !fInfo.isTextFile || fInfo.isLFSFile {
|
||||
ctx.NotFound(nil)
|
||||
return
|
||||
}
|
||||
|
@ -1296,11 +1296,6 @@ func CompareAndPullRequestPost(ctx *context.Context) {
|
||||
)
|
||||
|
||||
ci := ParseCompareInfo(ctx)
|
||||
defer func() {
|
||||
if ci != nil && ci.HeadGitRepo != nil {
|
||||
ci.HeadGitRepo.Close()
|
||||
}
|
||||
}()
|
||||
if ctx.Written() {
|
||||
return
|
||||
}
|
||||
|
@ -101,8 +101,8 @@
|
||||
{{end}}
|
||||
</div>
|
||||
<span class="file tw-flex tw-items-center tw-font-mono tw-flex-1"><a class="muted file-link" title="{{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}" href="#diff-{{$file.NameHash}}">{{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}</a>
|
||||
{{if .IsLFSFile}} ({{ctx.Locale.Tr "repo.stored_lfs"}}){{end}}
|
||||
<button class="btn interact-fg tw-p-2" data-clipboard-text="{{$file.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_path"}}">{{svg "octicon-copy" 14}}</button>
|
||||
{{if .IsLFSFile}}<span class="ui label">LFS</span>{{end}}
|
||||
{{if $file.IsGenerated}}
|
||||
<span class="ui label">{{ctx.Locale.Tr "repo.diff.generated"}}</span>
|
||||
{{end}}
|
||||
|
@ -11,7 +11,7 @@
|
||||
{{end}}
|
||||
{{if ne .FileSize nil}}
|
||||
<div class="file-info-entry">
|
||||
{{FileSize .FileSize}}{{if .IsLFSFile}} ({{ctx.Locale.Tr "repo.stored_lfs"}}){{end}}
|
||||
{{FileSize .FileSize}}{{if .IsLFSFile}}<span class="ui label">LFS</span>{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{if .LFSLock}}
|
||||
|
@ -8,7 +8,10 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
auth_model "code.gitea.io/gitea/models/auth"
|
||||
"code.gitea.io/gitea/models/db"
|
||||
@ -17,11 +20,15 @@ import (
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/services/convert"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
"code.gitea.io/gitea/services/gitdiff"
|
||||
issue_service "code.gitea.io/gitea/services/issue"
|
||||
pull_service "code.gitea.io/gitea/services/pull"
|
||||
files_service "code.gitea.io/gitea/services/repository/files"
|
||||
"code.gitea.io/gitea/tests"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@ -424,3 +431,94 @@ func TestAPICommitPullRequest(t *testing.T) {
|
||||
req = NewRequestf(t, "GET", "/api/v1/repos/%s/%s/commits/%s/pull", owner.Name, repo.Name, invalidCommitSHA).AddTokenAuth(ctx.Token)
|
||||
ctx.Session.MakeRequest(t, req, http.StatusNotFound)
|
||||
}
|
||||
|
||||
func TestAPIViewPullFilesWithHeadRepoDeleted(t *testing.T) {
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
baseRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
|
||||
user1 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1})
|
||||
|
||||
ctx := NewAPITestContext(t, "user1", baseRepo.Name, auth_model.AccessTokenScopeAll)
|
||||
|
||||
doAPIForkRepository(ctx, "user2")(t)
|
||||
|
||||
forkedRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ForkID: baseRepo.ID, OwnerName: "user1"})
|
||||
|
||||
// add a new file to the forked repo
|
||||
addFileToForkedResp, err := files_service.ChangeRepoFiles(git.DefaultContext, forkedRepo, user1, &files_service.ChangeRepoFilesOptions{
|
||||
Files: []*files_service.ChangeRepoFile{
|
||||
{
|
||||
Operation: "create",
|
||||
TreePath: "file_1.txt",
|
||||
ContentReader: strings.NewReader("file1"),
|
||||
},
|
||||
},
|
||||
Message: "add file1",
|
||||
OldBranch: "master",
|
||||
NewBranch: "fork-branch-1",
|
||||
Author: &files_service.IdentityOptions{
|
||||
GitUserName: user1.Name,
|
||||
GitUserEmail: user1.Email,
|
||||
},
|
||||
Committer: &files_service.IdentityOptions{
|
||||
GitUserName: user1.Name,
|
||||
GitUserEmail: user1.Email,
|
||||
},
|
||||
Dates: &files_service.CommitDateOptions{
|
||||
Author: time.Now(),
|
||||
Committer: time.Now(),
|
||||
},
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.NotEmpty(t, addFileToForkedResp)
|
||||
|
||||
// create Pull
|
||||
pullIssue := &issues_model.Issue{
|
||||
RepoID: baseRepo.ID,
|
||||
Title: "Test pull-request-target-event",
|
||||
PosterID: user1.ID,
|
||||
Poster: user1,
|
||||
IsPull: true,
|
||||
}
|
||||
pullRequest := &issues_model.PullRequest{
|
||||
HeadRepoID: forkedRepo.ID,
|
||||
BaseRepoID: baseRepo.ID,
|
||||
HeadBranch: "fork-branch-1",
|
||||
BaseBranch: "master",
|
||||
HeadRepo: forkedRepo,
|
||||
BaseRepo: baseRepo,
|
||||
Type: issues_model.PullRequestGitea,
|
||||
}
|
||||
|
||||
prOpts := &pull_service.NewPullRequestOptions{Repo: baseRepo, Issue: pullIssue, PullRequest: pullRequest}
|
||||
err = pull_service.NewPullRequest(git.DefaultContext, prOpts)
|
||||
assert.NoError(t, err)
|
||||
pr := convert.ToAPIPullRequest(t.Context(), pullRequest, user1)
|
||||
|
||||
ctx = NewAPITestContext(t, "user2", baseRepo.Name, auth_model.AccessTokenScopeAll)
|
||||
doAPIGetPullFiles(ctx, pr, func(t *testing.T, files []*api.ChangedFile) {
|
||||
if assert.Len(t, files, 1) {
|
||||
assert.Equal(t, "file_1.txt", files[0].Filename)
|
||||
assert.Empty(t, files[0].PreviousFilename)
|
||||
assert.Equal(t, 1, files[0].Additions)
|
||||
assert.Equal(t, 1, files[0].Changes)
|
||||
assert.Equal(t, 0, files[0].Deletions)
|
||||
assert.Equal(t, "added", files[0].Status)
|
||||
}
|
||||
})(t)
|
||||
|
||||
// delete the head repository of the pull request
|
||||
forkCtx := NewAPITestContext(t, "user1", forkedRepo.Name, auth_model.AccessTokenScopeAll)
|
||||
doAPIDeleteRepository(forkCtx)(t)
|
||||
|
||||
doAPIGetPullFiles(ctx, pr, func(t *testing.T, files []*api.ChangedFile) {
|
||||
if assert.Len(t, files, 1) {
|
||||
assert.Equal(t, "file_1.txt", files[0].Filename)
|
||||
assert.Empty(t, files[0].PreviousFilename)
|
||||
assert.Equal(t, 1, files[0].Additions)
|
||||
assert.Equal(t, 1, files[0].Changes)
|
||||
assert.Equal(t, 0, files[0].Deletions)
|
||||
assert.Equal(t, "added", files[0].Status)
|
||||
}
|
||||
})(t)
|
||||
})
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ func TestLFSRender(t *testing.T) {
|
||||
doc := NewHTMLParser(t, resp.Body).doc
|
||||
|
||||
fileInfo := doc.Find("div.file-info-entry").First().Text()
|
||||
assert.Contains(t, fileInfo, "Stored with Git LFS")
|
||||
assert.Contains(t, fileInfo, "LFS")
|
||||
|
||||
content := doc.Find("div.file-view").Text()
|
||||
assert.Contains(t, content, "Testing documents in LFS")
|
||||
@ -54,7 +54,7 @@ func TestLFSRender(t *testing.T) {
|
||||
doc := NewHTMLParser(t, resp.Body).doc
|
||||
|
||||
fileInfo := doc.Find("div.file-info-entry").First().Text()
|
||||
assert.Contains(t, fileInfo, "Stored with Git LFS")
|
||||
assert.Contains(t, fileInfo, "LFS")
|
||||
|
||||
src, exists := doc.Find(".file-view img").Attr("src")
|
||||
assert.True(t, exists, "The image should be in an <img> tag")
|
||||
@ -71,7 +71,7 @@ func TestLFSRender(t *testing.T) {
|
||||
doc := NewHTMLParser(t, resp.Body).doc
|
||||
|
||||
fileInfo := doc.Find("div.file-info-entry").First().Text()
|
||||
assert.Contains(t, fileInfo, "Stored with Git LFS")
|
||||
assert.Contains(t, fileInfo, "LFS")
|
||||
|
||||
rawLink, exists := doc.Find("div.file-view > div.view-raw > a").Attr("href")
|
||||
assert.True(t, exists, "Download link should render instead of content because this is a binary file")
|
||||
|
Loading…
Reference in New Issue
Block a user