summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2013-04-16 00:17:40 +0200
committerVicent Marti <tanoku@gmail.com>2013-04-16 00:17:40 +0200
commit32ef1d1c7cc8c603ab78416262cc421b80a8c2df (patch)
treecf15b5e88192fd4611265665840457c70776b159
parente13a0647a062073fee9ec26f0f3101b50b620c8b (diff)
downloadlibgit2-vmg/unified-revision.tar.gz
-rw-r--r--examples/rev-list.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/examples/rev-list.c b/examples/rev-list.c
index f309207b0..d9ec15f76 100644
--- a/examples/rev-list.c
+++ b/examples/rev-list.c
@@ -29,6 +29,7 @@ static int push_spec(git_repository *repo, git_revwalk *walk, const char *spec,
if ((error = git_revparse_single(&obj, repo, spec)) < 0)
return error;
+
error = push_commit(walk, git_object_id(obj), hide);
git_object_free(obj);
return error;
@@ -36,24 +37,25 @@ static int push_spec(git_repository *repo, git_revwalk *walk, const char *spec,
static int push_range(git_repository *repo, git_revwalk *walk, const char *range, int hide)
{
- git_object *left, *right;
- git_revparse_flag_t flags;
+ git_revspec revspec;
int error = 0;
- if ((error = git_revparse(&left, &right, &flags, repo, range)))
+ if ((error = git_revparse(&revspec, repo, range)))
return error;
- if (flags & GIT_REVPARSE_MERGE_BASE) {
+
+ if (revspec.flags & GIT_REVPARSE_MERGE_BASE) {
/* TODO: support "<commit>...<commit>" */
return GIT_EINVALIDSPEC;
}
- if ((error = push_commit(walk, git_object_id(left), !hide)))
+ if ((error = push_commit(walk, git_object_id(revspec.from), !hide)))
goto out;
- error = push_commit(walk, git_object_id(right), hide);
- out:
- git_object_free(left);
- git_object_free(right);
+ error = push_commit(walk, git_object_id(revspec.to), hide);
+
+out:
+ git_object_free(revspec.from);
+ git_object_free(revspec.to);
return error;
}