Skip to content

fetch-tags argument is incorrect #2309

@htunnicliff

Description

@htunnicliff

Expected Behavior

When fetch-tags is set to true, the --tags flag is appended to the underlying git fetch operation:

-git fetch
+git fetch --tags

Actual Behavior

When fetch-tags is set to true, the --tags flag is NOT appended to the underlying git fetch operation.

Notes

It appears that the only behavior change that this option introduces is the addition of the --no-tags flag when the fetch-tags option is set to false (which is its default):

if (!refSpec.some(x => x === refHelper.tagsRefSpec) && !options.fetchTags) {
args.push('--no-tags')
}

I find this behavior misleading, given that these are the typical tag behaviors of git fetch:

Operation Behavior
git fetch Any tag that points into the histories being fetched is also fetched1
git fetch --tags Fetches all tags from the remote2
git fetch --no-tags Disables automatic tag following3

It seems like the existing behavior of this option would be more appropriately named no-fetch-tags/no-tags/etc.

Change Request

  • Deprecate the fetch-tags option.
  • Add a tags option (or perhaps tags-behavior?) that can be set to one of the following:
    • follow (default)
    • all
    • none

I'd be happy to implement this behavior in a pull request if that would be welcome!

Related Issues

Footnotes

  1. https://git-scm.com/docs/git-fetch.html#_description

  2. https://git-scm.com/docs/git-fetch.html#Documentation/git-fetch.txt---tags

  3. https://git-scm.com/docs/git-fetch.html#Documentation/git-fetch.txt---no-tags

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions