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

Re: [PATCH] mergetool: don't skip modify/remove conflicts

From
Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Date
Feb 11, 2011, 02:46 UTC
Message-ID
<alpine.DEB.2.00.1102102130040.29809@debian>
In-Reply-To
<7vzkq4opaw.fsf@alter.siamese.dyndns.org>
On Wed, 9 Feb 2011, Junio C Hamano wrote:
Show 6 quoted lines
> Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> writes:
> 
> > +extern void *RERERE_UTIL_STAGED;
> 
> This is for what kind?  The contents on the filesystem is ready to go,
> added to the index, but still in MERGE_RR (i.e. "git rerere" not run yet)?
Correct.
> Is the real problem that git-mergetool is not running rerere when it
> should, I wonder...

You mean that maybe it should call rerere for files that are added to the index?

Show 8 quoted lines
> >  		it = string_list_insert(conflict, (const char *)e->name);
> > -		it->util = NULL;
> > +		it->util = RERERE_UTIL_PUNTED;
> >  		if (ce_stage(e) == 1) {
> > +			it->util = RERERE_UTIL_STAGED;
> 
> Hmm, I thought that you were taling about paths that the user
> hand-resolved and then ran "git add" on.  Why is this marked "STAGED"?
Very good question. It shouldn't.
> Either your logic is wrong, or the name of the symbol is.

The former. What I really wanted to check is if the file has been added to the index. I am currently struggling with how to do this correctly. My inexperience with the git internals makes it a very slow process with a lot of guesses and trial and error.

Show 9 quoted lines
> > -		if (!conflict.items[i].util)
> > -			continue; /* punted */
> > +		if (conflict.items[i].util == RERERE_UTIL_PUNTED ||
> > +			conflict.items[i].util == RERERE_UTIL_STAGED)
> > +			continue;
> 
> There are a few repetition of "if it is marked with PUNTED or STAGED"; can
> you make it into a small helper function and give it a _meaningful_ name?
> What does it mean for an entry to be marked with either of these marks?

There is another big problem here. I had not realized that the util field would be freed later (being spoilt by GCing languages, I guess) and that will of course fail if it is one of the two constants I defined. I stupidly did not run the commands manually, but relied only on the test cases, so I didn't notice the segfault at the end. Somehow all the test cases still pass.

I think this means that anyone intending to run rerere should not build pu at the moment, right? I'm really sorry about the inconvenience :-(.

/Martin
Previous: Junio C HamanoNext: Martin von Zweigbergk
Message 3 of 13 in “mergetool: don't skip modify/remove conflicts”
  1. mergetool: don't skip modify/remove conflictsMartin von Zweigbergk, Feb 8, 2011
  2. Junio C HamanoFeb 9, 2011
  3. Martin von ZweigbergkFeb 11, 2011
  4. 0/2 mergetool: don't skip modify/remove conflictsMartin von Zweigbergk, Feb 13, 2011
  5. 1/2 mergetool: don't skip modify/remove conflictsMartin von Zweigbergk, Feb 13, 2011
  6. Junio C HamanoFeb 15, 2011
  7. Martin von ZweigbergkFeb 15, 2011
  8. Junio C HamanoFeb 15, 2011
  9. 0/2 mergetool: don't skip modify/remove conflictsMartin von Zweigbergk, Feb 16, 2011
  10. 1/2 rerere "remaining"Martin von Zweigbergk, Feb 16, 2011
  11. Junio C HamanoFeb 16, 2011
  12. 2/2 mergetool: don't skip modify/remove conflictsMartin von Zweigbergk, Feb 16, 2011
  13. 2/2 rerere: factor out common conflict search codeMartin von Zweigbergk, Feb 13, 2011

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.