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

[PATCH 3/5] Make verbosity configurable in reset_index_file()

From
Miklos Vajna <vmiklos@frugalware.org>
Date
May 24, 2008, 00:01 UTC
Message-ID
<dace39a3a72957bec9a7f4b8528b08fc7fbe3341.1211586801.git.vmiklos@frugalware.org>
In-Reply-To
<28874c24faf45e6e4499c9692cc1de1e93cd4dcf.1211586801.git.vmiklos@frugalware.org>

Till now reset_index_file() was always verbose. Add a new argument to be able to disable this behaviour.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 builtin-reset.c |    2 +-
 reset.c         |    5 +++--
 reset.h         |    2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/builtin-reset.c b/builtin-reset.c
index 6e6e168..179c59c 100644
--- a/builtin-reset.c
+++ b/builtin-reset.c
@@ -216,7 +216,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
 		if (is_merge() || read_cache() < 0 || unmerged_cache())
 			die("Cannot do a soft reset in the middle of a merge.");
 	}
-	else if (reset_index_file(sha1, (reset_type == HARD)))
+	else if (reset_index_file(sha1, (reset_type == HARD), 1))
 		die("Could not reset index file to revision '%s'.", rev);
 
 	/* Any resets update HEAD to the head being switched to,
diff --git a/reset.c b/reset.c
index a75fec6..baae947 100644
--- a/reset.c
+++ b/reset.c
@@ -11,13 +11,14 @@
 #include "cache.h"
 #include "run-command.h"
 
-int reset_index_file(const unsigned char *sha1, int is_hard_reset)
+int reset_index_file(const unsigned char *sha1, int is_hard_reset, int verbose)
 {
 	int i = 0;
 	const char *args[6];
 
 	args[i++] = "read-tree";
-	args[i++] = "-v";
+	if (verbose)
+		args[i++] = "-v";
 	args[i++] = "--reset";
 	if (is_hard_reset)
 		args[i++] = "-u";
diff --git a/reset.h b/reset.h
index 4ae235b..c43ae22 100644
--- a/reset.h
+++ b/reset.h
@@ -1,6 +1,6 @@
 #ifndef RESET_H
 #define RESET_H
 
-int reset_index_file(const unsigned char *sha1, int is_hard_reset);
+int reset_index_file(const unsigned char *sha1, int is_hard_reset, int verbose);
 
 #endif
-- 
1.5.5.1.357.g1af8b.dirty
Previous: Miklos VajnaNext: Miklos Vajna
Message 4 of 10 in “Build in merge”
  1. 0/5 Build in mergeMiklos Vajna, May 24, 2008
  2. 1/5 Move reset_index_file() to a new reset.cMiklos Vajna, May 24, 2008
  3. 2/5 Move split_cmdline() to libgitMiklos Vajna, May 24, 2008
  4. 3/5 Make verbosity configurable in reset_index_file()Miklos Vajna, May 24, 2008
  5. 4/5 Move commit_list_count() to commit.cMiklos Vajna, May 24, 2008
  6. 5/5 Build in mergeMiklos Vajna, May 24, 2008
  7. Kristian HøgsbergMay 27, 2008
  8. Miklos VajnaMay 27, 2008
  9. Daniel BarkalowMay 24, 2008
  10. Miklos VajnaMay 24, 2008

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.