{"thread":{"id":"9109","subject":"Re: [PATCH guilt] Handles slashes in branch names","startedAt":"2007-07-19T18:35:11Z","lastAt":"2007-07-19T19:35:46Z","messageCount":4,"participants":["Josef Sipek","Eric Lesh"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"47897","messageId":"87y7hctf6o.fsf@hubert.paunchy.net","threadId":"9109","inReplyTo":null,"subject":"[PATCH guilt] Handles slashes in branch names","fromName":"Eric Lesh","fromEmail":"eclesh@ucla.edu","sentAt":"2007-07-19T18:35:11Z","receivedAt":"2007-07-19T18:35:11Z","isPatch":true,"sender":{"key":"eclesh@ucla.edu","avatar":null},"body":"When a branch name has a slash and autotagging is enabled, guilt barfs\nwhen updating the stack tags.  Escape the branch name in the tags to\nallow this to work.\n\nAlso allow guilt to create the patches directory for these branches.\n\nSigned-off-by: Eric Lesh <eclesh@ucla.edu>\n---\n guilt      |   15 +++++++++------\n guilt-init |    2 +-\n 2 files changed, 10 insertions(+), 7 deletions(-)\n\ndiff --git a/guilt b/guilt\nindex 214def4..9e4789a 100755\n--- a/guilt\n+++ b/guilt\n@@ -334,20 +334,23 @@ update_stack_tags()\n \t\treturn 0\n \tfi\n \n+        # handle branches with slashes\n+        newbranch=`echo $branch | sed -e 's,\\/,-,'`\n+\n \tif [ `wc -l < $applied` -gt 0 ]; then\n \t\t# there are patches applied, therefore we must get the top,\n \t\t# bottom and base hashes, and update the tags\n \n-\t\tgit-rev-parse HEAD > \"$GIT_DIR/refs/tags/${branch}_top\"\n-\t\thead -1 < $applied | cut -d: -f1 > \"$GIT_DIR/refs/tags/${branch}_bottom\"\n-\t\tgit-rev-parse $(head -1 < $applied | cut -d: -f1)^ > \"$GIT_DIR/refs/tags/${branch}_base\"\n+\t\tgit-rev-parse HEAD > \"$GIT_DIR/refs/tags/${newbranch}_top\"\n+\t\thead -1 < $applied | cut -d: -f1 > \"$GIT_DIR/refs/tags/${newbranch}_bottom\"\n+\t\tgit-rev-parse $(head -1 < $applied | cut -d: -f1)^ > \"$GIT_DIR/refs/tags/${newbranch}_base\"\n \telse\n \t\t# there are no patches applied, therefore we must remove the\n \t\t# tags to old top, bottom, and base\n \n-\t\trm -f \"$GIT_DIR/refs/tags/${branch}_top\"\n-\t\trm -f \"$GIT_DIR/refs/tags/${branch}_bottom\"\n-\t\trm -f \"$GIT_DIR/refs/tags/${branch}_base\"\n+\t\trm -f \"$GIT_DIR/refs/tags/${newbranch}_top\"\n+\t\trm -f \"$GIT_DIR/refs/tags/${newbranch}_bottom\"\n+\t\trm -f \"$GIT_DIR/refs/tags/${newbranch}_base\"\n \tfi\n }\n \ndiff --git a/guilt-init b/guilt-init\nindex ffe2434..9136f89 100755\n--- a/guilt-init\n+++ b/guilt-init\n@@ -24,7 +24,7 @@ if [ -d \"$GUILT_DIR/$branch\" ]; then\n fi\n \n [ ! -d \"$GUILT_DIR\" ] && mkdir $GUILT_DIR\n-mkdir $GUILT_DIR/$branch\n+mkdir -p $GUILT_DIR/$branch\n touch $GUILT_DIR/$branch/series\n touch $GUILT_DIR/$branch/status\n \n-- \n1.5.2\n"},{"id":"47888","messageId":"20070719184418.GA22463@filer.fsl.cs.sunysb.edu","threadId":"9109","inReplyTo":"87y7hctf6o.fsf@hubert.paunchy.net","subject":"Re: [PATCH guilt] Handles slashes in branch names","fromName":"Josef Sipek","fromEmail":"jsipek@fsl.cs.sunysb.edu","sentAt":"2007-07-19T18:44:18Z","receivedAt":"2007-07-19T18:44:18Z","isPatch":true,"sender":{"key":"jsipek@fsl.cs.sunysb.edu","avatar":null},"body":"On Thu, Jul 19, 2007 at 11:35:11AM -0700, Eric Lesh wrote:\n> When a branch name has a slash and autotagging is enabled, guilt barfs\n> when updating the stack tags.  Escape the branch name in the tags to\n> allow this to work.\n...\n> -\t\tgit-rev-parse HEAD > \"$GIT_DIR/refs/tags/${branch}_top\"\n> -\t\thead -1 < $applied | cut -d: -f1 > \"$GIT_DIR/refs/tags/${branch}_bottom\"\n> -\t\tgit-rev-parse $(head -1 < $applied | cut -d: -f1)^ > \"$GIT_DIR/refs/tags/${branch}_base\"\n> +\t\tgit-rev-parse HEAD > \"$GIT_DIR/refs/tags/${newbranch}_top\"\n> +\t\thead -1 < $applied | cut -d: -f1 > \"$GIT_DIR/refs/tags/${newbranch}_bottom\"\n> +\t\tgit-rev-parse $(head -1 < $applied | cut -d: -f1)^ > \"$GIT_DIR/refs/tags/${newbranch}_base\"\n\nWhy mangle the branch name when we can do:\n\nmkdir -p `basename $GIT_DIR/refs/tags/${branch}_top`\ngit-rev-parse .... \n\nSure, it is ugly, but it preserves the branch name. Am I missing something?\n\nJosef 'Jeff' Sipek.\n\n-- \nA computer without Microsoft is like chocolate cake without mustard.\n"},{"id":"47893","messageId":"87r6n4td8y.fsf@hubert.paunchy.net","threadId":"9109","inReplyTo":"20070719184418.GA22463@filer.fsl.cs.sunysb.edu","subject":"[PATCH guilt] Handles slashes in branch names","fromName":"Eric Lesh","fromEmail":"eclesh@ucla.edu","sentAt":"2007-07-19T19:17:01Z","receivedAt":"2007-07-19T19:17:01Z","isPatch":true,"sender":{"key":"eclesh@ucla.edu","avatar":null},"body":"When a branch name has a slash and autotagging is enabled, guilt barfs\nwhen updating the stack tags.  Make these branch names work.\n\nAlso allow guilt to create the patches directory for these branches.\n\nSigned-off-by: Eric Lesh <eclesh@ucla.edu>\n---\nJosef Sipek <jsipek@fsl.cs.sunysb.edu> writes:\n\n>\n> Why mangle the branch name when we can do:\n>\n> mkdir -p `basename $GIT_DIR/refs/tags/${branch}_top`\n> git-rev-parse .... \n>\n> Sure, it is ugly, but it preserves the branch name. Am I missing something?\n>\n\nYours is a lot less ugly than mine was.\n\n guilt      |    1 +\n guilt-init |    2 +-\n 2 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/guilt b/guilt\nindex 214def4..c913bd6 100755\n--- a/guilt\n+++ b/guilt\n@@ -338,6 +338,7 @@ update_stack_tags()\n \t\t# there are patches applied, therefore we must get the top,\n \t\t# bottom and base hashes, and update the tags\n \n+\t\tmkdir -p `dirname $GIT_DIR/refs/tags/${branch}_top`\n \t\tgit-rev-parse HEAD > \"$GIT_DIR/refs/tags/${branch}_top\"\n \t\thead -1 < $applied | cut -d: -f1 > \"$GIT_DIR/refs/tags/${branch}_bottom\"\n \t\tgit-rev-parse $(head -1 < $applied | cut -d: -f1)^ > \"$GIT_DIR/refs/tags/${branch}_base\"\ndiff --git a/guilt-init b/guilt-init\nindex ffe2434..9136f89 100755\n--- a/guilt-init\n+++ b/guilt-init\n@@ -24,7 +24,7 @@ if [ -d \"$GUILT_DIR/$branch\" ]; then\n fi\n \n [ ! -d \"$GUILT_DIR\" ] && mkdir $GUILT_DIR\n-mkdir $GUILT_DIR/$branch\n+mkdir -p $GUILT_DIR/$branch\n touch $GUILT_DIR/$branch/series\n touch $GUILT_DIR/$branch/status\n \n-- \n1.5.2\n"},{"id":"47900","messageId":"20070719193546.GA27388@filer.fsl.cs.sunysb.edu","threadId":"9109","inReplyTo":"87r6n4td8y.fsf@hubert.paunchy.net","subject":"Re: [PATCH guilt] Handles slashes in branch names","fromName":"Josef Sipek","fromEmail":"jsipek@fsl.cs.sunysb.edu","sentAt":"2007-07-19T19:35:46Z","receivedAt":"2007-07-19T19:35:46Z","isPatch":true,"sender":{"key":"jsipek@fsl.cs.sunysb.edu","avatar":null},"body":"On Thu, Jul 19, 2007 at 12:17:01PM -0700, Eric Lesh wrote:\n> When a branch name has a slash and autotagging is enabled, guilt barfs\n> when updating the stack tags.  Make these branch names work.\n> \n> Also allow guilt to create the patches directory for these branches.\n> \n> Signed-off-by: Eric Lesh <eclesh@ucla.edu>\n\nApplied. I just added quotes around the mkdir -p in guilt in case someone\nlikes to have whitespace in their branch names.\n\nThanks,\n\nJosef 'Jeff' Sipek.\n\n-- \nReal Programmers consider \"what you see is what you get\" to be just as bad a\nconcept in Text Editors as it is in women. No, the Real Programmer wants a\n\"you asked for it, you got it\" text editor -- complicated, cryptic,\npowerful, unforgiving, dangerous.\n"}]}