clustergit icon indicating copy to clipboard operation
clustergit copied to clipboard

Changes indicated when no commits in repo

Open skcole67 opened this issue 4 years ago • 3 comments

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.

skcole67 avatar Jan 13 '22 19:01 skcole67

You are welcome! What is the output for git status in one of the affected directories?

mnagel avatar Jan 16 '22 20:01 mnagel

I opened #44 to fix it.

ypid avatar Mar 01 '22 23:03 ypid

Now I understand. A freshly init'ed repo with no commits whatsover. Nice corner case ;) I will look into merging this.

mnagel avatar Mar 07 '22 20:03 mnagel

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 avatar Nov 16 '22 14:11 iainelder

@iainelder Does #44 work for you?

ypid avatar Nov 16 '22 15:11 ypid

@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.

iainelder avatar Nov 16 '22 16:11 iainelder

I've started using @ypid's patch in my daily workflow.

@mnagel , is there anything else missing to get this merged?

iainelder avatar Feb 13 '23 17:02 iainelder

Thanks @mnagel! I'll try your merged version soon and report back.

iainelder avatar Mar 09 '23 15:03 iainelder

Works great for me. Thanks.

iainelder avatar Mar 14 '23 09:03 iainelder