|
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 |
|
@@ -92,6 +93,9 @@ int protect_hfs = PROTECT_HFS_DEFAULT; |
92 | 93 | #define PROTECT_NTFS_DEFAULT 1 |
93 | 94 | #endif |
94 | 95 | int protect_ntfs = PROTECT_NTFS_DEFAULT; |
| 96 | +int core_use_gvfs_helper; |
| 97 | +char *gvfs_cache_server_url; |
| 98 | +const char *gvfs_shared_cache_pathname; |
95 | 99 |
|
96 | 100 | /* |
97 | 101 | * The character that begins a commented line in user-editable file |
@@ -522,6 +526,11 @@ int git_default_core_config(const char *var, const char *value, |
522 | 526 | return 0; |
523 | 527 | } |
524 | 528 |
|
| 529 | + if (!strcmp(var, "core.usegvfshelper")) { |
| 530 | + core_use_gvfs_helper = git_config_bool(var, value); |
| 531 | + return 0; |
| 532 | + } |
| 533 | + |
525 | 534 | if (!strcmp(var, "core.sparsecheckout")) { |
526 | 535 | /* virtual file system relies on the sparse checkout logic so force it on */ |
527 | 536 | if (core_virtualfilesystem) |
@@ -663,6 +672,39 @@ static int git_default_mailmap_config(const char *var, const char *value) |
663 | 672 | return 0; |
664 | 673 | } |
665 | 674 |
|
| 675 | +static int git_default_gvfs_config(const char *var, const char *value) |
| 676 | +{ |
| 677 | + if (!strcmp(var, "gvfs.cache-server")) { |
| 678 | + char *v2 = NULL; |
| 679 | + |
| 680 | + if (!git_config_string(&v2, var, value) && v2 && *v2) { |
| 681 | + free(gvfs_cache_server_url); |
| 682 | + gvfs_cache_server_url = transport_anonymize_url(v2); |
| 683 | + } |
| 684 | + free(v2); |
| 685 | + return 0; |
| 686 | + } |
| 687 | + |
| 688 | + if (!strcmp(var, "gvfs.sharedcache") && value && *value) { |
| 689 | + struct strbuf buf = STRBUF_INIT; |
| 690 | + strbuf_addstr(&buf, value); |
| 691 | + if (strbuf_normalize_path(&buf) < 0) { |
| 692 | + /* |
| 693 | + * Pretend it wasn't set. This will cause us to |
| 694 | + * fallback to ".git/objects" effectively. |
| 695 | + */ |
| 696 | + strbuf_release(&buf); |
| 697 | + return 0; |
| 698 | + } |
| 699 | + strbuf_trim_trailing_dir_sep(&buf); |
| 700 | + |
| 701 | + gvfs_shared_cache_pathname = strbuf_detach(&buf, NULL); |
| 702 | + return 0; |
| 703 | + } |
| 704 | + |
| 705 | + return 0; |
| 706 | +} |
| 707 | + |
666 | 708 | static int git_default_attr_config(const char *var, const char *value) |
667 | 709 | { |
668 | 710 | if (!strcmp(var, "attr.tree")) { |
@@ -730,6 +772,9 @@ int git_default_config(const char *var, const char *value, |
730 | 772 | if (starts_with(var, "sparse.")) |
731 | 773 | return git_default_sparse_config(var, value); |
732 | 774 |
|
| 775 | + if (starts_with(var, "gvfs.")) |
| 776 | + return git_default_gvfs_config(var, value); |
| 777 | + |
733 | 778 | /* Add other config variables here and to Documentation/config.adoc. */ |
734 | 779 | return 0; |
735 | 780 | } |
0 commit comments