Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

give an error when removing a repo the user is in #180

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/nu-git-manager/gm-clean.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `gm clean` from `nu-git-manager` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager/nu-git-manager/mod.nu#L560))
# `gm clean` from `nu-git-manager` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager/nu-git-manager/mod.nu#L567))
clean the store

this command will mainly remove empty directory recursively.
Expand Down
2 changes: 1 addition & 1 deletion docs/nu-git-manager/gm-squash-forks.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `gm squash-forks` from `nu-git-manager` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager/nu-git-manager/mod.nu#L483))
# `gm squash-forks` from `nu-git-manager` (see [source](https://github.com/amtoine/nu-git-manager/blob/main/pkgs/nu-git-manager/nu-git-manager/mod.nu#L490))
squash multi-directory forks into a single repo

Here, two forks are defined as *two non-grafted repositories that share the same initial commit,
Expand Down
7 changes: 7 additions & 0 deletions pkgs/nu-git-manager/nu-git-manager/mod.nu
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,13 @@ export def "gm remove" [

let repo_to_remove = $root | path join $repo_to_remove

# FIXME: this should be possible with `path relative-to`
# related to https://github.com/nushell/nushell/issues/10370
if (pwd | path expand | str starts-with $repo_to_remove) {
log error "cannot remove the repo because you are inside it"
return
}

rm --recursive --force --verbose $repo_to_remove

let cache_file = get-repo-store-cache-path
Expand Down
Loading