|
34 | 34 | #include "quote.h"
|
35 | 35 | #include "chdir-notify.h"
|
36 | 36 | #include "setup.h"
|
| 37 | +#include "transport.h" |
37 | 38 | #include "ws.h"
|
38 | 39 | #include "write-or-die.h"
|
39 | 40 |
|
@@ -129,6 +130,9 @@ int protect_hfs = PROTECT_HFS_DEFAULT;
|
129 | 130 | #define PROTECT_NTFS_DEFAULT 1
|
130 | 131 | #endif
|
131 | 132 | int protect_ntfs = PROTECT_NTFS_DEFAULT;
|
| 133 | +int core_use_gvfs_helper; |
| 134 | +char *gvfs_cache_server_url; |
| 135 | +const char *gvfs_shared_cache_pathname; |
132 | 136 |
|
133 | 137 | /*
|
134 | 138 | * The character that begins a commented line in user-editable file
|
@@ -545,6 +549,11 @@ int git_default_core_config(const char *var, const char *value,
|
545 | 549 | return 0;
|
546 | 550 | }
|
547 | 551 |
|
| 552 | + if (!strcmp(var, "core.usegvfshelper")) { |
| 553 | + core_use_gvfs_helper = git_config_bool(var, value); |
| 554 | + return 0; |
| 555 | + } |
| 556 | + |
548 | 557 | if (!strcmp(var, "core.sparsecheckout")) {
|
549 | 558 | /* virtual file system relies on the sparse checkout logic so force it on */
|
550 | 559 | if (core_virtualfilesystem)
|
@@ -691,6 +700,39 @@ static int git_default_mailmap_config(const char *var, const char *value)
|
691 | 700 | return 0;
|
692 | 701 | }
|
693 | 702 |
|
| 703 | +static int git_default_gvfs_config(const char *var, const char *value) |
| 704 | +{ |
| 705 | + if (!strcmp(var, "gvfs.cache-server")) { |
| 706 | + char *v2 = NULL; |
| 707 | + |
| 708 | + if (!git_config_string(&v2, var, value) && v2 && *v2) { |
| 709 | + free(gvfs_cache_server_url); |
| 710 | + gvfs_cache_server_url = transport_anonymize_url(v2); |
| 711 | + } |
| 712 | + free(v2); |
| 713 | + return 0; |
| 714 | + } |
| 715 | + |
| 716 | + if (!strcmp(var, "gvfs.sharedcache") && value && *value) { |
| 717 | + struct strbuf buf = STRBUF_INIT; |
| 718 | + strbuf_addstr(&buf, value); |
| 719 | + if (strbuf_normalize_path(&buf) < 0) { |
| 720 | + /* |
| 721 | + * Pretend it wasn't set. This will cause us to |
| 722 | + * fallback to ".git/objects" effectively. |
| 723 | + */ |
| 724 | + strbuf_release(&buf); |
| 725 | + return 0; |
| 726 | + } |
| 727 | + strbuf_trim_trailing_dir_sep(&buf); |
| 728 | + |
| 729 | + gvfs_shared_cache_pathname = strbuf_detach(&buf, NULL); |
| 730 | + return 0; |
| 731 | + } |
| 732 | + |
| 733 | + return 0; |
| 734 | +} |
| 735 | + |
694 | 736 | static int git_default_attr_config(const char *var, const char *value)
|
695 | 737 | {
|
696 | 738 | if (!strcmp(var, "attr.tree")) {
|
@@ -758,6 +800,9 @@ int git_default_config(const char *var, const char *value,
|
758 | 800 | if (starts_with(var, "sparse."))
|
759 | 801 | return git_default_sparse_config(var, value);
|
760 | 802 |
|
| 803 | + if (starts_with(var, "gvfs.")) |
| 804 | + return git_default_gvfs_config(var, value); |
| 805 | + |
761 | 806 | /* Add other config variables here and to Documentation/config.adoc. */
|
762 | 807 | return 0;
|
763 | 808 | }
|
0 commit comments