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

Re: [PATCH 2/2] git repack: keep commits hidden by a graft

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 24, 2009, 09:37 UTC
Message-ID
<alpine.DEB.1.00.0907241136081.19988@intel-tinevez-2-302>
In-Reply-To
<20090724053506.GB12855@atjola.homenet>
Hi,
On Fri, 24 Jul 2009, Björn Steinbrink wrote:
Show 22 quoted lines
> On 2009.07.23 22:13:43 -0700, Junio C Hamano wrote:
> > Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> > 
> > > diff --git a/commit.c b/commit.c
> > > index a47fb4d..ef8e911 100644
> > > --- a/commit.c
> > > +++ b/commit.c
> > > @@ -262,7 +262,7 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size)
> > >  		    bufptr[47] != '\n')
> > >  			return error("bad parents in commit %s", sha1_to_hex(item->object.sha1));
> > >  		bufptr += 48;
> > > -		if (graft)
> > > +		if (graft && (graft->nr_parent < 0 || grafts_replace_parents))
> > >  			continue;
> > 
> > Hmm, what is this "if it is negative" check for?  I did not see it
> > mentioned in the proposed commit log message.
> 
> That's for the special grafts for shallow clones. They override the 
> other grafts, and are identified by the negative nr_parent value. Those 
> have to stay in effect as the original parents aren't present in the 
> repo.
Right.  How about a comment above the if():
		/*
		 * If nr_parent is negative, the commit is shallow, and
		 * we must not traverse its real parents.
		 */
Hmm?

Ciao, Dscho

Previous: Björn SteinbrinkNext: Junio C Hamano
Message 9 of 10 in “Make git-gc more robust with regard to grafts”
  1. 0/2 Make git-gc more robust with regard to graftsJohannes Schindelin, Jul 23, 2009
  2. 1/2 Add a test showing that 'git repack' throws away grafted-away parentsJohannes Schindelin, Jul 23, 2009
  3. Björn SteinbrinkJul 23, 2009
  4. 2/2 git repack: keep commits hidden by a graftJohannes Schindelin, Jul 23, 2009
  5. Junio C HamanoJul 24, 2009
  6. Johannes SchindelinJul 24, 2009
  7. Junio C HamanoJul 24, 2009
  8. Björn SteinbrinkJul 24, 2009
  9. Johannes SchindelinJul 24, 2009
  10. Junio C HamanoJul 24, 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.