tig
tig copied to clipboard
tig not starting in a valid git repository with no commits
tig (even the current version from git) is not working in a repository without commits, even though it could show what is staged for commit, which would be useful.
$ git init Initialized empty Git repository in /home/proski/src/tig-test/.git/ $ echo staged >file1 $ git add file1 $ echo unstaged >file2 $ tig tig: No revisions match the given arguments.
There are no arguments, so the error message is misleading.
+1. I guess you could directly start in status view with tig status
As @netei points out tig status is the only command that works in such situation.
I like the idea of redirecting to tig status but it might also be considered somewhat confusing.
git log says fatal: bad default revision 'HEAD'. Is that better?
I expect tig to work just like it works in repositories with revisions. It can show staged changes. It can show unstaged changes to the added files.
It may look like a pathological case from the coding standpoint, but it's not a pathological case for a developer. I create a repository, write code and then I want to use my usual tool to double check what I'm committing. And the tool is suddenly unhappy.
I understand that and my question was mainly to understand how tig should
behave. Running tig in a repository without any revisions does not make
sense when tig is defined in terms of git-log, so it might be just a
case of detecting this and either switch to status view or error our with a
message saying No commit log, did you mean to run 'tig status'?.
On Mon, Oct 12, 2015 at 12:08 AM, Pavel Roskin [email protected] wrote:
I expect tig to work just like it works in repositories with revisions. It can show staged changes. It can show unstaged changes to the added files.
It may look like a pathological case from the coding standpoint, but it's not a pathological case for a developer. I create a repository, write code and then I want to use my usual tool to double check what I'm committing. And the tool is suddenly unhappy.
— Reply to this email directly or view it on GitHub https://github.com/jonas/tig/issues/445#issuecomment-147288544.
Jonas Fonseca
Printing No commit log, did you mean to run 'tig status'? when it is a git repository without commits is what makes most sense.
Putting you to status view automagically could be misleading (eg, a beginner asking : why don't I have this status view any more when running plain tig after doing a commit ?)
I agree. tig would actually educate its users, which is good.
Why not simply start as usual and simply show a "no commits yet" message in place of the usual commit log. I see no reason why it should refuse to launch.
Huh I actually had no idea you could use tig status to work around this issue - that's the view I wanted to get to anyway. +1 for redirecting to it, +1 also for showing a placeholder "no commits yet" in the log, -1 to just hard failing and returning 1.