For cases of PR merge conflicts I would like to capture the contents of conflicted files, including the conflict markers. I am able to perform a merge with WorkTree APIs to put the worktree into a merging state and add conflict markers to files. However, I can’t find a way to capture the contents of these conflicted files.
Since the WorkTree APIs don’t provide the location of the worktree, there seems to be no way to use Java IO to access the files. Also, I don’t seem to be able to use ContentService methods to access the contents of the conflicted files since they are not in the repository.
With the new WorkTree APIs, how can I capture the contents of a file in the worktree?