# [GUILT] handle branches with slashes in guilt-graph

6 messages from 2011-10-18 to 2011-10-18. Participants: Per Cederqvist, Jeff Sipek, Andreas Schwab, Junio C Hamano.
Thread: https://gitlist.dev/t/28711

## Per Cederqvist, 2011-10-18 10:40

Subject: [GUILT] handle branches with slashes in guilt-graph
Message-ID: <4E9D57BB.2030707@opera.com>
URL: https://gitlist.dev/e/4E9D57BB.2030707%40opera.com

```
Avoid sed errors when the branch name contains a slash.

Signed-off-by: Per Cederqvist <cederp@opera.com>

--- /usr/bin/guilt-graph~	2011-01-25 20:15:50.000000000 +0100
+++ /usr/bin/guilt-graph	2011-10-18 12:30:31.000000000 +0200
@@ -37,9 +37,10 @@ disp "digraph G {"

  current="$top"

+safebranch=`echo "$branch"|sed 's%/%\\\\/%g'`
  while [ "$current" != "$base" ]; do
  	pname=`git show-ref | sed -n -e "
-/^$current refs\/patches\/$branch/ {
+/^$current refs\/patches\/$safebranch/ {
  	s,^$current refs/patches/$branch/,,
  	p
  	q

```

## Jeff Sipek, 2011-10-18 13:30

Subject: Re: [GUILT] handle branches with slashes in guilt-graph
Message-ID: <20111018133038.GA16088@josefsipek.net>
URL: https://gitlist.dev/e/20111018133038.GA16088%40josefsipek.net
In-Reply-To: <4E9D57BB.2030707@opera.com>

```
On Tue, Oct 18, 2011 at 12:40:59PM +0200, Per Cederqvist wrote:
> Avoid sed errors when the branch name contains a slash.

Makes sense.  I'll test it and add it to my patch queue.

Thanks,

Jeff.

> Signed-off-by: Per Cederqvist <cederp@opera.com>
> 
> --- /usr/bin/guilt-graph~	2011-01-25 20:15:50.000000000 +0100
> +++ /usr/bin/guilt-graph	2011-10-18 12:30:31.000000000 +0200
> @@ -37,9 +37,10 @@ disp "digraph G {"
> 
>  current="$top"
> 
> +safebranch=`echo "$branch"|sed 's%/%\\\\/%g'`
>  while [ "$current" != "$base" ]; do
>  	pname=`git show-ref | sed -n -e "
> -/^$current refs\/patches\/$branch/ {
> +/^$current refs\/patches\/$safebranch/ {
>  	s,^$current refs/patches/$branch/,,
>  	p
>  	q

-- 
Once you have their hardware. Never give it back.
(The First Rule of Hardware Acquisition)

```

## Andreas Schwab, 2011-10-18 18:35

Subject: Re: [GUILT] handle branches with slashes in guilt-graph
Message-ID: <m2r52adu65.fsf@igel.home>
URL: https://gitlist.dev/e/m2r52adu65.fsf%40igel.home
In-Reply-To: <4E9D57BB.2030707@opera.com>

```
Per Cederqvist <cederp@opera.com> writes:

> Avoid sed errors when the branch name contains a slash.
>
> Signed-off-by: Per Cederqvist <cederp@opera.com>
>
> --- /usr/bin/guilt-graph~	2011-01-25 20:15:50.000000000 +0100
> +++ /usr/bin/guilt-graph	2011-10-18 12:30:31.000000000 +0200
> @@ -37,9 +37,10 @@ disp "digraph G {"
>
>  current="$top"
>
> +safebranch=`echo "$branch"|sed 's%/%\\\\/%g'`
>  while [ "$current" != "$base" ]; do
>  	pname=`git show-ref | sed -n -e "
> -/^$current refs\/patches\/$branch/ {
> +/^$current refs\/patches\/$safebranch/ {

Alternatively, you could change the delimiter to `,':

  \,^$current refs/patches/$branch, {

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

```

## Junio C Hamano, 2011-10-18 19:12

Subject: Re: [GUILT] handle branches with slashes in guilt-graph
Message-ID: <7v39eqglle.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v39eqglle.fsf%40alter.siamese.dyndns.org
In-Reply-To: <m2r52adu65.fsf@igel.home>

```
Andreas Schwab <schwab@linux-m68k.org> writes:

> Per Cederqvist <cederp@opera.com> writes:
>
>> Avoid sed errors when the branch name contains a slash.
>>
>> Signed-off-by: Per Cederqvist <cederp@opera.com>
>>
>> --- /usr/bin/guilt-graph~	2011-01-25 20:15:50.000000000 +0100
>> +++ /usr/bin/guilt-graph	2011-10-18 12:30:31.000000000 +0200
>> @@ -37,9 +37,10 @@ disp "digraph G {"
>>
>>  current="$top"
>>
>> +safebranch=`echo "$branch"|sed 's%/%\\\\/%g'`
>>  while [ "$current" != "$base" ]; do
>>  	pname=`git show-ref | sed -n -e "
>> -/^$current refs\/patches\/$branch/ {
>> +/^$current refs\/patches\/$safebranch/ {
>
> Alternatively, you could change the delimiter to `,':
>
>   \,^$current refs/patches/$branch, {

Isn't a comma still valid character in a branch name?

The vertical var | is available, though ;-)

```

## Junio C Hamano, 2011-10-18 19:15

Subject: Re: [GUILT] handle branches with slashes in guilt-graph
Message-ID: <7vy5wif6w3.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vy5wif6w3.fsf%40alter.siamese.dyndns.org
In-Reply-To: <7v39eqglle.fsf@alter.siamese.dyndns.org>

```
Junio C Hamano <gitster@pobox.com> writes:

>> Alternatively, you could change the delimiter to `,':
>>
>>   \,^$current refs/patches/$branch, {
>
> Isn't a comma still valid character in a branch name?
>
> The vertical var | is available, though ;-)

Nah, sorry, '|' is not.

```

## Andreas Schwab, 2011-10-18 19:56

Subject: Re: [GUILT] handle branches with slashes in guilt-graph
Message-ID: <m2mxcydqfa.fsf@igel.home>
URL: https://gitlist.dev/e/m2mxcydqfa.fsf%40igel.home
In-Reply-To: <7v39eqglle.fsf@alter.siamese.dyndns.org>

```
Junio C Hamano <gitster@pobox.com> writes:

> Andreas Schwab <schwab@linux-m68k.org> writes:
>
>> Per Cederqvist <cederp@opera.com> writes:
>>
>>> Avoid sed errors when the branch name contains a slash.
>>>
>>> Signed-off-by: Per Cederqvist <cederp@opera.com>
>>>
>>> --- /usr/bin/guilt-graph~	2011-01-25 20:15:50.000000000 +0100
>>> +++ /usr/bin/guilt-graph	2011-10-18 12:30:31.000000000 +0200
>>> @@ -37,9 +37,10 @@ disp "digraph G {"
>>>
>>>  current="$top"
>>>
>>> +safebranch=`echo "$branch"|sed 's%/%\\\\/%g'`
>>>  while [ "$current" != "$base" ]; do
>>>  	pname=`git show-ref | sed -n -e "
>>> -/^$current refs\/patches\/$branch/ {
>>> +/^$current refs\/patches\/$safebranch/ {
>>
>> Alternatively, you could change the delimiter to `,':
>>
>>   \,^$current refs/patches/$branch, {
>
> Isn't a comma still valid character in a branch name?

I suggested the comma because it is already used by the next sed
command, so that won't be a regression.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

```
