Erik Faye-Lund [off-list ref] writes:
On Thu, Mar 29, 2012 at 7:45 AM, Jeff King [off-list ref] wrote:
quoted
I like that we are down to a single ls-files invocation here. But can't
we determine from the diff-files output whether an entry is unmerged. In
my simple tests, I see that --numstat will show two lines for such an
entry. Is that reliable?
Nice. I've observed the same thing (although I've seen three entries,
not two). I don't know about the reliability, but I think it kind of
makes sense; one entry for both parents, and one for the unmerged
working-copy version.
Should I be dissappointed, or should I be happy for seeing "division of
labor" working?
By default "diff-files" compares stage #2 with the working tree files, and
at the same time shows an unmerged record. When there is no stage #2
entry, you will only see the unmerged record.
Notice that 1_3 is shown only once in the --numstat part of the output if
you run the script attached at the end.
I think the easiest thing to get the right information is to add --raw to
get the raw entries and read the status letters off of them.
-- >8 --
#!/bin/sh
mkdir -p /tmp/xprm && mkdir /tmp/xprm/stages && cd /tmp/xprm/stages || exit
git init
for i in 1 2 3
do
echo "$i" | git hash-object -w --stdin
done
git update-index --index-info <<EOF
100644 d00491fd7e5bb6fa28c517a0bb32b8b506539d4d 1 123
100644 0cfbf08886fca9a91cb753ec8734c84fcbe52c9f 2 123
100644 00750edc07d6415dcc07ae0351e9397b0222b7ba 3 123
100644 d00491fd7e5bb6fa28c517a0bb32b8b506539d4d 1 12_
100644 0cfbf08886fca9a91cb753ec8734c84fcbe52c9f 2 12_
100644 d00491fd7e5bb6fa28c517a0bb32b8b506539d4d 1 1_3
100644 00750edc07d6415dcc07ae0351e9397b0222b7ba 3 1_3
100644 0cfbf08886fca9a91cb753ec8734c84fcbe52c9f 2 _23
100644 00750edc07d6415dcc07ae0351e9397b0222b7ba 3 _23
EOF
git diff-files --numstat --summary --raw --abbrev=4