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

[PATCH/RFC v4 12/13] update-index.c: rewrite index when index-version is given

From
Thomas Gummerer <t.gummerer@gmail.com>
Date
Aug 16, 2012, 09:58 UTC
Message-ID
<1345111129-6925-13-git-send-email-t.gummerer@gmail.com>
In-Reply-To
<1345111129-6925-1-git-send-email-t.gummerer@gmail.com>

Make update-index always rewrite the index when a index-version is given, even if the index already has the right version. This option is used for performance testing the writer and reader.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
---
 builtin/update-index.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/builtin/update-index.c b/builtin/update-index.c
index 4ce341c..c31d176 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -6,6 +6,7 @@
 #include "cache.h"
 #include "quote.h"
 #include "cache-tree.h"
+#include "read-cache.h"
 #include "tree-walk.h"
 #include "builtin.h"
 #include "refs.h"
@@ -861,6 +862,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
 		if (the_index.version != preferred_index_format)
 			active_cache_changed = 1;
 		the_index.version = preferred_index_format;
+		set_istate_ops(&the_index);
 	}
 
 	if (read_from_stdin) {
@@ -886,7 +888,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
 		strbuf_release(&buf);
 	}
 
-	if (active_cache_changed) {
+	if (active_cache_changed || preferred_index_format) {
 		if (newfd < 0) {
 			if (refresh_args.flags & REFRESH_QUIET)
 				exit(128);
-- 
1.7.11.2
Previous: Thomas GummererNext: Thomas Gummerer
Message 13 of 14 in “Introduce index file format version 5”
  1. 0/13 Introduce index file format version 5Thomas Gummerer, Aug 16, 2012
  2. 01/13 Move index v2 specific functions to their own fileThomas Gummerer, Aug 16, 2012
  3. 02/13 read-cache.c: Re-read index if index file changedThomas Gummerer, Aug 16, 2012
  4. 03/13 t2104: Don't fail for index versions other than [23]Thomas Gummerer, Aug 16, 2012
  5. 04/13 Add documentation of the index-v5 file formatThomas Gummerer, Aug 16, 2012
  6. 05/13 Make in-memory format aware of stat_crcThomas Gummerer, Aug 16, 2012
  7. 06/13 Read index-v5Thomas Gummerer, Aug 16, 2012
  8. 07/13 Read resolve-undo dataThomas Gummerer, Aug 16, 2012
  9. 08/13 Read cache-tree in index-v5Thomas Gummerer, Aug 16, 2012
  10. 09/13 Write index-v5Thomas Gummerer, Aug 16, 2012
  11. 10/13 Write index-v5 cache-tree dataThomas Gummerer, Aug 16, 2012
  12. 11/13 Write resolve-undo data for index-v5Thomas Gummerer, Aug 16, 2012
  13. 12/13 update-index.c: rewrite index when index-version is givenThomas Gummerer, Aug 16, 2012
  14. 13/13 p0002-index.sh: add perf test for the index formatsThomas Gummerer, Aug 16, 2012

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.