diff options
author | Runxi Yu <me@runxiyu.org> | 2025-02-18 10:23:44 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-02-18 10:23:44 +0800 |
commit | dd95e2dbfad7f39060dc70f145d0e1478770e454 (patch) | |
tree | 863f9c3a941f21a66fe0af1cbe9a09ae444c8a46 /git_format_patch.go | |
parent | README.md: Mention that anonymous pushes to contrib/ are possible now (diff) | |
download | forge-dd95e2dbfad7f39060dc70f145d0e1478770e454.tar.gz forge-dd95e2dbfad7f39060dc70f145d0e1478770e454.tar.zst forge-dd95e2dbfad7f39060dc70f145d0e1478770e454.zip |
*.go: Add some comments for docs
Diffstat (limited to 'git_format_patch.go')
-rw-r--r-- | git_format_patch.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/git_format_patch.go b/git_format_patch.go index 33b981b..ecb266e 100644 --- a/git_format_patch.go +++ b/git_format_patch.go @@ -10,6 +10,8 @@ import ( "go.lindenii.runxiyu.org/lindenii-common/misc" ) +// get_patch_from_commit formats a commit object as if it was returned by +// git-format-patch. func format_patch_from_commit(commit *object.Commit) (string, error) { _, patch, err := get_patch_from_commit(commit) if err != nil { @@ -23,6 +25,7 @@ func format_patch_from_commit(commit *object.Commit) (string, error) { commit_msg_title, commit_msg_details, _ := strings.Cut(commit.Message, "\n") + // This date is hardcoded in Git. fmt.Fprintf(&buf, "From %s Mon Sep 17 00:00:00 2001\n", commit.Hash) fmt.Fprintf(&buf, "From: %s <%s>\n", author.Name, author.Email) fmt.Fprintf(&buf, "Date: %s\n", date) |