New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Diff Staging with Worktree #700
Comments
looks like what I want is the https://godocs.io/github.com/go-git/go-git/v5/plumbing/format/diff#UnifiedEncoder.Encode which requires the https://godocs.io/github.com/go-git/go-git/v5/plumbing/format/diff#Patch which is implemented by https://godocs.io/github.com/go-git/go-git/v5/plumbing/object#Patch assuming the following functions were exported, we could call Line 116 in 7e345bb
then call go-git/plumbing/object/change_adaptor.go Line 50 in 7e345bb
then call go-git/plumbing/object/change.go Line 149 in 7e345bb
until those functions are exported, the https://github.com/fhs/gig/blob/dd59dc92/cli/diff.go#L181-L187 |
@1268 did you manage to make it work like this? I'm also struggling with the same case: I basically want to execute the equivalent of |
@headyj yeah I found a solution, but:
is not true. staging to worktree is |
True @1268 , but I guess I can use the same principle for my case and it should work. Did you just do what you wrote on your first post or did you add something else to make it work? |
you should clarify what you are wanting, either staging to worktree or HEAD to staging. those aren't the same thing and they have very different solutions. |
I want to Diff Staging with Worktree. I found
diffStagingWithWorktree
:go-git/worktree_status.go
Line 116 in d525a51
but it returns a merkletrie.Changes. To make use of that, it would need to be converted to object.Changes. I found function
newChanges
:go-git/plumbing/object/change_adaptor.go
Line 50 in d525a51
but it is not public. I tried just copying the function into my code, but that does work as it calls another private function
newChange
:go-git/plumbing/object/change_adaptor.go
Line 14 in d525a51
which calls another private function
newChangeEntry
:go-git/plumbing/object/change_adaptor.go
Line 29 in d525a51
which calls a private struct
treeNoder
:go-git/plumbing/object/treenoder.go
Line 19 in d525a51
after that I gave up.
The text was updated successfully, but these errors were encountered: