Skip to content

fix(remote): handle empty ref_name in contributor detection with --latest#1454

Open
joaquinhuigomez wants to merge 3 commits intoorhun:mainfrom
joaquinhuigomez:fix/latest-new-contributors
Open

fix(remote): handle empty ref_name in contributor detection with --latest#1454
joaquinhuigomez wants to merge 3 commits intoorhun:mainfrom
joaquinhuigomez:fix/latest-new-contributors

Conversation

@joaquinhuigomez
Copy link
Copy Markdown

@joaquinhuigomez joaquinhuigomez commented Mar 29, 2026

Description

When using --latest or commit ranges ending with .., an empty ref_name gets passed to the remote API. This returns incomplete results and makes all contributors appear as first-time.

Treats empty ref_name the same as HEAD so the full commit history is available for the contributor check. Also adds debug logging when release_commit_timestamp can't be resolved.

Motivation and Context

Fixes #1096. The core timestamp-filtering bug was addressed in #1348; this covers the remaining edge case with empty ref_name.

Tests

  • Unit test for tagged releases with historical contributors
  • Unit test for missing release commit in API results
  • Integration test fixture for --latest with GitHub integration
…test

When using --latest or custom commit ranges ending with "..", the
ref_name passed to the remote API could be an empty string, causing
the API to return incomplete results. This made all contributors
appear as first-time.

Treat empty ref_name the same as HEAD (fetch all commits) to ensure
full commit history is available for first-time contributor detection.

Also adds regression tests for tagged release scenarios where
contributors have historical commits, and a test fixture for
--latest with GitHub integration.

Closes orhun#1096
@joaquinhuigomez joaquinhuigomez requested a review from orhun as a code owner March 29, 2026 12:22
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 29, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 47.64%. Comparing base (e7057dd) to head (878ea9c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
git-cliff-core/src/remote/mod.rs 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1454      +/-   ##
==========================================
+ Coverage   47.45%   47.64%   +0.20%     
==========================================
  Files          24       24              
  Lines        2131     2135       +4     
==========================================
+ Hits         1011     1017       +6     
+ Misses       1120     1118       -2     
Flag Coverage Δ
unit-tests 47.64% <80.00%> (+0.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Copy link
Copy Markdown
Collaborator

@ognis1205 ognis1205 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Before moving forward, please make sure the following points are resolved:

  • Formatting (cargo +nightly fmt --all)
  • Linting (cargo clippy --tests --verbose -- -D warnings)
  • Configure shell script permissions properly (fixtures/test-github-integration-latest/commit.sh must have executable permission)
@joaquinhuigomez
Copy link
Copy Markdown
Author

Fixed formatting, clippy is clean, and commit.sh now has executable permission.

Copy link
Copy Markdown
Owner

@orhun orhun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked locally and the test fixture seems to be failing. Can you check it?

- fixtures-name: test-github-integration
- fixtures-name: test-github-integration-custom-range
command: v1.0.0..v1.0.1
- fixtures-name: test-github-integration-latest
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: rename to follow the same format with other fixtures:

Suggested change
- fixtures-name: test-github-integration-latest
- fixtures-name: test-github-integration-latest-arg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants