Skip to content

Commit 944163a

Browse files
samueltardieugitster
authored andcommitted
Honor "tagopt = --tags" configuration option
If the "tagopt = --tags" option of a remote is set, all tags will be fetched as in "git fetch --tags". Signed-off-by: Samuel Tardieu <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5469e2d commit 944163a

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

Documentation/config.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,9 @@ remote.<name>.uploadpack::
15781578

15791579
remote.<name>.tagopt::
15801580
Setting this value to \--no-tags disables automatic tag following when
1581-
fetching from remote <name>
1581+
fetching from remote <name>. Setting it to \--tags will fetch every
1582+
tag from remote <name>, even if they are not reachable from remote
1583+
branch heads.
15821584

15831585
remote.<name>.vcs::
15841586
Setting this to a value <vcs> will cause git to interact with

contrib/examples/git-fetch.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,12 @@ then
127127
orig_head=$(git rev-parse --verify HEAD 2>/dev/null)
128128
fi
129129

130-
# Allow --notags from remote.$1.tagopt
130+
# Allow --tags/--notags from remote.$1.tagopt
131131
case "$tags$no_tags" in
132132
'')
133133
case "$(git config --get "remote.$1.tagopt")" in
134+
--tags)
135+
tags=t ;;
134136
--no-tags)
135137
no_tags=t ;;
136138
esac

remote.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,8 @@ static int handle_config(const char *key, const char *value, void *cb)
443443
} else if (!strcmp(subkey, ".tagopt")) {
444444
if (!strcmp(value, "--no-tags"))
445445
remote->fetch_tags = -1;
446+
else if (!strcmp(value, "--tags"))
447+
remote->fetch_tags = 2;
446448
} else if (!strcmp(subkey, ".proxy")) {
447449
return git_config_string((const char **)&remote->http_proxy,
448450
key, value);

0 commit comments

Comments
 (0)