You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm using go-git as the main lifter for a little static html repository viewer. git-to-html
Please pardon my Go code 😞
As part of the flow, I am replicating the unified encoder's functionality so that I can more easily access the colors used for the patch rendering: views/diff.go
which you'll find looks almost the exact same as go-git's unified encoder plumbing/format/diff/unified_encoder.go
However, when I render the patch using the hunks generator, the context doesn't show the parent function like I expect from git show
For example, running my executable on the git-to-html repo, the output for commit 29108ca75afaab1d058205ebdbfda7a3f656adc1 shows
diff --git a/views/views.go b/views/views.go
index 8dc85f2..5c957ac 100644
--- a/views/views.go
+++ b/views/views.go
@@ -75,7 +75,8 @@ if err != nil {
I believe that the hunk's ctxPrefix is somehow wrong here.
Is this the standard function of patches / hunks in go-git, or am I misusing it?
If I am misusing it, can someone point me to somewhere (possibly an example) which shows the correct inputs to get the correct context for this rendering?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I'm using go-git as the main lifter for a little static html repository viewer.
git-to-html
Please pardon my Go code 😞
As part of the flow, I am replicating the unified encoder's functionality so that I can more easily access the colors used for the patch rendering:
views/diff.go
which you'll find looks almost the exact same as go-git's unified encoder plumbing/format/diff/unified_encoder.go
However, when I render the patch using the hunks generator, the context doesn't show the parent function like I expect from git show
For example, running my executable on the git-to-html repo, the output for commit 29108ca75afaab1d058205ebdbfda7a3f656adc1 shows
Whereas git show provides
I believe that the hunk's ctxPrefix is somehow wrong here.
Is this the standard function of patches / hunks in go-git, or am I misusing it?
If I am misusing it, can someone point me to somewhere (possibly an example) which shows the correct inputs to get the correct context for this rendering?
Beta Was this translation helpful? Give feedback.
All reactions