Skip to contentSkip to conversation

More "use rev-parse -q" patches

PATCH New Miklos Vajna 1 participant 6 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

cover More "use rev-parse -q" patches

Hi,

I'm sending these as separate patches as they touch completely unrelated parts of Git, but feel free to squash them together you think that's better.

All of them is about using rev-parse -q instead of rev-parse 2>/dev/null.

Miklos Vajna (5):
filter-branch: use git rev-parse -q
lost-found: use git rev-parse -q
pull: use git rev-parse -q
rebase: use git rev-parse -q
submodule: use git rev-parse -q

 git-filter-branch.sh |    2 +-
 git-lost-found.sh    |    2 +-
 git-pull.sh          |    8 ++++----
 git-rebase.sh        |    4 ++--
 git-submodule.sh     |    6 +++---
 5 files changed, 11 insertions(+), 11 deletions(-)
#1 lore raw

PATCH 1/5 filter-branch: use git rev-parse -q

---
 git-filter-branch.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
git-filter-branch.sh +1 -1
index 81392ad..c106f45 100755
@@ -256,7 +256,7 @@ while read commit parents; do
 	*)
 		# The commit may not have the subdirectory at all
 		err=$(git read-tree -i -m $commit:"$filter_subdir" 2>&1) || {
-			if ! git rev-parse --verify $commit:"$filter_subdir" 2>/dev/null
+			if ! git rev-parse -q --verify $commit:"$filter_subdir"
 			then
 				rm -f "$GIT_INDEX_FILE"
 			else
Signature · 1 line
1.6.0.4
#2 lore raw

PATCH 2/5 lost-found: use git rev-parse -q

---
 git-lost-found.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
git-lost-found.sh +1 -1
index 9cedaf8..0b3e8c7 100755
@@ -20,7 +20,7 @@ while read dangling type sha1
 do
 	case "$dangling" in
 	dangling)
-		if git rev-parse --verify "$sha1^0" >/dev/null 2>/dev/null
+		if git rev-parse -q --verify "$sha1^0" >/dev/null
 		then
 			dir="$laf/commit"
 			git show-branch "$sha1"
Signature · 1 line
1.6.0.4
#3 lore raw

PATCH 3/5 pull: use git rev-parse -q

---
 git-pull.sh |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
git-pull.sh +4 -4
index 1cac898..2c7f432 100755
@@ -121,13 +121,13 @@ test true = "$rebase" && {
 	test -z "$origin" && origin=$(get_default_remote)
 	reflist="$(get_remote_refs_for_fetch "$@" 2>/dev/null |
 		sed "s|refs/heads/\(.*\):|\1|")" &&
-	oldremoteref="$(git rev-parse --verify \
-		"refs/remotes/$origin/$reflist" 2>/dev/null)"
+	oldremoteref="$(git rev-parse -q --verify \
+		"refs/remotes/$origin/$reflist")"
 }
-orig_head=$(git rev-parse --verify HEAD 2>/dev/null)
+orig_head=$(git rev-parse -q --verify HEAD)
 git fetch $verbosity --update-head-ok "$@" || exit 1
 
-curr_head=$(git rev-parse --verify HEAD 2>/dev/null)
+curr_head=$(git rev-parse -q --verify HEAD)
 if test -n "$orig_head" && test "$curr_head" != "$orig_head"
 then
 	# The fetch involved updating the current branch.
Signature · 1 line
1.6.0.4
#4 lore raw

PATCH 4/5 rebase: use git rev-parse -q

---
 git-rebase.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
git-rebase.sh +2 -2
index 023a6dc..ea7720d 100755
@@ -365,10 +365,10 @@ case "$#" in
 	switch_to="$2"
 
 	if git show-ref --verify --quiet -- "refs/heads/$2" &&
-	   branch=$(git rev-parse --verify "refs/heads/$2" 2>/dev/null)
+	   branch=$(git rev-parse -q --verify "refs/heads/$2")
 	then
 		head_name="refs/heads/$2"
-	elif branch=$(git rev-parse --verify "$2" 2>/dev/null)
+	elif branch=$(git rev-parse -q --verify "$2")
 	then
 		head_name="detached HEAD"
 	else
Signature · 1 line
1.6.0.4
#5 lore raw

PATCH 5/5 submodule: use git rev-parse -q

---
 git-submodule.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
git-submodule.sh +3 -3
index 220d94e..2f47e06 100755
@@ -413,7 +413,7 @@ cmd_summary() {
 
 	test $summary_limit = 0 && return
 
-	if rev=$(git rev-parse --verify "$1^0" 2>/dev/null)
+	if rev=$(git rev-parse -q --verify "$1^0")
 	then
 		head=$rev
 		shift
@@ -464,11 +464,11 @@ cmd_summary() {
 		missing_dst=
 
 		test $mod_src = 160000 &&
-		! GIT_DIR="$name/.git" git-rev-parse --verify $sha1_src^0 >/dev/null 2>&1 &&
+		! GIT_DIR="$name/.git" git-rev-parse -q --verify $sha1_src^0 >/dev/null &&
 		missing_src=t
 
 		test $mod_dst = 160000 &&
-		! GIT_DIR="$name/.git" git-rev-parse --verify $sha1_dst^0 >/dev/null 2>&1 &&
+		! GIT_DIR="$name/.git" git-rev-parse -q --verify $sha1_dst^0 >/dev/null &&
 		missing_dst=t
 
 		total_commits=
Signature · 1 line
1.6.0.4