-
Notifications
You must be signed in to change notification settings - Fork 899
Revparse #200
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
Revparse #200
Conversation
@nulltoken I think this is ready for review. Was there anything else you wanted from this feature? |
/// <param name = "type">The kind of <see cref = "GitObject" /> being looked up</param> | ||
/// <returns>The <see cref = "GitObject" /> or null if it was not found.</returns> | ||
public GitObject Lookup(string shaOrReferenceName, GitObjectType type = GitObjectType.Any) | ||
public GitObject Lookup(string objectSpec, GitObjectType type = GitObjectType.Any) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rename this objectish
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Is the documentation for this parameter okay? The git documentation doesn't say anything about rev-parse when it mentions "treeish"es or "commitish"es, but it seems to be the right thing.
@BenStraub This all looks pretty nice! Could you please rebase on top of vNext and squash this into a single commit?
I think |
I think it'd be nice to have revparse return So I'd tend to add a I add the revparse fix to my Todo list. |
Now running lookups through git_revparse_single.
I've added the Squash complete. Merge at will. 😺 |
Boom! Merged into vNext. First, there was nothing. Then native... And now, managed... Awesome job! ❤️
Thief! You'd better make it merged sooner rather than later, man. Otherwise, I'll find you... ;-) |
@BenStraub No more excuse ;p diff --git a/tests-clar/refs/revparse.c b/tests-clar/refs/revparse.c
index 02acb88..14bd9fb 100644
--- a/tests-clar/refs/revparse.c
+++ b/tests-clar/refs/revparse.c
@@ -442,3 +442,12 @@ void test_refs_revparse__disambiguation(void)
*/
test_object("e90810", "e90810b8df3e80c413d903f631643c716887138d");
}
+
+void test_refs_revparse__a_too_short_objectid_returns_EAMBIGUOUS(void)
+{
+ int result;
+
+ result = git_revparse_single(&g_obj, g_repo, "e90");
+
+ cl_assert_equal_i(GIT_EAMBIGUOUS, result);
+} |
Fixes #199
This adds rev-parse functionality to libgit2sharp methods which take a
shaOrReferenceName
parameter, making them much more powerful.