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

[PATCH 0/2] fix t3010 failure when core.ignorecase=true

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Aug 23, 2013, 04:29 UTC
Message-ID
<1377232155-7300-1-git-send-email-sunshine@sunshineco.com>

This series fixes a bug in dir.c which causes t3010 to fail [1] when core.ignorecase is true. The problem is that directory_exists_in_index(dirname,len) and directory_exists_in_index_icase() behave differently if dirname[len] is not a '/', even though this is beyond end-of-string. 2eac2a4cc4bdc8d7 (ls-files -k: a directory only can be killed if the index has a non-directory; 2013-08-15) adds a caller which neglects to ensure that the the required '/' is present, hence the failure.

I am not happy with the fix, which is too add a '/' after the last character in dirname just at the call site introduced by 2eac2a4cc4bdc8d7.

The reason for my unhappiness is that directory_exists_in_index_icase() makes the assumption, not only that it can access the character beyond the end-of-string, but also that that character will unconditionally be '/'. I presume that this was done for the sake of speed (existing callers always had a '/' beyond end-of-string), but it feels like an ugly wart. Since the required trailing '/' is purely an implementation detail of directory_exists_in_index_icase(), and not of directory_exists_in_index(), a cleaner fix would be for directory_exists_in_index_icase() to add the '/' it needs, and not expect the passed in dirname to have a '/' after its last character. Unfortunately, such a fix would probably negate any optimization benefit gained by the present implementation.

[1]: http://thread.gmane.org/gmane.comp.version-control.git/232727
Eric Sunshine (2):
  t3103: demonstrate dir.c:treat_one_path() core.ignorecase failure
  dir: test_one_path: fix inconsistent behavior due to missing '/'
 dir.c                   | 12 +++++++++---
 t/t3103-ls-tree-misc.sh | 15 +++++++++++++++
 2 files changed, 24 insertions(+), 3 deletions(-)
-- 
1.8.4.rc4.529.g78818d7
Next: Eric Sunshine
Message 1 of 7 in “fix t3010 failure when core.ignorecase=true”
  1. 0/2 fix t3010 failure when core.ignorecase=trueEric Sunshine, Aug 23, 2013
  2. 1/2 t3103: demonstrate dir.c:treat_one_path() core.ignorecase failureEric Sunshine, Aug 23, 2013
  3. Junio C HamanoAug 23, 2013
  4. 2/2 dir: test_one_path: fix inconsistent behavior due to missing '/'Eric Sunshine, Aug 23, 2013
  5. Jonathan NiederAug 25, 2013
  6. Eric SunshineAug 25, 2013
  7. Junio C HamanoAug 26, 2013

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.