Skip to content

Commit fbea14d

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: #85 #89 #91 #98 #243 #263 Signed-off-by: Derrick Stolee <[email protected]>
2 parents 06d45d2 + 02d8514 commit fbea14d

18 files changed

+473
-17
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+
```

apply.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "dir.h"
2121
#include "environment.h"
2222
#include "gettext.h"
23+
#include "gvfs.h"
2324
#include "hex.h"
2425
#include "xdiff-interface.h"
2526
#include "merge-ll.h"
@@ -3373,6 +3374,25 @@ static int checkout_target(struct index_state *istate,
33733374
{
33743375
struct checkout costate = CHECKOUT_INIT;
33753376

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

builtin/gc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "dir.h"
2020
#include "environment.h"
2121
#include "hex.h"
22+
#include "gvfs.h"
2223
#include "config.h"
2324
#include "tempfile.h"
2425
#include "lockfile.h"
@@ -896,6 +897,9 @@ int cmd_gc(int argc,
896897
if (quiet)
897898
strvec_push(&repack, "-q");
898899

900+
if ((!opts.auto_flag || (opts.auto_flag && cfg.gc_auto_threshold > 0)) && gvfs_config_is_set(GVFS_BLOCK_COMMANDS))
901+
die(_("'git gc' is not supported on a GVFS repo"));
902+
899903
if (opts.auto_flag) {
900904
if (cfg.detach_auto && opts.detach < 0)
901905
opts.detach = 1;

builtin/update-index.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#define DISABLE_SIGN_COMPARE_WARNINGS
99

1010
#include "builtin.h"
11+
#include "gvfs.h"
1112
#include "bulk-checkin.h"
1213
#include "config.h"
1314
#include "environment.h"
@@ -1164,7 +1165,13 @@ int cmd_update_index(int argc,
11641165
argc = parse_options_end(&ctx);
11651166

11661167
getline_fn = nul_term_line ? strbuf_getline_nul : strbuf_getline_lf;
1168+
if (mark_skip_worktree_only && gvfs_config_is_set(GVFS_BLOCK_COMMANDS))
1169+
die(_("modifying the skip worktree bit is not supported on a GVFS repo"));
1170+
11671171
if (preferred_index_format) {
1172+
if (preferred_index_format != 4 && gvfs_config_is_set(GVFS_BLOCK_COMMANDS))
1173+
die(_("changing the index version is not supported on a GVFS repo"));
1174+
11681175
if (preferred_index_format < 0) {
11691176
printf(_("%d\n"), the_repository->index->version);
11701177
} else if (preferred_index_format < INDEX_FORMAT_LB ||
@@ -1210,6 +1217,9 @@ int cmd_update_index(int argc,
12101217
end_odb_transaction();
12111218

12121219
if (split_index > 0) {
1220+
if (gvfs_config_is_set(GVFS_BLOCK_COMMANDS))
1221+
die(_("split index is not supported on a GVFS repo"));
1222+
12131223
if (repo_config_get_split_index(the_repository) == 0)
12141224
warning(_("core.splitIndex is set to false; "
12151225
"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
@@ -4,6 +4,7 @@
44
#include "builtin.h"
55
#include "abspath.h"
66
#include "advice.h"
7+
#include "gvfs.h"
78
#include "checkout.h"
89
#include "config.h"
910
#include "copy.h"
@@ -1450,6 +1451,13 @@ int cmd_worktree(int ac,
14501451

14511452
git_config(git_worktree_config, NULL);
14521453

1454+
/*
1455+
* git-worktree is special-cased to work in Scalar repositories
1456+
* even when they use the GVFS Protocol.
1457+
*/
1458+
if (core_gvfs & GVFS_USE_VIRTUAL_FILESYSTEM)
1459+
die("'git %s' is not supported on a GVFS repo", "worktree");
1460+
14531461
if (!prefix)
14541462
prefix = "";
14551463

cache-tree.c

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

439439
strbuf_grow(&buffer, entlen + 100);
440-
strbuf_addf(&buffer, "%o %.*s%c", mode, entlen, path + baselen, '\0');
440+
441+
switch (mode) {
442+
case 0100644:
443+
strbuf_add(&buffer, "100644 ", 7);
444+
break;
445+
case 0100664:
446+
strbuf_add(&buffer, "100664 ", 7);
447+
break;
448+
case 0100755:
449+
strbuf_add(&buffer, "100755 ", 7);
450+
break;
451+
case 0120000:
452+
strbuf_add(&buffer, "120000 ", 7);
453+
break;
454+
case 0160000:
455+
strbuf_add(&buffer, "160000 ", 7);
456+
break;
457+
default:
458+
strbuf_addf(&buffer, "%o ", mode);
459+
break;
460+
}
461+
strbuf_add(&buffer, path + baselen, entlen);
462+
strbuf_addch(&buffer, '\0');
441463
strbuf_add(&buffer, oid->hash, the_hash_algo->rawsz);
442464

443465
#if DEBUG_CACHE_TREE

0 commit comments

Comments
 (0)