Skip to contentSkip to conversation

handle branches with slashes in guilt-graph

GUILT Per Cederqvist 4 participants 6 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

Avoid sed errors when the branch name contains a slash.

usr/bin/guilt-graph renamed from usr/bin/guilt-graph~ +2 -1
@@ -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
#1 lore raw
Quoted 1 line · Per Cederqvist

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.

Quoted 16 lines
usr/bin/guilt-graph renamed from usr/bin/guilt-graph~ +2 -1
@@ -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
Signature · 2 lines
Once you have their hardware. Never give it back.
(The First Rule of Hardware Acquisition)
#2 lore raw
In reply to Per Cederqvist
Quoted 7 lines · Per Cederqvist

Avoid sed errors when the branch name contains a slash.

usr/bin/guilt-graph disp "digraph G {" · line 43

Quoted 8 lines
usr/bin/guilt-graph renamed from usr/bin/guilt-graph~ +2 -1
@@ -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.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#3 lore raw
Quoted 20 lines · Andreas Schwab
Quoted 7 lines · Per Cederqvist

Avoid sed errors when the branch name contains a slash.

usr/bin/guilt-graph disp "digraph G {" · line 43

Quoted 8 lines
usr/bin/guilt-graph renamed from usr/bin/guilt-graph~ +2 -1
@@ -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 `,':

Quoted 1 line
  \,^$current refs/patches/$branch, {

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

The vertical var | is available, though ;-)

#4 lore raw
Quoted 7 lines · Junio C Hamano
Quoted 3 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.

#5 lore raw
In reply to Junio C Hamano
Quoted 22 lines · Junio C Hamano
Quoted 20 lines · Andreas Schwab
Quoted 7 lines · Per Cederqvist

Avoid sed errors when the branch name contains a slash.

usr/bin/guilt-graph disp "digraph G {" · line 43

Quoted 8 lines
usr/bin/guilt-graph renamed from usr/bin/guilt-graph~ +2 -1
@@ -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 `,':

Quoted 3 lines
Quoted 1 line
  \,^$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.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."