All of lore.kernel.org
 help / color / mirror / Atom feed
* [TopGit PATCH] hooks/pre-commit.sh: fix it again
@ 2009-03-25 11:43 Bert Wesarg
  2009-03-25 12:17 ` martin f krafft
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Bert Wesarg @ 2009-03-25 11:43 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Bert Wesarg, git, martin f krafft, u.kleine-koenig

First I think the '#' is a leftover, second this is now a bashism.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>

---
 hooks/pre-commit.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hooks/pre-commit.sh b/hooks/pre-commit.sh
index a12cfa6..edf2932 100644
--- a/hooks/pre-commit.sh
+++ b/hooks/pre-commit.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # TopGit - A different patch queue manager
 # (c) Petr Baudis <pasky@suse.cz>  2008
 # GPLv2
@@ -20,7 +20,7 @@ tg_util
 if head_=$(git symbolic-ref -q HEAD); then
 	case "$head_" in
 		refs/heads/*)
-			git rev-parse -q --verify "${head_/#refs\/heads/refs\/top-bases}" >/dev/null || exit 0;;
+			git rev-parse -q --verify "${head_/refs\/heads/refs\/top-bases}" >/dev/null || exit 0;;
 		*)
 			exit 0;;
 	esac
-- 
tg: (fcb488d..) bw/fix-hook-again (depends on: master)

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

* Re: [TopGit PATCH] hooks/pre-commit.sh: fix it again
  2009-03-25 11:43 [TopGit PATCH] hooks/pre-commit.sh: fix it again Bert Wesarg
@ 2009-03-25 12:17 ` martin f krafft
  2009-03-25 12:20 ` Uwe Kleine-König
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: martin f krafft @ 2009-03-25 12:17 UTC (permalink / raw)
  To: Bert Wesarg; +Cc: Petr Baudis, git, u.kleine-koenig

[-- Attachment #1: Type: text/plain, Size: 1112 bytes --]

also sprach Bert Wesarg <bert.wesarg@googlemail.com> [2009.03.25.1243 +0100]:
> First I think the '#' is a leftover, second this is now a bashism.

I think this can be rewritten as POSIX as follows:

> -			git rev-parse -q --verify "${head_/#refs\/heads/refs\/top-bases}" >/dev/null || exit 0;;
> +			git rev-parse -q --verify "${head_/refs\/heads/refs\/top-bases}" >/dev/null || exit 0;;

  git rev-parse -q --verify "refs/top-bases/${head_##refs/heads/}" >/dev/null || exit 0;;

This turns e.g. refs/heads/foo into foo and prepends
refs/top-bases/, which should be the same effect, assuming that the
variable's value contains nothing else but the ref's path.

-- 
 .''`.   martin f. krafft <madduck@d.o>      Related projects:
: :'  :  proud Debian developer               http://debiansystem.info
`. `'`   http://people.debian.org/~madduck    http://vcs-pkg.org
  `-  Debian - when you have better things to do than fixing systems
 
logik ist analsadismus: gedanken werden gewaltsam
durch einen engen gang gepreßt.
                                                    -- frei nach lacan

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [TopGit PATCH] hooks/pre-commit.sh: fix it again
  2009-03-25 11:43 [TopGit PATCH] hooks/pre-commit.sh: fix it again Bert Wesarg
  2009-03-25 12:17 ` martin f krafft
@ 2009-03-25 12:20 ` Uwe Kleine-König
  2009-03-25 12:24   ` Bert Wesarg
  2009-03-25 21:44 ` Uwe Kleine-König
  2009-03-26  9:00 ` [PATCH TopGit] hooks/pre-commit.sh: fix bashism Uwe Kleine-König
  3 siblings, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2009-03-25 12:20 UTC (permalink / raw)
  To: Bert Wesarg; +Cc: Petr Baudis, git, martin f krafft

On Wed, Mar 25, 2009 at 12:43:04PM +0100, Bert Wesarg wrote:
> First I think the '#' is a leftover, second this is now a bashism.
according to bash(1):

	If pattern begins with #, it must match at the beginning of the
	expanded value of parameter.

And I noticed, too, that this is a bashism.  Using dash it fails, even
with your patch.

I would prefer to really fix it now.

Best regards
Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

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

* Re: [TopGit PATCH] hooks/pre-commit.sh: fix it again
  2009-03-25 12:20 ` Uwe Kleine-König
@ 2009-03-25 12:24   ` Bert Wesarg
  0 siblings, 0 replies; 8+ messages in thread
From: Bert Wesarg @ 2009-03-25 12:24 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Petr Baudis, git, martin f krafft

2009/3/25 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> On Wed, Mar 25, 2009 at 12:43:04PM +0100, Bert Wesarg wrote:
>> First I think the '#' is a leftover, second this is now a bashism.
> according to bash(1):
>
>        If pattern begins with #, it must match at the beginning of the
>        expanded value of parameter.
That is obviously true, I first removed this # and than switch to bash
(after it stills failed), so this was just thinking not testing.

>
> And I noticed, too, that this is a bashism.  Using dash it fails, even
> with your patch.
>
> I would prefer to really fix it now.
Thanks. I intended this patch as a bug report.

Bert
>
> Best regards
> Uwe
>
> --
> Pengutronix e.K.                              | Uwe Kleine-König            |
> Industrial Linux Solutions                    | http://www.pengutronix.de/  |
>

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

* Re: [TopGit PATCH] hooks/pre-commit.sh: fix it again
  2009-03-25 11:43 [TopGit PATCH] hooks/pre-commit.sh: fix it again Bert Wesarg
  2009-03-25 12:17 ` martin f krafft
  2009-03-25 12:20 ` Uwe Kleine-König
@ 2009-03-25 21:44 ` Uwe Kleine-König
  2009-03-26  9:00 ` [PATCH TopGit] hooks/pre-commit.sh: fix bashism Uwe Kleine-König
  3 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2009-03-25 21:44 UTC (permalink / raw)
  To: Bert Wesarg; +Cc: Petr Baudis, git, martin f krafft

Hello,

>  if head_=$(git symbolic-ref -q HEAD); then
>  	case "$head_" in
>  		refs/heads/*)
> -			git rev-parse -q --verify "${head_/#refs\/heads/refs\/top-bases}" >/dev/null || exit 0;;
> +			git rev-parse -q --verify "${head_/refs\/heads/refs\/top-bases}" >/dev/null || exit 0;;
			git rev-parse -q --verify "refs/top-bases${head_#refs/heads}" >/dev/null || exit 0;;

should work.

But I'm too tired to make a patch now.  That probably would only result
in more crap...

Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

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

* [PATCH TopGit] hooks/pre-commit.sh: fix bashism
  2009-03-25 11:43 [TopGit PATCH] hooks/pre-commit.sh: fix it again Bert Wesarg
                   ` (2 preceding siblings ...)
  2009-03-25 21:44 ` Uwe Kleine-König
@ 2009-03-26  9:00 ` Uwe Kleine-König
  2009-03-26  9:29   ` Marc Kleine-Budde
  3 siblings, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2009-03-26  9:00 UTC (permalink / raw)
  To: Bert Wesarg; +Cc: Petr Baudis, git, martin f krafft, Marc Kleine-Budde

This was introduced in fcb488d51e72c7414f9beb40ad06bf529b8b38dc.
A similar fix was suggested by martin f krafft, too.

Reported-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,

this should fix the issue now.

If I don't get negative feed back I will push this change later today.
I'm open for acks, too.

Best regards and thanks
Uwe

 hooks/pre-commit.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hooks/pre-commit.sh b/hooks/pre-commit.sh
index a12cfa6..9d677e9 100644
--- a/hooks/pre-commit.sh
+++ b/hooks/pre-commit.sh
@@ -20,7 +20,7 @@ tg_util
 if head_=$(git symbolic-ref -q HEAD); then
 	case "$head_" in
 		refs/heads/*)
-			git rev-parse -q --verify "${head_/#refs\/heads/refs\/top-bases}" >/dev/null || exit 0;;
+			git rev-parse -q --verify "refs/top-bases${head_#refs/heads}" >/dev/null || exit 0;;
 		*)
 			exit 0;;
 	esac
-- 
1.6.2

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

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

* Re: [PATCH TopGit] hooks/pre-commit.sh: fix bashism
  2009-03-26  9:00 ` [PATCH TopGit] hooks/pre-commit.sh: fix bashism Uwe Kleine-König
@ 2009-03-26  9:29   ` Marc Kleine-Budde
  2009-03-26 14:21     ` Bert Wesarg
  0 siblings, 1 reply; 8+ messages in thread
From: Marc Kleine-Budde @ 2009-03-26  9:29 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Bert Wesarg, Petr Baudis, git, martin f krafft, Marc Kleine-Budde

[-- Attachment #1: Type: text/plain, Size: 1484 bytes --]

Uwe Kleine-König wrote:
> This was introduced in fcb488d51e72c7414f9beb40ad06bf529b8b38dc.
> A similar fix was suggested by martin f krafft, too.

Works here on ubuntu bin /bin/sh is a link to /bin/dash

> Reported-by: Bert Wesarg <bert.wesarg@googlemail.com>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Marc Kleine-Budde <mkl@pengutronix.de>

> ---
> Hello,
> 
> this should fix the issue now.
> 
> If I don't get negative feed back I will push this change later today.
> I'm open for acks, too.
> 
> Best regards and thanks
> Uwe
> 
>  hooks/pre-commit.sh |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/hooks/pre-commit.sh b/hooks/pre-commit.sh
> index a12cfa6..9d677e9 100644
> --- a/hooks/pre-commit.sh
> +++ b/hooks/pre-commit.sh
> @@ -20,7 +20,7 @@ tg_util
>  if head_=$(git symbolic-ref -q HEAD); then
>  	case "$head_" in
>  		refs/heads/*)
> -			git rev-parse -q --verify "${head_/#refs\/heads/refs\/top-bases}" >/dev/null || exit 0;;
> +			git rev-parse -q --verify "refs/top-bases${head_#refs/heads}" >/dev/null || exit 0;;
>  		*)
>  			exit 0;;
>  	esac

Marc

-- 
Pengutronix e.K.                         | Marc Kleine-Budde           |
Linux Solutions for Science and Industry | Phone: +49-231-2826-924     |
Vertretung West/Dortmund                 | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686         | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* Re: [PATCH TopGit] hooks/pre-commit.sh: fix bashism
  2009-03-26  9:29   ` Marc Kleine-Budde
@ 2009-03-26 14:21     ` Bert Wesarg
  0 siblings, 0 replies; 8+ messages in thread
From: Bert Wesarg @ 2009-03-26 14:21 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Uwe Kleine-König, Petr Baudis, git, martin f krafft,
	Marc Kleine-Budde

2009/3/26 Marc Kleine-Budde <mkl@pengutronix.de>:
> Uwe Kleine-König wrote:
>> This was introduced in fcb488d51e72c7414f9beb40ad06bf529b8b38dc.
>> A similar fix was suggested by martin f krafft, too.
>
> Works here on ubuntu bin /bin/sh is a link to /bin/dash
>
>> Reported-by: Bert Wesarg <bert.wesarg@googlemail.com>
>> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Tested-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Bert Wesarg <bert.wesarg@googlemail.com>
Tested-by: Bert Wesarg <bert.wesarg@googlemail.com>

Thanks Uwe.

Bert

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

end of thread, other threads:[~2009-03-26 14:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-25 11:43 [TopGit PATCH] hooks/pre-commit.sh: fix it again Bert Wesarg
2009-03-25 12:17 ` martin f krafft
2009-03-25 12:20 ` Uwe Kleine-König
2009-03-25 12:24   ` Bert Wesarg
2009-03-25 21:44 ` Uwe Kleine-König
2009-03-26  9:00 ` [PATCH TopGit] hooks/pre-commit.sh: fix bashism Uwe Kleine-König
2009-03-26  9:29   ` Marc Kleine-Budde
2009-03-26 14:21     ` Bert Wesarg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.