diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-09-16 14:26:40 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-09-16 14:26:40 -0700 |
commit | bba287531b3a845faa032a8fef3e6d70d185c89b (patch) | |
tree | e234c232ce0b8acef3f43fa34c036e68522b5612 /entry.c | |
parent | 4197ce3c6d943759e1088a0298b64571b4bc725a (diff) | |
parent | da02ca508b842e61c71d920310ff30bbe0238993 (diff) | |
download | git-bba287531b3a845faa032a8fef3e6d70d185c89b.tar.gz git-bba287531b3a845faa032a8fef3e6d70d185c89b.tar.xz |
Merge branch 'jc/maint-checkout-index-to-prefix' into maint
* jc/maint-checkout-index-to-prefix:
check_path(): allow symlinked directories to checkout-index --prefix
Diffstat (limited to 'entry.c')
-rw-r--r-- | entry.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -177,11 +177,15 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout /* * This is like 'lstat()', except it refuses to follow symlinks - * in the path. + * in the path, after skipping "skiplen". */ -int check_path(const char *path, int len, struct stat *st) +int check_path(const char *path, int len, struct stat *st, int skiplen) { - if (has_symlink_leading_path(path, len)) { + const char *slash = path + len; + + while (path < slash && *slash != '/') + slash--; + if (!has_dirs_only_path(path, slash - path, skiplen)) { errno = ENOENT; return -1; } @@ -201,7 +205,7 @@ int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *t strcpy(path + len, ce->name); len += ce_namelen(ce); - if (!check_path(path, len, &st)) { + if (!check_path(path, len, &st, state->base_dir_len)) { unsigned changed = ce_match_stat(ce, &st, CE_MATCH_IGNORE_VALID); if (!changed) return 0; |