git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] stash: use --quiet rather than using 2>/dev/null
@ 2010-03-20  2:18 Benjamin C Meyer
  2010-03-20  2:18 ` [PATCH 2/4] pull: use --quiet rather than 2>/dev/null Benjamin C Meyer
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Benjamin C Meyer @ 2010-03-20  2:18 UTC (permalink / raw)
  To: git; +Cc: Benjamin C Meyer

Signed-off-by: Benjamin C Meyer <bmeyer@rim.com>
---
 git-stash.sh |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/git-stash.sh b/git-stash.sh
index aa47e54..2533185 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -39,7 +39,7 @@ clear_stash () {
 	then
 		die "git stash clear with parameters is unimplemented"
 	fi
-	if current=$(git rev-parse --verify $ref_stash 2>/dev/null)
+	if current=$(git rev-parse --quiet --verify $ref_stash)
 	then
 		git update-ref -d $ref_stash $current
 	fi
@@ -201,7 +201,7 @@ save_stash () {
 }
 
 have_stash () {
-	git rev-parse --verify $ref_stash >/dev/null 2>&1
+	git rev-parse --quiet --verify $ref_stash >/dev/null
 }
 
 list_stash () {
@@ -342,16 +342,16 @@ drop_stash () {
 	fi
 	# Verify supplied argument looks like a stash entry
 	s=$(git rev-parse --verify "$@") &&
-	git rev-parse --verify "$s:"   > /dev/null 2>&1 &&
-	git rev-parse --verify "$s^1:" > /dev/null 2>&1 &&
-	git rev-parse --verify "$s^2:" > /dev/null 2>&1 ||
+	git rev-parse --quiet --verify "$s:"   > /dev/null &&
+	git rev-parse --quiet --verify "$s^1:" > /dev/null &&
+	git rev-parse --quiet --verify "$s^2:" > /dev/null ||
 		die "$*: not a valid stashed state"
 
 	git reflog delete --updateref --rewrite "$@" &&
 		say "Dropped $* ($s)" || die "$*: 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 --quiet --verify "$ref_stash@{0}" > /dev/null || clear_stash
 }
 
 apply_to_branch () {
-- 
1.7.0.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] pull: use --quiet rather than 2>/dev/null
  2010-03-20  2:18 [PATCH 1/4] stash: use --quiet rather than using 2>/dev/null Benjamin C Meyer
@ 2010-03-20  2:18 ` Benjamin C Meyer
  2010-03-20 12:35   ` Jonathan Nieder
  2010-03-20  2:18 ` [PATCH 3/4] rebase: " Benjamin C Meyer
  2010-03-20  2:18 ` [PATCH 4/4] rebase-interactive: " Benjamin C Meyer
  2 siblings, 1 reply; 9+ messages in thread
From: Benjamin C Meyer @ 2010-03-20  2:18 UTC (permalink / raw)
  To: git; +Cc: Benjamin C Meyer

Signed-off-by: Benjamin C Meyer <bmeyer@rim.com>
---
 git-pull.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-pull.sh b/git-pull.sh
index d45b50c..08dac0a 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -206,7 +206,7 @@ test true = "$rebase" && {
 	. git-parse-remote &&
 	remoteref="$(get_remote_merge_branch "$@" 2>/dev/null)" &&
 	oldremoteref="$(git rev-parse -q --verify "$remoteref")" &&
-	for reflog in $(git rev-list -g $remoteref 2>/dev/null)
+	for reflog in $(git rev-list --quiet -g $remoteref)
 	do
 		if test "$reflog" = "$(git merge-base $reflog $curr_branch)"
 		then
-- 
1.7.0.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] rebase: use --quiet rather than 2>/dev/null
  2010-03-20  2:18 [PATCH 1/4] stash: use --quiet rather than using 2>/dev/null Benjamin C Meyer
  2010-03-20  2:18 ` [PATCH 2/4] pull: use --quiet rather than 2>/dev/null Benjamin C Meyer
@ 2010-03-20  2:18 ` Benjamin C Meyer
  2010-03-20  2:18 ` [PATCH 4/4] rebase-interactive: " Benjamin C Meyer
  2 siblings, 0 replies; 9+ messages in thread
From: Benjamin C Meyer @ 2010-03-20  2:18 UTC (permalink / raw)
  To: git; +Cc: Benjamin C Meyer

Signed-off-by: Benjamin C Meyer <bmeyer@rim.com>
---
 git-rebase.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-rebase.sh b/git-rebase.sh
index fb4fef7..bf93019 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -101,7 +101,7 @@ call_merge () {
 	cmt="$(cat "$dotest/cmt.$1")"
 	echo "$cmt" > "$dotest/current"
 	hd=$(git rev-parse --verify HEAD)
-	cmt_name=$(git symbolic-ref HEAD 2> /dev/null || echo HEAD)
+	cmt_name=$(git symbolic-ref --quiet HEAD || echo HEAD)
 	msgnum=$(cat "$dotest/msgnum")
 	end=$(cat "$dotest/end")
 	eval GITHEAD_$cmt='"${cmt_name##refs/heads/}~$(($end - $msgnum))"'
-- 
1.7.0.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] rebase-interactive: use --quiet rather than 2>/dev/null
  2010-03-20  2:18 [PATCH 1/4] stash: use --quiet rather than using 2>/dev/null Benjamin C Meyer
  2010-03-20  2:18 ` [PATCH 2/4] pull: use --quiet rather than 2>/dev/null Benjamin C Meyer
  2010-03-20  2:18 ` [PATCH 3/4] rebase: " Benjamin C Meyer
@ 2010-03-20  2:18 ` Benjamin C Meyer
  2 siblings, 0 replies; 9+ messages in thread
From: Benjamin C Meyer @ 2010-03-20  2:18 UTC (permalink / raw)
  To: git; +Cc: Benjamin C Meyer

Signed-off-by: Benjamin C Meyer <bmeyer@rim.com>
---
 git-rebase--interactive.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 3e4fd14..6f6748c 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -793,7 +793,7 @@ first and then run 'git rebase --continue' again."
 		mkdir "$DOTEST" || die "Could not create temporary $DOTEST"
 
 		: > "$DOTEST"/interactive || die "Could not mark as interactive"
-		git symbolic-ref HEAD > "$DOTEST"/head-name 2> /dev/null ||
+		git symbolic-ref --quiet HEAD > "$DOTEST"/head-name ||
 			echo "detached HEAD" > "$DOTEST"/head-name
 
 		echo $HEAD > "$DOTEST"/head
-- 
1.7.0.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] pull: use --quiet rather than 2>/dev/null
  2010-03-20  2:18 ` [PATCH 2/4] pull: use --quiet rather than 2>/dev/null Benjamin C Meyer
@ 2010-03-20 12:35   ` Jonathan Nieder
  2010-03-20 18:59     ` Benjamin Meyer
  0 siblings, 1 reply; 9+ messages in thread
From: Jonathan Nieder @ 2010-03-20 12:35 UTC (permalink / raw)
  To: Benjamin C Meyer; +Cc: git

Benjamin C Meyer wrote:

> -	for reflog in $(git rev-list -g $remoteref 2>/dev/null)
> +	for reflog in $(git rev-list --quiet -g $remoteref)

Are you sure?  My local copy of git-rev-list.1 says

    --quiet
         Don’t print anything to standard output. This form is primarily meant
         to allow the caller to test the exit status to see if a range of
         objects is fully connected (or not). It is faster than redirecting
         stdout to /dev/null as the output does not have to be formatted.

A similar question applies to the other patches in this series: are
you sure they suppress the right output?  (I haven’t checked, just
asking.)

Aside: that for loop looks like it could be improved.  Maybe it is worth
factoring this into a separate function, something like:

old_upstream() {
	remoteref=$1 &&
	curr_branch=$2 &&

	oldremoteref="$(git rev-parse -q --verify "$remoteref")" &&
	{ git rev-list -g "$remoteref" 2>/dev/null || return $?; } |
	while read reflog
	do
		if test -z "$(git rev-list "$curr_branch".."$reflog" | head -n 1)"
		then
			printf "%s\n" "$reflog"
			return 0
		fi
	done &&
	printf "%s\n" "$oldremoteref"
}

In other words, we can avoid walking the whole reflog before starting
to look for an ancestor for the current branch.

Jonathan

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] pull: use --quiet rather than 2>/dev/null
  2010-03-20 12:35   ` Jonathan Nieder
@ 2010-03-20 18:59     ` Benjamin Meyer
  2010-03-21  4:33       ` Jonathan Nieder
  0 siblings, 1 reply; 9+ messages in thread
From: Benjamin Meyer @ 2010-03-20 18:59 UTC (permalink / raw)
  Cc: git

On Mar 20, 2010, at 8:35 AM, Jonathan Nieder wrote:

> Benjamin C Meyer wrote:
> 
>> -	for reflog in $(git rev-list -g $remoteref 2>/dev/null)
>> +	for reflog in $(git rev-list --quiet -g $remoteref)
> 
> Are you sure?  My local copy of git-rev-list.1 says
> 
>   --quiet
>        Don’t print anything to standard output. This form is primarily meant
>        to allow the caller to test the exit status to see if a range of
>        objects is fully connected (or not). It is faster than redirecting
>        stdout to /dev/null as the output does not have to be formatted.
> 
> A similar question applies to the other patches in this series: are
> you sure they suppress the right output?  (I haven’t checked, just
> asking.)

Thanks for reviewing the change

Yah looks like I made a mistake there, rev-list --quiet suppresses everything and not just stderr.  When going through this janitor task I noticed that the --quiet is very inconsistent among git commands.  Some suppress error messages, some suppress all messages.  This might be something to improve in the future as even though I kept referring to the documentation this error slipped in.

re-checking the other patches I think they are correct in their usage.  I ran the matching tests, the rebase ones passed, 3903-stash.sh is already failing before my patch and t3904-stash-patch.sh continues passing with the patch.  Other then running the tests in t/ is there anything I should do to verify patches?

> Aside: that for loop looks like it could be improved.  Maybe it is worth
> factoring this into a separate function, something like:
> 
> old_upstream() {
> 	remoteref=$1 &&
> 	curr_branch=$2 &&
> 
> 	oldremoteref="$(git rev-parse -q --verify "$remoteref")" &&
> 	{ git rev-list -g "$remoteref" 2>/dev/null || return $?; } |
> 	while read reflog
> 	do
> 		if test -z "$(git rev-list "$curr_branch".."$reflog" | head -n 1)"
> 		then
> 			printf "%s\n" "$reflog"
> 			return 0
> 		fi
> 	done &&
> 	printf "%s\n" "$oldremoteref"
> }
> 
> In other words, we can avoid walking the whole reflog before starting
> to look for an ancestor for the current branch.

That looks like it would speed up that bit of code, but I am still figuring out the internals of git so I can't really comment on if this is the best solution etc.

-Benjamin Meyer

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] pull: use --quiet rather than 2>/dev/null
  2010-03-20 18:59     ` Benjamin Meyer
@ 2010-03-21  4:33       ` Jonathan Nieder
  2010-03-21 17:34         ` Benjamin Meyer
  0 siblings, 1 reply; 9+ messages in thread
From: Jonathan Nieder @ 2010-03-21  4:33 UTC (permalink / raw)
  To: Benjamin Meyer; +Cc: git

Hi again,

Benjamin Meyer wrote:

> re-checking the other patches I think they are correct in their
> usage.

Thanks for checking.

> I ran the matching tests, the rebase ones passed,
> 3903-stash.sh is already failing before my patch and
> t3904-stash-patch.sh continues passing with the patch.  Other then
> running the tests in t/ is there anything I should do to verify
> patches?

Regarding testing: the best thing to do IMHO is to explain in the commit
message what effect the patch will have.  Then reviewers (including you)
can read it and try it out to make sure what you say is true.

The test suite is not very good for checking that a patch does what
it’s meant to do, but that’s okay, since it has a different purpose [1].

As an example of what I mean, here is your patch 1/4 again (untested,
though).  I didn’t add any tests since it would be kind of hard to
provoke address space exhaustion at just the right moment.

[1] See http://thread.gmane.org/gmane.comp.version-control.git/142480/focus=142745

-- %< --
From: Benjamin C Meyer <bmeyer@rim.com>
Subject: scripts: use rev-parse --verify -q rather than using 2>/dev/null

b1b3596 (2008-04-26) taught rev-parse --verify a --quiet option to
suppress the “fatal: Needed a single revision” message when its
argument is not a valid object.  Use it; this simplifies scripts
somewhat, and it allows other errors (such as address space exhaustion)
to be reported properly.

Since --quiet does not suppress warnings about ambiguous ref names
and inadequate reflogs, the redirection has been kept for call sites
that might involve either of these phenomena.

Signed-off-by: Benjamin C Meyer <bmeyer@rim.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
t3903-stash.sh fails for me with your original patch.  Maybe you
forgot to run 'make' before running tests?  I fixed it by putting
back in the 2>&1 on the ... || clear_stash line.

 contrib/completion/git-completion.bash |    2 +-
 contrib/examples/git-checkout.sh       |   10 +++++-----
 contrib/examples/git-commit.sh         |    2 +-
 contrib/examples/git-fetch.sh          |    4 ++--
 contrib/examples/git-merge.sh          |   10 +++++-----
 contrib/examples/git-reset.sh          |    2 +-
 contrib/examples/git-revert.sh         |    4 ++--
 git-cvsimport.perl                     |    2 +-
 git-stash.sh                           |   13 +++++++------
 templates/hooks--pre-commit.sample     |    2 +-
 10 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 733ac39..5b287e1 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -151,7 +151,7 @@ __git_ps1 ()
 				fi
 			fi
 			if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then
-			        git rev-parse --verify refs/stash >/dev/null 2>&1 && s="$"
+				git rev-parse --verify -q refs/stash >/dev/null && s="$"
 			fi
 
 			if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then
diff --git a/contrib/examples/git-checkout.sh b/contrib/examples/git-checkout.sh
index 1a7689a..f735209 100755
--- a/contrib/examples/git-checkout.sh
+++ b/contrib/examples/git-checkout.sh
@@ -16,7 +16,7 @@ SUBDIRECTORY_OK=Sometimes
 require_work_tree
 
 old_name=HEAD
-old=$(git rev-parse --verify $old_name 2>/dev/null)
+old=$(git rev-parse --verify -q $old_name)
 oldbranch=$(git symbolic-ref $old_name 2>/dev/null)
 new=
 new_name=
@@ -71,8 +71,8 @@ while test $# != 0; do
 done
 
 arg="$1"
-rev=$(git rev-parse --verify "$arg" 2>/dev/null)
-if rev=$(git rev-parse --verify "$rev^0" 2>/dev/null)
+rev=$(git rev-parse --verify -q "$arg" 2>/dev/null)
+if rev=$(git rev-parse --verify -q "$rev^0" 2>/dev/null)
 then
 	[ -z "$rev" ] && die "unknown flag $arg"
 	new_name="$arg"
@@ -83,7 +83,7 @@ then
 	fi
 	new="$rev"
 	shift
-elif rev=$(git rev-parse --verify "$rev^{tree}" 2>/dev/null)
+elif rev=$(git rev-parse --verify -q "$rev^{tree}" 2>/dev/null)
 then
 	# checking out selected paths from a tree-ish.
 	new="$rev"
@@ -151,7 +151,7 @@ else
 	# but switching branches.
 	if test '' != "$new"
 	then
-		git rev-parse --verify "$new^{commit}" >/dev/null 2>&1 ||
+		git rev-parse --verify -q "$new^{commit}" >/dev/null 2>&1 ||
 		die "Cannot switch branch to a non-commit."
 	fi
 fi
diff --git a/contrib/examples/git-commit.sh b/contrib/examples/git-commit.sh
index 5c72f65..35626c5 100755
--- a/contrib/examples/git-commit.sh
+++ b/contrib/examples/git-commit.sh
@@ -9,7 +9,7 @@ OPTIONS_SPEC=
 . git-sh-setup
 require_work_tree
 
-git rev-parse --verify HEAD >/dev/null 2>&1 || initial_commit=t
+git rev-parse --verify -q HEAD >/dev/null || initial_commit=t
 
 case "$0" in
 *status)
diff --git a/contrib/examples/git-fetch.sh b/contrib/examples/git-fetch.sh
index e44af2c..a35f997 100755
--- a/contrib/examples/git-fetch.sh
+++ b/contrib/examples/git-fetch.sh
@@ -124,7 +124,7 @@ append_fetch_head () {
 # repository is always fine.
 if test -z "$update_head_ok" && test $(is_bare_repository) = false
 then
-	orig_head=$(git rev-parse --verify HEAD 2>/dev/null)
+	orig_head=$(git rev-parse --verify -q HEAD)
 fi
 
 # Allow --notags from remote.$1.tagopt
@@ -365,7 +365,7 @@ case "$orig_head" in
 '')
 	;;
 ?*)
-	curr_head=$(git rev-parse --verify HEAD 2>/dev/null)
+	curr_head=$(git rev-parse --verify -q HEAD)
 	if test "$curr_head" != "$orig_head"
 	then
 	    git update-ref \
diff --git a/contrib/examples/git-merge.sh b/contrib/examples/git-merge.sh
index 8f617fc..5ff2999 100755
--- a/contrib/examples/git-merge.sh
+++ b/contrib/examples/git-merge.sh
@@ -130,7 +130,7 @@ finish () {
 
 merge_name () {
 	remote="$1"
-	rh=$(git rev-parse --verify "$remote^0" 2>/dev/null) || return
+	rh=$(git rev-parse --verify -q "$remote^0" 2>/dev/null) || return
 	bh=$(git show-ref -s --verify "refs/heads/$remote" 2>/dev/null)
 	if test "$rh" = "$bh"
 	then
@@ -226,15 +226,15 @@ fi
 # have "-m" so it is an additional safety measure to check for it.
 
 if test -z "$have_message" &&
-	second_token=$(git rev-parse --verify "$2^0" 2>/dev/null) &&
-	head_commit=$(git rev-parse --verify "HEAD" 2>/dev/null) &&
+	second_token=$(git rev-parse --verify -q "$2^0" 2>/dev/null) &&
+	head_commit=$(git rev-parse --verify -q "HEAD") &&
 	test "$second_token" = "$head_commit"
 then
 	merge_msg="$1"
 	shift
 	head_arg="$1"
 	shift
-elif ! git rev-parse --verify HEAD >/dev/null 2>&1
+elif ! git rev-parse --verify -q HEAD >/dev/null
 then
 	# If the merged head is a valid one there is no reason to
 	# forbid "git merge" into a branch yet to be born.  We do
@@ -277,7 +277,7 @@ set_reflog_action "merge $*"
 remoteheads=
 for remote
 do
-	remotehead=$(git rev-parse --verify "$remote"^0 2>/dev/null) ||
+	remotehead=$(git rev-parse --verify -q "$remote"^0 2>/dev/null) ||
 	    die "$remote - not something we can merge"
 	remoteheads="${remoteheads}$remotehead "
 	eval GITHEAD_$remotehead='"$remote"'
diff --git a/contrib/examples/git-reset.sh b/contrib/examples/git-reset.sh
index bafeb52..e09a9c4 100755
--- a/contrib/examples/git-reset.sh
+++ b/contrib/examples/git-reset.sh
@@ -75,7 +75,7 @@ else
 fi
 
 # Any resets update HEAD to the head being switched to.
-if orig=$(git rev-parse --verify HEAD 2>/dev/null)
+if orig=$(git rev-parse --verify -q HEAD)
 then
 	echo "$orig" >"$GIT_DIR/ORIG_HEAD"
 else
diff --git a/contrib/examples/git-revert.sh b/contrib/examples/git-revert.sh
index 49f0032..5672b4f 100755
--- a/contrib/examples/git-revert.sh
+++ b/contrib/examples/git-revert.sh
@@ -78,9 +78,9 @@ esac
 rev=$(git-rev-parse --verify "$@") &&
 commit=$(git-rev-parse --verify "$rev^0") ||
 	die "Not a single commit $@"
-prev=$(git-rev-parse --verify "$commit^1" 2>/dev/null) ||
+prev=$(git rev-parse --verify -q "$commit^1") ||
 	die "Cannot run $me a root commit"
-git-rev-parse --verify "$commit^2" >/dev/null 2>&1 &&
+git rev-parse --verify -q "$commit^2" >/dev/null &&
 	die "Cannot run $me a multi-parent commit."
 
 encoding=$(git config i18n.commitencoding || echo UTF-8)
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 9e03eee..0b13d23 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -573,7 +573,7 @@ sub is_sha1 {
 
 sub get_headref ($) {
 	my $name = shift;
-	my $r = `git rev-parse --verify '$name' 2>/dev/null`;
+	my $r = `git rev-parse --verify -q '$name' 2>/dev/null`;
 	return undef unless $? == 0;
 	chomp $r;
 	return $r;
diff --git a/git-stash.sh b/git-stash.sh
index aa47e54..f6bd623 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -39,7 +39,7 @@ clear_stash () {
 	then
 		die "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 -q $ref_stash)
 	then
 		git update-ref -d $ref_stash $current
 	fi
@@ -201,7 +201,7 @@ save_stash () {
 }
 
 have_stash () {
-	git rev-parse --verify $ref_stash >/dev/null 2>&1
+	git rev-parse --verify -q $ref_stash >/dev/null
 }
 
 list_stash () {
@@ -342,16 +342,17 @@ drop_stash () {
 	fi
 	# Verify supplied argument looks like a stash entry
 	s=$(git rev-parse --verify "$@") &&
-	git rev-parse --verify "$s:"   > /dev/null 2>&1 &&
-	git rev-parse --verify "$s^1:" > /dev/null 2>&1 &&
-	git rev-parse --verify "$s^2:" > /dev/null 2>&1 ||
+	git rev-parse --verify -q "$s:"   > /dev/null &&
+	git rev-parse --verify -q "$s^1:" > /dev/null &&
+	git rev-parse --verify -q "$s^2:" > /dev/null ||
 		die "$*: not a valid stashed state"
 
 	git reflog delete --updateref --rewrite "$@" &&
 		say "Dropped $* ($s)" || die "$*: 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 -q "$ref_stash@{0}" > /dev/null 2>&1 ||
+		clear_stash
 }
 
 apply_to_branch () {
diff --git a/templates/hooks--pre-commit.sample b/templates/hooks--pre-commit.sample
index 439eefd..a1ebe75 100755
--- a/templates/hooks--pre-commit.sample
+++ b/templates/hooks--pre-commit.sample
@@ -7,7 +7,7 @@
 #
 # To enable this hook, rename this file to "pre-commit".
 
-if git-rev-parse --verify HEAD >/dev/null 2>&1
+if git rev-parse --verify -q HEAD >/dev/null
 then
 	against=HEAD
 else
-- 
1.7.0.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] pull: use --quiet rather than 2>/dev/null
  2010-03-21  4:33       ` Jonathan Nieder
@ 2010-03-21 17:34         ` Benjamin Meyer
  2010-03-23  3:23           ` Jonathan Nieder
  0 siblings, 1 reply; 9+ messages in thread
From: Benjamin Meyer @ 2010-03-21 17:34 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git


On Mar 21, 2010, at 12:33 AM, Jonathan Nieder wrote:

> Hi again,
> 
> Benjamin Meyer wrote:
> 
>> re-checking the other patches I think they are correct in their
>> usage.
> 
> Thanks for checking.
> 
>> I ran the matching tests, the rebase ones passed,
>> 3903-stash.sh is already failing before my patch and
>> t3904-stash-patch.sh continues passing with the patch.  Other then
>> running the tests in t/ is there anything I should do to verify
>> patches?
> 
> Regarding testing: the best thing to do IMHO is to explain in the commit
> message what effect the patch will have.  Then reviewers (including you)
> can read it and try it out to make sure what you say is true.
> 
> The test suite is not very good for checking that a patch does what
> it’s meant to do, but that’s okay, since it has a different purpose [1].
> 
> As an example of what I mean, here is your patch 1/4 again (untested,
> though).  I didn’t add any tests since it would be kind of hard to
> provoke address space exhaustion at just the right moment.

[snip]

Thanks for the example.  I will try to include a more full explanation for my changes in the future so it can be more easily reviewed.

-Benjamin Meyer

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] pull: use --quiet rather than 2>/dev/null
  2010-03-21 17:34         ` Benjamin Meyer
@ 2010-03-23  3:23           ` Jonathan Nieder
  0 siblings, 0 replies; 9+ messages in thread
From: Jonathan Nieder @ 2010-03-23  3:23 UTC (permalink / raw)
  To: Benjamin Meyer; +Cc: git

Benjamin Meyer wrote:

> Thanks for the example.  I will try to include a more full
> explanation for my changes in the future so it can be more easily
> reviewed.

Thanks for your work!  I got a kick out of reading
<http://meyerhome.net/icefox/git-achievements>, by the way.

Jonathan

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-03-23  3:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-20  2:18 [PATCH 1/4] stash: use --quiet rather than using 2>/dev/null Benjamin C Meyer
2010-03-20  2:18 ` [PATCH 2/4] pull: use --quiet rather than 2>/dev/null Benjamin C Meyer
2010-03-20 12:35   ` Jonathan Nieder
2010-03-20 18:59     ` Benjamin Meyer
2010-03-21  4:33       ` Jonathan Nieder
2010-03-21 17:34         ` Benjamin Meyer
2010-03-23  3:23           ` Jonathan Nieder
2010-03-20  2:18 ` [PATCH 3/4] rebase: " Benjamin C Meyer
2010-03-20  2:18 ` [PATCH 4/4] rebase-interactive: " Benjamin C Meyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).