Changes indicated when no commits in repo
As the title says. When I do a clustergit -v at the root of a number of repos, I get given a red "Changes" notice when, actually, no commits have yet been made to that repo. Great tool. Saves me so much effort. Thanks very much.
You are welcome! What is the output for git status in one of the affected directories?
I opened #44 to fix it.
Now I understand. A freshly init'ed repo with no commits whatsover. Nice corner case ;) I will look into merging this.
Here's a repro in Bash on Linux:
$ cd "$(mktemp --dir)"
$ git init empty
Initialized empty Git repository in /tmp/tmp.e8yuxWRRW2/empty/.git/
$ clustergit
Scanning sub directories of .
./empty : Changes
Done
It would be great for clustergit to show a distinct status in this case such as "Empty".
As it is, I don't know how to distinguish empty repos from those that really have changes to be pushed.
I use a daily script to loop to push all my changes at the end of a working session. It loops through the clustergit output. The empty repos create some noise and confusion for me every time I run the script.
Why do I have empty repos in the first place? Because I have another script that clones all the repos on my team's git server. I don't control who can create an empty repo or not. I could modify the sync script to ignore the empty repos, but I'd rather not.
@iainelder Does #44 work for you?
@ypid , Here's what I get when I use your solution (I've omitted output of all but the final command):
$ cd "$(mktemp --dir)"
$ git clone https://github.com/ypid/clustergit.git
$ git -C clustergit/ checkout fix/no-commits-yet
$ git init empty
$ ./clustergit/clustergit
Scanning sub directories of ['.']
./clustergit : On branch fix/no-commits-yet, No Changes
./empty : Clean
Done
This time it shows a "Clean" status for the empty repo.
My sync script passes over repos that show a "Clean" status. For my use case then, this would be good enough.
I've started using @ypid's patch in my daily workflow.
@mnagel , is there anything else missing to get this merged?
Thanks @mnagel! I'll try your merged version soon and report back.
Works great for me. Thanks.