[00:46] <cjwatson> wgrant,blr: we're definitely going to need some pygit2 backports sooner rather than later - even disregarding merge_trees, conflicts handling in 0.22.0 is unusably bad for our purposes (you can find out that there was a conflict in a merge and which files it touched, but you can't get a merged version with conflict markers).  I'm going to sort out some backports, as the patches we need look fairly self-contained
[00:47] <cjwatson> (why yes, I'm trying to put together the LP side of preview diffs because I can't sleep, why do you ask)
[02:09] <blr> cjwatson: oh dear, hope you're not up all night!
[02:11] <cjwatson> meh ...
[02:16]  * cjwatson blinks at https://launchpad.net/~cjwatson/+archive/ubuntu/launchpad/+build/7350071.  How is that architecture-specific in scalingstack?
[03:30] <cjwatson> https://github.com/libgit2/pygit2/pull/520 should fix the above, cherry-picking that
[04:21] <blr> cjwatson: huh, in what instances were you seeing garbage in the diff?
[08:48] <wgrant> cjwatson: Hum, I guess I was looking at master rather than 0.22.0 when I thought the conflict handling looked OK.
[09:42] <cjwatson> blr: nothing we were using yet, but when trying to improve the conflict handling using merge_file_from_index, we ended up with garbage in place of the path in the conflict marker sometimes, because it wasn't holding onto a reference to that memory
[09:43] <cjwatson> wgrant: right, it's fiddly but I do now have a workable algorithm which I'll implement on Friday when actually working
[09:45] <cjwatson> basically walk over index.conflicts and do blob_oid = repo.create_blob(repo.merge_file_from_index(*conflict)); index.add(IndexEntry(path, blob_oid, GIT_FILEMODE_BLOB)); conflicts.remove(path)
[09:45] <cjwatson> and keep a note of the conflicted paths and return them separately
[09:46] <wgrant> cjwatson: What was in the merged tree in case of conflicts?
[09:47] <cjwatson> wgrant: do you mean in diff_from_tree().patch?
[09:48] <wgrant> cjwatson: yeah
[09:48] <cjwatson> wgrant: a patch removing the conflicted file
[09:48] <cjwatson> super-useful
[09:48] <wgrant> ... oh
[09:49] <wgrant> That's totally not what favor says it does.
[09:49] <cjwatson> it soooooooort of makes sense internally
[09:49] <cjwatson> in a very skewed way
[09:52] <cjwatson> but yeah, I noticed when I tried to write a test and observed that it made NO SENSE
[09:52] <cjwatson> (when adding info about conflicts to the compare-merge return value so that previewdiff can use them)
[09:53] <cjwatson> wgrant: the cherry-picks for this plus merge_tree are in the LP PPA now, anyway.
[09:55] <wgrant> Lovely, thanks.