commit - 2312fc47a59d27ed181e1a095baf45c8b88cffd6
commit + f2b6a97d56d8273e6e97080c1b86b1dedd174ef7
blob - 8801ee6c890f7fea8d134551d25cfa15ef92fcab
blob + 419435b7c7b9acd5bed04c64feff1de3ccab0d23
--- tog/tog.c
+++ tog/tog.c
error = get_head_commit_id(&start_id, worktree ?
got_worktree_get_head_ref_name(worktree) : GOT_REF_HEAD,
repo);
- else
- error = got_repo_match_object_id_prefix(&start_id,
- start_commit, GOT_OBJ_TYPE_COMMIT, repo);
+ else {
+ error = get_head_commit_id(&start_id, start_commit, repo);
+ if (error) {
+ if (error->code != GOT_ERR_NOT_REF)
+ goto done;
+ error = got_repo_match_object_id_prefix(&start_id,
+ start_commit, GOT_OBJ_TYPE_COMMIT, repo);
+ }
+ }
if (error != NULL)
goto done;
error = got_ref_resolve(&commit_id, repo, head_ref);
got_ref_close(head_ref);
} else {
- error = got_repo_match_object_id_prefix(&commit_id,
- commit_id_str, GOT_OBJ_TYPE_COMMIT, repo);
+ error = get_head_commit_id(&commit_id, commit_id_str, repo);
+ if (error) {
+ if (error->code != GOT_ERR_NOT_REF)
+ goto done;
+ error = got_repo_match_object_id_prefix(&commit_id,
+ commit_id_str, GOT_OBJ_TYPE_COMMIT, repo);
+ }
}
if (error != NULL)
goto done;
if (commit_id_arg == NULL)
error = get_head_commit_id(&commit_id, GOT_REF_HEAD, repo);
- else
- error = got_repo_match_object_id_prefix(&commit_id,
- commit_id_arg, GOT_OBJ_TYPE_COMMIT, repo);
+ else {
+ error = get_head_commit_id(&commit_id, commit_id_arg, repo);
+ if (error) {
+ if (error->code != GOT_ERR_NOT_REF)
+ goto done;
+ error = got_repo_match_object_id_prefix(&commit_id,
+ commit_id_arg, GOT_OBJ_TYPE_COMMIT, repo);
+ }
+ }
if (error != NULL)
goto done;