Is this the intended behavior?
I'm pretty sure this was discussed recently on the list.
My understanding was that tags would only be fetched
automatically if a remote tracking branch was configured.
$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
I expect these to fetch tags automatically (and they do):
git fetch
git pull
git fetch <repo>
git pull <repo>
I expect these to _not_ fetch tags (and they don't):
git fetch <repo> <branch>
git pull <repo> <branch>
But, I did not expect these to fetch tags:
git fetch <repo> <branch>:<branch>
git pull <repo> <branch>:<branch>
The association I am making here is between manually specifying
the repo and branch implying "don't automatically fetch tags",
and fetch/pull automatically determining the branch (and repo)
implying "automatically fetch tags".
There is nothing automatic about that last form of fetch.
I know there is --no-tags, and I know I can do
git fetch <repo> <branch>
git branch <branch> FETCH_HEAD
But neither are what I expected to have to do. So I guess the
colon notation implies remote tracking? I'm not sure I want
the tags by default when I call fetch this way. In this
instance I definitely did not want them.
-brandon
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.
Hth,
Dscho
P.S.: What does the Navy do with git?
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.