Skip to content

Fix :goto <tag>#1178

Merged
koutcher merged 1 commit intojonas:masterfrom
koutcher:fix-goto-tag
May 7, 2022
Merged

Fix :goto <tag>#1178
koutcher merged 1 commit intojonas:masterfrom
koutcher:fix-goto-tag

Conversation

@koutcher
Copy link
Copy Markdown
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
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
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
Copy Markdown
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
@koutcher koutcher deleted the fix-goto-tag branch February 6, 2025 18:18
@koutcher koutcher restored the fix-goto-tag branch February 6, 2025 18:33
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