Skip to content

Commit

Permalink
Merge 'virtual-file-system-support'
Browse files Browse the repository at this point in the history
Add virtual file system settings and hook proc.  On index load,
clear/set the skip worktree bits based on the virtual file system data.
Use virtual file system data to update skip-worktree bit in
unpack-trees. Use virtual file system data to exclude files and folders
not explicitly requested.

Signed-off-by: Ben Peart <Ben.Peart@microsoft.com>
  • Loading branch information
Ben Peart authored and dscho committed Apr 11, 2018
2 parents c1dd29a + e2455fb commit 3d925e8
Show file tree
Hide file tree
Showing 22 changed files with 794 additions and 652 deletions.
18 changes: 8 additions & 10 deletions Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,14 @@ core.fsmonitor::
avoiding unnecessary processing of files that have not changed.
See the "fsmonitor-watchman" section of linkgit:githooks[5].

core.virtualFilesystem::
If set, the value of this variable is used as a command which
will identify all files and directories that are present in
the working directory. Git will only track and update files
listed in the virtual file system. Using the virtual file system
will supersede the sparse-checkout settings which will be ignored.
See the "virtual file system" section of linkgit:githooks[6].

core.trustctime::
If false, the ctime differences between the index and the
working tree are ignored; useful when the inode change time
Expand Down Expand Up @@ -928,10 +936,6 @@ core.gvfs::
GVFS_SKIP_SHA_ON_INDEX_READ::
Bit value 1
Disables the calculation and validation of the sha when reading the index
GVFS_SPARSE_HASHMAP::
Bit value 2
Changes sparse-checkout to use a hashmap to speed up lookups.
Only works with pathnames and directories (no wildcards, negatives, tokens, etc).
GVFS_MISSING_OK::
Bit value 4
Normally git write-tree ensures that the objects referenced by the
Expand Down Expand Up @@ -983,12 +987,6 @@ core.gvfs::
happened.
This drops the merge time from ~1 hour to ~5 minutes and the unmerged
entries goes down from ~40,000 to 1.
GVFS_ALWAYS_EXCLUDE_HASHMAP::
Bit value 512
Changes always_exclude to use a hashmap to speed up lookups.
Only works with exact matches and same-folder wildcards (pa/th/*)
and supports negatives. Behavior depends on GVFS's usage pattern
and is unlikely to work correctly otherwise.
--

core.midx::
Expand Down
20 changes: 20 additions & 0 deletions Documentation/githooks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,26 @@ The exit status determines whether git will use the data from the
hook to limit its search. On error, it will fall back to verifying
all files and folders.

virtualFilesystem
~~~~~~~~~~~~~~~~~~

"Virtual File System" allows populating the working directory sparsely.
The projection data is typically automatically generated by an external
process. Git will limit what files it checks for changes as well as which
directories are checked for untracked files based on the path names given.
Git will also only update those files listed in the projection.

The hook is invoked when the configuration option core.virtualFilesystem
is set. It takes one argument, a version (currently 1).

The hook should output to stdout the list of all files in the working
directory that git should track. The paths are relative to the root
of the working directory and are separated by a single NUL. Full paths
('dir1/a.txt') as well as directories are supported (ie 'dir1/').

The exit status determines whether git will use the data from the
hook. On error, git will abort the command with an error message.

GIT
---
Part of the linkgit:git[1] suite
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,7 @@ LIB_OBJS += utf8.o
LIB_OBJS += varint.o
LIB_OBJS += version.o
LIB_OBJS += versioncmp.o
LIB_OBJS += virtualfilesystem.o
LIB_OBJS += walker.o
LIB_OBJS += wildmatch.o
LIB_OBJS += worktree.o
Expand Down
1 change: 1 addition & 0 deletions cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,7 @@ extern int fsync_object_files;
extern int core_preload_index;
extern int core_commit_graph;
extern int core_apply_sparse_checkout;
extern const char *core_virtualfilesystem;
extern int core_gvfs;
extern int core_midx;
extern int precomposed_unicode;
Expand Down
23 changes: 22 additions & 1 deletion config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,11 @@ static int git_default_core_config(const char *var, const char *value, void *cb)
}

if (!strcmp(var, "core.sparsecheckout")) {
core_apply_sparse_checkout = git_config_bool(var, value);
/* virtual file system relies on the sparse checkout logic so force it on */
if (core_virtualfilesystem)
core_apply_sparse_checkout = 1;
else
core_apply_sparse_checkout = git_config_bool(var, value);
return 0;
}

Expand Down Expand Up @@ -2210,6 +2214,23 @@ int git_config_get_fsmonitor(void)
return 0;
}

int git_config_get_virtualfilesystem(void)
{
if (git_config_get_pathname("core.virtualfilesystem", &core_virtualfilesystem))
core_virtualfilesystem = getenv("GIT_VIRTUALFILESYSTEM_TEST");

if (core_virtualfilesystem && !*core_virtualfilesystem)
core_virtualfilesystem = NULL;

/* virtual file system relies on the sparse checkout logic so force it on */
if (core_virtualfilesystem) {
core_apply_sparse_checkout = 1;
return 1;
}

return 0;
}

NORETURN
void git_die_config_linenr(const char *key, const char *filename, int linenr)
{
Expand Down
1 change: 1 addition & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ extern int git_config_get_untracked_cache(void);
extern int git_config_get_split_index(void);
extern int git_config_get_max_percent_split_change(void);
extern int git_config_get_fsmonitor(void);
extern int git_config_get_virtualfilesystem(void);

/* This dies if the configured or default date is in the future */
extern int git_config_get_expiry(const char *key, const char **output);
Expand Down
Loading

0 comments on commit 3d925e8

Please sign in to comment.