Bug 29739 - tig is fooled by .git/.git/refs/ (via "git-ls-remote .git")
Summary: tig is fooled by .git/.git/refs/ (via "git-ls-remote .git")
Status: NEW
Alias: None
Product: Sisyphus
Classification: Development
Component: tig (show other bugs)
Version: unstable
Hardware: all Linux
: P3 normal
Assignee: Vitaly Chikunov
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-18 02:20 MSK by Ivan Zakharyaschev
Modified: 2014-01-18 02:20 MSK (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Zakharyaschev 2014-01-18 02:20:17 MSK
tig-1.1-alt1
git-1.8.4.4-alt1

Whenever there is .git/.git/ (quite an extra-ordinary case of a second repo inside .git/), tig marks the displayed commits with .git/.git/refs/* rather than with .git/refs/* .

Normal operation:

$ mkdir main
$ cd main
[imz@localhost main]$ git init
...
[imz@localhost main]$ echo a > a
[imz@localhost main]$ git add a
[imz@localhost main]$ git commit -m A.
[master (root-commit) 711df42] A.
 1 file changed, 1 insertion(+)
 create mode 100644 a
[imz@localhost main]$ git tag good
[imz@localhost main]$ tig # displays tag good (q to quit)
[imz@localhost main]$ 

Continue with the error:

[imz@localhost main]$ pushd .git
[imz@localhost .git]$ git init
...
[imz@localhost .git]$ git remote add origin ..
[imz@localhost .git]$ git fetch origin master --no-tags 
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From ..
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
[imz@localhost .git]$ git tag BAD origin/master 
[imz@localhost .git]$ popd
...
[imz@localhost main]$ tig # displays tag BAD, branch origin/master (and no GOOD and master)
[imz@localhost main]$ 

The explanation:

It is fooled together with "git ls-remote":

[imz@localhost main]$ TIG_TRACE=log-bad tig
[imz@localhost main]$ cat log-bad 
git rev-parse --git-dir --is-inside-work-tree --show-cdup --show-prefix 
git config --list 
git symbolic-ref HEAD 
git ls-remote .git 
git log --encoding=UTF-8 --no-color --pretty=raw --parents -- 
[imz@localhost main]$ bash -x < log-bad 
+ '[' -r /etc/bashrc ']'
+ . /etc/bashrc
++ '[' -z hxB ']'
+ git rev-parse --git-dir --is-inside-work-tree --show-cdup --show-prefix
.git
true


+ git config --list
user.email=imz@altlinux.org
user.name=Ivan Zakharyaschev
shortcut-scripts.as-remote=@vaio
gui.recentrepo=/home/imz/tmp/git-demo/my-project
core.excludesfile=/home/imz/ETC/gitignore
push.default=matching
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
+ git symbolic-ref HEAD
refs/heads/master
+ git ls-remote .git
711df42bf6f098bab312a212c59a572771093b9f	refs/remotes/origin/master
711df42bf6f098bab312a212c59a572771093b9f	refs/tags/BAD
+ git log --encoding=UTF-8 --no-color --pretty=raw --parents --
[imz@localhost main]$ 

When there is no .git/.git, "git ls-remote .git" gives another output:

[imz@localhost main]$ TIG_TRACE=log-good tig
[imz@localhost main]$ cat log-good 
git rev-parse --git-dir --is-inside-work-tree --show-cdup --show-prefix 
git config --list 
git symbolic-ref HEAD 
git ls-remote .git 
git log --encoding=UTF-8 --no-color --pretty=raw --parents -- 
git update-index -q --unmerged --refresh 
git diff-files --quiet 
git diff-index --quiet --diff-filter=ACDMRTXB -M --cached HEAD 
[imz@localhost main]$ bash -x < log-bad 
+ '[' -r /etc/bashrc ']'
+ . /etc/bashrc
++ '[' -z hxB ']'
+ git rev-parse --git-dir --is-inside-work-tree --show-cdup --show-prefix
.git
true


+ git config --list
user.email=imz@altlinux.org
user.name=Ivan Zakharyaschev
shortcut-scripts.as-remote=@vaio
gui.recentrepo=/home/imz/tmp/git-demo/my-project
core.excludesfile=/home/imz/ETC/gitignore
push.default=matching
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
+ git symbolic-ref HEAD
refs/heads/master
+ git ls-remote .git
711df42bf6f098bab312a212c59a572771093b9f	HEAD
711df42bf6f098bab312a212c59a572771093b9f	refs/heads/master
711df42bf6f098bab312a212c59a572771093b9f	refs/tags/good
+ git log --encoding=UTF-8 --no-color --pretty=raw --parents --
[imz@localhost main]$