amtoine / nu-git-manager

A collection of Nushell tools to manage Git repositories.
GNU General Public License v3.0
26 stars 2 forks source link

cannot remove a repo when inside of it #179

Closed amtoine closed 6 months ago

amtoine commented 6 months ago

Describe the bug

as per title

How to reproduce

tk run --clean {
    gm update-cache

    gm clone --depth 1 https://github.com/amtoine/nu-git-manager
    let repo = gm list --full-path | find nu-git-manager | get 0
    cd $repo
    gm remove --no-confirm nu-git-manager
}

will give

Error:   × Cannot remove any parent directory
     ╭─[/home/amtoine/.local/share/nupm/modules/nu-git-manager/mod.nu:433:1]
 433 │
 434 │     rm --recursive --force --verbose $repo_to_remove
     ·                                      ───────┬───────
     ·                                             ╰── cannot remove any parent directory
 435 │
     ╰────

Expected behavior

i expected either the repo to be removed or at least a nice error

Configuration

key value
version 0.89.0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.73.0 (cc66ad468 2023-10-03)
rust_channel stable-x86_64-unknown-linux-gnu
cargo_version cargo 1.73.0 (9c4383fb5 2023-08-26)
build_time 2024-01-11 18:20:14 +01:00
build_rust_channel release
allocator mimalloc
features default, sqlite, trash, which, zip
installed_plugins clipboard copy, clipboard paste, gstat, nu_plugin_explore, query git

Additional context

No response