git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] parse-remote: replace unnecessary sed invocation
@ 2011-03-30  8:48 Stephen Boyd
  2011-03-30 18:31 ` Michael Schubert
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Boyd @ 2011-03-30  8:48 UTC (permalink / raw
  To: git; +Cc: Junio C Hamano

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

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

* Re: [PATCH] parse-remote: replace unnecessary sed invocation
  2011-03-30  8:48 [PATCH] parse-remote: replace unnecessary sed invocation Stephen Boyd
@ 2011-03-30 18:31 ` Michael Schubert
  2011-03-31  1:02   ` Stephen Boyd
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Schubert @ 2011-03-30 18:31 UTC (permalink / raw
  To: git; +Cc: Stephen Boyd, Junio C Hamano

> +       curr_branch=$(git symbolic-ref -q HEAD)
> +       curr_branch="${cur_branch#refs/heads/}"
                                           ^^^



-- 
ms

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

* Re: [PATCH] parse-remote: replace unnecessary sed invocation
  2011-03-30 18:31 ` Michael Schubert
@ 2011-03-31  1:02   ` Stephen Boyd
  2011-03-31  2:31     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Boyd @ 2011-03-31  1:02 UTC (permalink / raw
  To: Michael Schubert, Junio C Hamano; +Cc: git

On Wed, Mar 30, 2011 at 11:31 AM, Michael Schubert <mschub@elegosoft.com> wrote:
>> +       curr_branch=$(git symbolic-ref -q HEAD)
>> +       curr_branch="${cur_branch#refs/heads/}"
>                                           ^^^

Ah! How did this pass the test suite... Anyway, looks like Junio
applied this patch to maint already :-( Sorry.

Junio, please apply this (probably word wrapped since this is gmail
interface) and drop your trust level of me by a few points.

diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 9168879..ea093d2 100644
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -6,7 +6,7 @@ GIT_DIR=$(git rev-parse -q --git-dir) || :;

 get_default_remote () {
        curr_branch=$(git symbolic-ref -q HEAD)
-       curr_branch="${cur_branch#refs/heads/}"
+       curr_branch="${curr_branch#refs/heads/}"
        origin=$(git config --get "branch.$curr_branch.remote")
        echo ${origin:-origin}
 }

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

* Re: [PATCH] parse-remote: replace unnecessary sed invocation
  2011-03-31  1:02   ` Stephen Boyd
@ 2011-03-31  2:31     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2011-03-31  2:31 UTC (permalink / raw
  To: Stephen Boyd; +Cc: Michael Schubert, Junio C Hamano, git

Stephen Boyd <bebarino@gmail.com> writes:

> On Wed, Mar 30, 2011 at 11:31 AM, Michael Schubert <mschub@elegosoft.com> wrote:
>>> +       curr_branch=$(git symbolic-ref -q HEAD)
>>> +       curr_branch="${cur_branch#refs/heads/}"
>>                                           ^^^
>
> Ah! How did this pass the test suite... Anyway, looks like Junio
> applied this patch to maint already :-( Sorry.

Heh, I was wondering what those three carets under ads in "#refs/heads/"
was pointing at, and didn't see you had only one R in the variable name.

Thanks for a correction, and Michael, please be a bit more specific (and
point the correct part with your carret) when you send your messages.

> Junio, please apply this (probably word wrapped since this is gmail
> interface) and drop your trust level of me by a few points.
>
> diff --git a/git-parse-remote.sh b/git-parse-remote.sh
> index 9168879..ea093d2 100644
> --- a/git-parse-remote.sh
> +++ b/git-parse-remote.sh
> @@ -6,7 +6,7 @@ GIT_DIR=$(git rev-parse -q --git-dir) || :;
>
>  get_default_remote () {
>         curr_branch=$(git symbolic-ref -q HEAD)
> -       curr_branch="${cur_branch#refs/heads/}"
> +       curr_branch="${curr_branch#refs/heads/}"
>         origin=$(git config --get "branch.$curr_branch.remote")
>         echo ${origin:-origin}
>  }

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

end of thread, other threads:[~2011-03-31  2:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-30  8:48 [PATCH] parse-remote: replace unnecessary sed invocation Stephen Boyd
2011-03-30 18:31 ` Michael Schubert
2011-03-31  1:02   ` Stephen Boyd
2011-03-31  2:31     ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).