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

Re: Distinguishing trivial and non-trivial merge commits

From
Eli Barzilay <eli@barzilay.org>
Date
May 2, 2010, 19:32 UTC
Message-ID
<19421.54064.178345.489772@winooski.ccs.neu.edu>
In-Reply-To
<20100502181854.GC16051@progeny.tock>
On May  2, Jonathan Nieder wrote:
Show 5 quoted lines
> Maybe --name-only or --name-status can help.
> 
> Note that most conflicts will not show up here: if the merge result
> matches either parent, then git diff --cc and friends will not
> consider it interesting at all.

Isn't that a good definition of a trivial commit? I'm not talking about the whole commit -- just any file that is not identical to one of its parents.

Show 7 quoted lines
> A command to list conflicts and their resolutions would be expensive
> but valuable, I think.  A naïve implementation would involve redoing
> the merge.
> [...]
> A “merge diffstat” sounds like an interesting idea, but the detailed
> semantics are not obvious to me (maybe separate counts for
> nontrivial added and removed lines from each parent?).

OK, thanks for clarifying that. For my purpose, I basically just want to know whether there was manual tweaking involved in the merge. (For my thing I don't even need to see those changes, since I show the overall push diff only.) What I ended up doing is pretty bad:

  git show --pretty=short --name-only "$r" | grep -q '^Merge: '
    --> test if it's a merge commit
  git show --pretty=format:"" --name-only "$r" | grep -q "."
    --> test if it's trivial
  git show --pretty=format:"" "$r" | diffstat -p1
    --> get the diffstated output

(My script generally "compensates" for git being fast by running a ton of them for each email...)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!
Previous: Jonathan NiederNext: Jakub Narebski
Message 3 of 8 in “Distinguishing trivial and non-trivial merge commits”
  1. Eli BarzilayApr 30, 2010
  2. Jonathan NiederMay 2, 2010
  3. Eli BarzilayMay 2, 2010
  4. Jakub NarebskiMay 2, 2010
  5. Eli BarzilayMay 2, 2010
  6. Junio C HamanoMay 2, 2010
  7. Eli BarzilayMay 2, 2010
  8. Jonathan NiederMay 2, 2010

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.