git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] fix t3010 failure when core.ignorecase=true
@ 2013-08-23  4:29 Eric Sunshine
  2013-08-23  4:29 ` [PATCH 1/2] t3103: demonstrate dir.c:treat_one_path() core.ignorecase failure Eric Sunshine
  2013-08-23  4:29 ` [PATCH 2/2] dir: test_one_path: fix inconsistent behavior due to missing '/' Eric Sunshine
  0 siblings, 2 replies; 7+ messages in thread
From: Eric Sunshine @ 2013-08-23  4:29 UTC (permalink / raw)
  To: git; +Cc: Eric Sunshine, Junio C Hamano, Joshua Jensen, Brian Gernhardt

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-08-26  5:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-23  4:29 [PATCH 0/2] fix t3010 failure when core.ignorecase=true Eric Sunshine
2013-08-23  4:29 ` [PATCH 1/2] t3103: demonstrate dir.c:treat_one_path() core.ignorecase failure Eric Sunshine
2013-08-23 17:21   ` Junio C Hamano
2013-08-23  4:29 ` [PATCH 2/2] dir: test_one_path: fix inconsistent behavior due to missing '/' Eric Sunshine
2013-08-25  6:00   ` Jonathan Nieder
2013-08-25  8:05     ` Eric Sunshine
2013-08-26  5:38       ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).