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

Re: [PATCH] diff: don't attempt to strip prefix from absolute Windows paths

From
Johannes Sixt <j6t@kdbg.org>
Date
Oct 18, 2018, 19:11 UTC
Message-ID
<a9a51e28-208d-d8dd-a868-bc2f8cc79598@kdbg.org>
In-Reply-To
<CAGZ79kYChLNDB_f1KR2k7G9FvHkX7x_yXdhxMRpLFWpRR0SoPg@mail.gmail.com>
Am 18.10.18 um 20:49 schrieb Stefan Beller:
Show 7 quoted lines
> On Thu, Oct 18, 2018 at 11:38 AM Johannes Sixt <j6t@kdbg.org> wrote:
> 
>> There is one peculiarity, though: [...]
> 
> The explanation makes sense, and the code looks good.
> Do we want to have a test for this niche case?
> 

Good point. That would be the following. But give me a day or two to cross-check on Windows and whether it really catches the breakage.

diff --git a/t/t4053-diff-no-index.sh b/t/t4053-diff-no-index.sh
index 453e6c35eb..6e0dd6f9e5 100755
--- a/t/t4053-diff-no-index.sh
+++ b/t/t4053-diff-no-index.sh
@@ -127,4 +127,14 @@ test_expect_success 'diff --no-index from repo subdir respects config (implicit)
 	test_cmp expect actual.head
 '
 
+test_expect_success 'diff --no-index from repo subdir with absolute paths' '
+	cat <<-EOF >expect &&
+	1	1	$(pwd)/non/git/{a => b}
+	EOF
+	test_expect_code 1 \
+		git -C repo/sub diff --numstat \
+		"$(pwd)/non/git/a" "$(pwd)/non/git/b" >actual &&
+	test_cmp expect actual
+'
+
 test_done
Previous: Stefan BellerNext: Johannes Sixt
Message 5 of 8 in “issue: strange `git diff --numstat` behavior.”
  1. Sergey AndreenkoOct 12, 2018
  2. Junio C HamanoOct 13, 2018
  3. diff: don't attempt to strip prefix from absolute Windows pathsJohannes Sixt, Oct 18, 2018
  4. Stefan BellerOct 18, 2018
  5. Johannes SixtOct 18, 2018
  6. diff: don't attempt to strip prefix from absolute Windows pathsJohannes Sixt, Oct 19, 2018
  7. Stefan BellerOct 19, 2018
  8. Junio C HamanoOct 19, 2018

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.