repos / git-pr

a self-hosted git collaboration server
git clone https://github.com/picosh/git-pr.git

commit
d5d651a
parent
750dcd1
author
Eric Bower
date
2024-07-18 14:31:44 -0400 EDT
feat: empty patch support

`git format-patch --cover-letter` is a great way to provide a summary
of all the changes within a patchset so we want to explicity support
that functionality.

The only gotcha here is we now allow empty patches.  So if there is an
empty patch in the patchset, the committer needs to add another option:
`git am -3 --empty=stop|drop|keep` depending on their preference.
3 files changed,  +2, -6
M tmpl/patch.html
+1, -1
1@@ -13,7 +13,7 @@
2 
3 {{if .Body}}<pre class="m-0">{{.Body}}</pre>{{end}}
4 
5-<pre class="m-0">{{.BodyAppendix}}</pre>
6+{{if .BodyAppendix}}<pre class="m-0">{{.BodyAppendix}}</pre>{{end}}
7 
8 <details>
9   <summary>Patch</summary>
M util.go
+0, -4
 1@@ -138,10 +138,6 @@ func parsePatchset(patchset io.Reader) ([]*Patch, error) {
 2 			authorEmail = header.Author.Email
 3 		}
 4 
 5-		if len(diffFiles) == 0 {
 6-			continue
 7-		}
 8-
 9 		contentSha := calcContentSha(diffFiles, header)
10 
11 		patches = append(patches, &Patch{
M util_test.go
+1, -1
1@@ -20,7 +20,7 @@ func TestParsePatchsetWithCover(t *testing.T) {
2 		t.Fatalf(err.Error())
3 	}
4 	expected := []*Patch{
5-		// {Title: "Add torch deps"},
6+		{Title: "Add torch deps"},
7 		{Title: "feat: lets build an rnn"},
8 		{Title: "chore: add torch to requirements"},
9 	}