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

[PATCH 1/2] test-path-utils.c: remove incorrect assumption

From
Ray Donnelly <mingw.android@gmail.com>
Date
Oct 3, 2015, 12:44 UTC
Message-ID
<CAOYw7dubGJ=m5+EnjGy7jTQxR+b0uBmyG138KEQ5rzX2K7WcgA@mail.gmail.com>

In normalize_ceiling_entry(), we test that normalized paths end with slash, *unless* the path to be normalized was already the root directory.

However, normalize_path_copy() does not even enforce this condition.

Even worse: on Windows, the root directory gets translated into a Windows directory by the Bash before being passed to `git.exe` (or `test-path-utils.exe`), which means that we cannot even know whether the path that was passed to us was the root directory to begin with.

This issue has already caused endless hours of trying to "fix" the MSYS2 runtime, only to break other things due to MSYS2 ensuring that the converted path maintains the same state as the input path with respect to any final '/'.

So let's just forget about this test. It is non-essential to Git's operation, anyway.

Ack-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Ray Donnelly <mingw.android@gmail.com>
---
 test-path-utils.c | 2 --
 1 file changed, 2 deletions(-)
diff --git a/test-path-utils.c b/test-path-utils.c
index 3dd3744..c67bf65 100644
--- a/test-path-utils.c
+++ b/test-path-utils.c
@@ -21,8 +21,6 @@ static int normalize_ceiling_entry(struct
string_list_item *item, void *unused)
  if (normalize_path_copy(buf, ceil) < 0)
  die("Path \"%s\" could not be normalized", ceil);
  len = strlen(buf);
- if (len > 1 && buf[len-1] == '/')
- die("Normalized path \"%s\" ended with slash", buf);
  free(item->string);
  item->string = xstrdup(buf);
  return 1;
-- 
2.5.2
Next: Ray Donnelly
Message 1 of 9 in “test-path-utils.c: remove incorrect assumption”
  1. 1/2 test-path-utils.c: remove incorrect assumptionRay Donnelly, Oct 3, 2015
  2. Ray DonnellyOct 3, 2015
  3. Junio C HamanoOct 3, 2015
  4. Ray DonnellyOct 4, 2015
  5. Junio C HamanoOct 4, 2015
  6. Ray DonnellyOct 4, 2015
  7. Ray DonnellyOct 8, 2015
  8. Junio C HamanoOct 9, 2015
  9. Ray DonnellyOct 9, 2015

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.