lud / mix_version

A simple version tool for Elixir
https://hex.pm/packages/mix_version
MIT License
1 stars 1 forks source link

Tool freezes with certain git configurations and annotations disabled. #3

Open whmountains opened 6 months ago

whmountains commented 6 months ago

On my my system, the following command opens EDITOR: git tag foo. This causes mix version to freeze since it is waiting for the editor to close.

I'm using MacOS 12.5.1, with Git version 2.41.0. I can't find any git configuration which would be forcing the use of annotated tags.

This issue merits more research. I don't know what would be the best way to fix it, but I wanted to at least document the problem for other people who may be facing something similar. It is especially confusing in combination with #2, because the tool will still try to create non-annotated tags even when you specifically set annotated: true. Took me a while to get to the bottom of that combo!

lud commented 6 months ago

Hey !

2 should be fixed by now.

But if someone does not use annotated tags, there is no -m option passed to git tag, so there is still a bug. I could change the naming of "annotation" to "tag message" to always provide a tag message with a default, that could be a sane solution.

What do you think?

whmountains commented 6 months ago

What a clever solution!

A co-worker helped me realize this was due to a git option called tag.gpgSign being enabled. Tags can only be signed with GPG when they are the annotated kind. This feature can be bypassed using the --no-sign flag. So that adds a second option to the list of potential solutions:

  1. default to an empty tag message
  2. pass the --no-sign flag when annotations are disabled

I would be happy with either option. I guess it depends on which semantics make more sense to you.

lud commented 6 months ago

I guess --no-sign could be easier. If enabled only when annotate is false then it should not mess with people's workflows because, as you said, I would not work anyway without the annotation.

I'll have to verify if that is fine. Is the issue currently blocking for you? Or can you use annotated tags?

whmountains commented 6 months ago

Not a blocking issue for me. I intend to stick with annotated tags so I can sign them, haha. Honestly I don't know much about git tags. If there is a situation where you definitely should use non-annotated tags, I'm not aware of it.

lud commented 6 months ago

Hi!

Could you test with the enforce-tag-msg branch? (If you installed mix_version globally with mix archive install you need to remove it and pull the tool as a dependency)

It should always use the annotation messages, which has a default value.