git/lib
Mark Levedahl 587a4ac448 git-gui: do not change global vars in choose_repository::pick
The repository picker (choose_repository::pick, AKA pick) on success
always returns with the current directory at the root of the selected
worktree, with the global variable _gitdir holding the name of the
git repository, possibly as a relative path, and _prefix {}. The
worktree root (_gitworktree) is not filled out, and if the selection was
from the "recent" list, no validation has occurred beyond testing that
the worktree root exists. So, repository and worktree validation are
still needed to be sure the new repo + worktree is usable.

pick only supports worktrees with a .git entry in the worktree root, so
git repository and worktree discovery will work starting in the current
directory on return. In cases of error, or user abort, pick exits the
process rather than returning.

So, let's change pick to not alter any global values, with success
indicated by the process returning to the caller. In this case, the
current directory is the worktree root, with a .git entry. The caller
then proceeds with normal discovery to find and validate both repository
and worktree.

With this, pick now returns 1 in the success case, but additional work
would be necessary to return from conditions where 0 should be returned.
Checking this return value would be superfluous.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2026-06-02 19:13:13 +02:00
..
about.tcl Merge branch 'ml/abandon-old-versions' 2025-07-22 17:37:33 +02:00
blame.tcl git-gui: use -profile tcl8 on encoding conversions 2025-07-31 13:51:03 -04:00
branch.tcl git-gui: do not mix -translation binary and -encoding 2025-07-22 12:32:58 -04:00
branch_checkout.tcl git-gui: remove non-ttk code 2025-07-21 11:59:21 -04:00
branch_create.tcl git-gui: remove non-ttk code 2025-07-21 11:59:21 -04:00
branch_delete.tcl git-gui: remove non-ttk code 2025-07-21 11:59:21 -04:00
branch_rename.tcl git-gui: remove non-ttk code 2025-07-21 11:59:21 -04:00
browser.tcl git-gui: do not mix -translation binary and -encoding 2025-07-22 12:32:58 -04:00
checkout_op.tcl git-gui: assure -eofchar {} on all channels 2025-07-22 12:32:58 -04:00
choose_font.tcl git-gui: remove non-ttk code 2025-07-21 11:59:21 -04:00
choose_repository.tcl git-gui: do not change global vars in choose_repository::pick 2026-06-02 19:13:13 +02:00
choose_rev.tcl git-gui: remove EOL translation for gets 2025-07-31 13:50:59 -04:00
chord.tcl git-gui: create a new namespace for chord script evaluation 2020-03-17 18:48:54 +05:30
class.tcl git-gui: remove non-ttk code 2025-07-21 11:59:21 -04:00
commit.tcl Merge branch 'strip-post-hooks' of github.com:orgads/git-gui 2025-08-02 14:45:19 +02:00
console.tcl git-gui: remove non-ttk code 2025-07-21 11:59:21 -04:00
database.tcl git-gui: remove non-ttk code 2025-07-21 11:59:21 -04:00
date.tcl git-gui: Localize commit/author dates when displaying them 2007-09-10 01:54:16 -04:00
diff.tcl git-gui: shift tabstops to account for the first column of patch text 2026-01-29 22:34:53 +01:00
encoding.tcl doc: switch links to https 2024-05-05 16:49:00 +02:00
error.tcl git-gui: remove non-ttk code 2025-07-21 11:59:21 -04:00
git-gui.ico git-gui: Improve the application icon on Windows. 2007-12-02 23:05:10 -05:00
index.tcl git-gui: fix error handling of Revert Changes command 2025-09-01 21:07:57 +02:00
line.tcl git-gui: remove non-ttk code 2025-07-21 11:59:21 -04:00
logo.tcl git-gui: Refactor Henrik Nyh's logo into its own procedure 2007-10-10 01:12:15 -04:00
merge.tcl Merge branch 'ml/abandon-old-versions' 2025-07-22 17:37:33 +02:00
mergetool.tcl git-gui: translation binary defines iso8859-1 2025-07-22 12:32:58 -04:00
meson.build git-gui: wire up support for the Meson build system 2025-05-13 08:48:09 +02:00
option.tcl git-gui: remove non-ttk code 2025-07-21 11:59:21 -04:00
remote.tcl git-gui: git-remote is always available 2025-07-18 23:48:06 -04:00
remote_add.tcl git-gui: remove non-ttk code 2025-07-21 11:59:21 -04:00
remote_branch_delete.tcl git-gui: remove EOL translation for gets 2025-07-31 13:50:59 -04:00
search.tcl git-gui: remove non-ttk code 2025-07-21 11:59:21 -04:00
shortcut.tcl git-gui: use /cmd/git-gui.exe for shortcut 2025-07-22 10:21:44 -04:00
spellcheck.tcl git-gui: assure -eofchar {} on all channels 2025-07-22 12:32:58 -04:00
sshkey.tcl git-gui: remove non-ttk code 2025-07-21 11:59:21 -04:00
status_bar.tcl git-gui: remove non-ttk code 2025-07-21 11:59:21 -04:00
themed.tcl git-gui: themed.tcl: use full namespace for color 2025-07-31 13:51:03 -04:00
tools.tcl Merge branch 'ml/replace-auto-execok' into js/fix-open-exec 2025-05-23 17:04:27 -04:00
tools_dlg.tcl git-gui: remove non-ttk code 2025-07-21 11:59:21 -04:00
transport.tcl git-gui: remove non-ttk code 2025-07-21 11:59:21 -04:00
win32.tcl git-gui: sanitize 'exec' arguments: simple cases 2025-05-23 17:04:23 -04:00
win32_shortcut.js git-gui: Use proper Windows shortcuts instead of bat files 2007-10-12 23:07:58 -04:00