threads / patch / 16579

patch, 5 partslost-found: use git rev-parse -q

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

## tl;dr

6 messages between Dec 3, 2008 and Dec 3, 2008. Diffs are folded; open one to read it.

replies: 5people: 1as markdown or json

Miklos Vajna· Dec 3, 2008, 13:26 UTC · lore

[PATCH 0/5] 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(-)
Miklos Vajna· Dec 3, 2008, 13:26 UTC · re: Miklos Vajna · lore

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

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 git-filter-branch.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to git-filter-branch.sh +1 −1
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 81392ad..c106f45 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -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
-- 
1.6.0.4
Miklos Vajna· Dec 3, 2008, 13:26 UTC · re: Miklos Vajna · lore
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 git-lost-found.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to git-lost-found.sh +1 −1
diff --git a/git-lost-found.sh b/git-lost-found.sh
index 9cedaf8..0b3e8c7 100755
--- a/git-lost-found.sh
+++ b/git-lost-found.sh
@@ -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"
-- 
1.6.0.4
Miklos Vajna· Dec 3, 2008, 13:26 UTC · re: Miklos Vajna · lore

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

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 git-pull.sh |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
Show changes to git-pull.sh +4 −4
diff --git a/git-pull.sh b/git-pull.sh
index 1cac898..2c7f432 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -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.
-- 
1.6.0.4
Miklos Vajna· Dec 3, 2008, 13:26 UTC · re: Miklos Vajna · lore

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

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 git-rebase.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Show changes to git-rebase.sh +2 −2
diff --git a/git-rebase.sh b/git-rebase.sh
index 023a6dc..ea7720d 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -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
-- 
1.6.0.4
Miklos Vajna· Dec 3, 2008, 13:26 UTC · re: Miklos Vajna · lore

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

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 git-submodule.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Show changes to git-submodule.sh +3 −3
diff --git a/git-submodule.sh b/git-submodule.sh
index 220d94e..2f47e06 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -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=
-- 
1.6.0.4

← back to recent threads