Thread (3 messages) flat view 3 messages, 2 authors, 2016-06-15

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

From: Brandon Casey <hidden>
Date: 2016-06-15 22:44:08

Johannes Schindelin wrote:
Hi,

On Mon, 28 Jan 2008, Brandon Casey wrote:
quoted
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

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help