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

Re: [PATCH 0/2] Fix warnings on access of a remote with Windows paths

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 23, 2017, 10:53 UTC
Message-ID
<alpine.DEB.2.21.1.1705231248150.3610@virtualbox>
In-Reply-To
<947b2453-52b6-4940-fd20-ddf350c5df4d@kdbg.org>
Hi Hannes (& Junio, see below),
On Mon, 22 May 2017, Johannes Sixt wrote:
Show 22 quoted lines
> Am 22.05.2017 um 13:59 schrieb Johannes Schindelin:
> > On Sat, 20 May 2017, Johannes Sixt wrote:
> > > This small series fixes these warnings on Windows:
> > >
> > > C:\Temp\gittest>git fetch C:\Temp\gittest
> > > warning: unable to access '.git/remotes/C:\Temp\gittest': Invalid argument
> > > warning: unable to access '.git/branches/C:\Temp\gittest': Invalid
> > > warning: argument
> > >  From C:\Temp\gittest
> > >   * branch            HEAD       -> FETCH_HEAD
> > >
> > > The fix is in the second patch; the first patch is a
> > > preparation that allows to write the fix in my preferred style.
> > 
> > Thank you!
> > 
> > Maybe you want to accompany these patches with a simple test case that
> > uses e.g. ls-remote on $(pwd | tr / \\\\)?
> 
> Actually, no, I don't want to. It would have to be protected by MINGW, and I
> don't want to burden us (and here I mean Windows folks) with a check for a
> cosmetic deficiency. (Shell scripts, slow forks, yadda, yadda...)
Actually, yes, I want to.

Yes, it would have to be protected by MINGW, and yes, it would put a burden on us, but also yes: it would put an even higher burden on me to check this manually before releasing Git for Windows, or even worse: this regression would be the kind of bug that triggers many bug reports, addressing which would take a lot more time than writing this test case and executing it as part of our test suite.

So here goes:
-- snipsnap --
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Tue, 23 May 2017 12:42:13 +0200
Subject: [PATCH] mingw: verify that paths are not mistaken for remote nicknames

This added test case simply verifies that users will not be bothered with bogus complaints à la

	warning: unable to access '.git/remotes/D:\repo': Invalid argument
when fetching from a Windows path (in this case, D:\repo).
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t5580-clone-push-unc.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/t/t5580-clone-push-unc.sh b/t/t5580-clone-push-unc.sh
index b195f71ea98..93ce99ba3c6 100755
--- a/t/t5580-clone-push-unc.sh
+++ b/t/t5580-clone-push-unc.sh
@@ -1,13 +1,19 @@
 #!/bin/sh
 
-test_description='various UNC path tests (Windows-only)'
+test_description='various Windows-only path tests'
 . ./test-lib.sh
 
 if ! test_have_prereq MINGW; then
-	skip_all='skipping UNC path tests, requires Windows'
+	skip_all='skipping Windows-only path tests'
 	test_done
 fi
 
+test_expect_success 'remote nick cannot contain backslashes' '
+	BACKSLASHED="$(pwd | tr / \\\\)" &&
+	git ls-remote "$BACKSLASHED" >out 2>err &&
+	! grep "unable to access" err
+'
+
 UNCPATH="$(pwd)"
 case "$UNCPATH" in
 [A-Z]:*)
-- 
2.13.0.windows.1
Previous: Johannes SixtNext: Johannes Sixt
Message 8 of 19 in “Fix warnings on access of a remote with Windows paths”
  1. 0/2 Fix warnings on access of a remote with Windows pathsJohannes Sixt, May 20, 2017
  2. 1/2 mingw.h: permit arguments with side effects for is_dir_sepJohannes Sixt, May 20, 2017
  3. Johannes SchindelinMay 22, 2017
  4. 2/2 Windows: do not treat a path with backslashes as a remote's nick nameJohannes Sixt, May 20, 2017
  5. Johannes SchindelinMay 22, 2017
  6. Johannes SchindelinMay 22, 2017
  7. Johannes SixtMay 22, 2017
  8. Johannes SchindelinMay 23, 2017
  9. Johannes SixtMay 23, 2017
  10. stefan.naewe@atlas-elektronik.comMay 22, 2017
  11. Johannes SchindelinMay 22, 2017
  12. Johannes SixtMay 22, 2017
  13. Johannes SchindelinMay 23, 2017
  14. Junio C HamanoMay 23, 2017
  15. Johannes SixtMay 24, 2017
  16. 2/2 Windows: do not treat a path with backslashes as a remote's nick nameJohannes Sixt, May 25, 2017
  17. Junio C HamanoMay 25, 2017
  18. 1/2 mingw.h: permit arguments with side effects for is_dir_sepJohannes Sixt, May 22, 2017
  19. 2/2 Windows: do not treat a path with backslashes as a remote's nick nameJohannes Sixt, May 22, 2017

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.