|
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 |
|
@@ -128,6 +129,9 @@ int protect_hfs = PROTECT_HFS_DEFAULT; |
128 | 129 | #define PROTECT_NTFS_DEFAULT 1 |
129 | 130 | #endif |
130 | 131 | int protect_ntfs = PROTECT_NTFS_DEFAULT; |
| 132 | +int core_use_gvfs_helper; |
| 133 | +char *gvfs_cache_server_url; |
| 134 | +const char *gvfs_shared_cache_pathname; |
131 | 135 |
|
132 | 136 | /* |
133 | 137 | * The character that begins a commented line in user-editable file |
@@ -558,6 +562,11 @@ int git_default_core_config(const char *var, const char *value, |
558 | 562 | return 0; |
559 | 563 | } |
560 | 564 |
|
| 565 | + if (!strcmp(var, "core.usegvfshelper")) { |
| 566 | + core_use_gvfs_helper = git_config_bool(var, value); |
| 567 | + return 0; |
| 568 | + } |
| 569 | + |
561 | 570 | if (!strcmp(var, "core.sparsecheckout")) { |
562 | 571 | /* virtual file system relies on the sparse checkout logic so force it on */ |
563 | 572 | if (core_virtualfilesystem) |
@@ -704,6 +713,39 @@ static int git_default_mailmap_config(const char *var, const char *value) |
704 | 713 | return 0; |
705 | 714 | } |
706 | 715 |
|
| 716 | +static int git_default_gvfs_config(const char *var, const char *value) |
| 717 | +{ |
| 718 | + if (!strcmp(var, "gvfs.cache-server")) { |
| 719 | + char *v2 = NULL; |
| 720 | + |
| 721 | + if (!git_config_string(&v2, var, value) && v2 && *v2) { |
| 722 | + free(gvfs_cache_server_url); |
| 723 | + gvfs_cache_server_url = transport_anonymize_url(v2); |
| 724 | + } |
| 725 | + free(v2); |
| 726 | + return 0; |
| 727 | + } |
| 728 | + |
| 729 | + if (!strcmp(var, "gvfs.sharedcache") && value && *value) { |
| 730 | + struct strbuf buf = STRBUF_INIT; |
| 731 | + strbuf_addstr(&buf, value); |
| 732 | + if (strbuf_normalize_path(&buf) < 0) { |
| 733 | + /* |
| 734 | + * Pretend it wasn't set. This will cause us to |
| 735 | + * fallback to ".git/objects" effectively. |
| 736 | + */ |
| 737 | + strbuf_release(&buf); |
| 738 | + return 0; |
| 739 | + } |
| 740 | + strbuf_trim_trailing_dir_sep(&buf); |
| 741 | + |
| 742 | + gvfs_shared_cache_pathname = strbuf_detach(&buf, NULL); |
| 743 | + return 0; |
| 744 | + } |
| 745 | + |
| 746 | + return 0; |
| 747 | +} |
| 748 | + |
707 | 749 | static int git_default_attr_config(const char *var, const char *value) |
708 | 750 | { |
709 | 751 | if (!strcmp(var, "attr.tree")) { |
@@ -771,6 +813,9 @@ int git_default_config(const char *var, const char *value, |
771 | 813 | if (starts_with(var, "sparse.")) |
772 | 814 | return git_default_sparse_config(var, value); |
773 | 815 |
|
| 816 | + if (starts_with(var, "gvfs.")) |
| 817 | + return git_default_gvfs_config(var, value); |
| 818 | + |
774 | 819 | /* Add other config variables here and to Documentation/config.adoc. */ |
775 | 820 | return 0; |
776 | 821 | } |
0 commit comments