Skip to content

Commit 5c64b6d

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 afbae5a + b4b05e8 commit 5c64b6d

25 files changed

+524
-16
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(istate->repo, 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/commit.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,6 +1801,7 @@ int cmd_commit(int argc,
18011801

18021802
#ifndef WITH_BREAKING_CHANGES
18031803
warn_on_auto_comment_char = true;
1804+
repo_config_clear(the_repository);
18041805
#endif /* !WITH_BREAKING_CHANGES */
18051806
prepare_repo_settings(the_repository);
18061807
the_repository->settings.command_requires_full_index = 0;

builtin/gc.c

Lines changed: 6 additions & 1 deletion
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"
@@ -843,7 +844,7 @@ static int gc_foreground_tasks(struct maintenance_run_opts *opts,
843844
int cmd_gc(int argc,
844845
const char **argv,
845846
const char *prefix,
846-
struct repository *repo UNUSED)
847+
struct repository *repo)
847848
{
848849
int aggressive = 0;
849850
int force = 0;
@@ -925,6 +926,10 @@ int cmd_gc(int argc,
925926
if (opts.quiet)
926927
strvec_push(&repack_args, "-q");
927928

929+
if ((!opts.auto_flag || (opts.auto_flag && cfg.gc_auto_threshold > 0)) &&
930+
gvfs_config_is_set(repo, GVFS_BLOCK_COMMANDS))
931+
die(_("'git gc' is not supported on a GVFS repo"));
932+
928933
if (opts.auto_flag) {
929934
if (cfg.detach_auto && opts.detach < 0)
930935
opts.detach = 1;

builtin/merge.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,7 @@ int cmd_merge(int argc,
13811381

13821382
#ifndef WITH_BREAKING_CHANGES
13831383
warn_on_auto_comment_char = true;
1384+
repo_config_clear(the_repository);
13841385
#endif /* !WITH_BREAKING_CHANGES */
13851386
prepare_repo_settings(the_repository);
13861387
the_repository->settings.command_requires_full_index = 0;

builtin/rebase.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,7 @@ int cmd_rebase(int argc,
12431243

12441244
#ifndef WITH_BREAKING_CHANGES
12451245
warn_on_auto_comment_char = true;
1246+
repo_config_clear(the_repository);
12461247
#endif /* !WITH_BREAKING_CHANGES */
12471248
prepare_repo_settings(the_repository);
12481249
the_repository->settings.command_requires_full_index = 0;

builtin/revert.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "rerere.h"
1111
#include "sequencer.h"
1212
#include "branch.h"
13+
#include "config.h"
1314

1415
/*
1516
* This implements the builtins revert and cherry-pick.
@@ -288,6 +289,7 @@ int cmd_revert(int argc,
288289

289290
#ifndef WITH_BREAKING_CHANGES
290291
warn_on_auto_comment_char = true;
292+
repo_config_clear(the_repository);
291293
#endif /* !WITH_BREAKING_CHANGES */
292294
opts.action = REPLAY_REVERT;
293295
sequencer_init_config(&opts);
@@ -308,6 +310,7 @@ struct repository *repo UNUSED)
308310

309311
#ifndef WITH_BREAKING_CHANGES
310312
warn_on_auto_comment_char = true;
313+
repo_config_clear(the_repository);
311314
#endif /* !WITH_BREAKING_CHANGES */
312315
opts.action = REPLAY_PICK;
313316
sequencer_init_config(&opts);

builtin/update-index.c

Lines changed: 11 additions & 1 deletion
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 "config.h"
1213
#include "environment.h"
1314
#include "gettext.h"
@@ -914,7 +915,7 @@ static enum parse_opt_result reupdate_callback(
914915
int cmd_update_index(int argc,
915916
const char **argv,
916917
const char *prefix,
917-
struct repository *repo UNUSED)
918+
struct repository *repo)
918919
{
919920
int newfd, entries, has_errors = 0, nul_term_line = 0;
920921
enum uc_mode untracked_cache = UC_UNSPECIFIED;
@@ -1178,7 +1179,13 @@ int cmd_update_index(int argc,
11781179
argc = parse_options_end(&ctx);
11791180

11801181
getline_fn = nul_term_line ? strbuf_getline_nul : strbuf_getline_lf;
1182+
if (mark_skip_worktree_only && gvfs_config_is_set(repo, GVFS_BLOCK_COMMANDS))
1183+
die(_("modifying the skip worktree bit is not supported on a GVFS repo"));
1184+
11811185
if (preferred_index_format) {
1186+
if (preferred_index_format != 4 && gvfs_config_is_set(repo, GVFS_BLOCK_COMMANDS))
1187+
die(_("changing the index version is not supported on a GVFS repo"));
1188+
11821189
if (preferred_index_format < 0) {
11831190
printf(_("%d\n"), the_repository->index->version);
11841191
} else if (preferred_index_format < INDEX_FORMAT_LB ||
@@ -1224,6 +1231,9 @@ int cmd_update_index(int argc,
12241231
odb_transaction_commit(transaction);
12251232

12261233
if (split_index > 0) {
1234+
if (gvfs_config_is_set(repo, GVFS_BLOCK_COMMANDS))
1235+
die(_("split index is not supported on a GVFS repo"));
1236+
12271237
if (repo_config_get_split_index(the_repository) == 0)
12281238
warning(_("core.splitIndex is set to false; "
12291239
"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
repo_config(the_repository, 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 (gvfs_config_is_set(repo, 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)