Git for Windows "No tag files" Response from the "Git diff" command

Git version: 2.14.2.2

Whenever I run git diff in the repository, the answer is No tags file . I tried to run the command on several repositories, on several consoles (Cmd, PowerShell, MINGW64, Visual Studio Command Prompt), and they all have the same answer.

No tag files

Oddly, the git log command also fails. However, many other commands work, for example, git status , git pull , etc. It seems to be only log and diff .

Working teams

I completely uninstalled Git and reinstalled. Rebooted my system. I tried to refer directly to git.exe (which gives exactly the same answer). Nothing works, and I have not seen this error anywhere. I compared my custom configs to the settings of my colleague, and they are identical.

Some of the command is executed properly, because if I put two commit hashes and I intentionally break one, the answer I get is the following:

Bad answer

It seems like another program might capture the git diff . I believe in this because I'm not sure that โ€œNo tag filesโ€ is even a possible Git answer. Not sure what else will be.

To make things even more confusing - my ultimate goal is to run git diff in the msbuild context, and it is RUNNING CORRECTLY. Now I can be happy with this, but I need to change the diff command a bit, and each time the complete build is inefficient and not easy to fix. Inside the build script, there is a task that runs the Exec command, and it has no problems running diff . I can also do the Diff Against Current in SourceTree, which, as far as I know, runs git diff behind the scenes.

Any help would be greatly appreciated.

:: Editing ::

Various teams:

 git diff HEAD~1 HEAD git diff master~1 master git diff <commit-hash-1> <commit-hash-2> git log HEAD~1..HEAD git log master~1..master git log <commit-hash-1>..<commit-hash-2> 

Output:

Each of the above commands returns the same No tags file response in all my repositories.

Cat head:

 cd .git cat HEAD ls -R refs 

Output:

Cathead

New repo:

 mkdir testrepo cd testrepo git init echo "file1" > file1.txt git add . git commit -m "initial commit of file1.txt" echo "Hi there!" > file2.txt git add . git commit -m "added file2.txt" git log git diff HEAD~1 HEAD 

Output:

Newrepo

Git config -e:

gitconfige

Git config --global -e:

gitconfigglobale

:: Editing 2 ::

I removed all my tools for managing various / source files (SourceTree, Git, SVN, WinMerge, KDiff). The portable version of Git is installed. Opened CMD for the repo, placed the full path to the portable device Git.exe and still returned No tags file answer.

I also looked at all my path variables for: Git, vim, ming, mintty and everything else that seemed suspicious, but could not find.

I rebooted after completing all the steps, but the problem remains.

:: Editing 3 ::

I have another user on my laptop, switched to this user, and git diff working correctly, so it is clear that my main user is facing a conflict. Will continue to look for problems in my User directory.

+5
source share
2 answers

Here are the steps that I will take in this situation:

  • Try the following and check the answer:

     git diff HEAD~1 HEAD git diff master~1 master git diff <commit-hash-1> <commit-hash-2> 
  • Try the same with the log:

     git log HEAD~1..HEAD git log master~1..master git log <commit-hash-1>..<commit-hash-2> 

    I actually guess that your refs are confused, which means that direct hashes can work, but HEAD and / or master cannot be.

  • Check out the .git/refs folder

    In the main repo folder:

     cd .git cat HEAD ls -R refs 

    Hopefully HEAD points to a branch, and if master output, cat HEAD output should look like this:

     ref: refs/heads/master 

    Then, in the ls -R refs , the heads folder should be displayed with the files for each of your local branches (i.e. master and possibly others). You probably also have the refs/remotes and refs/tags directories.

    If any of these things are radically different or missing, this might be your problem ...

  • Since you reinstalled git, create a new repo and try the same commands:

     mkdir testrepo cd testrepo git init echo "file1" > file1.txt git add . git commit -m "initial commit of file1.txt" echo "Hi there!" > file2.txt git add . git commit -m "added file2.txt" git log git diff HEAD~1 HEAD 

    If this last one works, then git most likely works fine, but some kind of tool do you have messing things up.

  • Send your config from git config -e and git config --global -e - maybe we can see something?

+3
source

When you send the "No tag files" error message, the first results that I all talk about are vi .

I donโ€™t understand why git will try to execute vi when running git diff or git log , maybe your system is configured to use vi as a pager?

 # some possible places which could influence that : echo $PAGER echo $GIT_PAGER git config --get core.pager 

When copying the documentation for less I found that less can use the ctags file to define "a file containing this tag."

So, you can also see a list of variables that affect the behavior of less :

 # from bash : # env will list all the defined environment variables env # the ones that impact 'less' should contain "LESS" in their names : env | grep LESS 
+3
source

Source: https://habr.com/ru/post/1272413/


All Articles