jgitver / jgitver/jgitver-maven-plugin

COMMIT_ISO_TIMESTAMP is empty when the repository is initialized without commits

Open
#184 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Groovy
Stars
166
Forks
42
PR merge metrics
No merged PRs in 30d

Description

## Issue

**version**: 1.8.0

**usage context**:

- [ ] maven command line:
- [ ] eclipse:
- [ ] netbeans:
- [X] 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 https://github.com/apache/maven-compiler-plugin/pull/244.

**Steps to reproduce**

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

ant-run:
```
maven-antrun-plugin


validate

run



used version: ${jgitver.used_version}
version calculated: ${jgitver.calculated_version}
dirty: ${jgitver.dirty}
head_committer_name: ${jgitver.head_committer_name}
head_commiter_email: ${jgitver.head_commiter_email}
head_commit_datetime: ${jgitver.head_commit_datetime}
git_sha1_full: ${jgitver.git_sha1_full}
git_sha1_8: ${jgitver.git_sha1_8}
branch_name: ${jgitver.branch_name}
head_tags: ${jgitver.head_tags}
head_annotated_tags: ${jgitver.head_annotated_tags}
head_lightweight_tags: ${jgitver.head_lightweight_tags}
base_tag: ${jgitver.base_tag}
all_tags: ${jgitver.all_tags}
all_annotated_tags: ${jgitver.all_annotated_tags}
all_lightweight_tags: ${jgitver.all_lightweight_tags}
all_version_tags: ${jgitver.all_version_tags}
all_version_annotated_tags: ${jgitver.all_version_annotated_tags}
all_version_lightweight_tags: ${jgitver.all_version_lightweight_tags}
commit_iso_timestamp: ${jgitver.commit_iso_timestamp}




```

**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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.