threads / discuss / 28711

[GUILT] handle branches with slashes in guilt-graph

Subject: [GUILT] handle branches with slashes in guilt-graph

## tl;dr

6 messages between Oct 18, 2011 and Oct 18, 2011.

replies: 5people: 4as markdown or json

Per Cederqvist· Oct 18, 2011, 10:40 UTC · lore
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· Oct 18, 2011, 13:30 UTC · re: Per Cederqvist · lore

Re: [GUILT] handle branches with slashes in guilt-graph

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.
Show 16 quoted lines
> 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· Oct 18, 2011, 18:35 UTC · re: Per Cederqvist · lore

Re: [GUILT] handle branches with slashes in guilt-graph

Per Cederqvist <cederp@opera.com> writes:
Show 15 quoted lines
> 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· Oct 18, 2011, 19:12 UTC · re: Andreas Schwab · lore

Re: [GUILT] handle branches with slashes in guilt-graph

Andreas Schwab <schwab@linux-m68k.org> writes:
Show 21 quoted lines
> 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· Oct 18, 2011, 19:15 UTC · re: Junio C Hamano · lore

Re: [GUILT] handle branches with slashes in guilt-graph

Junio C Hamano <gitster@pobox.com> writes:
Show 7 quoted lines
>> 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· Oct 18, 2011, 19:56 UTC · re: Junio C Hamano · lore

Re: [GUILT] handle branches with slashes in guilt-graph

Junio C Hamano <gitster@pobox.com> writes:
Show 25 quoted lines
> 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."

← back to recent threads