commit - 3818e3c42c1ac77dac0c571165dabfe2da05ff2b
commit + 7f9bfb3188bd9d77317f3205b61e96c7a55b005a
blob - 40ab964e77891970bf5fa1e069607c1aa4a6c250
blob + 3d41cd3c7dba250edd22bdb2f232bd169acc4944
--- got/got.c
+++ got/got.c
if (errstr != NULL)
return 0;
return n;
-}
-
-static const struct got_error *
-resolve_commit_arg(struct got_object_id **id, const char *commit_arg,
- struct got_repository *repo)
-{
- const struct got_error *err = NULL;
- struct got_reference *ref;
-
- *id = NULL;
-
- err = got_ref_open(&ref, repo, commit_arg, 0);
- if (err == NULL) {
- int obj_type;
- err = got_ref_resolve(id, repo, ref);
- got_ref_close(ref);
- if (err)
- return err;
- err = got_object_get_type(&obj_type, repo, *id);
- if (err)
- return err;
- if (obj_type == GOT_OBJ_TYPE_TAG) {
- struct got_tag_object *tag;
- err = got_object_open_as_tag(&tag, repo, *id);
- if (err)
- return err;
- if (got_object_tag_get_object_type(tag) !=
- GOT_OBJ_TYPE_COMMIT) {
- got_object_tag_close(tag);
- return got_error(GOT_ERR_OBJ_TYPE);
- }
- free(*id);
- *id = got_object_id_dup(
- got_object_tag_get_object_id(tag));
- if (*id == NULL)
- err = got_error_from_errno(
- "got_object_id_dup");
- got_object_tag_close(tag);
- if (err)
- return err;
- } else if (obj_type != GOT_OBJ_TYPE_COMMIT)
- return got_error(GOT_ERR_OBJ_TYPE);
- } else {
- err = got_repo_match_object_id_prefix(id, commit_arg,
- GOT_OBJ_TYPE_COMMIT, repo);
- }
-
- return err;
}
static const struct got_error *
goto done;
got_object_commit_close(commit);
} else {
- error = resolve_commit_arg(&start_id, start_commit, repo);
+ error = got_repo_match_object_id(&start_id, NULL,
+ start_commit, GOT_OBJ_TYPE_COMMIT, 1, repo);
if (error != NULL)
goto done;
}
if (end_commit != NULL) {
- error = resolve_commit_arg(&end_id, end_commit, repo);
+ error = got_repo_match_object_id(&end_id, NULL,
+ end_commit, GOT_OBJ_TYPE_COMMIT, 1, repo);
if (error != NULL)
goto done;
}
blob - 6d76d8908d8e38ade06083ff93a4b8757b7dab89
blob + 81ae9fc2f561dca7077178cd1520b721402bf297
--- regress/cmdline/log.sh
+++ regress/cmdline/log.sh
return 1
fi
echo -n > $testroot/stdout.expected
- echo "got: nonexistent: bad object id string" \
+ echo "got: reference nonexistent not found" \
> $testroot/stderr.expected
cmp -s $testroot/stderr.expected $testroot/stderr
ret="$?"