diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-09-29 12:36:10 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-09-29 12:36:10 -0700 |
commit | 507fe835ed0753ff266fdb998853cc5dea3758c6 (patch) | |
tree | 06a7d355d50bea90bf2a3859c11e9d9a5b633b6f /git-stash.sh | |
parent | b8e533f12acec63242c5405286fbbcfa66eecfdd (diff) | |
parent | 1956dfa818e376c5d62adc16d77f5b5cacf923f8 (diff) | |
download | git-507fe835ed0753ff266fdb998853cc5dea3758c6.tar.gz |
Merge branch 'da/rev-parse-verify-quiet'
"rev-parse --verify --quiet $name" is meant to quietly exit with a
non-zero status when $name is not a valid object name, but still
gave error messages in some cases.
* da/rev-parse-verify-quiet:
stash: prefer --quiet over shell redirection of the standard error stream
refs: make rev-parse --quiet actually quiet
t1503: use test_must_be_empty
Documentation: a note about stdout for git rev-parse --verify --quiet
Diffstat (limited to 'git-stash.sh')
-rwxr-xr-x | git-stash.sh | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/git-stash.sh b/git-stash.sh index 0158c73386..d4cf818be9 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -50,7 +50,7 @@ clear_stash () { then die "$(gettext "git stash clear with parameters is unimplemented")" fi - if current=$(git rev-parse --verify $ref_stash 2>/dev/null) + if current=$(git rev-parse --verify --quiet $ref_stash) then git update-ref -d $ref_stash $current fi @@ -292,7 +292,7 @@ save_stash () { } have_stash () { - git rev-parse --verify $ref_stash >/dev/null 2>&1 + git rev-parse --verify --quiet $ref_stash >/dev/null } list_stash () { @@ -392,12 +392,12 @@ parse_flags_and_rev() ;; esac - REV=$(git rev-parse --quiet --symbolic --verify "$1" 2>/dev/null) || { + REV=$(git rev-parse --symbolic --verify --quiet "$1") || { reference="$1" die "$(eval_gettext "\$reference is not a valid reference")" } - i_commit=$(git rev-parse --quiet --verify "$REV^2" 2>/dev/null) && + i_commit=$(git rev-parse --verify --quiet "$REV^2") && set -- $(git rev-parse "$REV" "$REV^1" "$REV:" "$REV^1:" "$REV^2:" 2>/dev/null) && s=$1 && w_commit=$1 && @@ -409,7 +409,7 @@ parse_flags_and_rev() test "$ref_stash" = "$(git rev-parse --symbolic-full-name "${REV%@*}")" && IS_STASH_REF=t - u_commit=$(git rev-parse --quiet --verify "$REV^3" 2>/dev/null) && + u_commit=$(git rev-parse --verify --quiet "$REV^3") && u_tree=$(git rev-parse "$REV^3:" 2>/dev/null) } @@ -531,7 +531,8 @@ drop_stash () { die "$(eval_gettext "\${REV}: Could not drop stash entry")" # clear_stash if we just dropped the last stash entry - git rev-parse --verify "$ref_stash@{0}" >/dev/null 2>&1 || clear_stash + git rev-parse --verify --quiet "$ref_stash@{0}" >/dev/null || + clear_stash } apply_to_branch () { |