Skip to content

Commit ab37eac

Browse files
committed
Merge advanced VFS-specific features
Most of these were done in private before microsoft/git. However, the following pull requests modified the core feature: git#85 git#89 git#91 git#98 git#243 git#263 Signed-off-by: Derrick Stolee <[email protected]>
2 parents cb839fe + 6918eec commit ab37eac

19 files changed

+516
-41
lines changed

BRANCHES.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
Branches used in this repo
2+
==========================
3+
4+
The document explains the branching structure that we are using in the VFSForGit repository as well as the forking strategy that we have adopted for contributing.
5+
6+
Repo Branches
7+
-------------
8+
9+
1. `vfs-#`
10+
11+
These branches are used to track the specific version that match Git for Windows with the VFSForGit specific patches on top. When a new version of Git for Windows is released, the VFSForGit patches will be rebased on that windows version and a new gvfs-# branch created to create pull requests against.
12+
13+
#### Examples
14+
15+
```
16+
vfs-2.27.0
17+
vfs-2.30.0
18+
```
19+
20+
The versions of git for VFSForGit are based on the Git for Windows versions. v2.20.0.vfs.1 will correspond with the v2.20.0.windows.1 with the VFSForGit specific patches applied to the windows version.
21+
22+
2. `vfs-#-exp`
23+
24+
These branches are for releasing experimental features to early adopters. They
25+
should contain everything within the corresponding `vfs-#` branch; if the base
26+
branch updates, then merge into the `vfs-#-exp` branch as well.
27+
28+
Tags
29+
----
30+
31+
We are using annotated tags to build the version number for git. The build will look back through the commit history to find the first tag matching `v[0-9]*vfs*` and build the git version number using that tag.
32+
33+
Full releases are of the form `v2.XX.Y.vfs.Z.W` where `v2.XX.Y` comes from the
34+
upstream version and `Z.W` are custom updates within our fork. Specifically,
35+
the `.Z` value represents the "compatibility level" with VFS for Git. Only
36+
increase this version when making a breaking change with a released version
37+
of VFS for Git. The `.W` version is used for minor updates between major
38+
versions.
39+
40+
Experimental releases are of the form `v2.XX.Y.vfs.Z.W.exp`. The `.exp`
41+
suffix indicates that experimental features are available. The rest of the
42+
version string comes from the full release tag. These versions will only
43+
be made available as pre-releases on the releases page, never a full release.
44+
45+
Forking
46+
-------
47+
48+
A personal fork of this repository and a branch in that repository should be used for development.
49+
50+
These branches should be based on the latest vfs-# branch. If there are work in progress pull requests that you have based on a previous version branch when a new version branch is created, you will need to move your patches to the new branch to get them in that latest version.
51+
52+
#### Example
53+
54+
```
55+
git clone <personal fork repo URL>
56+
git remote add ms https://github.com/Microsoft/git.git
57+
git checkout -b my-changes ms/vfs-2.20.0 --no-track
58+
git push -fu origin HEAD
59+
```

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,7 @@ LIB_OBJS += git-zlib.o
10421042
LIB_OBJS += gpg-interface.o
10431043
LIB_OBJS += graph.o
10441044
LIB_OBJS += grep.o
1045+
LIB_OBJS += gvfs.o
10451046
LIB_OBJS += hash-lookup.o
10461047
LIB_OBJS += hashmap.o
10471048
LIB_OBJS += help.o

apply.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3380,6 +3380,24 @@ static int checkout_target(struct index_state *istate,
33803380
{
33813381
struct checkout costate = CHECKOUT_INIT;
33823382

3383+
/*
3384+
* Do not checkout the entry if the skipworktree bit is set
3385+
*
3386+
* Both callers of this method (check_preimage and load_current)
3387+
* check for the existance of the file before calling this
3388+
* method so we know that the file doesn't exist at this point
3389+
* and we don't need to perform that check again here.
3390+
* We just need to check the skip-worktree and return.
3391+
*
3392+
* This is to prevent git from creating a file in the
3393+
* working directory that has the skip-worktree bit on,
3394+
* then updating the index from the patch and not keeping
3395+
* the working directory version up to date with what it
3396+
* changed the index version to be.
3397+
*/
3398+
if (ce_skip_worktree(ce))
3399+
return 0;
3400+
33833401
costate.refresh_cache = 1;
33843402
costate.istate = istate;
33853403
if (checkout_entry(ce, &costate, NULL, NULL) ||

builtin/gc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "environment.h"
1717
#include "hex.h"
1818
#include "repository.h"
19+
#include "gvfs.h"
1920
#include "config.h"
2021
#include "tempfile.h"
2122
#include "lockfile.h"
@@ -621,6 +622,9 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
621622
if (quiet)
622623
strvec_push(&repack, "-q");
623624

625+
if ((!auto_gc || (auto_gc && gc_auto_threshold > 0)) && gvfs_config_is_set(GVFS_BLOCK_COMMANDS))
626+
die(_("'git gc' is not supported on a GVFS repo"));
627+
624628
if (auto_gc) {
625629
/*
626630
* Auto-gc should be least intrusive as possible.

builtin/update-index.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
#define USE_THE_INDEX_VARIABLE
77
#include "builtin.h"
8+
#include "gvfs.h"
89
#include "bulk-checkin.h"
910
#include "config.h"
1011
#include "environment.h"
@@ -1181,7 +1182,13 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
11811182
argc = parse_options_end(&ctx);
11821183

11831184
getline_fn = nul_term_line ? strbuf_getline_nul : strbuf_getline_lf;
1185+
if (mark_skip_worktree_only && gvfs_config_is_set(GVFS_BLOCK_COMMANDS))
1186+
die(_("modifying the skip worktree bit is not supported on a GVFS repo"));
1187+
11841188
if (preferred_index_format) {
1189+
if (preferred_index_format != 4 && gvfs_config_is_set(GVFS_BLOCK_COMMANDS))
1190+
die(_("changing the index version is not supported on a GVFS repo"));
1191+
11851192
if (preferred_index_format < INDEX_FORMAT_LB ||
11861193
INDEX_FORMAT_UB < preferred_index_format)
11871194
die("index-version %d not in range: %d..%d",
@@ -1222,6 +1229,9 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
12221229
end_odb_transaction();
12231230

12241231
if (split_index > 0) {
1232+
if (gvfs_config_is_set(GVFS_BLOCK_COMMANDS))
1233+
die(_("split index is not supported on a GVFS repo"));
1234+
12251235
if (git_config_get_split_index() == 0)
12261236
warning(_("core.splitIndex is set to false; "
12271237
"remove or change it, if you really want to "

builtin/worktree.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "builtin.h"
22
#include "abspath.h"
33
#include "advice.h"
4+
#include "gvfs.h"
45
#include "checkout.h"
56
#include "config.h"
67
#include "copy.h"
@@ -1404,6 +1405,13 @@ int cmd_worktree(int ac, const char **av, const char *prefix)
14041405

14051406
git_config(git_worktree_config, NULL);
14061407

1408+
/*
1409+
* git-worktree is special-cased to work in Scalar repositories
1410+
* even when they use the GVFS Protocol.
1411+
*/
1412+
if (core_gvfs & GVFS_USE_VIRTUAL_FILESYSTEM)
1413+
die("'git %s' is not supported on a GVFS repo", "worktree");
1414+
14071415
if (!prefix)
14081416
prefix = "";
14091417

cache-tree.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,29 @@ static int update_one(struct cache_tree *it,
429429
continue;
430430

431431
strbuf_grow(&buffer, entlen + 100);
432-
strbuf_addf(&buffer, "%o %.*s%c", mode, entlen, path + baselen, '\0');
432+
433+
switch (mode) {
434+
case 0100644:
435+
strbuf_add(&buffer, "100644 ", 7);
436+
break;
437+
case 0100664:
438+
strbuf_add(&buffer, "100664 ", 7);
439+
break;
440+
case 0100755:
441+
strbuf_add(&buffer, "100755 ", 7);
442+
break;
443+
case 0120000:
444+
strbuf_add(&buffer, "120000 ", 7);
445+
break;
446+
case 0160000:
447+
strbuf_add(&buffer, "160000 ", 7);
448+
break;
449+
default:
450+
strbuf_addf(&buffer, "%o ", mode);
451+
break;
452+
}
453+
strbuf_add(&buffer, path + baselen, entlen);
454+
strbuf_addch(&buffer, '\0');
433455
strbuf_add(&buffer, oid->hash, the_hash_algo->rawsz);
434456

435457
#if DEBUG_CACHE_TREE

0 commit comments

Comments
 (0)