Skip to content

Commit c2db5a3

Browse files
jeffhostetlermjcheetham
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 4825ba9 + e6674f3 commit c2db5a3

25 files changed

+7190
-5
lines changed

.gitignore

+1
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-hook

Documentation/config.txt

+2
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,8 @@ include::config/gui.txt[]
448448

449449
include::config/guitool.txt[]
450450

451+
include::config/gvfs.txt[]
452+
451453
include::config/help.txt[]
452454

453455
include::config/http.txt[]

Documentation/config/core.txt

+3
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,9 @@ core.gvfs::
793793
flag just blocks them from occurring at all.
794794
--
795795

796+
core.useGvfsHelper::
797+
TODO
798+
796799
core.sparseCheckout::
797800
Enable "sparse checkout" feature. See linkgit:git-sparse-checkout[1]
798801
for more information.

Documentation/config/gvfs.txt

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

Documentation/lint-manpages.sh

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ check_missing_docs () (
2727
git-init-db) continue;;
2828
git-remote-*) continue;;
2929
git-stage) continue;;
30+
git-gvfs-helper) continue;;
3031
git-legacy-*) continue;;
3132
git-?*--?* ) continue ;;
3233
esac

Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,7 @@ LIB_OBJS += gpg-interface.o
10341034
LIB_OBJS += graph.o
10351035
LIB_OBJS += grep.o
10361036
LIB_OBJS += gvfs.o
1037+
LIB_OBJS += gvfs-helper-client.o
10371038
LIB_OBJS += hash-lookup.o
10381039
LIB_OBJS += hashmap.o
10391040
LIB_OBJS += help.o
@@ -1651,6 +1652,9 @@ endif
16511652
endif
16521653
BASIC_CFLAGS += $(CURL_CFLAGS)
16531654

1655+
PROGRAM_OBJS += gvfs-helper.o
1656+
TEST_PROGRAMS_NEED_X += test-gvfs-protocol
1657+
16541658
REMOTE_CURL_PRIMARY = git-remote-http$X
16551659
REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
16561660
REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
@@ -2914,6 +2918,10 @@ scalar$X: scalar.o GIT-LDFLAGS $(GITLIBS)
29142918
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
29152919
$(filter %.o,$^) $(LIBS)
29162920

2921+
git-gvfs-helper$X: gvfs-helper.o http.o GIT-LDFLAGS $(GITLIBS) $(LAZYLOAD_LIBCURL_OBJ)
2922+
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
2923+
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
2924+
29172925
$(LIB_FILE): $(LIB_OBJS)
29182926
$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
29192927

builtin/index-pack.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
811811
read_lock();
812812
collision_test_needed =
813813
repo_has_object_file_with_flags(the_repository, oid,
814-
OBJECT_INFO_QUICK);
814+
OBJECT_INFO_FOR_PREFETCH);
815815
read_unlock();
816816
}
817817

config.c

+40
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "wildmatch.h"
4343
#include "ws.h"
4444
#include "write-or-die.h"
45+
#include "transport.h"
4546

4647
struct config_source {
4748
struct config_source *prev;
@@ -1671,6 +1672,11 @@ int git_default_core_config(const char *var, const char *value,
16711672
return 0;
16721673
}
16731674

1675+
if (!strcmp(var, "core.usegvfshelper")) {
1676+
core_use_gvfs_helper = git_config_bool(var, value);
1677+
return 0;
1678+
}
1679+
16741680
if (!strcmp(var, "core.sparsecheckout")) {
16751681
/* virtual file system relies on the sparse checkout logic so force it on */
16761682
if (core_virtualfilesystem)
@@ -1822,6 +1828,37 @@ static int git_default_mailmap_config(const char *var, const char *value)
18221828
return 0;
18231829
}
18241830

1831+
static int git_default_gvfs_config(const char *var, const char *value)
1832+
{
1833+
if (!strcmp(var, "gvfs.cache-server")) {
1834+
char *v2 = NULL;
1835+
1836+
if (!git_config_string(&v2, var, value) && v2 && *v2) {
1837+
free(gvfs_cache_server_url);
1838+
gvfs_cache_server_url = transport_anonymize_url(v2);
1839+
}
1840+
free(v2);
1841+
return 0;
1842+
}
1843+
1844+
if (!strcmp(var, "gvfs.sharedcache") && value && *value) {
1845+
strbuf_setlen(&gvfs_shared_cache_pathname, 0);
1846+
strbuf_addstr(&gvfs_shared_cache_pathname, value);
1847+
if (strbuf_normalize_path(&gvfs_shared_cache_pathname) < 0) {
1848+
/*
1849+
* Pretend it wasn't set. This will cause us to
1850+
* fallback to ".git/objects" effectively.
1851+
*/
1852+
strbuf_release(&gvfs_shared_cache_pathname);
1853+
return 0;
1854+
}
1855+
strbuf_trim_trailing_dir_sep(&gvfs_shared_cache_pathname);
1856+
return 0;
1857+
}
1858+
1859+
return 0;
1860+
}
1861+
18251862
static int git_default_attr_config(const char *var, const char *value)
18261863
{
18271864
if (!strcmp(var, "attr.tree")) {
@@ -1889,6 +1926,9 @@ int git_default_config(const char *var, const char *value,
18891926
if (starts_with(var, "sparse."))
18901927
return git_default_sparse_config(var, value);
18911928

1929+
if (starts_with(var, "gvfs."))
1930+
return git_default_gvfs_config(var, value);
1931+
18921932
/* Add other config variables here and to Documentation/config.txt. */
18931933
return 0;
18941934
}

contrib/buildsystems/CMakeLists.txt

+18-1
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ if(NOT CURL_FOUND)
649649
add_compile_definitions(NO_CURL)
650650
message(WARNING "git-http-push and git-http-fetch will not be built")
651651
else()
652-
list(APPEND PROGRAMS_BUILT git-http-fetch git-http-push git-imap-send git-remote-http)
652+
list(APPEND PROGRAMS_BUILT git-http-fetch git-http-push git-imap-send git-remote-http git-gvfs-helper)
653653
if(CURL_VERSION_STRING VERSION_GREATER_EQUAL 7.34.0)
654654
add_compile_definitions(USE_CURL_FOR_IMAP_SEND)
655655
endif()
@@ -818,6 +818,9 @@ if(CURL_FOUND)
818818
add_executable(git-http-push ${CMAKE_SOURCE_DIR}/http-push.c)
819819
target_link_libraries(git-http-push http_obj common-main ${CURL_LIBRARIES} ${EXPAT_LIBRARIES})
820820
endif()
821+
822+
add_executable(git-gvfs-helper ${CMAKE_SOURCE_DIR}/gvfs-helper.c)
823+
target_link_libraries(git-gvfs-helper http_obj common-main ${CURL_LIBRARIES} )
821824
endif()
822825

823826
parse_makefile_for_executables(git_builtin_extra "BUILT_INS")
@@ -1058,6 +1061,20 @@ set(wrapper_scripts
10581061
set(wrapper_test_scripts
10591062
test-fake-ssh test-tool)
10601063

1064+
if(CURL_FOUND)
1065+
list(APPEND wrapper_test_scripts test-gvfs-protocol)
1066+
1067+
add_executable(test-gvfs-protocol ${CMAKE_SOURCE_DIR}/t/helper/test-gvfs-protocol.c)
1068+
target_link_libraries(test-gvfs-protocol common-main)
1069+
1070+
if(MSVC)
1071+
set_target_properties(test-gvfs-protocol
1072+
PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/t/helper)
1073+
set_target_properties(test-gvfs-protocol
1074+
PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/t/helper)
1075+
endif()
1076+
endif()
1077+
10611078

10621079
foreach(script ${wrapper_scripts})
10631080
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)

credential.c

+2
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,8 @@ static int run_credential_helper(struct credential *c,
417417
else
418418
helper.no_stdout = 1;
419419

420+
helper.trace2_child_class = "cred";
421+
420422
if (start_command(&helper) < 0)
421423
return -1;
422424

environment.c

+3
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ int protect_hfs = PROTECT_HFS_DEFAULT;
111111
#define PROTECT_NTFS_DEFAULT 1
112112
#endif
113113
int protect_ntfs = PROTECT_NTFS_DEFAULT;
114+
int core_use_gvfs_helper;
115+
char *gvfs_cache_server_url;
116+
struct strbuf gvfs_shared_cache_pathname = STRBUF_INIT;
114117

115118
/*
116119
* The character that begins a commented line in user-editable file

environment.h

+3
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ extern int core_gvfs;
160160
extern int precomposed_unicode;
161161
extern int protect_hfs;
162162
extern int protect_ntfs;
163+
extern int core_use_gvfs_helper;
164+
extern char *gvfs_cache_server_url;
165+
extern struct strbuf gvfs_shared_cache_pathname;
163166

164167
extern int core_apply_sparse_checkout;
165168
extern int core_sparse_checkout_cone;

0 commit comments

Comments
 (0)