git-changelog-gradle-plugin icon indicating copy to clipboard operation
git-changelog-gradle-plugin copied to clipboard

fromCommit doesn't works

Open Edivad99 opened this issue 2 years ago • 3 comments

This is the piece of code that doesn't work:

tasks.register('makeChangelog', GitChangelogTask) {
    fromRepo = projectDir.absolutePath.toString()
    file = file('CHANGELOG.md')
    fromCommit = '5062fd494493e12b6419d2af2fa3a73ff5119ece'
    toRef = 'HEAD'
    templateContent = file('changelog.mustache').text
    untaggedName = 'Next release'
}

It produces this error: https://github.com/railcraft-reborn/railcraft/actions/runs/5835400872/job/15826896012#step:6:41 While if I use the date it works and doesn't cause any problems:

tasks.register('makeChangelog', GitChangelogTask) {
    fromRepo = projectDir.absolutePath.toString()
    file = file('CHANGELOG.md')
    ignoreCommitsOlderThan = LocalDate.of(2023, 8, 10).toDate()
    templateContent = file('changelog.mustache').text
    untaggedName = 'Next release'
}

Edivad99 avatar Aug 11 '23 17:08 Edivad99

Are you sure it clones deep enough to get this commit?

I see the clone command: /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +7b01415eddb3dec0462ecfdd835cbe1f2ec3d25b:refs/remotes/origin/test-changelog

It has depth 1. But also looks like it is downloading a lot of commits...

I can have a closer look later.

tomasbjerre avatar Aug 11 '23 18:08 tomasbjerre

Thanks, because I really don't know where to look anymore

Edivad99 avatar Aug 11 '23 18:08 Edivad99

I tried putting fetch-depth: '0', and that works

Edivad99 avatar Aug 11 '23 18:08 Edivad99