Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

Equivalent of git diff --cached #1279

Open
mediocregopher opened this issue Jan 14, 2020 · 1 comment
Open

Equivalent of git diff --cached #1279

mediocregopher opened this issue Jan 14, 2020 · 1 comment

Comments

@mediocregopher
Copy link

So to do a "normal" diff I would get my two different *object.Tree instances and use object.DiffTree. However with staged changes I'm unsure of how to get a tree, if it's possible at all. It seems that *index.Index only provides a list of files changed, with no way to get a tree. Is it possible to retrieve a diff/patch describing the changes which have been added in the workspace compared to HEAD (or some other arbitrary commit)?

@mediocregopher
Copy link
Author

It seems that the buildTreeHelper's BuildTree method mostly does what I want here. Perhaps the buildTreeHelper could be exposed in some way? Or if not the helper directly, having a method on Worktree or Index that called it would be super helpful.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant