From: Junio C Hamano Date: Thu, 22 Jun 2017 21:15:21 +0000 (-0700) Subject: Merge branch 'pc/dir-count-slashes' X-Git-Tag: v2.14.0-rc0~80 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=52ab95cfea15ae8a60fb4febc99d54034c8800b8;p=git Merge branch 'pc/dir-count-slashes' Three instances of the same helper function have been consolidated to one. * pc/dir-count-slashes: dir: create function count_slashes() --- 52ab95cfea15ae8a60fb4febc99d54034c8800b8 diff --cc dir.c index 1759063817,a870f42ddc..5f1afb56bc --- a/dir.c +++ b/dir.c @@@ -46,12 -45,19 +46,21 @@@ struct cached_dir }; static enum path_treatment read_directory_recursive(struct dir_struct *dir, - const char *path, int len, struct untracked_cache_dir *untracked, + struct index_state *istate, const char *path, int len, + struct untracked_cache_dir *untracked, int check_only, const struct pathspec *pathspec); -static int get_dtype(struct dirent *de, const char *path, int len); +static int get_dtype(struct dirent *de, struct index_state *istate, + const char *path, int len); + int count_slashes(const char *s) + { + int cnt = 0; + while (*s) + if (*s++ == '/') + cnt++; + return cnt; + } + int fspathcmp(const char *a, const char *b) { return ignore_case ? strcasecmp(a, b) : strcmp(a, b);