Skip to content

Commit

Permalink
Merge branch 'long-paths'
Browse files Browse the repository at this point in the history
  • Loading branch information
dscho committed Jan 27, 2025
2 parents b2e0ca7 + 641861e commit a713265
Show file tree
Hide file tree
Showing 29 changed files with 1,674 additions and 122 deletions.
13 changes: 13 additions & 0 deletions Documentation/config/core.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,19 @@ relatively high IO latencies. When enabled, Git will do the
index comparison to the filesystem data in parallel, allowing
overlapping IO's. Defaults to true.

core.fscache::
Enable additional caching of file system data for some operations.
+
Git for Windows uses this to bulk-read and cache lstat data of entire
directories (instead of doing lstat file by file).

core.longpaths::
Enable long path (> 260) support for builtin commands in Git for
Windows. This is disabled by default, as long paths are not supported
by Windows Explorer, cmd.exe and the Git for Windows tool chain
(msys, bash, tcl, perl...). Only enable this if you know what you're
doing and are prepared to live with a few quirks.

core.unsetenvvars::
Windows-only: comma-separated list of environment variables'
names that need to be unset before spawning any other process.
Expand Down
5 changes: 5 additions & 0 deletions builtin/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,10 @@ int cmd_add(int argc,
die_in_unpopulated_submodule(repo->index, prefix);
die_path_inside_submodule(repo->index, &pathspec);

enable_fscache(0);
/* We do not really re-read the index but update the up-to-date flags */
preload_index(repo->index, &pathspec, 0);

if (add_new_files) {
int baselen;

Expand Down Expand Up @@ -589,5 +593,6 @@ int cmd_add(int argc,
free(ps_matched);
dir_clear(&dir);
clear_pathspec(&pathspec);
enable_fscache(0);
return exit_status;
}
2 changes: 2 additions & 0 deletions builtin/checkout.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ static int checkout_worktree(const struct checkout_opts *opts,
if (pc_workers > 1)
init_parallel_checkout();

enable_fscache(the_repository->index->cache_nr);
for (pos = 0; pos < the_repository->index->cache_nr; pos++) {
struct cache_entry *ce = the_repository->index->cache[pos];
if (ce->ce_flags & CE_MATCHED) {
Expand All @@ -432,6 +433,7 @@ static int checkout_worktree(const struct checkout_opts *opts,
errs |= run_parallel_checkout(&state, pc_workers, pc_threshold,
NULL, NULL);
mem_pool_discard(&ce_mem_pool, should_validate_cache_entries());
disable_fscache();
remove_marked_cache_entries(the_repository->index, 1);
remove_scheduled_dirs();
errs |= finish_delayed_checkout(&state, opts->show_progress);
Expand Down
2 changes: 2 additions & 0 deletions builtin/clean.c
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,7 @@ int cmd_clean(int argc,

if (repo_read_index(the_repository) < 0)
die(_("index file corrupt"));
enable_fscache(the_repository->index->cache_nr);

pl = add_pattern_list(&dir, EXC_CMDL, "--exclude option");
for (i = 0; i < exclude_list.nr; i++)
Expand Down Expand Up @@ -1117,6 +1118,7 @@ int cmd_clean(int argc,
}
}

disable_fscache();
strbuf_release(&abs_path);
strbuf_release(&buf);
string_list_clear(&del_list, 0);
Expand Down
2 changes: 2 additions & 0 deletions builtin/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1583,6 +1583,7 @@ struct repository *repo UNUSED)
PATHSPEC_PREFER_FULL,
prefix, argv);

enable_fscache(0);
if (status_format != STATUS_FORMAT_PORCELAIN &&
status_format != STATUS_FORMAT_PORCELAIN_V2)
progress_flag = REFRESH_PROGRESS;
Expand Down Expand Up @@ -1623,6 +1624,7 @@ struct repository *repo UNUSED)
wt_status_print(&s);
wt_status_collect_free_buffers(&s);

disable_fscache();
return 0;
}

Expand Down
Loading

0 comments on commit a713265

Please sign in to comment.