Add support for libgit2's git_reset. #185

Merged
griffindy merged 1 commits from dg-add-reset into next 2015-03-22 01:25:28 -05:00
griffindy commented 2015-03-21 17:45:09 -05:00 (Migrated from github.com)

Hey all, I'm not super experienced with go and C, but I'm working on something that requires git reset. This should solve https://github.com/libgit2/git2go/issues/107.

Feel free to let me know if anything looks wrong in either implementation or style! I based this off of the next branch because that is what I'm using, not sure how much work it would be to update it for master.

Adds a new method to *Repository called ResetToCommit as well as constants for
the three reset modes that libgit2 currently supports. This does not need to be
limited to Commit, we actually just need something with a gitObject, which blobs
and other Objects have, they will just require different methods. I only need
to be able to reset to commits, so that's all I'm implementing right now.

Also adds a test which updates the test repository README twice and then resets
to the first commit.

Hey all, I'm not super experienced with go and C, but I'm working on something that requires git reset. This should solve https://github.com/libgit2/git2go/issues/107. Feel free to let me know if anything looks wrong in either implementation or style! I based this off of the `next` branch because that is what I'm using, not sure how much work it would be to update it for `master`. Adds a new method to *Repository called ResetToCommit as well as constants for the three reset modes that libgit2 currently supports. This does not need to be limited to Commit, we actually just need something with a gitObject, which blobs and other Objects have, they will just require different methods. I only need to be able to reset to commits, so that's all I'm implementing right now. Also adds a test which updates the test repository README twice and then resets to the first commit.
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: jcarr/git2go#185
No description provided.