Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMMIT_ISO_TIMESTAMP is empty when the repository is initialized without commits #184

Open
1 of 4 tasks
thijsrijpert opened this issue Jun 28, 2024 · 0 comments
Open
1 of 4 tasks

Comments

@thijsrijpert
Copy link

Issue

version: 1.8.0

usage context:

  • maven command line:
  • eclipse:
  • netbeans:
  • Intellij IDEA: 2024.1.4

Problem description:

jgitver collects a large amount of useful data from git. This includes a field which contains the commit timestamp (COMMIT_ISO_TIMESTAMP). If the repository is initialized, but without commits the timestamp is equal to an empty string.

This can cause hard to diagnose issues in downstream maven plugins, such as apache/maven-compiler-plugin#244.

Steps to reproduce

  1. Create a new maven project, with jgitver installed
  2. Add the ant-run configuration as specified below
  3. Initialize an empty git repository
  4. run: mvn clean install
  5. Observe that the date is an empty string

ant-run:

    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
        <execution>
            <phase>validate</phase>
            <goals>
                <goal>run</goal>
            </goals>
            <configuration>
                <tasks>
                    <echo>used version: ${jgitver.used_version}</echo>
                    <echo>version calculated: ${jgitver.calculated_version}</echo>
                    <echo>dirty: ${jgitver.dirty}</echo>
                    <echo>head_committer_name: ${jgitver.head_committer_name}</echo>
                    <echo>head_commiter_email: ${jgitver.head_commiter_email}</echo>
                    <echo>head_commit_datetime: ${jgitver.head_commit_datetime}</echo>
                    <echo>git_sha1_full: ${jgitver.git_sha1_full}</echo>
                    <echo>git_sha1_8: ${jgitver.git_sha1_8}</echo>
                    <echo>branch_name: ${jgitver.branch_name}</echo>
                    <echo>head_tags: ${jgitver.head_tags}</echo>
                    <echo>head_annotated_tags: ${jgitver.head_annotated_tags}</echo>
                    <echo>head_lightweight_tags: ${jgitver.head_lightweight_tags}</echo>
                    <echo>base_tag: ${jgitver.base_tag}</echo>
                    <echo>all_tags: ${jgitver.all_tags}</echo>
                    <echo>all_annotated_tags: ${jgitver.all_annotated_tags}</echo>
                    <echo>all_lightweight_tags: ${jgitver.all_lightweight_tags}</echo>
                    <echo>all_version_tags: ${jgitver.all_version_tags}</echo>
                    <echo>all_version_annotated_tags: ${jgitver.all_version_annotated_tags}</echo>
                    <echo>all_version_lightweight_tags: ${jgitver.all_version_lightweight_tags}</echo>
                    <echo>commit_iso_timestamp: ${jgitver.commit_iso_timestamp}</echo>
                </tasks>
            </configuration>
        </execution>
    </executions>
</plugin>```

**Request**

Would it be possible to have log the used values by default, instead of having to use the ant-run plugin? Or to supply a default value for the commit_iso_timestamp when it is empty?
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

No branches or pull requests

1 participant