magit / forge

Work with Git forges from the comfort of Magit
GNU General Public License v3.0
1.3k stars 113 forks source link

Do not sent updated_after on the first pull in forge-gitlab. #634

Closed mlemerre closed 6 months ago

mlemerre commented 6 months ago

Thanks for forge!

The fetchers for gitlab do not work on the first fetch. I got this error:

error in process filter: HTTP Error: 400, "Bad Request", "/api/v4/projects/.../merge_requests?per_page=100&order_by=updated_at&updated_after=false", ((error . "updated_after is invalid"))

What I did was change forge--fetchpullreqs and forge--fetch-issues in forge-gitlab.el to remove the line beginning with (updated_after), and then it went fine.

Because it was re-fetching all the issues and pullreqs, I re-added the line after the first pull was complete, and it was working again.

So I guess the safest fix is to drop that field the first time forge fetches the issues and pullreqs.

tarsius commented 6 months ago

So I guess the safest fix is to drop that field the first time forge fetches the issues and pullreqs.

That's what the and-let* in forge--fetch-pullreqs is supposed to do. forge--topics-until is supposed to return nil in that case.

I tried to reproduce but with the latest version all of this works as expected for me. Are you on the very latest snapshot release. A lot of things changed in recent weeks and months.

If you can reproduce after updating, add (message "-- %S" (forge--topics-until repo until 'pullreq)) before forge--glab-get. The value should be nil, checking if actually is, would be the first step in investigating this.