all repos

mugit @ 3ab5d0aafc20240a0b3ea56f7b23c1654a13a839

馃惍 git server that your cow will love
2 files changed, 26 insertions(+), 32 deletions(-)
ui: show added content in first commit
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2026-02-26 21:22:23 +0200
Authored at: 2026-02-26 20:58:49 +0200
Change ID: sxuzmuprnkysxyzumvmnlmktrmpvlllt
Parent: f9a31fe
M internal/git/diff.go
路路路
        22
        22
         	IsBinary      bool

      
        23
        23
         	IsNew         bool

      
        24
        24
         	IsDelete      bool

      
        
        25
        +	IsRename      bool

      
        25
        26
         }

      
        26
        27
         

      
        27
        28
         type NiceDiff struct {

      路路路
        65
        66
         		diff.IsBinary = d.IsBinary

      
        66
        67
         		diff.IsNew = d.IsNew

      
        67
        68
         		diff.IsDelete = d.IsDelete

      
        
        69
        +		diff.IsRename = d.IsRename

      
        68
        70
         

      
        69
        71
         		for _, tf := range d.TextFragments {

      
        70
        72
         			diff.TextFragments = append(diff.TextFragments, TextFragment{

      
M web/templates/repo_commit.html
路路路
        45
        45
                     {{ $commit.ChangeID }}

      
        46
        46
                   </div>

      
        47
        47
                   {{- end }}

      
        
        48
        +          {{ if $parents }}

      
        48
        49
                   <div>

      
        49
        50
                     <strong>Parent:</strong>

      
        50
        51
                     {{ range $i, $p := $parents -}}

      
        51
        52
                     {{ if $i }}, {{ end -}}

      
        52
        
        -            <a class="link" href="/{{$.RepoName}}/commit/{{ $p }}">{{ $p }}</a>

      
        
        53
        +            <a class="link" href="/{{ $.RepoName }}/commit/{{ $p }}">{{ $p }}</a>

      
        53
        54
                     {{- end }}

      
        54
        55
                   </div>

      
        
        56
        +          {{ end }}

      
        55
        57
                 </div>

      
        56
        58
         

      
        57
        59
                 {{ if gt (len $diff) 1 -}}

      路路路
        64
        66
                       {{ if not $path }}{{ $path = .Name.Old }}{{ end }}

      
        65
        67
                       <tr>

      
        66
        68
                         <td class="diff-type">

      
        67
        
        -                  {{ if .IsNew }}<span class="diff-type diff-add">A</span>{{ end }}

      
        68
        
        -                  {{ if .IsDelete }}<span class="diff-type diff-del">D</span>{{ end }}

      
        69
        
        -                  {{ if not (or .IsNew .IsDelete) }}<span class="diff-type diff-mod">M</span>{{ end }}

      
        
        69
        +                  {{ if .IsNew }}<span class="diff-type diff-add">A</span>

      
        
        70
        +                  {{ else if .IsDelete }}<span class="diff-type diff-del">D</span>

      
        
        71
        +                  {{ else }}<span class="diff-type diff-mod">M</span>{{ end }}

      
        70
        72
                         </td>

      
        71
        73
                         <td class="fill">

      
        72
        74
                           <a href="#{{ $path }}">

      
        73
        
        -                    {{ if and .Name.Old .Name.New }}{{ .Name.Old }} &#8594; {{ .Name.New }}{{ else }}{{ $path }}{{ end }}

      
        
        75
        +                    {{ if .IsRename }}{{ .Name.Old }} &#8594; {{ .Name.New }}

      
        
        76
        +                    {{ else }}{{ $path }}{{ end }}

      
        74
        77
                           </a>

      
        75
        78
                         </td>

      
        76
        79
                       </tr>

      路路路
        80
        83
                 </div>

      
        81
        84
                 {{ end }}

      
        82
        85
               </section>

      
        
        86
        +

      
        83
        87
               <section>

      
        84
        88
                 {{ $this := $commit.Hash }}

      
        85
        
        -        {{ $parent := index $parents 0 }}

      
        
        89
        +        {{ $parent := "" }}

      
        
        90
        +        {{ if $parents }}{{ $parent = index $parents 0 }}{{ end }}

      
        86
        91
                 {{ range $diff }}

      
        87
        92
                 {{ $path := .Name.New }}

      
        88
        93
                 {{ if not $path }}{{ $path = .Name.Old }}{{ end }}

      
        89
        94
                 <div id="{{ $path }}">

      
        90
        95
                   <div class="diff">

      
        91
        
        -            {{ if .IsNew }}

      
        92
        
        -            <span class="diff-type diff-add">A</span>

      
        93
        
        -            {{ end }}

      
        94
        
        -            {{ if .IsDelete }}

      
        95
        
        -            <span class="diff-type diff-del">D</span>

      
        96
        
        -            {{ end }}

      
        97
        
        -            {{ if not (or .IsNew .IsDelete) }}

      
        98
        
        -            <span class="diff-type diff-mod">M</span>

      
        99
        
        -            {{ end }}

      
        100
        
        -            {{ if .Name.Old }}

      
        101
        
        -            <a href="/{{$.RepoName}}/blob/{{ $parent }}/{{ .Name.Old }}">{{ .Name.Old }}</a>

      
        102
        
        -            {{ if .Name.New }}

      
        103
        
        -            &#8594;

      
        104
        
        -            <a href="/{{$.RepoName}}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>

      
        
        96
        +            {{ if .IsNew }}<span class="diff-type diff-add">A</span>

      
        
        97
        +            {{ else if .IsDelete }}<span class="diff-type diff-del">D</span>

      
        
        98
        +            {{ else }}<span class="diff-type diff-mod">M</span>{{ end }}

      
        
        99
        +

      
        
        100
        +            {{ if .IsNew }}<a href="/{{ $.RepoName }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>{{ else }}

      
        
        101
        +            {{ if $parent }}<a href="/{{ $.RepoName }}/blob/{{ $parent }}/{{ .Name.Old }}">{{ .Name.Old }}</a>

      
        
        102
        +            {{ else }}{{ .Name.Old }}{{ end }}

      
        
        103
        +            {{ if .IsRename }}&#8594;<a href="/{{ $.RepoName }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>{{ end }}

      
        105
        104
                     {{ end }}

      
        106
        
        -            {{ else }}

      
        107
        
        -            <a href="/{{$.RepoName}}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>

      
        108
        
        -            {{- end -}}

      
        
        105
        +

      
        109
        106
                     {{ if .IsBinary }}

      
        110
        107
                     <p>Not showing binary file.</p>

      
        111
        108
                     {{ else }}

      路路路
        113
        110
                       {{- range .TextFragments -}}

      
        114
        111
                       <p>{{- .Header -}}</p>

      
        115
        112
                       {{- range .Lines -}}

      
        116
        
        -              {{- if eq .Op.String "+" -}}

      
        117
        
        -              <span class="diff-add">{{ .String }}</span>

      
        118
        
        -              {{- end -}}

      
        119
        
        -              {{- if eq .Op.String "-" -}}

      
        120
        
        -              <span class="diff-del">{{ .String }}</span>

      
        121
        
        -              {{- end -}}

      
        122
        
        -              {{- if eq .Op.String " " -}}

      
        123
        
        -              <span class="diff-noop">{{ .String }}</span>

      
        124
        
        -              {{- end -}}

      
        
        113
        +              {{- if eq .Op.String "+" -}}<span class="diff-add">{{ .String }}</span>

      
        
        114
        +              {{- else if eq .Op.String "-" -}}<span class="diff-del">{{ .String }}</span>

      
        
        115
        +              {{- else -}}<span class="diff-noop">{{ .String }}</span>

      
        125
        116
                       {{- end -}}

      
        126
        117
                       {{- end -}}

      
        127
        118
                       {{- end -}}

      
        128
        119
                     </pre>

      
        
        120
        +            {{ end }}

      
        129
        121
                   </div>

      
        130
        122
                 </div>

      
        131
        123
                 {{ end }}