Skip to content

Commit a608883

Browse files
jeffhostetlerderrickstolee
authored andcommitted
Merge first wave of gvfs-helper feature
Includes commits from these pull requests: #191 #205 #206 #207 #208 #215 #220 #221 Signed-off-by: Derrick Stolee <[email protected]>
2 parents 630bf9f + 293e4da commit a608883

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
@@ -378,6 +378,8 @@ include::config/gui.txt[]
378378

379379
include::config/guitool.txt[]
380380

381+
include::config/gvfs.txt[]
382+
381383
include::config/help.txt[]
382384

383385
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
@@ -902,6 +902,7 @@ LIB_OBJS += gpg-interface.o
902902
LIB_OBJS += graph.o
903903
LIB_OBJS += grep.o
904904
LIB_OBJS += gvfs.o
905+
LIB_OBJS += gvfs-helper-client.o
905906
LIB_OBJS += hashmap.o
906907
LIB_OBJS += help.o
907908
LIB_OBJS += hex.o
@@ -1417,6 +1418,9 @@ else
14171418
endif
14181419
BASIC_CFLAGS += $(CURL_CFLAGS)
14191420

1421+
PROGRAM_OBJS += gvfs-helper.o
1422+
TEST_PROGRAMS_NEED_X += test-gvfs-protocol
1423+
14201424
REMOTE_CURL_PRIMARY = git-remote-http$X
14211425
REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
14221426
REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
@@ -2536,6 +2540,10 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS
25362540
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
25372541
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
25382542

2543+
git-gvfs-helper$X: gvfs-helper.o http.o GIT-LDFLAGS $(GITLIBS)
2544+
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
2545+
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
2546+
25392547
$(LIB_FILE): $(LIB_OBJS)
25402548
$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
25412549

builtin/index-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
810810
if (startup_info->have_repository) {
811811
read_lock();
812812
collision_test_needed =
813-
has_object_file_with_flags(oid, OBJECT_INFO_QUICK);
813+
has_object_file_with_flags(oid, OBJECT_INFO_FOR_PREFETCH);
814814
read_unlock();
815815
}
816816

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
@@ -284,6 +284,8 @@ static int run_credential_helper(struct credential *c,
284284
else
285285
helper.no_stdout = 1;
286286

287+
helper.trace2_child_class = "cred";
288+
287289
if (start_command(&helper) < 0)
288290
return -1;
289291

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)