git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] status: only touch path we may need to check

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Jan 14, 2010, 15:02 UTC
Message-ID
<1263481341-28401-3-git-send-email-pclouds@gmail.com>
In-Reply-To
<1263481341-28401-1-git-send-email-pclouds@gmail.com>

This patch gets rid of whole-tree cache refresh and untracked file search. Instead only specified path will be looked at.

Again some numbers on gentoo-x86, ~80k files:
Unmodified Git:

$ time git st eclass/ nothing to commit (working directory clean)

real 0m3.211s user 0m1.977s sys 0m1.135s

Modified Git:

$ time ~/w/git/git st eclass/ nothing to commit (working directory clean)

real 0m1.587s user 0m1.426s sys 0m0.111s

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin-commit.c |    2 +-
 wt-status.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 6199db7..dae6cb3 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -1024,7 +1024,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
 		s.pathspec = get_pathspec(prefix, argv);
 
 	read_cache();
-	refresh_cache(REFRESH_QUIET|REFRESH_UNMERGED);
+	refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, s.pathspec, NULL, NULL);
 	s.is_initial = get_sha1(s.reference, sha1) ? 1 : 0;
 	s.in_merge = in_merge;
 	wt_status_collect(&s);
diff --git a/wt-status.c b/wt-status.c
index 5d56988..65feb29 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -343,7 +343,7 @@ static void wt_status_collect_untracked(struct wt_status *s)
 			DIR_SHOW_OTHER_DIRECTORIES | DIR_HIDE_EMPTY_DIRECTORIES;
 	setup_standard_excludes(&dir);
 
-	fill_directory(&dir, NULL);
+	fill_directory(&dir, s->pathspec);
 	for (i = 0; i < dir.nr; i++) {
 		struct dir_entry *ent = dir.entries[i];
 		if (!cache_name_is_other(ent->name, ent->len))
-- 
1.6.6.181.g5ee6
Previous: Nguyen Thai Ngoc DuyNext: Sverre Rabbelier
Message 5 of 10 in “Improve Git performance on big trees”
  1. 0/2 Improve Git performance on big treesNguyễn Thái Ngọc Duy, Jan 14, 2010
  2. 1/2 rm: only refresh entries that we may touchNguyễn Thái Ngọc Duy, Jan 14, 2010
  3. Junio C HamanoJan 16, 2010
  4. Nguyen Thai Ngoc DuyJan 16, 2010
  5. 2/2 status: only touch path we may need to checkNguyễn Thái Ngọc Duy, Jan 14, 2010
  6. Sverre RabbelierJan 14, 2010
  7. Junio C HamanoJan 16, 2010
  8. Martin LanghoffJan 14, 2010
  9. Nguyen Thai Ngoc DuyJan 15, 2010
  10. rm: only refresh entries that we may touchNguyễn Thái Ngọc Duy, Jan 17, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.