Skip to content

Commit b546376

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 abd49af + f67891f commit b546376

25 files changed

+7190
-5
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
/git-gc
7676
/git-get-tar-commit-id
7777
/git-grep
78+
/git-gvfs-helper
7879
/git-hash-object
7980
/git-help
8081
/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
@@ -1043,6 +1043,7 @@ LIB_OBJS += gpg-interface.o
10431043
LIB_OBJS += graph.o
10441044
LIB_OBJS += grep.o
10451045
LIB_OBJS += gvfs.o
1046+
LIB_OBJS += gvfs-helper-client.o
10461047
LIB_OBJS += hash-lookup.o
10471048
LIB_OBJS += hashmap.o
10481049
LIB_OBJS += help.o
@@ -1679,6 +1680,9 @@ endif
16791680
endif
16801681
BASIC_CFLAGS += $(CURL_CFLAGS)
16811682

1683+
PROGRAM_OBJS += gvfs-helper.o
1684+
TEST_PROGRAMS_NEED_X += test-gvfs-protocol
1685+
16821686
REMOTE_CURL_PRIMARY = git-remote-http$X
16831687
REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
16841688
REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
@@ -2959,6 +2963,10 @@ scalar$X: scalar.o GIT-LDFLAGS $(GITLIBS)
29592963
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
29602964
$(filter %.o,$^) $(LIBS)
29612965

2966+
git-gvfs-helper$X: gvfs-helper.o http.o GIT-LDFLAGS $(GITLIBS) $(LAZYLOAD_LIBCURL_OBJ)
2967+
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
2968+
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
2969+
29622970
$(LIB_FILE): $(LIB_OBJS)
29632971
$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
29642972

builtin/index-pack.c

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

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;
@@ -1648,6 +1649,11 @@ int git_default_core_config(const char *var, const char *value,
16481649
return 0;
16491650
}
16501651

1652+
if (!strcmp(var, "core.usegvfshelper")) {
1653+
core_use_gvfs_helper = git_config_bool(var, value);
1654+
return 0;
1655+
}
1656+
16511657
if (!strcmp(var, "core.sparsecheckout")) {
16521658
/* virtual file system relies on the sparse checkout logic so force it on */
16531659
if (core_virtualfilesystem)
@@ -1799,6 +1805,37 @@ static int git_default_mailmap_config(const char *var, const char *value)
17991805
return 0;
18001806
}
18011807

1808+
static int git_default_gvfs_config(const char *var, const char *value)
1809+
{
1810+
if (!strcmp(var, "gvfs.cache-server")) {
1811+
char *v2 = NULL;
1812+
1813+
if (!git_config_string(&v2, var, value) && v2 && *v2) {
1814+
free(gvfs_cache_server_url);
1815+
gvfs_cache_server_url = transport_anonymize_url(v2);
1816+
}
1817+
free(v2);
1818+
return 0;
1819+
}
1820+
1821+
if (!strcmp(var, "gvfs.sharedcache") && value && *value) {
1822+
strbuf_setlen(&gvfs_shared_cache_pathname, 0);
1823+
strbuf_addstr(&gvfs_shared_cache_pathname, value);
1824+
if (strbuf_normalize_path(&gvfs_shared_cache_pathname) < 0) {
1825+
/*
1826+
* Pretend it wasn't set. This will cause us to
1827+
* fallback to ".git/objects" effectively.
1828+
*/
1829+
strbuf_release(&gvfs_shared_cache_pathname);
1830+
return 0;
1831+
}
1832+
strbuf_trim_trailing_dir_sep(&gvfs_shared_cache_pathname);
1833+
return 0;
1834+
}
1835+
1836+
return 0;
1837+
}
1838+
18021839
static int git_default_attr_config(const char *var, const char *value)
18031840
{
18041841
if (!strcmp(var, "attr.tree")) {
@@ -1866,6 +1903,9 @@ int git_default_config(const char *var, const char *value,
18661903
if (starts_with(var, "sparse."))
18671904
return git_default_sparse_config(var, value);
18681905

1906+
if (starts_with(var, "gvfs."))
1907+
return git_default_gvfs_config(var, value);
1908+
18691909
/* Add other config variables here and to Documentation/config.txt. */
18701910
return 0;
18711911
}

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")
@@ -1108,6 +1111,20 @@ set(wrapper_scripts
11081111
set(wrapper_test_scripts
11091112
test-fake-ssh test-tool)
11101113

1114+
if(CURL_FOUND)
1115+
list(APPEND wrapper_test_scripts test-gvfs-protocol)
1116+
1117+
add_executable(test-gvfs-protocol ${CMAKE_SOURCE_DIR}/t/helper/test-gvfs-protocol.c)
1118+
target_link_libraries(test-gvfs-protocol common-main)
1119+
1120+
if(MSVC)
1121+
set_target_properties(test-gvfs-protocol
1122+
PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/t/helper)
1123+
set_target_properties(test-gvfs-protocol
1124+
PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/t/helper)
1125+
endif()
1126+
endif()
1127+
11111128

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

credential.c

+2
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,8 @@ static int run_credential_helper(struct credential *c,
443443
else
444444
helper.no_stdout = 1;
445445

446+
helper.trace2_child_class = "cred";
447+
446448
if (start_command(&helper) < 0)
447449
return -1;
448450

environment.c

+3
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ int protect_hfs = PROTECT_HFS_DEFAULT;
101101
#define PROTECT_NTFS_DEFAULT 1
102102
#endif
103103
int protect_ntfs = PROTECT_NTFS_DEFAULT;
104+
int core_use_gvfs_helper;
105+
char *gvfs_cache_server_url;
106+
struct strbuf gvfs_shared_cache_pathname = STRBUF_INIT;
104107

105108
/*
106109
* The character that begins a commented line in user-editable file

environment.h

+3
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ extern int core_gvfs;
176176
extern int precomposed_unicode;
177177
extern int protect_hfs;
178178
extern int protect_ntfs;
179+
extern int core_use_gvfs_helper;
180+
extern char *gvfs_cache_server_url;
181+
extern struct strbuf gvfs_shared_cache_pathname;
179182

180183
extern int core_apply_sparse_checkout;
181184
extern int core_sparse_checkout_cone;

0 commit comments

Comments
 (0)