git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] add -p: skip conflicted paths

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 2, 2012, 18:25 UTC
Message-ID
<7v398mgfdu.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CABPQNSY8gNPZTV77AjFbHn1HA9S=fw3NC+H8bCzZOPFyLg0nHQ@mail.gmail.com>
Erik Faye-Lund <kusmabite@gmail.com> writes:
Show 11 quoted lines
> On Thu, Mar 29, 2012 at 7:45 AM, Jeff King <peff@peff.net> wrote:
>>
>> 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
Previous: Erik Faye-LundNext: Jeff King
Message 9 of 16 in “add -p: skip conflicted paths”
  1. add -p: skip conflicted pathsErik Faye-Lund, Mar 28, 2012
  2. Junio C HamanoMar 28, 2012
  3. add -p: skip conflicted pathsErik Faye-Lund, Mar 28, 2012
  4. Junio C HamanoMar 28, 2012
  5. Junio C HamanoMar 28, 2012
  6. Junio C HamanoMar 28, 2012
  7. Jeff KingMar 29, 2012
  8. Erik Faye-LundApr 2, 2012
  9. Junio C HamanoApr 2, 2012
  10. Jeff KingApr 4, 2012
  11. Tay Ray ChuanApr 4, 2012
  12. Junio C HamanoApr 4, 2012
  13. Junio C HamanoApr 4, 2012
  14. Jeff KingApr 4, 2012
  15. Junio C HamanoApr 4, 2012
  16. Jeff KingApr 5, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.