Skip to content

alr publish does not work anymore in a git submodule #1021

@stcarrez

Description

@stcarrez

The alr publish was working well when running in a git submodule.

This is not the case anymore at its crashes:

ciceron@zebulon:/src/awa/ada-awa/ada-util$ alr -d publish
✓ Local repository is clean.
ⓘ Crate at /src/awa/ada-awa/ada-util is nested in repo at /src/awa/ada-awa/.git/modules/ada-util
stderr: ADA.IO_EXCEPTIONS.USE_ERROR
stderr: directory "/" has no containing directory
stderr: raised ADA.IO_EXCEPTIONS.USE_ERROR : directory "/" has no containing directory
[/opt/applications/gnat-2021/bin/alr]
0xee680c ada__directories__containing_directory at ???
0xd3fdf5 Alire.Vcss.Git.Get_Rel_Path_Inside_Repo at alire-vcss-git.adb:570
0xb1644a Alire.Publish.Local_Repository.Check_Nested_Crate at alire-publish.adb:990
0xb13b0e Alire.Publish.Local_Repository at alire-publish.adb:1021
0x4b483b Alr.Commands.Publish.Execute at alr-commands-publish.adb:56
0x52a7eb Alr.Commands.Sub_Cmd.Execute at clic-subcommand-instance.adb:741
0x535d71 Alr.Commands.Execute at alr-commands.adb:492
0x42b9aa Alr.Main at alr-main.adb:10
0x42e277 Main at b__alr-main.adb:2132
[/lib/x86_64-linux-gnu/libc.so.6]
0x7f13f101b0b1
[/opt/applications/gnat-2021/bin/alr]
0x42b88c _start at ???
0xfffffffffffffffe

error: directory "/" has no containing directory
error: alr encountered an unexpected error, re-run with -d for details.

The root cause is the commit 26c5c28 which introduced the Get_Rel_Path_Inside_Repo function that now fails.

I think the logic behind its use is not correct because for a submodule, you will get a different path:

ciceron@zebulon:/src/awa/ada-awa/ada-util$ git worktree list
/src/awa/ada-awa/.git/modules/ada-util  2def17d [master]

and the git repository is not in the same sub-tree as the sources.

The old logic in alr 1.1 is working very well.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions