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

squashing forks with remotes already setup fails #101

Open amtoine opened 9 months ago

amtoine commented 9 months ago

Describe the bug

as per title

How to reproduce

first run

tk run --clean {
    gm update-cache

    # clone two forks
    gm clone https://github.com/amtoine/nushell
    gm clone https://github.com/nushell/nushell

    # setup `nushell` as a remote of `amtoine`
    ^git -C ($env.GIT_REPOS_HOME | path join "github.com/amtoine/nushell") remote add nushell https://github.com/nushell/nushell

    # try to squash into `amtoine`
    gm squash-forks --non-interactive-preselect {
        8f3b273337b53bd86d5594d5edc9d4ad7242bd4c: "github.com/amtoine/nushell"
    }
}
deleted /tmp/nu-git-manager/repos
deleted /tmp/nu-git-manager/repos.cache
updating cache... done
Cloning into '/tmp/nu-git-manager/repos/github.com/amtoine/nushell'...
remote: Enumerating objects: 102625, done.
remote: Counting objects: 100% (102625/102625), done.
remote: Compressing objects: 100% (27930/27930), done.
remote: Total 102625 (delta 73950), reused 101765 (delta 73656), pack-reused 0
Receiving objects: 100% (102625/102625), 38.30 MiB | 21.49 MiB/s, done.
Resolving deltas: 100% (73950/73950), done.
updating cache... done
Cloning into '/tmp/nu-git-manager/repos/github.com/nushell/nushell'...
remote: Enumerating objects: 102194, done.
remote: Counting objects: 100% (102194/102194), done.
remote: Compressing objects: 100% (27838/27838), done.
remote: Total 102194 (delta 73627), reused 101309 (delta 73323), pack-reused 0
Receiving objects: 100% (102194/102194), 38.24 MiB | 12.13 MiB/s, done.
Resolving deltas: 100% (73627/73627), done.
Warning:   ⚠ cloning_fork
| this repo is a fork of 1 other repo because they share the same root commit: 8f3b273337b53bd86d5594d5edc9d4ad7242bd4c
| - github.com/amtoine/nushell
updating cache... done
error: remote nushell already exists.

Note see the error at the bottom

now, if we list the repos, we still see nushell...

tk run { gm list }
─┬──────────────────────────
0│github.com/amtoine/nushell
1│github.com/nushell/nushell
─┴──────────────────────────

Expected behavior

i expected tk run { gm list } to only return the amtoine fork.

Configuration

key value
version 0.87.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 2023-11-15 18:45:43 +01:00
build_rust_channel release
allocator mimalloc
features default, sqlite, trash, which, zip
installed_plugins clipboard copy, clipboard paste, jwalk, nu_plugin_explore

Additional context

No response