git-reset: honor -q and do not show progress message
When running git-reset in a non-interactive setting, the -q switch works for everything except the progress updates. This squelches it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jamis Buck committed
May 31, 2008 at 18:10 UTC
5aa965a0c156c6c6d6d38b82c9361a98ba8ed825
1 file changed
+5
-4
builtin-reset.c
+5
-4
@@ -49,13 +49,14 @@ static inline int is_merge(void)
49
return !access(git_path("MERGE_HEAD"), F_OK);
50
}
51
52
-static int reset_index_file(const unsigned char *sha1, int is_hard_reset)
52
+static int reset_index_file(const unsigned char *sha1, int is_hard_reset, int quiet)
53
{
54
int i = 0;
55
const char *args[6];
56
57
args[i++] = "read-tree";
58
- args[i++] = "-v";
58
+ if (!quiet)
59
+ args[i++] = "-v";
60
args[i++] = "--reset";
61
if (is_hard_reset)
62
args[i++] = "-u";
@@ -182,7 +183,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
183
OPT_SET_INT(0, "hard", &reset_type,
184
"reset HEAD, index and working tree", HARD),
185
OPT_BOOLEAN('q', NULL, &quiet,
185
- "disable showing new HEAD in hard reset"),
186
+ "disable showing new HEAD in hard reset and progress message"),
187
OPT_END()
188
};
189
@@ -231,7 +232,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
232
if (is_merge() || read_cache() < 0 || unmerged_cache())
233
die("Cannot do a soft reset in the middle of a merge.");
234
}
234
- else if (reset_index_file(sha1, (reset_type == HARD)))
235
+ else if (reset_index_file(sha1, (reset_type == HARD), quiet))
236
die("Could not reset index file to revision '%s'.", rev);
237
238
/* Any resets update HEAD to the head being switched to,