git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* --no-tags doesn't appear to be working as intended
@ 2020-05-02 21:01 Ben Denhartog
  2020-05-03  6:54 ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Denhartog @ 2020-05-02 21:01 UTC (permalink / raw)
  To: git

From the documentation, it would appear that `--no-tags` should avoid pulling tags, even if they point to refs which match the refspec being fetched:

>        -n, --no-tags
>            By default, tags that point at objects that are downloaded from the remote repository are fetched and
>            stored locally. This option disables this automatic tag following. The default behavior for a remote may
>            be specified with the remote.<name>.tagOpt setting. See git-config(1). 

This, however, does not appear to be the case: Either using the `--no-tags` flag on the command line directly or setting `remote.<name>.tagopt = --no-tags` appears to be ignored when running `git-fetch`. This can be recreated simply:

```
# /tmp/a will be our "origin"
# /tmp/b will be our "fork"
mkdir /tmp/{a,b}

# set up the origin
git -C /tmp/a init
echo "Hello, world" >/tmp/a/README
git -C /tmp/a add README
git -C /tmp/a commit -m 'initial commit'
git -C /tmp/a tag 0.0.1 HEAD

# set up the fork
git -C /tmp/b init
git -C /tmp/b remote add -f --no-tags upstream file:///tmp/a
```

You'll see the 0.0.1 tag being fetched. You can delete it all you want, set the `remote.upstream.tagopt = --no-tags`, etc -- it will always be pulled. This is the opposite behavior I would expect based on the available documentation and discussion around the tag in the mailing list.

-- 
  Ben Denhartog
  ben@sudoforge.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: --no-tags doesn't appear to be working as intended
@ 2020-05-02 22:20 Ben Denhartog
  0 siblings, 0 replies; 4+ messages in thread
From: Ben Denhartog @ 2020-05-02 22:20 UTC (permalink / raw)
  To: ben; +Cc: git

I should note that this occurs with Git v2.26.2 on x86_64 architecture with kernel 5.6.4 -- so it doesn't appear to be due to an outdated build. I was not able to find any previous bug report in the mailing list, nor have I tested this with previous versions of Git to determine whether it is a regression or a bug that has existed since the flag was introduced. 

-- 
  Ben Denhartog
  ben@sudoforge.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: --no-tags doesn't appear to be working as intended
  2020-05-02 21:01 --no-tags doesn't appear to be working as intended Ben Denhartog
@ 2020-05-03  6:54 ` Jeff King
  2020-05-03 18:27   ` Ben Denhartog
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff King @ 2020-05-03  6:54 UTC (permalink / raw)
  To: Ben Denhartog; +Cc: git

On Sat, May 02, 2020 at 02:01:35PM -0700, Ben Denhartog wrote:

> # set up the fork
> git -C /tmp/b init
> git -C /tmp/b remote add -f --no-tags upstream file:///tmp/a
> ```
> 
> You'll see the 0.0.1 tag being fetched. You can delete it all you
> want, set the `remote.upstream.tagopt = --no-tags`, etc -- it will
> always be pulled. This is the opposite behavior I would expect based
> on the available documentation and discussion around the tag in the
> mailing list.

I don't see that behavior. I get:

  $ git -C /tmp/b remote add -f --no-tags upstream file:///tmp/a
  Updating upstream
  remote: Enumerating objects: 3, done.
  remote: Counting objects: 100% (3/3), done.
  remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
  Unpacking objects: 100% (3/3), 197 bytes | 197.00 KiB/s, done.
  From file:///tmp/a
   * [new branch]      master     -> upstream/master

Is it possible you have some other config that might be conflicting
(e.g., extra refspecs that ask to transfer tags)? What does "git config
--list --show-origin" say?

-Peff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: --no-tags doesn't appear to be working as intended
  2020-05-03  6:54 ` Jeff King
@ 2020-05-03 18:27   ` Ben Denhartog
  0 siblings, 0 replies; 4+ messages in thread
From: Ben Denhartog @ 2020-05-03 18:27 UTC (permalink / raw)
  To: Jeff King; +Cc: git

Gah, sorry for the erroneous bug report, this was user error.

This was caused by having `fetch.prunetags = true` in my user-scoped conffile. As per the documentation from `git-fetch`:

```
The --prune-tags option is equivalent to having refs/tags/*:refs/tags/* declared in the refspecs of the remote. This can lead to some seemingly strange interactions:

           # These both fetch tags
           $ git fetch --no-tags origin 'refs/tags/*:refs/tags/*'
           $ git fetch --no-tags --prune-tags origin

       The reason it doesn’t error out when provided without --prune or its config versions is for flexibility of the configured versions, and to maintain a 1=1 mapping between what the command line flags
       do, and what the configuration versions do.
```

-- 
  Ben Denhartog
  ben@sudoforge.com

On Sat, May 2, 2020, at 23:54, Jeff King wrote:
> On Sat, May 02, 2020 at 02:01:35PM -0700, Ben Denhartog wrote:
> 
> > # set up the fork
> > git -C /tmp/b init
> > git -C /tmp/b remote add -f --no-tags upstream file:///tmp/a
> > ```
> > 
> > You'll see the 0.0.1 tag being fetched. You can delete it all you
> > want, set the `remote.upstream.tagopt = --no-tags`, etc -- it will
> > always be pulled. This is the opposite behavior I would expect based
> > on the available documentation and discussion around the tag in the
> > mailing list.
> 
> I don't see that behavior. I get:
> 
>   $ git -C /tmp/b remote add -f --no-tags upstream file:///tmp/a
>   Updating upstream
>   remote: Enumerating objects: 3, done.
>   remote: Counting objects: 100% (3/3), done.
>   remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
>   Unpacking objects: 100% (3/3), 197 bytes | 197.00 KiB/s, done.
>   From file:///tmp/a
>    * [new branch]      master     -> upstream/master
> 
> Is it possible you have some other config that might be conflicting
> (e.g., extra refspecs that ask to transfer tags)? What does "git config
> --list --show-origin" say?
> 
> -Peff
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-03 18:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-02 21:01 --no-tags doesn't appear to be working as intended Ben Denhartog
2020-05-03  6:54 ` Jeff King
2020-05-03 18:27   ` Ben Denhartog
  -- strict thread matches above, loose matches on Subject: below --
2020-05-02 22:20 Ben Denhartog

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).