eclipse-jgit / jgit

JGit, the Java implementation of git
https://www.eclipse.org/jgit/
Other
92 stars 31 forks source link

.setTags(true) doesn't work exactly like --tags #32

Closed xenoterracide closed 4 months ago

xenoterracide commented 4 months ago

Version

6.8.0.202311291450-r

Operating System

Linux/Unix

Bug description

don't ask me how this is possible, I don't understand what github is doing to make this weird, even git isn't behaving like I'd expect, however github is checking it out though... build included for reference.

Here's the tag I push

git tag -m "v0.9.3" -a v0.9.3 -f && git push --tags -f

github does some weird checkout thing that I haven't yet repro-ed locally...

  SemverExtension(@NonNull Supplier<@NonNull Git> git) {
    this.git = Objects.requireNonNull(git);
  }

  Try<@Nullable String> describe() {
    return Try.of(() -> this.git.get().describe().setMatch(VERSION_GLOB).setTags(true))
      .mapTry(DescribeCommand::call)
      .onFailure(ExceptionTools::rethrow);
  }

  public Semver getGradlePlugin() {
    return describe()
      .map(v -> null == v ? PRE_VERSION : v)
      .map(Semver::coerce)
      .map(
        v ->
          !(v.getPreRelease().isEmpty() || v.getBuild().isEmpty()) ? v.withClearedPreReleaseAndBuild().nextPatch() : v
      )
      .get();
  }

Actual behavior

git describe        #v0.9.2-5-g8ed3c02
git describe --tags #v0.9.3

jgit

version: 0.9.2-5-g8ed3c02

Expected behavior

should behave like git describe --tags

Relevant log output

No response

Other information

https://github.com/xenoterracide/gradle-semver/actions/runs/8071119003/job/22050029061

the behavior is the same without this change

https://github.com/xenoterracide/gradle-semver/commit/8ed3c02d4f2dce95fdf77d6868eedd5656c25f70#diff-6e959ec6d14b0ecd038956866d1a1f1aa76c247e7b7533db27a91c73a8444531R29

logs_21180325707.zip

xenoterracide commented 4 months ago

invalid, I forgot that I haven't gotten a more direct dog food yet... setTags fixed. On the off chance someone looks at this and knows what would make my local git behave in the same way, that'd be great so I could add a regression test