alpha
Login
or
Join now
4uffin.bsky.social
/
core
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
My own copy of Tangled :)
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
add IsCopy and IsRename to git diff
author
Akshay
date
1 year ago
(Mar 2, 2025, 6:29 PM UTC)
commit
a6aefa41
a6aefa4127daf99cfbca54c2ac12fa10cb6ef6a9
parent
985f3926
985f39262763084b1173ea7c0600fddbedb40ab0
+24
-12
3 changed files
Expand all
Collapse all
Unified
Split
appview
pages
templates
repo
commit.html
knotserver
git
diff.go
types
diff.go
+20
-12
appview/pages/templates/repo/commit.html
Reviewed
···
24
24
<span class="px-1 select-none before:content-['\00B7']"></span>
25
25
{{ timeFmt $commit.Author.When }}
26
26
<span class="px-1 select-none before:content-['\00B7']"></span>
27
27
-
<span class="font-mono">{{ $stat.FilesChanged }}</span> files <span class="font-mono">(+{{ $stat.Insertions }}, -{{ $stat.Deletions }})</span>
27
27
+
<span>{{ $stat.FilesChanged }}</span> files <span class="font-mono">(+{{ $stat.Insertions }}, -{{ $stat.Deletions }})</span>
28
28
<span class="px-1 select-none before:content-['\00B7']"></span>
29
29
</p>
30
30
···
73
73
<details open>
74
74
<summary class="list-none cursor-pointer sticky top-0">
75
75
<div id="diff-file-header" class="rounded cursor-pointer bg-white flex justify-between">
76
76
-
<div id="left-side-items" class="p-2">
76
76
+
<div id="left-side-items" class="p-2 flex gap-2 items-center">
77
77
+
{{ $markerstyle := "diff-type p-1 mr-1 font-mono text-sm rounded select-none" }}
78
78
+
77
79
{{ if .IsNew }}
78
78
-
<span class="diff-type p-1 mr-1 font-mono text-sm bg-green-100 rounded text-green-700 select-none">A</span>
79
79
-
{{ end }}
80
80
-
{{ if .IsDelete }}
81
81
-
<span class="diff-type p-1 mr-1 font-mono text-sm bg-red-100 rounded text-red-700 select-none">D</span>
82
82
-
{{ end }}
83
83
-
{{ if not (or .IsNew .IsDelete) }}
84
84
-
<span class="diff-type p-1 mr-1 font-mono bg-gray-100 text-sm rounded text-gray-700 select-none">M</span>
80
80
+
<span class="bg-green-100 text-green-700 {{ $markerstyle }}">ADDED</span>
81
81
+
{{ else if .IsDelete }}
82
82
+
<span class="bg-red-100 text-red-700 {{ $markerstyle }}">DELETED</span>
83
83
+
{{ else if .IsCopy }}
84
84
+
<span class="bg-gray-100 text-gray-700 {{ $markerstyle }}">COPIED</span>
85
85
+
{{ else if .IsRename }}
86
86
+
<span class="bg-gray-100 text-gray-700 {{ $markerstyle }}">RENAMED</span>
87
87
+
{{ else }}
88
88
+
<span class="bg-gray-100 text-gray-700 {{ $markerstyle }}">MODIFIED</span>
85
89
{{ end }}
86
90
87
91
{{ if .IsDelete }}
88
88
-
<a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.Old }}" class="no-underline hover:underline">{{ .Name.Old }}</a>
92
92
+
<a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.Old }}">{{ .Name.Old }}</a>
93
93
+
{{ else if (or .IsCopy .IsRename) }}
94
94
+
<a href="/{{ $repo }}/blob/{{ $parent }}/{{ .Name.Old }}">{{ .Name.Old }}</a>
95
95
+
<i class="w-4 h-4" data-lucide="arrow-right"></i>
96
96
+
<a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
89
97
{{ else }}
90
90
-
<a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}" class="no-underline hover:underline">{{ .Name.New }}</a>
98
98
+
<a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>
91
99
{{ end }}
92
100
</div>
93
101
94
102
{{ $iconstyle := "p-1 mx-1 hover:bg-gray-100 rounded" }}
95
103
<div id="right-side-items" class="p-2 flex items-center">
96
96
-
<a title="top of file" href="#file-{{ .Name.New }}" class="{{ $iconstyle }}"><i class="w-4 h-4" data-lucide="arrow-up-from-line"></i></a>
104
104
+
<a title="top of file" href="#file-{{ .Name.New }}" class="{{ $iconstyle }}"><i class="w-4 h-4" data-lucide="arrow-up-to-line"></i></a>
97
105
{{ if gt $idx 0 }}
98
106
{{ $prev := index $diff (sub $idx 1) }}
99
107
<a title="previous file" href="#file-{{ $prev.Name.New }}" class="{{ $iconstyle }}"><i class="w-4 h-4" data-lucide="arrow-up"></i></a>
+2
knotserver/git/diff.go
Reviewed
···
63
63
ndiff.IsBinary = d.IsBinary
64
64
ndiff.IsNew = d.IsNew
65
65
ndiff.IsDelete = d.IsDelete
66
66
+
ndiff.IsCopy = d.IsCopy
67
67
+
ndiff.IsRename = d.IsRename
66
68
67
69
for _, tf := range d.TextFragments {
68
70
ndiff.TextFragments = append(ndiff.TextFragments, *tf)
+2
types/diff.go
Reviewed
···
19
19
IsBinary bool `json:"is_binary"`
20
20
IsNew bool `json:"is_new"`
21
21
IsDelete bool `json:"is_delete"`
22
22
+
IsCopy bool `json:"is_copy"`
23
23
+
IsRename bool `json:"is_rename"`
22
24
}
23
25
24
26
// A nicer git diff representation.