Skip to content
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

Fix :goto <tag> #1178

Merged
merged 1 commit into from
May 7, 2022
Merged

Fix :goto <tag> #1178

merged 1 commit into from
May 7, 2022

Conversation

koutcher
Copy link
Collaborator

Dereference goto argument to make sure we try to reach the commit and
not the tag object for annotated tags.

src/prompt.c Outdated
char dest[SIZEOF_STR];

snprintf(dest, SIZEOF_STR, "%s^{}", argv[1]);
goto_id(view, dest, true, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review Johannes. As one can also just do :<sha1> at the prompt, I'll amend the PR to move the code directly in goto_id().

@koutcher koutcher force-pushed the fix-goto-tag branch 3 times, most recently from 9b0a664 to 278acab Compare January 23, 2022 17:20
src/view.c Outdated Show resolved Hide resolved
Dereference goto argument to make sure we try to reach the commit and
not the tag object for annotated tags.

Reviewed-by: Johannes Altmanninger <aclopte@gmail.com>
@krobelus
Copy link
Contributor

I was looking for other uses of the comma operator in Tig and found one strange one in ui.c:303

Yep that definitely looks like a typo.

I didn't think of using clang-query before, it's so easy:

clang-query src/*.[ch] -c 'match binaryOperator(hasOperatorName(","))'

If the comma operator is too subtle here, we can also be more explicit about ignoring the return value with snprintf()*0 +argv_format_view()

@koutcher koutcher merged commit 55398de into jonas:master May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants