Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerrit Pape <pape@smarden.org>2007-11-04 12:37:20 +0300
committerJunio C Hamano <gitster@pobox.com>2007-11-06 11:18:39 +0300
commit521b53e5c7ee23a137e903d99108f81d44cca5ec (patch)
tree9fe349b3f6c40ee2edf24417101f0c9aceeb31e3 /builtin-reset.c
parentfe61935007b6803ce116e233316e4ff51de02be6 (diff)
git-reset: add -q option to operate quietly
Many git commands have a -q option to suppress output to stdout, let's have it for git-reset too. This was asked for by Joey Hess through http://bugs.debian.org/444933 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-reset.c')
-rw-r--r--builtin-reset.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/builtin-reset.c b/builtin-reset.c
index 5467e36c73..9626d4c54a 100644
--- a/builtin-reset.c
+++ b/builtin-reset.c
@@ -18,7 +18,7 @@
#include "tree.h"
static const char builtin_reset_usage[] =
-"git-reset [--mixed | --soft | --hard] [<commit-ish>] [ [--] <paths>...]";
+"git-reset [--mixed | --soft | --hard] [-q] [<commit-ish>] [ [--] <paths>...]";
static char *args_to_str(const char **argv)
{
@@ -185,7 +185,7 @@ static const char *reset_type_names[] = { "mixed", "soft", "hard", NULL };
int cmd_reset(int argc, const char **argv, const char *prefix)
{
- int i = 1, reset_type = NONE, update_ref_status = 0;
+ int i = 1, reset_type = NONE, update_ref_status = 0, quiet = 0;
const char *rev = "HEAD";
unsigned char sha1[20], *orig = NULL, sha1_orig[20],
*old_orig = NULL, sha1_old_orig[20];
@@ -197,7 +197,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
reflog_action = args_to_str(argv);
setenv("GIT_REFLOG_ACTION", reflog_action, 0);
- if (i < argc) {
+ while (i < argc) {
if (!strcmp(argv[i], "--mixed")) {
reset_type = MIXED;
i++;
@@ -210,6 +210,12 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
reset_type = HARD;
i++;
}
+ else if (!strcmp(argv[i], "-q")) {
+ quiet = 1;
+ i++;
+ }
+ else
+ break;
}
if (i < argc && argv[i][0] != '-')
@@ -270,7 +276,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
switch (reset_type) {
case HARD:
- if (!update_ref_status)
+ if (!update_ref_status && !quiet)
print_new_head_line(commit);
break;
case SOFT: /* Nothing else to do. */