dir: revert work-around for retired dangerous behavior

directory_exists_in_index_icase() dangerously assumed that it could access one character beyond the end of its directory argument, and that that character would unconditionally be '/'. 2eac2a4c (ls-files -k: a directory only can be killed if the index has a non-directory, 2013-08-15) added a caller which did not respect this undocumented assumption, and 680be044 (dir.c::test_one_path(): work around directory_exists_in_index_icase() breakage, 2013-08-23) added a work-around which temporarily appends a '/' before invoking directory_exists_in_index_icase(). Since the dangerous behavior of directory_exists_in_index_icase() has been eliminated, the work-around is now redundant, so retire it (but not the tests added by the same commit). Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Eric Sunshine committed Sep 17, 2013 at 03:06 UTC de372b1b46d91ffdcd6eb6e324cb8b586c99c539
1 file changed +3 -15
dir.c
+3 -15
@@ -1160,21 +1160,9 @@ static enum path_treatment treat_one_path(struct dir_struct *dir,
1160 */
1161 if ((dir->flags & DIR_COLLECT_KILLED_ONLY) &&
1162 (dtype == DT_DIR) &&
1163 - !has_path_in_index) {
1164 - /*
1165 - * NEEDSWORK: directory_exists_in_index_icase()
1166 - * assumes that one byte past the given path is
1167 - * readable and has '/', which needs to be fixed, but
1168 - * until then, work it around in the caller.
1169 - */
1170 - strbuf_addch(path, '/');
1171 - if (directory_exists_in_index(path->buf, path->len - 1) ==
1172 - index_nonexistent) {
1173 - strbuf_setlen(path, path->len - 1);
1174 - return path_none;
1175 - }
1176 - strbuf_setlen(path, path->len - 1);
1177 - }
1163 + !has_path_in_index &&
1164 + (directory_exists_in_index(path->buf, path->len) == index_nonexistent))
1165 + return path_none;
1166
1167 exclude = is_excluded(dir, path->buf, &dtype);
1168