Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Git status silently fails in a repository with no commits. #459

Closed
JarrahGos opened this issue Jul 3, 2017 · 6 comments
Closed

Git status silently fails in a repository with no commits. #459

JarrahGos opened this issue Jul 3, 2017 · 6 comments
Labels

Comments

@JarrahGos
Copy link

JarrahGos commented Jul 3, 2017

When running the following code on a repository with no commits but staged or untracked content status.IsClean() return true and status.String() returns an empty string. (error checking done, but excluded from example)

status, err := wt.Status()
fmt.Println(status.IsClean())

Normal git functionality is to return the following:

user@work(master|●1…)> git status                                                          
On branch master

Initial commit

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

	new file:   name.tex

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	file
	mothen
	name.pdf
	name.txt
	one.tex
	second
	tags
	three.tex
	two.tex
	unclean

user@work(master|●1…)> git l 
fatal: your current branch 'master' does not have any commits yet
user@work(master|●1…)>
@smola smola added the bug label Jul 4, 2017
@smola
Copy link
Collaborator

smola commented Jul 4, 2017

@JarrahGos Thank you for reporting this. We will look into the issue.

@ganesh-sadanala
Copy link

I am facing the same issue with Git Bash

Today i have initialized git using git init
and checked status using git status

It is showing No commits yet instead of Initial commit

@smola
Copy link
Collaborator

smola commented Mar 20, 2019

@ganesh-sadanala That's git expected behavior. git init does not create any commit. Anyway, this repository is about go-git, not git itself.

@surabhi24
Copy link

I am facing the same issue with Git Bash

Today i have initialized git using git init
and checked status using git status

It is showing No commits yet instead of Initial commit

I am facing this issue too.

@aimei26
Copy link

aimei26 commented Aug 18, 2019

after add comment I face some issue just now
do the following:

  1. git commit -m"First commit"
  2. git log

@shravari
Copy link

shravari commented Nov 1, 2019

even i am facing this issue what is to be done?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants