{ coreutils, git, writeDashBin }: writeDashBin "git-preview" '' set -efu # Checked here: merge-tree fails with exit status 1 for a name it can't # resolve, too, which would pass for a conflict below. merge_commit=$(${git}/bin/git rev-parse --verify "$1^{commit}"); shift # Merges in the object store, without a worktree: exit status 1 means # conflicts, which the tree then holds as conflict markers. output=$(${git}/bin/git merge-tree --write-tree HEAD "$merge_commit") || { status=$? test "$status" = 1 || exit "$status" } tree=$(printf '%s\n' "$output" | ${coreutils}/bin/head -n 1) ${git}/bin/git diff HEAD "$tree" "$@" ''