Skip to content

Do not report all git fetch errors as "revision not found". - #16623

Merged
Alizter merged 1 commit into
ocaml:mainfrom
mefyl:fix/revision-not-found-error-message
Oct 19, 2026
Merged

Alizter merged 1 commit into
ocaml:mainfrom
mefyl:fix/revision-not-found-error-message

Conversation

@mefyl

@mefyl mefyl commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Do not over-interpret a failure from git: report that we "could not fetch $REV from $REMOTE", not that the revision does not exist in the remote, which is wrong if eg. the remote is not accessible.

Related Issue and Motivation

Fixes #16466

Other design options

This does not try to be smart and determine the actual reason, in hope that the actual error from git included in the output will give enough information.

Git always exits 128 so some alternatives could be:

  • Parse the error messages, but they are obviously prone to change, platform dependent and even forge-dependent (github and gitlab may give different errors).
  • Try to git ls-remote to determine whether the remote is reachable, but the additional network roundtrip looks more like a liability to me.

All in all I do not think it's worth the hassle.

Checklist

  • Tests added, if applicable.
  • Change log entry added for any user-facing changes.
  • Documentation added for any user-facing changes.

@mefyl
mefyl marked this pull request as draft October 16, 2026 12:28
@mefyl
mefyl force-pushed the fix/revision-not-found-error-message branch from 8b68a13 to 04e7188 Compare October 16, 2026 14:09
@mefyl
mefyl force-pushed the fix/revision-not-found-error-message branch from 04e7188 to cb360cd Compare October 16, 2026 14:10
@mefyl mefyl changed the title fix(pkg): do not report all git fetch errors as "revision not found". Do not report all git fetch errors as "revision not found". Oct 16, 2026
@mefyl

mefyl commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator Author

This is the minimal non opinionated fix; @Alizter suggested moving the git output at the end, I have a separate MR ready for that since this might be more debatable.

(unfortunately I don't think we can make a PR stack across repositories in github)

@mefyl
mefyl marked this pull request as ready for review October 16, 2026 14:32
@shonfeder

shonfeder commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

(unfortunately I don't think we can make a PR stack across repositories in github)

Any reason not to target that PR at this fork?

FWIW, forwarding the git error seems the most helpful to me, prima facie!

@mefyl

mefyl commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

(unfortunately I don't think we can make a PR stack across repositories in github)

Any reason not to target that PR at this fork?

I did not find how to; there is no branch in ocaml/dune for mefyl/dune to target, I think it's only possible if all the PRs are in the same repository.

@Alizter

Alizter commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Stacked GitHub PRs don't work across forks unfortunately. I typically don't bother with them and just keep the earlier commits in the later PRs, since they will go away once it is rebased.

@mefyl

mefyl commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

Stacked GitHub PRs don't work across forks unfortunately. I typically don't bother with them and just keep the earlier commits in the later PRs, since they will go away once it is rebased.

Fair point, here goes: #16628

@Alizter
Alizter merged commit 9462385 into ocaml:main Oct 19, 2026
67 of 99 checks passed
@Alizter Alizter added this to the 3.26.0 milestone Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dune pkg lock offline reports a pinned repository revision as not found

3 participants