git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: fetch <repo> <branch>:<branch> fetches tags?

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
Jan 29, 2008, 03:09 UTC
Message-ID
<479E9903.9000706@nrlssc.navy.mil>
In-Reply-To
<alpine.LSU.1.00.0801290240240.23907@racer.site>
Johannes Schindelin wrote:
Show 9 quoted lines
> Hi,
> 
> On Mon, 28 Jan 2008, Brandon Casey wrote:
> 
>> Is this the intended behavior?
> 
> AFAICT yes.  Whenever you say "git fetch" without "--no-tags", it should 
> fetch those tags that reference objects that were fetched, and _only_ 
> those.

It doesn't always fetch tags only when "--no-tags" is missing. Sometimes it refrains from fetching tags even when "--no-tags" is missing.

$ mkdir test1 && cd test1 && git init && echo : > file1 && git add file1 &&
  git commit -m 'Commit1' file1 && git tag -m 'CommitTag1' tag1 && cd .. &&
  mkdir test2 && cd test2 && git init && git fetch ../test1 master &&
  git branch master FETCH_HEAD && cd ../test1 && echo -n 'Test1: ' &&
  git tag -n -l && cd ../test2 && echo -n 'Test2: ' && git tag -n -l | grep '' || echo 'NO TAGS'
Initialized empty Git repository in .git/
Created initial commit 0f701fc: Commit1
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 file1
Initialized empty Git repository in .git/
warning: no common commits
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
Test1: tag1            CommitTag1
Test2: NO TAGS
Notice the last two lines.
But, change that fetch to master:master and...
$ mkdir test1 && cd test1 && git init && echo : > file1 && git add file1 &&
  git commit -m 'Commit1' file1 && git tag -m 'CommitTag1' tag1 && cd .. &&
  mkdir test2 && cd test2 && git init && git fetch ../test1 master:master &&
  cd ../test1 && echo -n 'Test1: ' && git tag -n -l && cd ../test2 &&
  echo -n 'Test2: ' && git tag -n -l | grep '' || echo 'NO TAGS'
Initialized empty Git repository in .git/
Created initial commit d67022e: Commit1
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 file1
Initialized empty Git repository in .git/
warning: no common commits
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From ../test1
 * [new branch]      master     -> master
remote: Counting objects: 1, done.
remote: Total 1 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (1/1), done.
From ../test1
 * [new tag]         tag1       -> tag1
Test1: tag1            CommitTag1
Test2: tag1            CommitTag1
I only get the tags if I use the colon notation.
-brandon
Show 5 quoted lines
> 
> Hth,
> Dscho
> 
> P.S.: What does the Navy do with git?
Manage software of course! What a silly question.
Kidding aside. I work with oceanographers.
Previous: Johannes SchindelinNext: Junio C Hamano
Message 3 of 9 in “fetch <repo> <branch>:<branch> fetches tags?”
  1. Brandon CaseyJan 29, 2008
  2. Johannes SchindelinJan 29, 2008
  3. Brandon CaseyJan 29, 2008
  4. Junio C HamanoJan 29, 2008
  5. Shawn O. PearceJan 29, 2008
  6. Junio C HamanoJan 29, 2008
  7. Brandon CaseyJan 29, 2008
  8. Junio C HamanoJan 29, 2008
  9. Brandon CaseyJan 29, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.