diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-12-19 10:58:29 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-12-19 10:58:30 -0800 |
| commit | a1f34d5955035dc64f2e25da0ba2cc0a0c73c21c (patch) | |
| tree | 0ef621c787630848212eb27671891bc9ba2a2a58 /remote.c | |
| parent | Merge branch 'jc/set-head-symref-fix' (diff) | |
| parent | remote set-head: set followRemoteHEAD to "warn" if "always" (diff) | |
| download | git-a1f34d5955035dc64f2e25da0ba2cc0a0c73c21c.tar.gz git-a1f34d5955035dc64f2e25da0ba2cc0a0c73c21c.zip | |
Merge branch 'bf/fetch-set-head-config'
"git fetch" honors "remote.<remote>.followRemoteHEAD" settings to
tweak the remote-tracking HEAD in "refs/remotes/<remote>/HEAD".
* bf/fetch-set-head-config:
remote set-head: set followRemoteHEAD to "warn" if "always"
fetch set_head: add warn-if-not-$branch option
fetch set_head: move warn advice into advise_if_enabled
fetch: add configuration for set_head behaviour
Diffstat (limited to 'remote.c')
| -rw-r--r-- | remote.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -514,6 +514,24 @@ static int handle_config(const char *key, const char *value, } else if (!strcmp(subkey, "serveroption")) { return parse_transport_option(key, value, &remote->server_options); + } else if (!strcmp(subkey, "followremotehead")) { + const char *no_warn_branch; + if (!strcmp(value, "never")) + remote->follow_remote_head = FOLLOW_REMOTE_NEVER; + else if (!strcmp(value, "create")) + remote->follow_remote_head = FOLLOW_REMOTE_CREATE; + else if (!strcmp(value, "warn")) { + remote->follow_remote_head = FOLLOW_REMOTE_WARN; + remote->no_warn_branch = NULL; + } else if (skip_prefix(value, "warn-if-not-", &no_warn_branch)) { + remote->follow_remote_head = FOLLOW_REMOTE_WARN; + remote->no_warn_branch = no_warn_branch; + } else if (!strcmp(value, "always")) { + remote->follow_remote_head = FOLLOW_REMOTE_ALWAYS; + } else { + warning(_("unrecognized followRemoteHEAD value '%s' ignored"), + value); + } } return 0; } |
