Skip to content

Conversation

@natanloterio
Copy link

Before this PR

Currently, gradle-git-version does not provide the total commit count of the repository. Many Android projects rely on this count to set versionCode, forcing them to implement custom scripts or workarounds.

After this PR

A new property totalCommits is exposed, allowing users to access the total number of commits directly from the plugin. Android projects can now set versionCode using:

android {
    defaultConfig {
        versionCode gitVersion.commitCount
        versionName gitVersion.lastTag  
   }
}

==COMMIT_MSG==
Add totalCommits property to expose the repository's total commit count for versioning.
==COMMIT_MSG==

Possible downsides?

  • Users who don’t need the commit count will see a minor increase in plugin computation time when querying Git metadata.
  • Projects relying on older Git versions may encounter compatibility issues if commit count retrieval fails.

@palantirtech
Copy link
Member

Thanks for your interest in palantir/gradle-git-version, @natanloterio! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

@changelog-app
Copy link

changelog-app bot commented Aug 14, 2025

Generate changelog in changelog/@unreleased

Type (Select exactly one)

  • Feature (Adding new functionality)
  • Improvement (Improving existing functionality)
  • Fix (Fixing an issue with existing functionality)
  • Break (Creating a new major version by breaking public APIs)
  • Deprecation (Removing functionality in a non-breaking way)
  • Migration (Automatically moving data/functionality to a new system)

Description

Introduce Commit Count in VersionDetails

Check the box to generate changelog(s)

  • Generate changelog entry

@stale
Copy link

stale bot commented Oct 18, 2025

This PR has been automatically marked as stale because it has not been touched in the last 14 days. If you'd like to keep it open, please leave a comment or add the 'long-lived' label, otherwise it'll be closed in 7 days.

@stale stale bot added the stale label Oct 18, 2025
@natanloterio
Copy link
Author

up

@stale stale bot removed the stale label Oct 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants