git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] Use Linus' show ref in "git-branch.sh".

From
Christian Couder <chriscool@tuxfamily.org>
Date
Sep 17, 2006, 04:32 UTC
Message-ID
<20060917063224.0dc298ae.chriscool@tuxfamily.org>
In-Reply-To
<20060917062024.c476e07d.chriscool@tuxfamily.org>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 git-branch.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-branch.sh b/git-branch.sh
index e0501ec..2600e9c 100755
--- a/git-branch.sh
+++ b/git-branch.sh
@@ -21,7 +21,7 @@ delete_branch () {
 	,,)
 	    die "What branch are you on anyway?" ;;
 	esac
-	branch=$(cat "$GIT_DIR/refs/heads/$branch_name") &&
+	branch=$(git-show-ref --verify --hash -- "refs/heads/$branch_name") &&
 	    branch=$(git-rev-parse --verify "$branch^0") ||
 		die "Seriously, what branch are you talking about?"
 	case "$option" in
@@ -112,7 +112,7 @@ rev=$(git-rev-parse --verify "$head") ||
 git-check-ref-format "heads/$branchname" ||
 	die "we do not like '$branchname' as a branch name."
 
-if [ -e "$GIT_DIR/refs/heads/$branchname" ]
+if git-show-ref --verify --quiet -- "refs/heads/$branchname"
 then
 	if test '' = "$force"
 	then
-- 
1.4.2.1.gea00f-dirty
Previous: Christian CouderNext: Jakub Narebski
Message 2 of 4 in “Add [-s|--hash] option to Linus' show-ref.”
  1. 1/2 Add [-s|--hash] option to Linus' show-ref.Christian Couder, Sep 17, 2006
  2. 2/2 Use Linus' show ref in "git-branch.sh".Christian Couder, Sep 17, 2006
  3. Jakub NarebskiSep 17, 2006
  4. Christian CouderSep 17, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.