mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 10:56:10 +01: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> | ||||
|   | ||||
| @@ -28,6 +28,7 @@ import octiconEye from '../../public/assets/img/svg/octicon-eye.svg'; | ||||
| import octiconFile from '../../public/assets/img/svg/octicon-file.svg'; | ||||
| import octiconFileDirectoryFill from '../../public/assets/img/svg/octicon-file-directory-fill.svg'; | ||||
| import octiconFileDirectoryOpenFill from '../../public/assets/img/svg/octicon-file-directory-open-fill.svg'; | ||||
| import octiconFileSubmodule from '../../public/assets/img/svg/octicon-file-submodule.svg'; | ||||
| import octiconFilter from '../../public/assets/img/svg/octicon-filter.svg'; | ||||
| import octiconGear from '../../public/assets/img/svg/octicon-gear.svg'; | ||||
| import octiconGitBranch from '../../public/assets/img/svg/octicon-git-branch.svg'; | ||||
| @@ -104,6 +105,7 @@ const svgs = { | ||||
|   'octicon-file': octiconFile, | ||||
|   'octicon-file-directory-fill': octiconFileDirectoryFill, | ||||
|   'octicon-file-directory-open-fill': octiconFileDirectoryOpenFill, | ||||
|   'octicon-file-submodule': octiconFileSubmodule, | ||||
|   'octicon-filter': octiconFilter, | ||||
|   'octicon-gear': octiconGear, | ||||
|   'octicon-git-branch': octiconGitBranch, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user