git-cliff icon indicating copy to clipboard operation
git-cliff copied to clipboard

Bitbucket `is_first_time` can report incorrectly

Open mcwarman opened this issue 4 months ago • 7 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description of the bug

The Bitbucket first time does not report correctly when a user has made a commit in another as well as there first merged contribution.

We had a scenario where a first time contributor wasn't being reported in the change log. Looking into it the Commits API from bitbucket it returns all commits across all branches.

GET /repositories/{workspace}/{repo_slug}/commits/

Returns all commits in the repo in topological order (newest commit first). All branches and tags are included (similar to git log --all).

The user has also made another commit in another branch which was there first commit in the repo, but not there first commit on the branch being released.

Reference: https://developer.atlassian.com/cloud/bitbucket/rest/api-group-commits/#api-repositories-workspace-repo-slug-commits-get

curl https://api.bitbucket.org/2.0/repositories/<org>/<repo>/commits?include=<branch>

Steps To Reproduce

  1. New user commits and pushes branch
  2. New user commits and pushes branch for second change
  3. Merge change from item 2
  4. git-cliff --current --context --bitbucket-repo "org/repo"

Expected behavior

The is_first_time value is updated based on users contributions to the current branch (not the repo).

Screenshots / Logs

No response

Software information

  • Operating system: WSL - Debian GNU/Linux 12 (bookworm)
  • Rust version: N/A
  • Project version: 2.6.1

Additional context

I guess the fix is to make the current branch context available in the Remote struct so it can be used in the API call.

https://github.com/orhun/git-cliff/blob/508a97edb088f77d01f232676d1e3c7f129071b2/git-cliff-core/src/remote/bitbucket.rs#L52-L58

mcwarman avatar Oct 06 '24 10:10 mcwarman