apache / apache/maven-scm

InfoItem.lastChangeDate/lastChangeDateTime returns wrong date when cloning shallow repository

Open
#1,378 1 comment 0 reactions 0 assignees View on GitHub
bug enhancement
Dominant language
Java
Stars
104
Forks
189
Avg merge
17h 46m
Merged PRs (30d)
6

Description

### Affected version

2.1.0

### Bug description

When cloning a [shallow Git repository](https://git-scm.com/docs/shallow) (i.e. with [`--depth=1`](https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt---depthdepth), common for CI builds like GitHub actions,https://github.com/actions/checkout) the date being returned by `InfoItem.lastChangeDate/lastChangeDateTime` incorrectly always returns the author date of that last commit (which was not necessarily affecting the file to which the metadata belongs).

There should at least be a warning in that case as otherwise issues related to that are hard to track.

This relates to #1134

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the implementations of InfoItem.lastChangeDate and lastChangeDateTime, then inspect how shallow Git repositories are detected during metadata lookup. Check the behavior with a repository cloned using --depth=1. Done means the incorrect date case is addressed or clearly warned about, with existing relevant tests updated or added if the project has coverage for this path.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.