Compare commits

...

8 Commits

Author SHA1 Message Date
Johannes Altmanninger
00e987df15 completions/git: stop "git for-each-ref refs/remotes/" after 200ms
See #11535
2025-06-01 17:11:54 +02:00
Johannes Altmanninger
a6ee9be72a completions/git: only look at local branches and tags when computing 50 recent commits
Commit 836b6bea73 (git completions: Add commit hashes for `show`, 2015-12-18)
made

	git show foo<TAB>

magically expand "foo" to the commit hash of a recent commit.  I would
discourage from using raw commit IDs on the command line but I guess it's the
most convenient way sometimes. Probably this is still useful to some users even
though "git show :/foo" exists.  The set of target commits was "git log -50".

Commit 3c3bf7ffd7 (completions/git: Show recent commits *on all branches*
for rebase, 2021-03-12) and others expanded the set of target commits to "git
log -50 --all" for some commands. I think Git partially sorts the result
set before returning the top 50 entries, possibly causing a slowdown.
(A slowdown is easily reproducible with "time git log --max-count=50
>/dev/null" with and without "--all").

The "--all" flag seems excessive because
1. it looks at remote branches. There can be a lot of those, especially in
   a monorepo context or when Git is configured to fetch branches from
   multiple remotes.  See also #9248 where we explicitly decided not to sort
   remote branches.
2. it looks at refs that are neither branches nor tags.
   Some systems like Jujutsu or git-branchless use such refs to prevent their
   commits from being garbage-collected. Such refs typically have opaque
   (autogenerated) IDs and should normally not be shown in a generic Git UI.

I don't know if completion of commit IDs for these kinds of refs is worth it.
(Normally you'd run something like "git checkout remote-branch" instead.)

Exclude these two types of refs.  Do include HEAD which is not a branch or
tag.  In future we could include refs like REBASE_HEAD again; though again,
I don't know if those are needed for commit-ID completion.

Given

	$ git for-each-ref refs/tags | wc -l
	1033
	$ git for-each-ref refs/heads | wc -l   # local branches
	6
	$ git for-each-ref refs/remotes | wc -l # remote branches
	5270
	$ git for-each-ref refs/jj/keep | wc -l # Jujutsu
	8390

this results in a good speedup for completions:

	$ fish -c "time complete -C'git ' >/dev/null && time complete -C'git checkout hello' >/dev/null" &| grep .
	________________________________________________________
	Executed in   68.61 millis    fish           external
	   usr time   63.50 millis   55.17 millis    8.33 millis
	   sys time   13.41 millis   13.41 millis    0.00 millis
	________________________________________________________
	Executed in  911.49 millis    fish           external
	   usr time  359.17 millis   91.00 millis  268.18 millis
	   sys time  604.22 millis   24.70 millis  579.53 millis
	$ fish -c "time complete -C'git ' >/dev/null && time complete -C'git checkout hello' >/dev/null" &| grep .
	________________________________________________________
	Executed in   70.20 millis    fish           external
	   usr time   59.81 millis   59.81 millis    0.00 millis
	   sys time   19.39 millis   12.22 millis    7.17 millis
	________________________________________________________
	Executed in  449.83 millis    fish           external
	   usr time  240.37 millis   94.17 millis  146.21 millis
	   sys time  403.66 millis   29.66 millis  374.00 millis

Part of #11535
2025-06-01 17:11:54 +02:00
Johannes Altmanninger
ad28e17b50 completions/git: sort stash completions after branches and others
Completions like "stash@{1}" don't give a lot of information, unlike local
branches which are sorted by recency so let's put those first.
2025-06-01 17:11:54 +02:00
Johannes Altmanninger
a7d9f2293e completions/git: extract logic 2025-06-01 17:11:54 +02:00
Johannes Altmanninger
df92c93332 completions/git: extract function for adding completions for arbitrary revisions
Most commands take arbitrary revisions.  AFAICT, the order should always be
the same: we list local branches before remote branches before commit IDs etc.

Let's extract a function. This adds a various revision-types that were missing.
2025-06-01 17:11:54 +02:00
Johannes Altmanninger
aebae23533 completions/git: rebase --onto requires a revision argument 2025-06-01 17:11:54 +02:00
Johannes Altmanninger
69b5ad110a completions/git: add more special refs
These are things like .git/HEAD, i.e. the ones that are typically not
namespaced under .git/refs.  The list is taken from gitrevisions(7).
2025-06-01 17:11:54 +02:00
Johannes Altmanninger
17446ad20f completions/git: fix copy-paste error
This variable is never defined. It was copied from Git's
contrib/completion/git-completion.bash where $match is probably equivalent
to $(commandline -t).  I could measure a significant speedup passing down
this filter, so let's remove it for now.
2025-06-01 17:11:54 +02:00

View File

@@ -16,7 +16,8 @@ function __fish_git
end
end
# Using 'command git' to avoid interactions for aliases from git to (e.g.) hub
command git $global_args $saved_args 2>/dev/null
set -l git $__fish_git_timeout git
command $git $global_args $saved_args 2>/dev/null
end
# Print an optspec for argparse to handle git's options that are independent of any subcommand.
@@ -52,8 +53,8 @@ end
function __fish_git_branches
# This is much faster than using `git branch` and avoids dealing with localized "detached HEAD" messages.
# We intentionally only sort local branches by recency. See discussion in #9248.
__fish_git for-each-ref --format='%(refname:strip=2)%09Local Branch' --sort=-committerdate refs/heads/ 2>/dev/null
__fish_git for-each-ref --format='%(refname:strip=2)%09Remote Branch' refs/remotes/ 2>/dev/null
__fish_git_local_branches
__fish_git_remote_branches
end
function __fish_git_submodules
@@ -65,14 +66,18 @@ function __fish_git_local_branches
__fish_git for-each-ref --format='%(refname:strip=2)%09Local Branch' --sort=-committerdate refs/heads/ 2>/dev/null
end
function __fish_git_remote_branches
__fish_git_timeout=(string split ' ' -- (command -v timeout)' 0.200') __fish_git for-each-ref --format='%(refname:strip=2)%09Remote Branch' refs/remotes/ 2>/dev/null
end
function __fish_git_unique_remote_branches
# `git checkout` accepts remote branches without the remote part
# if they are unambiguous.
# E.g. if only alice has a "frobulate" branch
# `git checkout frobulate` is equivalent to `git checkout -b frobulate --track alice/frobulate`.
__fish_git for-each-ref --format="%(refname:strip=3)" \
__fish_git_timeout=(string split ' ' -- (command -v timeout)' 0.200') __fish_git for-each-ref --format="%(refname:strip=3)" \
--sort="refname:strip=3" \
"refs/remotes/*/$match*" "refs/remotes/*/*/**" 2>/dev/null | uniq -u
refs/remotes/ 2>/dev/null | uniq -u
end
function __fish_git_tags
@@ -82,7 +87,8 @@ end
function __fish_git_heads
set -l gitdir (__fish_git rev-parse --git-dir 2>/dev/null)
or return # No git dir, no need to even test.
for head in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD
for head in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD REVERT_HEAD \
CHERRY_PICK_HEAD BISECT_HEAD AUTO_MERGE
if test -f $gitdir/$head
echo $head
end
@@ -101,6 +107,32 @@ function __fish_git_remotes
__fish_git config --get-regexp 'remote\.[a-z]+\.url' | string replace -rf 'remote\.(.*)\.url (.*)' '$1\t$2'
end
set -g __fish_git_extra_recent_commits false
set -g __fish_git_unqualified_unique_remote_branches false
set -g __fish_git_filter_non_pushable 'string join \n'
function __fish_git_add_revision_completion
set -l c complete -f -c git $argv -n 'not contains -- -- (commandline -xpc)' -ka
# The following dynamic, order-preserved (-k) completions will be shown in reverse order (see #9221)
$c "(__fish_git_recent_commits \$(
if $__fish_git_extra_recent_commits
begin
echo HEAD
git for-each-ref --sort=-committerdate --format='%(refname)' 2>/dev/null \
refs/tags refs/heads
end | string join ' '
end
) | $__fish_git_filter_non_pushable)"
$c "(__fish_git_tags)" -d Tag
$c "(__fish_git_heads | $__fish_git_filter_non_pushable)" -d Head
$c "(__fish_git_remotes | $__fish_git_filter_non_pushable)" -d 'Remote alias'
$c "(__fish_git_remote_branches | $__fish_git_filter_non_pushable)"
if $__fish_git_unqualified_unique_remote_branches
$c "(__fish_git_unique_remote_branches | $__fish_git_filter_non_pushable)" -d 'Unique Remote Branch'
end
$c "(__fish_git_local_branches)" -d 'Local Branch'
end
function __fish_git_files
# A function to show various kinds of files git knows about,
# by parsing `git status --porcelain`.
@@ -1037,7 +1069,7 @@ complete -f -c git -n '__fish_git_using_command fetch' -l shallow-since -d 'Deep
complete -f -c git -n '__fish_git_using_command fetch' -l shallow-exclude -d 'Deepen history of shallow clone, excluding rev'
complete -f -c git -n '__fish_git_using_command fetch' -l unshallow -d 'Convert to a complete repository'
complete -f -c git -n '__fish_git_using_command fetch' -l refetch -d 'Re-fetch without negotiating common commits'
complete -f -c git -n '__fish_git_using_command fetch' -l negotiation-tip -d 'Only report commits reachable from these tips' -kxa '(__fish_git_commits; __fish_git_branches)'
__fish_git_add_revision_completion -n '__fish_git_using_command fetch' -l negotiation-tip -d 'Only report commits reachable from these tips' -x
complete -f -c git -n '__fish_git_using_command fetch' -l negotiate-only -d "Don't fetch, only show commits in common with the server"
complete -f -c git -n '__fish_git_using_command fetch' -l filter -ra '(__fish_git_filters)' -d 'Request a subset of objects from server'
@@ -1090,10 +1122,8 @@ complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcomma
### show
complete -f -c git -n __fish_git_needs_command -a show -d 'Show the last commit of a branch'
complete -f -c git -n '__fish_git_using_command show' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_branches)'
complete -f -c git -n '__fish_git_using_command show' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_tags)' -d Tag
complete -f -c git -n '__fish_git_using_command show' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_commits)'
complete -f -c git -n '__fish_git_using_command show' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_complete_stashes)'
__fish_git_add_revision_completion -n '__fish_git_using_command show'
complete -f -c git -n __fish_git_needs_rev_files -n 'not contains -- -- (commandline -xpc)' -xa '(__fish_git_complete_rev_files)'
complete -F -c git -n '__fish_git_using_command show' -n 'contains -- -- (commandline -xpc)'
complete -f -c git -n '__fish_git_using_command show' -l format -d 'Pretty-print the contents of the commit logs in a given format' -a '(__fish_git_show_opt format)'
@@ -1182,13 +1212,12 @@ complete -c git -n '__fish_git_using_command am' -l show-current-patch -a 'diff
### checkout
complete -F -c git -n '__fish_git_using_command checkout' -n 'contains -- -- (commandline -xpc)'
complete -f -c git -n __fish_git_needs_command -a checkout -d 'Checkout and switch to a branch'
begin
set -lx __fish_git_extra_recent_commits true
set -lx __fish_git_unqualified_unique_remote_branches true
__fish_git_add_revision_completion -n '__fish_git_using_command checkout'
end
# The following dynamic, order-preserved (-k) completions will be shown in reverse order (see #9221)
complete -f -c git -n '__fish_git_using_command checkout' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_recent_commits --all)'
complete -f -c git -n '__fish_git_using_command checkout' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_tags)' -d Tag
complete -f -c git -n '__fish_git_using_command checkout' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_heads)' -d Head
complete -f -c git -n '__fish_git_using_command checkout' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_unique_remote_branches)' -d 'Unique Remote Branch'
complete -f -c git -n '__fish_git_using_command checkout' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_branches)'
# In the presence of changed files, `git checkout ...` assumes highest likelihood is intent to restore so this comes last (aka shown first).
complete -f -c git -n '__fish_git_using_command checkout' -ka '(__fish_git_files modified deleted modified-staged-deleted)'
@@ -1425,9 +1454,7 @@ complete -x -c git -n '__fish_git_using_command daemon' -l access-hook -d 'Hook
### describe
complete -c git -n __fish_git_needs_command -a describe -d 'Give an object a human readable name'
complete -f -c git -n '__fish_git_using_command describe' -ka '(__fish_git_tags)' -d Tag
complete -f -c git -n '__fish_git_using_command describe' -ka '(__fish_git_branches)'
complete -f -c git -n '__fish_git_using_command describe' -ka '(__fish_git_heads)' -d Head
__fish_git_add_revision_completion -n '__fish_git_using_command describe'
complete -f -c git -n '__fish_git_using_command describe' -l dirty -d 'Describe the state of the working tree, append dirty if there are local changes'
complete -f -c git -n '__fish_git_using_command describe' -l broken -d 'Describe the state of the working tree, append -broken instead of erroring'
complete -f -c git -n '__fish_git_using_command describe' -l all -d 'Use all tags, not just annotated'
@@ -1447,7 +1474,10 @@ complete -f -c git -n '__fish_git_using_command describe' -l first-parent -d 'Fo
complete -c git -n __fish_git_needs_command -a diff -d 'Show changes between commits and working tree'
complete -c git -n '__fish_git_using_command diff' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_ranges)'
complete -c git -n '__fish_git_using_command diff' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_complete_stashes)'
complete -c git -n '__fish_git_using_command diff' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_recent_commits --all)'
begin
set -lx __fish_git_extra_recent_commits true
__fish_git_add_revision_completion -n '__fish_git_using_command diff'
end
complete -c git -n '__fish_git_using_command diff' -l cached -d 'Show diff of changes in the index'
complete -c git -n '__fish_git_using_command diff' -l staged -d 'Show diff of changes in the index'
complete -c git -n '__fish_git_using_command diff' -l no-index -d 'Compare two paths on the filesystem'
@@ -1778,7 +1808,7 @@ complete -f -c git -n '__fish_git_using_command maintenance' -l schedule -d 'Run
### merge
complete -f -c git -n __fish_git_needs_command -a merge -d 'Join multiple development histories'
complete -f -c git -n '__fish_git_using_command merge' -ka '(__fish_git_branches)'
__fish_git_add_revision_completion -n '__fish_git_using_command merge'
complete -f -c git -n '__fish_git_using_command merge' -l commit -d "Autocommit the merge"
complete -f -c git -n '__fish_git_using_command merge' -l no-commit -d "Don't autocommit the merge"
complete -f -c git -n '__fish_git_using_command merge' -s e -l edit -d 'Edit auto-generated merge message'
@@ -1814,7 +1844,7 @@ complete -f -c git -n '__fish_git_using_command merge' -l no-autostash -d 'Do no
### merge-base
complete -f -c git -n __fish_git_needs_command -a merge-base -d 'Find a common ancestor for a merge'
complete -f -c git -n '__fish_git_using_command merge-base' -ka '(__fish_git_branches)'
__fish_git_add_revision_completion -n '__fish_git_using_command merge-base'
complete -f -c git -n '__fish_git_using_command merge-base' -s a -l all -d 'Output all merge bases for the commits, instead of just one'
complete -f -c git -n '__fish_git_using_command merge-base' -l octopus -d 'Compute the best common ancestors of all supplied commits'
complete -f -c git -n '__fish_git_using_command merge-base' -l independent -d 'Print a minimal subset of the supplied commits with the same ancestors'
@@ -1932,9 +1962,11 @@ complete -f -c git -n '__fish_git_using_command range-diff' -l no-dual-color -d
### push
complete -f -c git -n __fish_git_needs_command -a push -d 'Push changes elsewhere'
complete -f -c git -n '__fish_git_using_command push' -n 'not __fish_git_branch_for_remote' -a '(__fish_git_remotes)' -d 'Remote alias'
complete -f -c git -n '__fish_git_using_command push' -n __fish_git_branch_for_remote -ka '(__fish_git_tags)' -d Tag
complete -f -c git -n '__fish_git_using_command push' -n __fish_git_branch_for_remote -ka '(__fish_git_branches)'
complete -f -c git -n '__fish_git_using_command push' -n __fish_git_branch_for_remote -ka '(__fish_git_heads)'
begin
# TODO
set -lx __fish_git_filter_non_pushable 'string replace -r "(\t.*)?\$" ":\$1"'
__fish_git_add_revision_completion -n '__fish_git_using_command push' -n __fish_git_branch_for_remote
end
# The "refspec" here is an optional "+" to signify a force-push
complete -f -c git -n '__fish_git_using_command push' -n __fish_git_branch_for_remote -n 'string match -q "+*" -- (commandline -ct)' -ka '+(__fish_git_branches | string replace -r \t".*" "")' -d 'Force-push branch'
# git push REMOTE :BRANCH deletes BRANCH on remote REMOTE
@@ -1961,11 +1993,7 @@ complete -f -c git -n '__fish_git_using_command push' -l progress -d 'Force prog
### rebase
complete -f -c git -n __fish_git_needs_command -a rebase -d 'Reapply commit sequence on a new base'
complete -f -c git -n '__fish_git_using_command rebase' -a '(__fish_git_remotes)' -d 'Remote alias'
complete -f -c git -n '__fish_git_using_command rebase' -ka '(__fish_git_branches)'
complete -f -c git -n '__fish_git_using_command rebase' -a '(__fish_git_heads)' -d Head
complete -f -c git -n '__fish_git_using_command rebase' -ka '(__fish_git_tags)' -d Tag -k
complete -f -c git -n '__fish_git_using_command rebase' -a '(__fish_git_recent_commits)' -k
__fish_git_add_revision_completion -n '__fish_git_using_command rebase'
complete -f -c git -n '__fish_git_using_command rebase' -n __fish_git_is_rebasing -l continue -d 'Restart the rebasing process'
complete -f -c git -n '__fish_git_using_command rebase' -n __fish_git_is_rebasing -l abort -d 'Abort the rebase operation'
complete -f -c git -n '__fish_git_using_command rebase' -n __fish_git_is_rebasing -l edit-todo -d 'Edit the todo list'
@@ -1990,7 +2018,7 @@ complete -f -c git -n '__fish_git_using_command rebase' -l no-autosquash -d 'No
complete -f -c git -n '__fish_git_using_command rebase' -l autostash -d 'Before starting rebase, stash local changes, and apply stash when done'
complete -f -c git -n '__fish_git_using_command rebase' -l no-autostash -d 'Do not stash local changes before starting rebase'
complete -f -c git -n '__fish_git_using_command rebase' -l no-ff -d 'No fast-forward'
complete -f -c git -n '__fish_git_using_command rebase' -l onto -d 'Rebase current branch onto given upstream or newbase' -ka '(__fish_git_branches)'
__fish_git_add_revision_completion -n '__fish_git_using_command rebase' -l onto -d 'Rebase current branch onto given upstream or newbase' -r
complete -f -c git -n '__fish_git_using_command rebase' -l update-refs -d 'Update any branches that point to commits being rebased'
complete -f -c git -n '__fish_git_using_command rebase' -l no-update-refs -d 'Don\'t update any branches that point to commits being rebased'
# This actually takes script for $SHELL, but completing that is... complicated.
@@ -2009,7 +2037,7 @@ complete -c git -n __fish_git_needs_command -a reset -d 'Reset current HEAD to t
complete -f -c git -n '__fish_git_using_command reset' -l hard -d 'Reset the index and the working tree'
complete -f -c git -n '__fish_git_using_command reset' -l soft -d 'Reset head without touching the index or the working tree'
complete -f -c git -n '__fish_git_using_command reset' -l mixed -d 'The default: reset the index but not the working tree'
complete -c git -n '__fish_git_using_command reset' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_branches)'
__fish_git_add_revision_completion -n '__fish_git_using_command reset'
# reset can either undo changes to versioned modified files,
# or remove files from the staging area.
# Deleted files seem to need a "--" separator.
@@ -2041,7 +2069,10 @@ complete -f -c git -n '__fish_git_using_command switch' -ka '(__fish_git_unique_
complete -f -c git -n '__fish_git_using_command switch' -ka '(__fish_git_branches)'
complete -f -c git -n '__fish_git_using_command switch' -s c -l create -d 'Create a new branch'
complete -f -c git -n '__fish_git_using_command switch' -s C -l force-create -d 'Force create a new branch'
complete -f -c git -n '__fish_git_using_command switch' -s d -l detach -rka '(__fish_git_recent_commits --all)'
begin
set -lx __fish_git_extra_recent_commits true
__fish_git_add_revision_completion -n '__fish_git_using_command switch' -s d -l detach -r
end
complete -f -c git -n '__fish_git_using_command switch' -s d -l detach -d 'Switch to a commit for inspection and discardable experiment' -rka '(__fish_git_refs)'
complete -f -c git -n '__fish_git_using_command switch' -l guess -d 'Guess branch name from remote branch (default)'
complete -f -c git -n '__fish_git_using_command switch' -l no-guess -d 'Do not guess branch name from remote branch'
@@ -2066,9 +2097,7 @@ complete -f -c git -n __fish_git_needs_command -a rev-list -d 'List commits in c
### rev-parse
complete -f -c git -n __fish_git_needs_command -a rev-parse -d 'Parse revision names or give repo information'
complete -f -c git -n '__fish_git_using_command rev-parse' -ka '(__fish_git_branches)'
complete -f -c git -n '__fish_git_using_command rev-parse' -a '(__fish_git_heads)' -d Head
complete -c git -n '__fish_git_using_command rev-parse' -ka '(__fish_git_tags)' -d Tag
__fish_git_add_revision_completion -n '__fish_git_using_command rev-parse'
complete -c git -n '__fish_git_using_command rev-parse' -l abbrev-ref -d 'Output non-ambiguous short object names'
### revert
@@ -2118,7 +2147,7 @@ complete -f -c git -n '__fish_git_using_command stripspace' -s c -l comment-line
### tag
complete -f -c git -n __fish_git_needs_command -a tag -d 'Create, list, delete or verify a tag object signed with GPG'
complete -f -c git -n '__fish_git_using_command tag' -n '__fish_not_contain_opt -s d' -n '__fish_not_contain_opt -s v' -n 'test (count (commandline -xpc | string match -r -v \'^-\')) -eq 3' -ka '(__fish_git_branches)'
__fish_git_add_revision_completion -n '__fish_git_using_command tag' -n '__fish_not_contain_opt -s d' -n '__fish_not_contain_opt -s v' -n 'test (count (commandline -xpc | string match -r -v \'^-\')) -eq 3'
complete -f -c git -n '__fish_git_using_command tag' -s a -l annotate -d 'Make an unsigned, annotated tag object'
complete -f -c git -n '__fish_git_using_command tag' -s s -l sign -d 'Make a GPG-signed tag'
complete -f -c git -n '__fish_git_using_command tag' -s d -l delete -d 'Remove a tag'
@@ -2179,11 +2208,10 @@ complete -f -c git -n "__fish_git_using_command worktree" -n "not __fish_seen_su
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add move remove' -s f -l force -d 'Override safeguards'
complete -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add'
complete -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -ka '(__fish_git_branches)'
complete -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -ka '(__fish_git_heads)' -d Head
complete -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -ka '(__fish_git_tags)' -d Tag
complete -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -ka '(__fish_git_unique_remote_branches)' -d 'Unique Remote Branch'
complete -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -ka '(__fish_git_local_branches)'
begin
set -lx __fish_git_unqualified_unique_remote_branches true
__fish_git_add_revision_completion -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add'
end
complete -x -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -s b -d 'Create a new branch'
complete -x -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -s B -d 'Create a new branch even if it already exists'
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -l detach -d 'Detach HEAD in the new working tree'
@@ -2219,11 +2247,7 @@ complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_u
complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a branch -d 'Create a new branch from a stash'
complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a push -d 'Create a new stash with given files'
complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command apply' -ka '(__fish_git_complete_stashes)'
complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command branch' -ka '(__fish_git_complete_stashes)'
complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command drop' -ka '(__fish_git_complete_stashes)'
complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command pop' -ka '(__fish_git_complete_stashes)'
complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command show' -ka '(__fish_git_complete_stashes)'
complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command apply branch drop pop show' -ka '(__fish_git_complete_stashes)'
complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command push' -a '(__fish_git_files modified deleted modified-staged-deleted)'
complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command push' -s a -l all -d 'Stash ignored and untracked files'
@@ -2240,7 +2264,7 @@ complete -f -c git -n __fish_git_needs_command -a config -d 'Set and read git co
### format-patch
complete -f -c git -n __fish_git_needs_command -a format-patch -d 'Generate patch series to send upstream'
complete -f -c git -n '__fish_git_using_command format-patch' -ka '(__fish_git_branches)'
__fish_git_add_revision_completion -n '__fish_git_using_command format-patch'
complete -c git -n '__fish_git_using_command format-patch' -s o -l output-directory -xa '(__fish_complete_directories)'
complete -f -c git -n '__fish_git_using_command format-patch' -s p -l no-stat -d "Generate plain patches without diffstat"
complete -f -c git -n '__fish_git_using_command format-patch' -s s -l no-patch -d "Suppress diff output"
@@ -2602,3 +2626,8 @@ for file in (path filter -xZ $PATH/git-* | path basename)
complete -c git -f -n "__fish_git_using_command $cmd" -a "(__fish_git_complete_custom_command $cmd)"
set -a __fish_git_custom_commands_completion $file
end
functions --erase __fish_git_add_revision_completion
set -eg __fish_git_extra_recent_commits
set -eg __fish_git_unqualified_unique_remote_branches
set -eg __fish_git_filter_non_pushable