Commit Graph

25 Commits

Author SHA1 Message Date
65d99c40e8 git🐮 Keep relative path offset 2025-09-15 13:49:33 +02:00
d28ef61694 git🐮 Rename temporary worktree directory
Shorten the "worktree" and place the random bytes at the end for better
sorting.
2025-09-15 13:23:01 +02:00
d5a95f9ce5 git🐮 Fix name of submodules
Previously git-checkout-worktree would use the name of the superproject
instead of the submodule for the temporary directory.
2025-09-15 13:19:28 +02:00
c8c9d887f5 git:checkout-worktree: Echo non-zero exit code 2025-01-29 14:27:11 +01:00
58243e0510 *: Update and add TODOs 2024-01-05 16:20:42 +01:00
5deb69bbd6 git:checkout-worktree: Improve name on recursion
When calling git-checkout-worktree from inside a temporary working tree
(doesn't necessary need to be a recursive call, could be another shell
too) the name would be very long.

Fix this by using the folder name of the main working tree.
2023-04-11 23:24:52 +02:00
10824feb74 git:checkout-worktree: Make errc variable local 2023-02-13 17:18:25 +01:00
28f60004de git:checkout-worktree: Fix unset ret variable 2023-02-13 17:17:49 +01:00
b22085777e git:checkout-worktree: Remove tmp dir on error
When the git-worktree call exits with an error we can delete the
temporary directory as nothing is in it.
2022-10-27 23:52:17 +02:00
43d87467d2 git:checkout-worktree: Pass all arguments
Pass all given arguments to `git worktree add`. This makes it possible
to directly create a new branch with `-b` for example. As the arguments
are not used anywhere else, this should not introduce any parsing
issues.
2022-07-12 21:00:12 +02:00
932c2eee35 git:checkout-worktree: Format description comment 2022-06-23 23:59:01 +02:00
b96d32996b *: Wrap lines at 80 columns where appropriate
Wrap lines at 80 columns where appropriate and I had the energy to think
about how/where to wrap.

There are still lines longer than that, which I plan to wrap in the
future. But that is enough for now.
2022-06-23 23:59:00 +02:00
79c7cdf416 git:checkout-worktree: Escape slashes in branch
Escape slashes in the branch name before passing it to `mktemp`.
Otherwise it would complain with:

    mktemp: invalid suffix [...], contains directory separator
2022-06-23 23:54:13 +02:00
be1bd6f08d git:checkout-worktree: Add scripted-use examples 2022-03-31 17:56:07 +02:00
ab53cff2a3 git:checkout-worktree: Update description
Add description in one sentence and use cases for this.
Remove sentence about removing `TEMP_DIR` that is outdated since:
5a8b5ffd21 ("git:checkout-worktree: Use `mktemp` template")
2022-03-31 17:48:05 +02:00
71450ad133 git:checkout-worktree: Fix endless loop
Fix endless loop when commands are passed via stdin that result in the
worktree not being removable. Fix by then dropping into an interactive
shell.
2022-03-31 17:28:05 +02:00
399b571e85 git:checkout-worktree: Refactor into one loop 2022-03-31 17:11:59 +02:00
a60c955d3d git:checkout-worktree: Set err_return + no_unset
If anything happens abnormally, return early and leave it to the user to
fix things.
2022-03-31 16:57:46 +02:00
d56979362a git:checkout-worktree: s/REPO_DIR/WORKTREE_PATH/ 2022-03-31 16:15:46 +02:00
5a8b5ffd21 git:checkout-worktree: Use mktemp template
Use a template that directly includes the repository name and the branch
checked out. This makes finding and deleting the worktree directory if
anything goes wrong a lot easier.

Checkout the worktree directly in the temporary directory. With that
`TEMP_DIR` becomes obsolete.
2022-03-31 16:00:47 +02:00
976d3f9000 git:checkout-worktree: Mention non-interactive use 2022-03-31 15:43:49 +02:00
02a0e17bcb git:checkout-worktree: Fix exit when not in repo
Fix the exit condition when the function is called outside of a git
repository.
Use zsh's `:t` History Expansion Modifier, as `$?` does not keep `git
rev-parse`'s exit code, but rather `basename`'s.
2022-03-31 15:33:53 +02:00
eb323992dc git:checkout-worktree: Keep the shell's exit code
Exit with the exit code of the last spawned shell.
2022-03-31 15:29:53 +02:00
b44ff72210 git:checkout-worktree: Rephrase description 2022-03-31 15:27:29 +02:00
9968edaf09 zsh: Make git-checkout-worktree autoloadable
Transform `git-checkout-worktree` into an autoloadable function.
2022-03-31 15:19:56 +02:00