summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fe61935)
raw | patch | inline | side by side (parent: fe61935)
author | Gerrit Pape <pape@smarden.org> | |
Sun, 4 Nov 2007 09:37:20 +0000 (09:37 +0000) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 6 Nov 2007 08:18:39 +0000 (00:18 -0800) |
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>
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>
Documentation/git-reset.txt | patch | blob | history | |
builtin-reset.c | patch | blob | history |
index 87afa6f8da0c6421e909663fe79a6f8b0fc0a7d8..050e4eadbb3d5b8f60edc173f2f17fdc959dde5d 100644 (file)
SYNOPSIS
--------
[verse]
-'git-reset' [--mixed | --soft | --hard] [<commit>]
-'git-reset' [--mixed] <commit> [--] <paths>...
+'git-reset' [--mixed | --soft | --hard] [-q] [<commit>]
+'git-reset' [--mixed] [-q] <commit> [--] <paths>...
DESCRIPTION
-----------
switched to. Any changes to tracked files in the working tree
since <commit> are lost.
+-q::
+ Be quiet, only report errors.
+
<commit>::
Commit to make the current HEAD.
diff --git a/builtin-reset.c b/builtin-reset.c
index 5467e36c73766494ba23d03fd23a9cbf03d05b95..9626d4c54a812e0ad94204cfb434309da33b6a57 100644 (file)
--- a/builtin-reset.c
+++ b/builtin-reset.c
#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)
{
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];
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++;
reset_type = HARD;
i++;
}
+ else if (!strcmp(argv[i], "-q")) {
+ quiet = 1;
+ i++;
+ }
+ else
+ break;
}
if (i < argc && argv[i][0] != '-')
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. */