git/builtin
Derrick Stolee 6508076132 worktree: allow in Scalar repositories
The 'git worktree' command was marked as BLOCK_ON_GVFS_REPO because it
does not interact well with the virtual filesystem of VFS for Git. When
a Scalar clone uses the GVFS protocol, it enables the
GVFS_BLOCK_COMMANDS flag, since commands like 'git gc' do not work well
with the GVFS protocol.

However, 'git worktree' works just fine with the GVFS protocol since it
isn't doing anything special. It copies the sparse-checkout from the
current worktree, so it does not have performance issues.

This is a highly requested option.

The solution is to stop using the BLOCK_ON_GVFS_REPO option and instead
add a special-case check in cmd_worktree() specifically for a particular
bit of the 'core_gvfs' global variable (loaded by very early config
reading) that corresponds to the virtual filesystem. The bit that most
closely resembled this behavior was non-obviously named, but does
provide a signal that we are in a Scalar clone and not a VFS for Git
clone. The error message is copied from git.c, so it will have the same
output as before if a user runs this in a VFS for Git clone.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
2022-10-04 23:15:24 +02:00
..
add.c add/rm: allow adding sparse entries when virtual 2022-10-03 20:01:44 +02:00
am.c git-compat-util.h: use "UNUSED", not "UNUSED(var)" 2022-09-01 10:49:48 -07:00
annotate.c strvec: rename struct fields 2020-07-30 19:18:06 -07:00
apply.c apply.c: remove unnecessary include 2022-04-06 09:42:14 -07:00
archive.c parse-options: PARSE_OPT_KEEP_UNKNOWN only applies to --options 2022-08-19 11:13:14 -07:00
bisect--helper.c Merge branch 'ab/unused-annotation' 2022-09-14 12:56:39 -07:00
blame.c parse-options: add support for parsing subcommands 2022-08-19 11:13:14 -07:00
branch.c branch: drop unused worktrees variable 2022-06-21 08:52:37 -07:00
bugreport.c builtin/bugreport.c: create '--diagnose' option 2022-08-12 13:20:02 -07:00
bundle.c builtin/bundle.c: let parse-options parse subcommands 2022-08-19 11:13:15 -07:00
cat-file.c Merge branch 'tb/cat-file-z' 2022-08-05 15:52:14 -07:00
check-attr.c
check-ignore.c dir.[ch]: replace dir_init() with DIR_INIT 2021-07-01 12:32:22 -07:00
check-mailmap.c shortlog: remove unused(?) "repo-abbrev" feature 2021-01-12 14:04:42 -08:00
check-ref-format.c check-ref-format: fix trivial memory leak 2022-07-01 11:43:42 -07:00
checkout--worker.c pkt-line.[ch]: remove unused packet_read_line_buf() 2021-10-15 13:09:40 -07:00
checkout-index.c checkout-index: integrate with sparse index 2022-01-13 13:49:45 -08:00
checkout.c Trace2:gvfs:experiment: capture more 'tracking' details 2022-10-03 20:01:34 +02:00
clean.c clean: suggest using `core.longPaths` if paths are too long to remove 2022-10-03 19:54:09 +02:00
clone.c Merge branch 'jk/list-objects-filter-cleanup' 2022-09-19 14:35:24 -07:00
column.c column: fix parsing of the '--nl' option 2021-08-26 14:36:27 -07:00
commit-graph.c Merge branch 'ab/unused-annotation' 2022-09-14 12:56:39 -07:00
commit-tree.c use xopen() to handle fatal open(2) failures 2021-08-25 14:39:08 -07:00
commit.c gvfs:trace2:data: status deserialization information 2022-10-03 20:01:33 +02:00
config.c git-compat-util.h: use "UNUSED", not "UNUSED(var)" 2022-09-01 10:49:48 -07:00
count-objects.c i18n: remove from i18n strings that do not hold translatable parts 2022-02-04 13:58:28 -08:00
credential-cache--daemon.c unix-socket: add backlog size option to unix_stream_listen() 2021-03-15 14:32:51 -07:00
credential-cache.c credential-cache: check for windows specific errors 2021-09-14 09:30:54 -07:00
credential-store.c Use a better name for the function interpolating paths 2021-07-26 12:17:16 -07:00
credential.c doc: fix git credential synopsis 2021-10-28 09:57:09 -07:00
describe.c git-compat-util.h: use "UNUSED", not "UNUSED(var)" 2022-09-01 10:49:48 -07:00
diagnose.c builtin/diagnose.c: don't translate the two mode values 2022-09-21 11:53:35 -07:00
diff-files.c diff-files: move misplaced cleanup label 2022-07-12 07:17:28 -07:00
diff-index.c revisions API: call diff_free(&revs->pruning) in revisions_release() 2022-04-13 23:56:10 -07:00
diff-tree.c 2.36 gitk/diff-tree --stdin regression fix 2022-04-26 09:26:35 -07:00
diff.c Merge branch 'ab/plug-leak-in-revisions' 2022-06-07 14:10:56 -07:00
difftool.c Introduce helper to create symlinks that knows about index_state 2022-10-03 19:54:12 +02:00
env--helper.c parse-options: PARSE_OPT_KEEP_UNKNOWN only applies to --options 2022-08-19 11:13:14 -07:00
fast-export.c Merge branch 'ab/unused-annotation' 2022-09-14 12:56:39 -07:00
fast-import.c git-compat-util.h: use "UNUSED", not "UNUSED(var)" 2022-09-01 10:49:48 -07:00
fetch-pack.c list-objects-filter: add and use initializers 2022-09-12 08:38:59 -07:00
fetch.c fetch: reprepare packs before checking connectivity 2022-10-03 20:01:37 +02:00
fmt-merge-msg.c merge: allow to pretend a merge is made into a different branch 2021-12-20 14:55:02 -08:00
for-each-ref.c for-each-ref: delay parsing of --sort=<atom> options 2021-10-20 14:33:07 -07:00
for-each-repo.c builtin/for-each-repo: remove unnecessary argv copy to plug leak 2021-07-26 12:19:20 -07:00
fsck.c git-compat-util.h: use "UNUSED", not "UNUSED(var)" 2022-09-01 10:49:48 -07:00
fsmonitor--daemon.c fsmonitor--daemon: stub in health thread 2022-05-26 15:59:27 -07:00
gc.c Merge branch 'sparse-index-stuff' 2022-10-04 23:03:12 +02:00
get-tar-commit-id.c
grep.c grep: add --max-count command line option 2022-06-22 13:23:29 -07:00
hash-object.c Merge branch 'ab/object-file-api-updates' 2022-03-16 17:53:08 -07:00
help.c git help: special-case `scalar` 2022-09-02 10:02:56 -07:00
hook.c builtin/hook.c: let parse-options parse subcommands 2022-08-19 11:13:15 -07:00
index-pack.c index-pack: avoid immediate object fetch while parsing packfile 2022-10-03 20:01:35 +02:00
init-db.c Introduce helper to create symlinks that knows about index_state 2022-10-03 19:54:12 +02:00
interpret-trailers.c Use OPT_CALLBACK and OPT_CALLBACK_F 2020-04-28 10:47:10 -07:00
log.c Merge branch 'ab/unused-annotation' 2022-09-14 12:56:39 -07:00
ls-files.c ls-files: fix black space in error message 2022-09-12 09:25:40 -07:00
ls-remote.c Merge branch 'ep/maint-equals-null-cocci' 2022-05-20 15:26:59 -07:00
ls-tree.c git-compat-util.h: use "UNUSED", not "UNUSED(var)" 2022-09-01 10:49:48 -07:00
mailinfo.c mailinfo: allow squelching quoted CRLF warning 2021-05-10 15:06:22 +09:00
mailsplit.c Merge branch 'ep/maint-equals-null-cocci' 2022-05-20 15:26:59 -07:00
merge-base.c merge-base: free() allocated "struct commit **" list 2022-03-04 13:24:17 -08:00
merge-file.c merge-file: fix memory leaks on error path 2022-07-01 11:43:43 -07:00
merge-index.c merge-index: ensure full index 2021-04-14 13:47:21 -07:00
merge-ours.c builtins + test helpers: use return instead of exit() in cmd_* 2021-06-09 09:15:58 +09:00
merge-recursive.c gettext API users: don't explicitly cast ngettext()'s "n" 2022-03-07 11:57:52 -08:00
merge-tree.c merge-tree: add a --allow-unrelated-histories flag 2022-06-22 16:10:06 -07:00
merge.c Merge branch 'en/merge-multi-strategies' 2022-09-01 13:40:19 -07:00
mktag.c Merge branch 'ab/object-file-api-updates' 2022-03-16 17:53:08 -07:00
mktree.c mktree: do not check type of remote objects 2022-06-21 10:12:15 -07:00
multi-pack-index.c Merge branch 'ab/unused-annotation' 2022-09-14 12:56:39 -07:00
mv.c Merge branch 'sy/mv-out-of-cone' 2022-09-19 14:35:23 -07:00
name-rev.c git-compat-util.h: use "UNUSED", not "UNUSED(var)" 2022-09-01 10:49:48 -07:00
notes.c notes, remote: show unknown subcommands between `' 2022-09-07 12:06:12 -07:00
pack-objects.c Merge branch 'ab/unused-annotation' 2022-09-14 12:56:39 -07:00
pack-redundant.c tree-wide: apply equals-null.cocci 2022-05-02 09:50:37 -07:00
pack-refs.c
patch-id.c patch-id: fix scan_hunk_header on diffs with 1 line of before/after 2022-02-02 11:24:23 -08:00
prune-packed.c i18n: remove from i18n strings that do not hold translatable parts 2022-02-04 13:58:28 -08:00
prune.c revisions API users: add straightforward release_revisions() 2022-04-13 23:56:08 -07:00
pull.c pull: fix a "struct oid_array" memory leak 2022-07-01 11:43:43 -07:00
push.c push: fix capitalisation of the option name autoSetupMerge 2022-06-15 11:45:46 -07:00
range-diff.c range-diff: optionally accept pathspecs 2022-08-26 09:49:26 -07:00
read-tree.c read-tree: make three-way merge sparse-aware 2022-03-01 12:36:01 -08:00
rebase.c rebase: add rebase.updateRefs config option 2022-07-19 12:49:04 -07:00
receive-pack.c git-compat-util.h: use "UNUSED", not "UNUSED(var)" 2022-09-01 10:49:48 -07:00
reflog.c Merge branch 'ab/unused-annotation' 2022-09-14 12:56:39 -07:00
remote-ext.c strvec: convert builtin/ callers away from argv_array name 2020-07-28 15:02:18 -07:00
remote-fd.c
remote.c Merge branch 'ab/unused-annotation' 2022-09-14 12:56:39 -07:00
repack.c git-compat-util.h: use "UNUSED", not "UNUSED(var)" 2022-09-01 10:49:48 -07:00
replace.c refs: use ref_namespaces for replace refs base 2022-08-05 14:13:12 -07:00
rerere.c xdiff users: use designated initializers for out_line 2021-05-11 12:47:31 +09:00
reset.c reset: fix mixed reset when using virtual filesystem 2022-10-03 20:01:49 +02:00
rev-list.c rev-list: support human-readable output for `--disk-usage` 2022-08-11 13:45:23 -07:00
rev-parse.c Merge branch 'ab/unused-annotation' 2022-09-14 12:56:39 -07:00
revert.c parse-options: PARSE_OPT_KEEP_UNKNOWN only applies to --options 2022-08-19 11:13:14 -07:00
rm.c add/rm: allow adding sparse entries when virtual 2022-10-03 20:01:44 +02:00
send-pack.c i18n: factorize "invalid value" messages 2022-02-04 13:58:28 -08:00
shortlog.c parse-options: add support for parsing subcommands 2022-08-19 11:13:14 -07:00
show-branch.c git-compat-util.h: use "UNUSED", not "UNUSED(var)" 2022-09-01 10:49:48 -07:00
show-index.c builtin/show-index: set the algorithm for object IDs 2021-04-27 16:31:39 +09:00
show-ref.c git-compat-util.h: use "UNUSED", not "UNUSED(var)" 2022-09-01 10:49:48 -07:00
sparse-checkout.c sparse-checkout: add config to disable deleting dirs 2022-10-03 20:01:45 +02:00
stash.c Merge branch 'ab/unused-annotation' 2022-09-14 12:56:39 -07:00
stripspace.c i18n: remove from i18n strings that do not hold translatable parts 2022-02-04 13:58:28 -08:00
submodule--helper.c Merge branch 'jk/list-objects-filter-cleanup' 2022-09-19 14:35:24 -07:00
symbolic-ref.c symbolic-ref: refuse to set syntactically invalid target 2022-08-01 12:17:13 -07:00
tag.c Merge branch 'ep/maint-equals-null-cocci' 2022-05-20 15:26:59 -07:00
unpack-file.c
unpack-objects.c unpack-objects: use stream_loose_object() to unpack large objects 2022-06-13 10:22:36 -07:00
update-index.c gvfs: block unsupported commands when running in a GVFS repo 2022-10-03 20:01:31 +02:00
update-microsoft-git.c update-microsoft-git: use brew on macOS 2022-10-03 20:01:39 +02:00
update-ref.c update-ref: fix streaming of status updates 2021-09-03 11:35:15 -07:00
update-server-info.c i18n: remove from i18n strings that do not hold translatable parts 2022-02-04 13:58:28 -08:00
upload-archive.c upload-archive: use regular "struct child_process" pattern 2021-11-25 22:15:07 -08:00
upload-pack.c upload-pack: document and rename --advertise-refs 2021-08-05 08:59:37 -07:00
var.c var: add GIT_DEFAULT_BRANCH variable 2021-11-03 13:25:36 -07:00
verify-commit.c
verify-pack.c Merge branch 'bc/sha-256-part-3' 2020-08-11 18:04:11 -07:00
verify-tag.c
worktree.c worktree: allow in Scalar repositories 2022-10-04 23:15:24 +02:00
write-tree.c