mtkennerly / poetry-dynamic-versioning

Plugin for Poetry to enable dynamic versioning based on VCS tags
MIT License
588 stars 36 forks source link

Got an error with 'poetry update' #162

Closed hdaipteam closed 4 months ago

hdaipteam commented 6 months ago

I got that error

_GitRefInfo.init() missing 4 required positional arguments: 'commit', 'creatordate', 'committerdate', and 'taggerdate'

[build-system] requires = [ "poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0" ] build-backend = "poetry_dynamic_versioning.backend"

[tool.poetry-dynamic-versioning] enable = true vcs = "git" style = "semver"

I am using the same config in other projects also. The only difference is a direct load of code from a repo - BitBucket - into the source.

mtkennerly commented 6 months ago

Could you run this command in your clone and check the output?

git for-each-ref "refs/tags/**" --merged HEAD --format "%(refname)@{%(objectname)@{%(creatordate:iso-strict)@{%(*committerdate:iso-strict)@{%(taggerdate:iso-strict)"

It should either be empty or produce several lines in this format:

refs/tags/v0.1.0@{9abeb12f3ec8dd91b2f2db0e0a0b7529050b99f7@{2019-03-26T06:51:22-04:00@{2019-03-26T06:25:37-04:00@{2019-03-26T06:51:22-04:00

The only difference is a direct load of code from a repo - BitBucket - into the source.

I don't quite understand what you mean by this. Could you elaborate?

meksor commented 4 months ago

Hey there! I was having the same problem, the output to the command you posted was something along the lines of: warning: ignoring broken ref refs/tags/__init__.py

This was due to an utterly broken and useless IDE extension which I had installed and ran once accidentally. This extension is meant to generate __init__ files for python modules, but it insidiously also put these init files in my .git folder as well...

Anyway, seems it has something to do with corrupting your git "state" in a way where git will not complain unless you try to run one of these commands. It's probably best to add an error message forwarding the original git output if it is malformed?

mtkennerly commented 4 months ago

@meksor Thanks! That's exactly the info I needed. I was able to reproduce it, so I've added a fix/test in Dunamai (https://github.com/mtkennerly/dunamai/commit/33281c83fd1ef413da2a366e7d47f8c7bb02c4fe). I'll make a new Dunamai release shortly.