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

[PATCH] parse-remote: replace unnecessary sed invocation

From
Stephen Boyd <bebarino@gmail.com>
Date
Mar 30, 2011, 08:48 UTC
Message-ID
<1301474920-6718-1-git-send-email-bebarino@gmail.com>
Just use parameter expansion instead.
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
---
Cleaning out the attic.
 git-parse-remote.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index e7013f7..9168879 100644
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -5,7 +5,8 @@
 GIT_DIR=$(git rev-parse -q --git-dir) || :;
 
 get_default_remote () {
-	curr_branch=$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||')
+	curr_branch=$(git symbolic-ref -q HEAD)
+	curr_branch="${cur_branch#refs/heads/}"
 	origin=$(git config --get "branch.$curr_branch.remote")
 	echo ${origin:-origin}
 }
-- 
1.7.4.2.422.g537d99
Next: Michael Schubert
Message 1 of 4 in “parse-remote: replace unnecessary sed invocation”
  1. parse-remote: replace unnecessary sed invocationStephen Boyd, Mar 30, 2011
  2. Michael SchubertMar 30, 2011
  3. Stephen BoydMar 31, 2011
  4. Junio C HamanoMar 31, 2011

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.