git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 4/6 (v2)] administrative functions for rev-cache, and start of integration into git

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 9, 2009, 18:36 UTC
Message-ID
<7vtz0g7s1p.fsf@alter.siamese.dyndns.org>
In-Reply-To
<op.uyb1vcvytdk399@sirnot.private>
"Nick Edelen" <sirnot@gmail.com> writes:

Note that I didn't read the entire patch, so the parts I did not comment on in this message may or may not have problematic parts.

>  - extra 'size' field added to commit, tag and blob objects, initialized in 
>    parse_* functions and cache traversal
It is unclear which "size" this field refers to without comment.

I do not know if this change is justifiable. We (mostly Linus) spent considerble effort to shrink the memory footprint of struct commit (and struct object in general) exactly because revision traversal needs to inspect tons of them.

Show 21 quoted lines
> +static unsigned int parse_size(const char *name)
> +{
> +	unsigned int size;
> +	char *p;
> +	
> +	size = strtol(name, &p, 10);
> +	switch (*p) {
> +	case 'k' : 
> +	case 'K' : 
> +		size *= 0x400;
> +		break;
> +	case 'm' : 
> +	case 'M' : 
> +		size *= 0x100000;
> +		break;
> +	default : 
> +		break;
> +	}
> +	
> +	return size;
> +}
Looks vaguely familiar.

The configuration parser already knows about these size suffixes when told to read "int". Can't that code, e.g. git_parse_ulong(), be reused here?

Show 7 quoted lines
> @@ -219,7 +221,6 @@ unsigned char *get_cache_slice(struct commit *commit)
>  		return 0;
>  	
>  	ie = search_index(commit->object.sha1);
> -	
>  	if (ie && ie->cache_index < idx_head.cache_nr)
>  		return idx_caches + ie->cache_index * 20;
"Oops, fix an earlier mistake"...
Show 5 quoted lines
> @@ -262,7 +282,6 @@ static int setup_traversal(struct cache_slice_header *head, unsigned char *map,
>  	struct commit_list *prev, *wp, **wpp;
>  	int retval;
>  	
> -	/* printf("adding %s\n", sha1_to_hex(commit->object.sha1)); */
Likewise.
Previous: Nick EdelenNext: Nick Edelen
Message 2 of 4 in “administrative functions for rev-cache, and start of integration into git”
  1. 4/6 administrative functions for rev-cache, and start of integration into gitNick Edelen, Aug 8, 2009
  2. Junio C HamanoAug 9, 2009
  3. Nick EdelenAug 11, 2009
  4. Nick EdelenAug 16, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.