aboutsummaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/dir.c b/dir.c
index b00821f294..fcb8f6dd2a 100644
--- a/dir.c
+++ b/dir.c
@@ -1551,7 +1551,9 @@ done:
int init_sparse_checkout_patterns(struct index_state *istate)
{
- if (!core_apply_sparse_checkout)
+ struct repo_config_values *cfg = repo_config_values(the_repository);
+
+ if (!cfg->apply_sparse_checkout)
return 1;
if (istate->sparse_checkout_patterns)
return 0;
@@ -3516,15 +3518,15 @@ int get_sparse_checkout_patterns(struct pattern_list *pl)
int remove_path(const char *name)
{
- char *slash;
+ const char *last;
if (unlink(name) && !is_missing_file_error(errno))
return -1;
- slash = strrchr(name, '/');
- if (slash) {
+ last = strrchr(name, '/');
+ if (last) {
char *dirs = xstrdup(name);
- slash = dirs + (slash - name);
+ char *slash = dirs + (last - name);
do {
*slash = '\0';
if (startup_info->original_cwd &&