Skip to contentSkip to conversation

git-count-objects --all support

PATCH In review Petr Baudis 2 participants 5 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-count-objects --all support

Having command called "git-count-objects" count only unpacked objects is a little strange and confusing. This patch adds a warning if packs are already present in the current repository, an --unpacked argument to suppress the warning, and an --all argument to count even packed objects (useful at least for statistics).

---

 Documentation/git-count-objects.txt |    9 ++++----
 git-count-objects.sh                |   41 ++++++++++++++++++++++++++++++++---
 2 files changed, 42 insertions(+), 8 deletions(-)
Documentation/git-count-objects.txt +5 -4
index 36888d9..105721b 100644
@@ -3,16 +3,17 @@ git-count-objects(1)
 
 NAME
 ----
-git-count-objects - Reports on unpacked objects.
+git-count-objects - Reports on objects count.
 
 SYNOPSIS
 --------
-'git-count-objects'
+'git-count-objects' [--unpacked | --all]
 
 DESCRIPTION
 -----------
-This counts the number of unpacked object files and disk space consumed by
-them, to help you decide when it is a good time to repack.
+This counts the number of objects and disk space consumed by them.
+It by default counts only unpacked objects in order to help you decide
+when it is a good time to repack.
 
 Author
 ------
git-count-objects.sh +37 -4

56 lines not on this page · raw message

#1 lore raw
Quoted 3 lines · Petr Baudis

Having command called "git-count-objects" count only unpacked objects is a little strange and confusing. This patch adds a warning if packs are already present in the current repository,

The point of counting objects is to see if it is time to repack, so the warning is something I am quite hesitant to accept, even with a suppression option. The other way around is probably OK ("please warn me if I have packs"), but feels somewhat pointless.

The --all option might be a welcome addition, though.

#2 lore raw

Dear diary, on Sun, Jan 22, 2006 at 03:49:40AM CET, I got a letter where Junio C Hamano <[email protected]> said that...

Quoted 9 lines
Quoted 3 lines · Petr Baudis

Having command called "git-count-objects" count only unpacked objects is a little strange and confusing. This patch adds a warning if packs are already present in the current repository,

The point of counting objects is to see if it is time to repack, so the warning is something I am quite hesitant to accept, even with a suppression option.

Then please change the command name - it is very confusing this way; I've been "burnt" (well, no big deal but wrong numbers, but anyway...) multiple times and I know others who were as well.

Signature · 5 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Of the 3 great composers Mozart tells us what it's like to be human,
Beethoven tells us what it's like to be Beethoven and Bach tells us
what it's like to be the universe.  -- Douglas Adams
#3 lore raw
Quoted 5 lines · Petr Baudis
Quoted 3 lines

The point of counting objects is to see if it is time to repack, so the warning is something I am quite hesitant to accept, even with a suppression option.

Then please change the command name - it is very confusing this way;

True. count-loose-objects would have been a good name, if it were named that way from the beginning.

#4 lore raw
In reply to Junio C Hamano
Quoted 6 lines · Junio C Hamano

The point of counting objects is to see if it is time to repack, so the warning is something I am quite hesitant to accept, even with a suppression option. The other way around is probably OK ("please warn me if I have packs"), but feels somewhat pointless.

The --all option might be a welcome addition, though.

I think your patch counts the same object twice if it is packed in more than one packs and/or it has a loose copy _and_ also in a pack. If it is a good thing or not is totally up to the reason why we are counting.

We might be better off if we did this kind of additions by building on fsck-objects. For example, you could give a --stat option that might say something like this:

	$ git fsck-objects --full --stat
        commit	 2488
        tree    43343
        blob   212234
        total  258065
	packed 184382
	loose   78115
        dups     4432

where "dups" is number of duplicated copies --- an object packed in more than two packs, or appearing in a pack and also having a loose copy. I dunno.