mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-05-24 18:46:12 +08:00
add submodule diff links (#33097)
This adds links to submodules in diffs, similar to the existing link when viewing a repo at a specific commit. It does this by expanding diff parsing to recognize changes to submodules, and find the specific refs that are added, deleted or changed. Related #25888 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@ -8,6 +8,7 @@ type File = {
|
||||
NameHash: string;
|
||||
Type: number;
|
||||
IsViewed: boolean;
|
||||
IsSubmodule: boolean;
|
||||
}
|
||||
|
||||
type Item = {
|
||||
@ -34,6 +35,13 @@ function getIconForDiffType(pType) {
|
||||
};
|
||||
return diffTypes[pType];
|
||||
}
|
||||
|
||||
function fileIcon(file) {
|
||||
if (file.IsSubmodule) {
|
||||
return 'octicon-file-submodule';
|
||||
}
|
||||
return 'octicon-file';
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -44,7 +52,7 @@ function getIconForDiffType(pType) {
|
||||
:title="item.name" :href="'#diff-' + item.file.NameHash"
|
||||
>
|
||||
<!-- file -->
|
||||
<SvgIcon name="octicon-file"/>
|
||||
<SvgIcon :name="fileIcon(item.file)"/>
|
||||
<span class="gt-ellipsis tw-flex-1">{{ item.name }}</span>
|
||||
<SvgIcon :name="getIconForDiffType(item.file.Type).name" :class="getIconForDiffType(item.file.Type).classes"/>
|
||||
</a>
|
||||
|
Reference in New Issue
Block a user