Skip to content

Add check that commit ID is valid hexadecimal#1740

Merged
Fabien-Chouteau merged 1 commit into
alire-project:masterfrom
Seb-MCaw:fix/Bad-commit-chars
Aug 19, 2024
Merged

Add check that commit ID is valid hexadecimal#1740
Fabien-Chouteau merged 1 commit into
alire-project:masterfrom
Seb-MCaw:fix/Bad-commit-chars

Conversation

@Seb-MCaw

Copy link
Copy Markdown
Contributor

At present,

alr publish https://host.invalid/path/to/repo.git 0000000000000000000000000000000000000000

merely complains about the untrusted host (as it should), but

alr publish https://host.invalid/path/to/repo.git zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

yields a rather unhelpful

error: Dynamic_Predicate failed at alire-origins.adb:435
error: alr encountered an unexpected error, re-run with -d for details.

The same issue arises with commits specified in the [origin] section of index manifests.

This PR adds an explicit check for non-hexadecimal characters alongside the existing check for an incorrect number of characters, so the new error message is

error: Could not complete the publishing assistant:
error:    invalid git commit id, 40 digits hexadecimal expected

@Seb-MCaw Seb-MCaw marked this pull request as ready for review August 19, 2024 13:24
@Fabien-Chouteau Fabien-Chouteau merged commit d296745 into alire-project:master Aug 19, 2024
@Seb-MCaw Seb-MCaw deleted the fix/Bad-commit-chars branch August 19, 2024 14:30
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.

2 participants