Skip to content

Commit 310b9de

Browse files
committed
Merge branch 'jb/reset-q'
* jb/reset-q: git-reset: honor -q and do not show progress message
2 parents 8f1b063 + 5aa965a commit 310b9de

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

builtin-reset.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,14 @@ static inline int is_merge(void)
4949
return !access(git_path("MERGE_HEAD"), F_OK);
5050
}
5151

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)
5353
{
5454
int i = 0;
5555
const char *args[6];
5656

5757
args[i++] = "read-tree";
58-
args[i++] = "-v";
58+
if (!quiet)
59+
args[i++] = "-v";
5960
args[i++] = "--reset";
6061
if (is_hard_reset)
6162
args[i++] = "-u";
@@ -182,7 +183,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
182183
OPT_SET_INT(0, "hard", &reset_type,
183184
"reset HEAD, index and working tree", HARD),
184185
OPT_BOOLEAN('q', NULL, &quiet,
185-
"disable showing new HEAD in hard reset"),
186+
"disable showing new HEAD in hard reset and progress message"),
186187
OPT_END()
187188
};
188189

@@ -231,7 +232,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
231232
if (is_merge() || read_cache() < 0 || unmerged_cache())
232233
die("Cannot do a soft reset in the middle of a merge.");
233234
}
234-
else if (reset_index_file(sha1, (reset_type == HARD)))
235+
else if (reset_index_file(sha1, (reset_type == HARD), quiet))
235236
die("Could not reset index file to revision '%s'.", rev);
236237

237238
/* Any resets update HEAD to the head being switched to,

0 commit comments

Comments
 (0)