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!