Skip to content

Commit b098b57

Browse files
jeffhostetlerderrickstolee
authored andcommitted
Merge first wave of gvfs-helper feature
Includes commits from these pull requests: git-for-windows#191 git-for-windows#205 git-for-windows#206 git-for-windows#207 git-for-windows#208 git-for-windows#215 git-for-windows#220 git-for-windows#221 Signed-off-by: Derrick Stolee <[email protected]>
2 parents 10ece56 + 376b123 commit b098b57

23 files changed

+7054
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
/git-gc
7474
/git-get-tar-commit-id
7575
/git-grep
76+
/git-gvfs-helper
7677
/git-hash-object
7778
/git-help
7879
/git-http-backend

Documentation/config.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,8 @@ include::config/gui.txt[]
374374

375375
include::config/guitool.txt[]
376376

377+
include::config/gvfs.txt[]
378+
377379
include::config/help.txt[]
378380

379381
include::config/http.txt[]

Documentation/config/core.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,9 @@ core.gvfs::
672672
flag just blocks them from occurring at all.
673673
--
674674

675+
core.useGvfsHelper::
676+
TODO
677+
675678
core.sparseCheckout::
676679
Enable "sparse checkout" feature. See linkgit:git-sparse-checkout[1]
677680
for more information.

Documentation/config/gvfs.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
gvfs.cache-server::
2+
TODO
3+
4+
gvfs.sharedcache::
5+
TODO

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,7 @@ LIB_OBJS += gpg-interface.o
891891
LIB_OBJS += graph.o
892892
LIB_OBJS += grep.o
893893
LIB_OBJS += gvfs.o
894+
LIB_OBJS += gvfs-helper-client.o
894895
LIB_OBJS += hashmap.o
895896
LIB_OBJS += help.o
896897
LIB_OBJS += hex.o
@@ -1379,6 +1380,9 @@ else
13791380
endif
13801381
BASIC_CFLAGS += $(CURL_CFLAGS)
13811382

1383+
PROGRAM_OBJS += gvfs-helper.o
1384+
TEST_PROGRAMS_NEED_X += test-gvfs-protocol
1385+
13821386
REMOTE_CURL_PRIMARY = git-remote-http$X
13831387
REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
13841388
REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
@@ -2494,6 +2498,10 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS
24942498
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
24952499
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
24962500

2501+
git-gvfs-helper$X: gvfs-helper.o http.o GIT-LDFLAGS $(GITLIBS)
2502+
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
2503+
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
2504+
24972505
$(LIB_FILE): $(LIB_OBJS)
24982506
$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
24992507

builtin/index-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
782782
if (startup_info->have_repository) {
783783
read_lock();
784784
collision_test_needed =
785-
has_object_file_with_flags(oid, OBJECT_INFO_QUICK);
785+
has_object_file_with_flags(oid, OBJECT_INFO_FOR_PREFETCH);
786786
read_unlock();
787787
}
788788

cache.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,9 @@ extern int precomposed_unicode;
961961
extern int protect_hfs;
962962
extern int protect_ntfs;
963963
extern const char *core_fsmonitor;
964+
extern int core_use_gvfs_helper;
965+
extern const char *gvfs_cache_server_url;
966+
extern struct strbuf gvfs_shared_cache_pathname;
964967

965968
extern int core_apply_sparse_checkout;
966969
extern int core_sparse_checkout_cone;

config.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "color.h"
2222
#include "refs.h"
2323
#include "gvfs.h"
24+
#include "transport.h"
2425

2526
struct config_source {
2627
struct config_source *prev;
@@ -1380,6 +1381,11 @@ static int git_default_core_config(const char *var, const char *value, void *cb)
13801381
return 0;
13811382
}
13821383

1384+
if (!strcmp(var, "core.usegvfshelper")) {
1385+
core_use_gvfs_helper = git_config_bool(var, value);
1386+
return 0;
1387+
}
1388+
13831389
if (!strcmp(var, "core.sparsecheckout")) {
13841390
/* virtual file system relies on the sparse checkout logic so force it on */
13851391
if (core_virtualfilesystem)
@@ -1505,6 +1511,35 @@ static int git_default_mailmap_config(const char *var, const char *value)
15051511
return 0;
15061512
}
15071513

1514+
static int git_default_gvfs_config(const char *var, const char *value)
1515+
{
1516+
if (!strcmp(var, "gvfs.cache-server")) {
1517+
const char *v2 = NULL;
1518+
1519+
if (!git_config_string(&v2, var, value) && v2 && *v2)
1520+
gvfs_cache_server_url = transport_anonymize_url(v2);
1521+
free((char*)v2);
1522+
return 0;
1523+
}
1524+
1525+
if (!strcmp(var, "gvfs.sharedcache") && value && *value) {
1526+
strbuf_setlen(&gvfs_shared_cache_pathname, 0);
1527+
strbuf_addstr(&gvfs_shared_cache_pathname, value);
1528+
if (strbuf_normalize_path(&gvfs_shared_cache_pathname) < 0) {
1529+
/*
1530+
* Pretend it wasn't set. This will cause us to
1531+
* fallback to ".git/objects" effectively.
1532+
*/
1533+
strbuf_release(&gvfs_shared_cache_pathname);
1534+
return 0;
1535+
}
1536+
strbuf_trim_trailing_dir_sep(&gvfs_shared_cache_pathname);
1537+
return 0;
1538+
}
1539+
1540+
return 0;
1541+
}
1542+
15081543
int git_default_config(const char *var, const char *value, void *cb)
15091544
{
15101545
if (starts_with(var, "core."))
@@ -1551,6 +1586,9 @@ int git_default_config(const char *var, const char *value, void *cb)
15511586
return 0;
15521587
}
15531588

1589+
if (starts_with(var, "gvfs."))
1590+
return git_default_gvfs_config(var, value);
1591+
15541592
/* Add other config variables here and to Documentation/config.txt. */
15551593
return 0;
15561594
}

credential.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ static int run_credential_helper(struct credential *c,
286286
else
287287
helper.no_stdout = 1;
288288

289+
helper.trace2_child_class = "cred";
290+
289291
if (start_command(&helper) < 0)
290292
return -1;
291293

environment.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ int protect_hfs = PROTECT_HFS_DEFAULT;
8787
#endif
8888
int protect_ntfs = PROTECT_NTFS_DEFAULT;
8989
const char *core_fsmonitor;
90+
int core_use_gvfs_helper;
91+
const char *gvfs_cache_server_url;
92+
struct strbuf gvfs_shared_cache_pathname = STRBUF_INIT;
9093

9194
/*
9295
* The character that begins a commented line in user-editable file

0 commit comments

Comments
 (0)