Skip to content

add apply support to repository #542

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

Merged
merged 1 commit into from
Apr 6, 2020
Merged

Conversation

extrawurst
Copy link
Contributor

after adding the necessary sys code (#531) this adds the new apply method to Repository and a new apply module handling the new ApplyOptions and c-callbacks.

(this is related to #403)

@extrawurst extrawurst force-pushed the apply branch 2 times, most recently from f606544 to 125cc0d Compare April 5, 2020 12:14
@alexcrichton
Copy link
Member

Nice!

@alexcrichton alexcrichton merged commit 45ba1b8 into rust-lang:master Apr 6, 2020
@extrawurst extrawurst deleted the apply branch April 6, 2020 18:52
@extrawurst
Copy link
Contributor Author

@alexcrichton can we have a point release with this? 😏

@alexcrichton
Copy link
Member

Sure thing, done!

@mainrs
Copy link
Contributor

mainrs commented Jul 22, 2020

Hey! Sorry to kind of necro this, but I have a question regarding this PR. Is this meant to be used with files produced by git diff's output? E.g. .patch files that can be applied to repositories? If so, how exactly? The documentation mentions that the Diff object is created with one of the diff_ methods on Repository, but that wouldn't apply for the above example.

Maybe I just misunderstood the purpose of this PR...

@extrawurst
Copy link
Contributor Author

@sirwindfield I think this kind of question fits more into libgit2, git2-rs is only a wrapper around it. I am using apply to do hunk by hunk staging in gitui, maybe this helps you: https://github.com/extrawurst/gitui/blob/master/asyncgit/src/sync/hunks.rs

@mainrs
Copy link
Contributor

mainrs commented Jul 22, 2020

I opened a discussion on their repository. The feature is relatively new and I am the first one, but I hope someone answers it haha. Just for reference: libgit2/libgit2#5588

@extrawurst hunk by hunk (as you did it) does still compare between the index and the current file, doesn't it?

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

Successfully merging this pull request may close these issues.

3 participants