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

improvements to gix clean #1470

Merged
merged 3 commits into from
Jul 26, 2024
Merged

improvements to gix clean #1470

merged 3 commits into from
Jul 26, 2024

Conversation

Byron
Copy link
Member

@Byron Byron commented Jul 26, 2024

Related Fixes #1469

Tasks

  • reproduce issue with test
  • see if a fix is easy

Copy link
Member

@EliahKagan EliahKagan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! It even properly handles the intuitively tricky case where the repo has a git worktree managed worktree that is nested inside an unrelated repository that is itself nested inside an ignored directory. The directory for the unrelated repository is removed, except for its subdirectory that is our worktree.

ek@Glub:~/src/has-deeply-nested-worktree (main)$ git worktree list
/home/ek/src/has-deeply-nested-worktree                     e53b380 [main]
/home/ek/src/has-deeply-nested-worktree/subdir/blah/tricky  e53b380 [tricky]
/home/ek/src/has-deeply-nested-worktree/subdir/mybranch     e53b380 [mybranch]
ek@Glub:~/src/has-deeply-nested-worktree (main)$ tree
.
└── subdir
    ├── blah
    │   ├── bar
    │   ├── foo
    │   └── tricky
    └── mybranch

4 directories, 2 files
ek@Glub:~/src/has-deeply-nested-worktree (main)$ gix clean -xdrn
WOULD remove repository subdir/blah/.git/ (🗑️)
WOULD remove subdir/blah/bar (🗑️)
WOULD remove subdir/blah/foo (🗑️)
ek@Glub:~/src/has-deeply-nested-worktree (main)$ git worktree remove subdir/mybranch
ek@Glub:~/src/has-deeply-nested-worktree (main)$ git worktree list
/home/ek/src/has-deeply-nested-worktree                     e53b380 [main]
/home/ek/src/has-deeply-nested-worktree/subdir/blah/tricky  e53b380 [tricky]
ek@Glub:~/src/has-deeply-nested-worktree (main)$ gix clean -xdrn
WOULD remove repository subdir/blah/.git/ (🗑️)
WOULD remove subdir/blah/bar (🗑️)
WOULD remove subdir/blah/foo (🗑️)
ek@Glub:~/src/has-deeply-nested-worktree (main)$ gix clean -xdre
removing repository subdir/blah/.git/ (🗑️)
removing subdir/blah/bar (🗑️)
removing subdir/blah/foo (🗑️)
ek@Glub:~/src/has-deeply-nested-worktree (main)$ tree
.
└── subdir
    └── blah
        └── tricky

3 directories, 0 files
ek@Glub:~/src/has-deeply-nested-worktree (main)$ ls -al subdir/blah
total 12
drwxr-xr-x 3 ek ek 4096 Jul 26 04:59 .
drwxr-xr-x 3 ek ek 4096 Jul 26 04:58 ..
drwxr-xr-x 2 ek ek 4096 Jul 26 04:55 tricky

@EliahKagan
Copy link
Member

Are there aspects of #1469 that this does not cover? It looks like this may be a fix for it rather than just being related. But maybe I'm missing something.

@Byron Byron merged commit 348b9bf into main Jul 26, 2024
19 checks passed
@Byron Byron deleted the fix-clean branch July 26, 2024 09:12
@Byron
Copy link
Member Author

Byron commented Jul 26, 2024

Indeed, it turned out to be a fix.

EliahKagan added a commit to EliahKagan/gitoxide that referenced this pull request Jul 26, 2024
Since GitoxideLabs#1470 (for GitoxideLabs#1469), the repository's own nested worktrees are
no longer removed when using `gix clean`, even if they are nested
arbitarily under ignored directories. So no new mention of
worktrees (separate from "repositories") in the help and warning
message is accurate or required.

This removes that, which means really we are keeping the warning
message the same as it had been earlier, while still otherwise
bringing in new explanatory text in the `gix clean` options help.
EliahKagan added a commit to EliahKagan/gitoxide that referenced this pull request Jul 26, 2024
Since GitoxideLabs#1470 (for GitoxideLabs#1469), the repository's own nested worktrees are
no longer removed when using `gix clean`, even if they are nested
arbitarily under ignored directories. So no new mention of
worktrees (separate from "repositories") in the help and warning
message is accurate or required.

This removes that, which means really we are keeping the warning
message the same as it had been earlier, while still otherwise
bringing in new explanatory text in the `gix clean` options help.
EliahKagan added a commit to EliahKagan/gitoxide that referenced this pull request Jul 26, 2024
Since GitoxideLabs#1470 (for GitoxideLabs#1469), the repository's own nested worktrees are
no longer removed when using `gix clean`, even if they are nested
arbitarily under ignored directories. So no new mention of
worktrees (separate from "repositories") in the help and warning
message is accurate or required.

This removes that, which means really we are keeping the warning
message the same as it had been earlier, while still otherwise
bringing in new explanatory text in the `gix clean` options help.
LuaKT pushed a commit to LMonitor/gitoxide that referenced this pull request Aug 20, 2024
LuaKT pushed a commit to LMonitor/gitoxide that referenced this pull request Aug 20, 2024
Since GitoxideLabs#1470 (for GitoxideLabs#1469), the repository's own nested worktrees are
no longer removed when using `gix clean`, even if they are nested
arbitarily under ignored directories. So no new mention of
worktrees (separate from "repositories") in the help and warning
message is accurate or required.

This removes that, which means really we are keeping the warning
message the same as it had been earlier, while still otherwise
bringing in new explanatory text in the `gix clean` options help.
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.

gix clean -xde deletes the repo's own hidden nested worktrees, but they are not really hidden
2 participants