rustic-games / jilu

Generate a change log based on the state of your Git repository.
104 stars 6 forks source link

Invalid Git tag - no exact reason why it's invalid? #9

Closed aejenk closed 5 years ago

aejenk commented 5 years ago

I'm working on my crate, glitchup, and I have been for a while - however today I decided to want and try to use Jilu with this project. Made my first release, with my first tag, v0.3.0. It's out of order because v0.1.0-v0.2.0 weren't published on GitHub - only on crates.io.

Whenever I try to run jilu however, it gives me an Invalid Git tag. I tried changing the tag to v0.1.0, but this error still popped up. I'm not sure why this error is popping up.

I tried checking out to master (now untagged), or checking out into a tag, but nothing seems to have worked. Do I have to start from v0.1.0 for jilu to work, or could this be a general bug.

Update: The error seems to be coming from the tags function. I updated a part of code to look like this:

.map(|string| {
    string.ok_or((None, Error::Utf8Error)).and_then(|name| {
        println!("NAME: {}", name); // new
        repo.revparse_single(name)
            .map_err(Into::into)
            // <new>
            .and_then(|object| object.into_tag().map_err(|err| {
                eprintln!("Error in tags function: {:#?}", err);
                Error::InvalidTag
            }))
            // </new>
            .and_then(TryInto::try_into)
            .map_err(|err| (Some(name), err))
    })
})

So that I could more specifically see what's going on. In this case, the output was:

NAME: v0.3.0
Error in tags function: Object {
    kind: Commit,
    id: 55780ee218a25198b222b40815e771a8832bf8f6,
}
Invalid Git tag

It seems to be getting the tag right, but I'm not sure what's happening afterwards. I hope this helps!

JeanMertz commented 5 years ago

Thanks for letting me know.

I suspect this is because your tags are lightweight tags, instead of annotated.

I've just pushed a fix for this at 6b79f8725ed99db07c5199428d8b70cf35bc9eb2. Lightweight tags are now supported, but they can't have any metadata attached, so releases tied to a lightweight tag can't have release names, or custom release notes added.

I haven't released a new version yet though, so you'll have to use cargo install for now:

cargo install jilu --force --git https://github.com/rustic-games/jilu

by the way, nice hobby project. I never heard of databending, but the Wikipedia page is quite fascinating. Good luck with the library!

aejenk commented 5 years ago

Yep - I added an admittedly bare tag message, and the error changed! The error is now Conventional Commit error: invalid commit format. I see that there's already an issue open for this however so I'll leave it here for now.

you can try it out if you want! it's in its alpha, but it's currently functional. I suggest bending a .png file. Thanks!

JeanMertz commented 5 years ago

This was indeed an existing issue. I just pushed another fix at ceabf81b2ebe24c9fea4f5d0ff95cf83e823c535.

With this change, any non-conventional commits are ignored in the final change log output.


Also, I tried databending NASA's famous "blue marble" photograph, using the default Options.toml, but it didn't turn out too well yet. But things worked, that's already more than most alpha versions achieve!

blue_marble

aejenk commented 5 years ago

Just in case it helps - I managed to find out which commit triggered the issue:

commit:Commit {
    id: "adfcfb5af1029e06a269792b4c29b5410f1972c0",
    short_id: "adfcfb5",
    message: "Initial commit",
    time: 2019-07-18T19:10:25Z,
    author: Signature {
        email: "mctech26@gmail.com",
        name: "Calmynt",
        time: 2019-07-18T19:10:25Z,
    },
    committer: Signature {
        email: "mctech26@gmail.com",
        name: "Calmynt",
        time: 2019-07-18T19:10:25Z,
    },
}
FROM CONVENTIONAL!: Error {
    commit: "Initial commit",
    kind: InvalidFormat,
}
Conventional Commit error: invalid commit format

I know this is kinda useless by now, but it's kinda interesting how Initial Commit matched it heh.

Oh! - I think it actually worked well. I plan on including a sort of tutorial/example page in the future because it might be a bit confusing to mess with at the start.

JPGs are a bit volatile, databending them with too intense of a setting leads to breaking the image.

The following 3 images use the exact same settings, however with iterations set to 10, and chunksize to 100:

earto__RVR_it=10_ch=100 earto__VOID_it=10_ch=100---CHS_it=10_ch=100---VOID_it=10_ch=100 earto__VOID_it=10_ch=100---CHS_it=10_ch=100

PNGs are far easier/nicer to corrupt - however many different files produce different artefacts! You can experiment w/ BMPs, TIFFs, etc...

also if this is getting too much I can delete this comment, no worries!

JeanMertz commented 5 years ago

also if this is getting too much I can delete this comment, no worries!

Hah, no worries. I find the subject interesting. Thanks for those pointers, and the results you got from them.

And indeed, Initial Commit would've triggered that error, but no more 🎉

Feel free to create any issues if you run into anything else. I plan on working some more on Jilu in the coming days, especially now that v1.0.0 of the spec is about to be released, which allows me to finish the parser used by Jilu.

aejenk commented 5 years ago

Sounds very promising! Also - managed to create the CHANGELOG, and it looks gorgeous - much better than alternatives honestly. Sometimes I wish that GitHub would annotate tags automatically...

Speaking of the spec, it seems as if they only explain feat and fix - with the others only being suggested - which is kinda weird. Anyways, if you need any help, I'd love to contribute!