unpack-trees: remove redundant path search in verify_absent
Since the only caller, verify_absent, relies on the fact that o->pos points to the next index entry anyways, there is no need to recompute its position. Furthermore, if a nondirectory entry were found, this would return too early, because there could still be an untracked directory in the way. This is currently not a problem, because verify_absent is only called if the index does not have this entry. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Clemens Buchacher committed
Jan 1, 2009 at 21:54 UTC
7b9e3ce0255002075809917e0384cba3a0d18589
1 file changed
+2
-6
unpack-trees.c
+2
-6
@@ -493,7 +493,7 @@ static int verify_clean_subdirectory(struct cache_entry *ce, const char *action,
493
* anything in the existing directory there.
494
*/
495
int namelen;
496
- int pos, i;
496
+ int i;
497
struct dir_struct d;
498
char *pathbuf;
499
int cnt = 0;
@@ -514,11 +514,7 @@ static int verify_clean_subdirectory(struct cache_entry *ce, const char *action,
514
* in that directory.
515
*/
516
namelen = strlen(ce->name);
517
- pos = index_name_pos(o->src_index, ce->name, namelen);
518
- if (0 <= pos)
519
- return 0; /* we have it as nondirectory */
520
- pos = -pos - 1;
521
- for (i = pos; i < o->src_index->cache_nr; i++) {
517
+ for (i = o->pos; i < o->src_index->cache_nr; i++) {
518
struct cache_entry *ce2 = o->src_index->cache[i];
519
int len = ce_namelen(ce2);
520
if (len < namelen ||