{"thread":{"id":"33893","subject":"[PATCH] guilt: force the use of bare branches","startedAt":"2013-05-22T02:55:57Z","lastAt":"2013-05-23T19:14:27Z","messageCount":17,"participants":["Theodore Ts'o","Josef 'Jeff' Sipek","Per Cederqvist","Junio C Hamano","Ramkumar Ramachandra"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"218138","messageId":"1369191357-6777-1-git-send-email-tytso@mit.edu","threadId":"33893","inReplyTo":null,"subject":"[PATCH] guilt: force the use of bare branches","fromName":"Theodore Ts'o","fromEmail":"tytso@mit.edu","sentAt":"2013-05-22T02:55:57Z","receivedAt":"2013-05-22T02:55:57Z","isPatch":true,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"To make it harder to accidentally do \"git push\" with a guilt patch\napplied, \"guilt push\" changes branch from e.g. \"master\" to\n\"guilt/master\" starting with commit 67d3af63f422.  This is a feature\nwhich I use for ext4 development; I actually *do* want to be able to\npush patches to the dev branch, which is a rewindable branch much like\ngit's \"pu\" branch.\n\nAllow the use of the environment variable GUILT_FORCE_BARE_BRANCH\nwhich disables the new behavior introduced by commit 67d3af63f422.\n\nSigned-off-by: \"Theodore Ts'o\" <tytso@mit.edu>\nCc: Per Cederqvist <cederp@opera.com>\n---\n guilt | 17 +++++++++++++----\n 1 file changed, 13 insertions(+), 4 deletions(-)\n\ndiff --git a/guilt b/guilt\nindex 309437a..9953bdf 100755\n--- a/guilt\n+++ b/guilt\n@@ -914,13 +914,22 @@ else\n \tdie \"Unsupported operating system: $UNAME_S\"\n fi\n \n-if [ \"$branch\" = \"$raw_git_branch\" ] && [ -n \"`get_top 2>/dev/null`\" ]\n-then\n-    # This is for compat with old repositories that still have a\n-    # pushed patch without the new-style branch prefix.\n+if [ -n \"`get_top 2>/dev/null`\" ]; then\n+  #\n+  # If we have repositories patches pushed, then use whatever scheme\n+  # is currently in use\n+  #\n+  if [ \"$branch\" = \"$raw_git_branch\" ]; then\n     old_style_prefix=true\n+  else\n+    old_style_prefix=false\n+  fi\n else\n+  if [ -n \"$GUILT_FORCE_BARE_BRANCH\" ]; then\n+    old_style_prefix=true\n+  else\n     old_style_prefix=false\n+  fi\n fi\n \n _main \"$@\"\n-- \n1.7.12.rc0.22.gcdd159b\n"},{"id":"218143","messageId":"20130522032946.GA101217@meili.valhalla.31bits.net","threadId":"33893","inReplyTo":"1369191357-6777-1-git-send-email-tytso@mit.edu","subject":"Re: [PATCH] guilt: force the use of bare branches","fromName":"Josef 'Jeff' Sipek","fromEmail":"jeffpc@josefsipek.net","sentAt":"2013-05-22T03:29:47Z","receivedAt":"2013-05-22T03:29:47Z","isPatch":true,"sender":{"key":"jeffpc@josefsipek.net","avatar":null},"body":"On Tue, May 21, 2013 at 10:55:57PM -0400, Theodore Ts'o wrote:\n> To make it harder to accidentally do \"git push\" with a guilt patch\n> applied, \"guilt push\" changes branch from e.g. \"master\" to\n> \"guilt/master\" starting with commit 67d3af63f422.  This is a feature\n> which I use for ext4 development; I actually *do* want to be able to\n> push patches to the dev branch, which is a rewindable branch much like\n> git's \"pu\" branch.\n> \n> Allow the use of the environment variable GUILT_FORCE_BARE_BRANCH\n> which disables the new behavior introduced by commit 67d3af63f422.\n\nWould it make sense to make it git-config-able instead?  As an added bonus,\none can then make the decision on per-repository basis.\n\nJeff.\n\n> Signed-off-by: \"Theodore Ts'o\" <tytso@mit.edu>\n> Cc: Per Cederqvist <cederp@opera.com>\n> ---\n>  guilt | 17 +++++++++++++----\n>  1 file changed, 13 insertions(+), 4 deletions(-)\n> \n> diff --git a/guilt b/guilt\n> index 309437a..9953bdf 100755\n> --- a/guilt\n> +++ b/guilt\n> @@ -914,13 +914,22 @@ else\n>  \tdie \"Unsupported operating system: $UNAME_S\"\n>  fi\n>  \n> -if [ \"$branch\" = \"$raw_git_branch\" ] && [ -n \"`get_top 2>/dev/null`\" ]\n> -then\n> -    # This is for compat with old repositories that still have a\n> -    # pushed patch without the new-style branch prefix.\n> +if [ -n \"`get_top 2>/dev/null`\" ]; then\n> +  #\n> +  # If we have repositories patches pushed, then use whatever scheme\n> +  # is currently in use\n> +  #\n> +  if [ \"$branch\" = \"$raw_git_branch\" ]; then\n>      old_style_prefix=true\n> +  else\n> +    old_style_prefix=false\n> +  fi\n>  else\n> +  if [ -n \"$GUILT_FORCE_BARE_BRANCH\" ]; then\n> +    old_style_prefix=true\n> +  else\n>      old_style_prefix=false\n> +  fi\n>  fi\n>  \n>  _main \"$@\"\n> -- \n> 1.7.12.rc0.22.gcdd159b\n> \n\n-- \nLinux, n.:\n  Generous programmers from around the world all join forces to help\n  you shoot yourself in the foot for free. \n"},{"id":"218165","messageId":"1369224677-16404-1-git-send-email-tytso@mit.edu","threadId":"33893","inReplyTo":"20130522032946.GA101217@meili.valhalla.31bits.net","subject":"[PATCH -v2] guilt: force the use of bare branches","fromName":"Theodore Ts'o","fromEmail":"tytso@mit.edu","sentAt":"2013-05-22T12:11:17Z","receivedAt":"2013-05-22T12:11:17Z","isPatch":true,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"To make it harder to accidentally do \"git push\" with a guilt patch\napplied, \"guilt push\" changes branch from e.g. \"master\" to\n\"guilt/master\" starting with commit 67d3af63f422.  This is a feature\nwhich I use for ext4 development; I actually *do* want to be able to\npush patches to the dev branch, which is a rewindable branch much like\ngit's \"pu\" branch.\n\nAllow the use of the environment variable GUILT_FORCE_BARE_BRANCH\nwhich disables the new behavior introduced by commit 67d3af63f422.\n\nSigned-off-by: \"Theodore Ts'o\" <tytso@mit.edu>\nCc: Per Cederqvist <cederp@opera.com>\n---\n guilt | 17 +++++++++++++----\n 1 file changed, 13 insertions(+), 4 deletions(-)\n\ndiff --git a/guilt b/guilt\nindex e9b2aab..35a84dc 100755\n--- a/guilt\n+++ b/guilt\n@@ -914,13 +914,22 @@ else\n \tdie \"Unsupported operating system: $UNAME_S\"\n fi\n \n-if [ \"$branch\" = \"$raw_git_branch\" ] && [ -n \"`get_top 2>/dev/null`\" ]\n-then\n-    # This is for compat with old repositories that still have a\n-    # pushed patch without the new-style branch prefix.\n+if [ -n \"`get_top 2>/dev/null`\" ]; then\n+  #\n+  # If we have repositories patches pushed, then use whatever scheme\n+  # is currently in use\n+  #\n+  if [ \"$branch\" = \"$raw_git_branch\" ]; then\n     old_style_prefix=true\n+  else\n+    old_style_prefix=false\n+  fi\n else\n+  if [ \"$(git config --bool --get guilt.bareBranch)\" = \"true\" ]; then\n+    old_style_prefix=true\n+  else\n     old_style_prefix=false\n+  fi\n fi\n \n _main \"$@\"\n-- \n1.7.12.rc0.22.gcdd159b\n"},{"id":"218168","messageId":"519CBC83.3090705@opera.com","threadId":"33893","inReplyTo":"1369224677-16404-1-git-send-email-tytso@mit.edu","subject":"Re: [PATCH -v2] guilt: force the use of bare branches","fromName":"Per Cederqvist","fromEmail":"cederp@opera.com","sentAt":"2013-05-22T12:39:31Z","receivedAt":"2013-05-22T12:39:31Z","isPatch":true,"sender":{"key":"cederp@opera.com","avatar":"https://gravatar.com/avatar/008fe28caedea0ba34042cd5157705267934f4ba7a9b29fb248ae18ec5b3055e?d=mp&s=160"},"body":"On 05/22/13 14:11, Theodore Ts'o wrote:\n> To make it harder to accidentally do \"git push\" with a guilt patch\n> applied, \"guilt push\" changes branch from e.g. \"master\" to\n> \"guilt/master\" starting with commit 67d3af63f422.  This is a feature\n> which I use for ext4 development; I actually *do* want to be able to\n> push patches to the dev branch, which is a rewindable branch much like\n> git's \"pu\" branch.\n>\n> Allow the use of the environment variable GUILT_FORCE_BARE_BRANCH\n> which disables the new behavior introduced by commit 67d3af63f422.\n>\n> Signed-off-by: \"Theodore Ts'o\" <tytso@mit.edu>\n> Cc: Per Cederqvist <cederp@opera.com>\n\nI just posted an alternative patch that solves the same issue.\nI forgot to add in-reply-to headers, and did change the subject\nto \"Added guilt.reusebranch configuration option\". Sorry if I've\ncaused any confusion.\n\n     /ceder\n\n> ---\n>   guilt | 17 +++++++++++++----\n>   1 file changed, 13 insertions(+), 4 deletions(-)\n>\n> diff --git a/guilt b/guilt\n> index e9b2aab..35a84dc 100755\n> --- a/guilt\n> +++ b/guilt\n> @@ -914,13 +914,22 @@ else\n>   \tdie \"Unsupported operating system: $UNAME_S\"\n>   fi\n>\n> -if [ \"$branch\" = \"$raw_git_branch\" ] && [ -n \"`get_top 2>/dev/null`\" ]\n> -then\n> -    # This is for compat with old repositories that still have a\n> -    # pushed patch without the new-style branch prefix.\n> +if [ -n \"`get_top 2>/dev/null`\" ]; then\n> +  #\n> +  # If we have repositories patches pushed, then use whatever scheme\n> +  # is currently in use\n> +  #\n> +  if [ \"$branch\" = \"$raw_git_branch\" ]; then\n>       old_style_prefix=true\n> +  else\n> +    old_style_prefix=false\n> +  fi\n>   else\n> +  if [ \"$(git config --bool --get guilt.bareBranch)\" = \"true\" ]; then\n> +    old_style_prefix=true\n> +  else\n>       old_style_prefix=false\n> +  fi\n>   fi\n>\n>   _main \"$@\"\n>\n"},{"id":"218169","messageId":"x2ip2b6udr.fsf@bacon.lysator.liu.se","threadId":"33893","inReplyTo":"1369224677-16404-1-git-send-email-tytso@mit.edu","subject":"[PATCH] Added guilt.reusebranch configuration option.","fromName":"Per Cederqvist","fromEmail":"ceder@lysator.liu.se","sentAt":"2013-05-22T13:01:36Z","receivedAt":"2013-05-22T13:01:36Z","isPatch":true,"sender":{"key":"ceder@lysator.liu.se","avatar":"https://gravatar.com/avatar/2fb7fdd80e190aad4640112b9d07fda1db01a5eb9b1d643d9e07d047e52bd71e?d=mp&s=160"},"body":"When the option is true (the default), Guilt does not create a new Git\nbranch when patches are applied.  This way, you can switch between\nGuilt 0.35 and the current version of Guilt with no issues.\n\nAt a future time, maybe a year after Guilt with guilt.reusebranch\nsupport is released, the default should be changed to \"false\" to take\nadvantage of the ability to use a separate Git branch when patches are\napplied.\n\nSigned-off-by: Per Cederqvist <cederp@opera.com>\n---\n\nThis is an alternative solution to the same problem.  I've been running\nwith this code for a while.  I don't remember if I sent it to the list\nbefore, but if I did it was apparently lost.  Sorry if I never sent it.\n\nThis version includes some regression tests.\n\n(I'm having mail problems. Apologies if you receive this patch twice.)\n\n    /ceder\n\n guilt                |  29 +++-\n regression/scaffold  |   1 +\n regression/t-062.out | 457 +++++++++++++++++++++++++++++++++++++++++++++++++++\n regression/t-062.sh  | 150 +++++++++++++++++\n 4 files changed, 632 insertions(+), 5 deletions(-)\n create mode 100644 regression/t-062.out\n create mode 100755 regression/t-062.sh\n\ndiff --git a/guilt b/guilt\nindex 66a671a..108d4e7 100755\n--- a/guilt\n+++ b/guilt\n@@ -836,6 +836,9 @@ guilt_push_diff_context=1\n # default diffstat value: true or false\n DIFFSTAT_DEFAULT=\"false\"\n \n+# default old_style_prefix value: true or false\n+REUSE_BRANCH_DEFAULT=\"true\"\n+\n # Prefix for guilt branches.\n GUILT_PREFIX=guilt/\n \n@@ -847,6 +850,10 @@ GUILT_PREFIX=guilt/\n diffstat=`git config --bool guilt.diffstat`\n [ -z \"$diffstat\" ] && diffstat=$DIFFSTAT_DEFAULT\n \n+# reuse Git branch?\n+reuse_branch=`git config --bool guilt.reusebranch`\n+[ -z \"$reuse_branch\" ] && reuse_branch=$REUSE_BRANCH_DEFAULT\n+\n #\n # The following gets run every time this file is source'd\n #\n@@ -911,13 +918,25 @@ else\n \tdie \"Unsupported operating system: $UNAME_S\"\n fi\n \n-if [ \"$branch\" = \"$raw_git_branch\" ] && [ -n \"`get_top 2>/dev/null`\" ]\n+if [ -n \"`get_top 2>/dev/null`\" ]\n then\n-    # This is for compat with old repositories that still have a\n-    # pushed patch without the new-style branch prefix.\n-    old_style_prefix=true\n+\t# If there is at least one pushed patch, we set\n+\t# old_style_prefix according to how it was pushed.  It is only\n+\t# possible to change the prefix style while no patches are\n+\t# applied.\n+\tif [ \"$branch\" = \"$raw_git_branch\" ]\n+\tthen\n+\t\told_style_prefix=true\n+\telse\n+\t\told_style_prefix=false\n+\tfi\n else\n-    old_style_prefix=false\n+\tif $reuse_branch\n+\tthen\n+\t\told_style_prefix=true\n+\telse\n+\t\told_style_prefix=false\n+\tfi\n fi\n \n _main \"$@\"\ndiff --git a/regression/scaffold b/regression/scaffold\nindex 5c8b73e..acddb07 100644\n--- a/regression/scaffold\n+++ b/regression/scaffold\n@@ -88,6 +88,7 @@ function setup_git_repo\n \tgit config log.date default\n \tgit config log.decorate no\n \tgit config guilt.diffstat false\n+\tgit config guilt.reusebranch false\n }\n \n function setup_guilt_repo\ndiff --git a/regression/t-062.out b/regression/t-062.out\nnew file mode 100644\nindex 0000000..d00b3f6\n--- /dev/null\n+++ b/regression/t-062.out\n@@ -0,0 +1,457 @@\n+% setup_repo\n+% git config guilt.reusebranch true\n+% guilt push -a\n+Applying patch..modify\n+Patch applied.\n+Applying patch..add\n+Patch applied.\n+Applying patch..remove\n+Patch applied.\n+Applying patch..mode\n+Patch applied.\n+% list_files\n+d .git/patches\n+d .git/patches/master\n+d .git/refs/patches\n+d .git/refs/patches/master\n+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode\n+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove\n+f 71596bf71b72c2717e1aee378aabefbfa19ab7c8  .git/patches/master/status\n+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add\n+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series\n+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify\n+r 33633e7a1aa31972f125878baf7807be57b1672d  .git/refs/patches/master/modify\n+r 37d588cc39848368810e88332bd03b083f2ce3ac  .git/refs/patches/master/add\n+r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba  .git/refs/patches/master/mode\n+r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9  .git/refs/patches/master/remove\n+% git for-each-ref\n+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/heads/master\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/patches/master/mode\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n+% git update-ref refs/heads/master refs/heads/guilt/master\n+fatal: refs/heads/guilt/master: not a valid SHA1\n+% git symbolic-ref HEAD refs/heads/master\n+% git update-ref -d refs/heads/guilt/master\n+% git for-each-ref\n+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/heads/master\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/patches/master/mode\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n+% list_files\n+d .git/patches\n+d .git/patches/master\n+d .git/refs/patches\n+d .git/refs/patches/master\n+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode\n+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove\n+f 71596bf71b72c2717e1aee378aabefbfa19ab7c8  .git/patches/master/status\n+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add\n+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series\n+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify\n+r 33633e7a1aa31972f125878baf7807be57b1672d  .git/refs/patches/master/modify\n+r 37d588cc39848368810e88332bd03b083f2ce3ac  .git/refs/patches/master/add\n+r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba  .git/refs/patches/master/mode\n+r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9  .git/refs/patches/master/remove\n+% guilt pop\n+Now at remove.\n+% git for-each-ref\n+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/heads/master\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n+% guilt push\n+Applying patch..mode\n+Patch applied.\n+% git for-each-ref\n+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/heads/master\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/patches/master/mode\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n+% guilt pop\n+Now at remove.\n+% git for-each-ref\n+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/heads/master\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n+% guilt pop\n+Now at add.\n+% git for-each-ref\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/heads/master\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+% guilt push\n+Applying patch..remove\n+Patch applied.\n+% git for-each-ref\n+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/heads/master\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n+% guilt pop\n+Now at add.\n+% git for-each-ref\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/heads/master\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+% guilt pop\n+Now at modify.\n+% git for-each-ref\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/heads/master\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+% guilt push\n+Applying patch..add\n+Patch applied.\n+% git for-each-ref\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/heads/master\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+% guilt pop\n+Now at modify.\n+% git for-each-ref\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/heads/master\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+% guilt pop\n+All patches popped.\n+% git for-each-ref\n+d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n+% guilt push\n+Applying patch..modify\n+Patch applied.\n+% git for-each-ref\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/heads/master\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+% guilt pop\n+All patches popped.\n+% git for-each-ref\n+d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n+% guilt pop\n+No patches applied.\n+% git for-each-ref\n+d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n+% guilt push\n+Applying patch..modify\n+Patch applied.\n+% git for-each-ref\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/heads/master\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+% guilt pop\n+All patches popped.\n+% git for-each-ref\n+d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n+% guilt push -a\n+Applying patch..modify\n+Patch applied.\n+Applying patch..add\n+Patch applied.\n+Applying patch..remove\n+Patch applied.\n+Applying patch..mode\n+Patch applied.\n+% git update-ref refs/heads/master refs/heads/guilt/master\n+fatal: refs/heads/guilt/master: not a valid SHA1\n+% git symbolic-ref HEAD refs/heads/master\n+% git update-ref -d refs/heads/guilt/master\n+% git for-each-ref\n+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/heads/master\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/patches/master/mode\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n+% guilt pop -a\n+All patches popped.\n+% git for-each-ref\n+d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n+% guilt push add\n+Applying patch..modify\n+Patch applied.\n+Applying patch..add\n+Patch applied.\n+% git for-each-ref\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/heads/master\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+% git update-ref refs/heads/master refs/heads/guilt/master\n+fatal: refs/heads/guilt/master: not a valid SHA1\n+% git symbolic-ref HEAD refs/heads/master\n+% git update-ref -d refs/heads/guilt/master\n+% guilt branch topic\n+Switched to branch \"topic\"\n+% git for-each-ref\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/heads/master\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/heads/topic\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/topic/add\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/topic/modify\n+% guilt pop -a\n+All patches popped.\n+% guilt push\n+Applying patch..modify\n+Patch applied.\n+% git for-each-ref\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/heads/master\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/heads/topic\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/topic/modify\n+% guilt pop -a\n+All patches popped.\n+% git checkout master\n+Switched to branch \"master\"\n+% guilt pop -a\n+All patches popped.\n+% git branch -d topic\n+Deleted branch topic (was d485041).\n+% rm -r .git/patches/topic\n+% git for-each-ref\n+d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n+% list_files\n+d .git/patches\n+d .git/patches/master\n+d .git/refs/patches\n+d .git/refs/patches/master\n+d .git/refs/patches/topic\n+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode\n+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove\n+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add\n+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series\n+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify\n+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status\n+% guilt push -a\n+Applying patch..modify\n+Patch applied.\n+Applying patch..add\n+Patch applied.\n+Applying patch..remove\n+Patch applied.\n+Applying patch..mode\n+Patch applied.\n+% git update-ref refs/heads/master refs/heads/guilt/master\n+fatal: refs/heads/guilt/master: not a valid SHA1\n+% git symbolic-ref HEAD refs/heads/master\n+% git update-ref -d refs/heads/guilt/master\n+% guilt branch topic\n+Switched to branch \"topic\"\n+% git for-each-ref\n+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/heads/master\n+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/heads/topic\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/patches/master/mode\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/topic/add\n+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/patches/topic/mode\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/topic/modify\n+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/topic/remove\n+% guilt pop -a\n+All patches popped.\n+% git checkout master\n+Switched to branch \"master\"\n+% guilt pop -a\n+All patches popped.\n+% git branch -d topic\n+Deleted branch topic (was d485041).\n+% rm -r .git/patches/topic\n+% git for-each-ref\n+d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n+% list_files\n+d .git/patches\n+d .git/patches/master\n+d .git/refs/patches\n+d .git/refs/patches/master\n+d .git/refs/patches/topic\n+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode\n+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove\n+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add\n+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series\n+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify\n+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status\n+% guilt branch topic\n+Switched to branch \"topic\"\n+% git for-each-ref\n+d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n+d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/topic\n+% list_files\n+d .git/patches\n+d .git/patches/master\n+d .git/patches/topic\n+d .git/refs/patches\n+d .git/refs/patches/master\n+d .git/refs/patches/topic\n+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode\n+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/topic/mode\n+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove\n+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/topic/remove\n+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add\n+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/topic/add\n+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series\n+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/topic/series\n+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify\n+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/topic/modify\n+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status\n+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/topic/status\n+% guilt pop -a\n+No patches applied.\n+% git checkout master\n+Switched to branch \"master\"\n+% guilt pop -a\n+No patches applied.\n+% git branch -d topic\n+Deleted branch topic (was d485041).\n+% rm -r .git/patches/topic\n+% git for-each-ref\n+d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n+% list_files\n+d .git/patches\n+d .git/patches/master\n+d .git/refs/patches\n+d .git/refs/patches/master\n+d .git/refs/patches/topic\n+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode\n+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove\n+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add\n+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series\n+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify\n+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status\n+% guilt push -a\n+Applying patch..modify\n+Patch applied.\n+Applying patch..add\n+Patch applied.\n+Applying patch..remove\n+Patch applied.\n+Applying patch..mode\n+Patch applied.\n+% guilt branch topic\n+Switched to branch \"topic\"\n+% git for-each-ref\n+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/heads/master\n+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/heads/topic\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/patches/master/mode\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/topic/add\n+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/patches/topic/mode\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/topic/modify\n+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/topic/remove\n+% list_files\n+d .git/patches\n+d .git/patches/master\n+d .git/patches/topic\n+d .git/refs/patches\n+d .git/refs/patches/master\n+d .git/refs/patches/topic\n+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode\n+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/topic/mode\n+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove\n+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/topic/remove\n+f 71596bf71b72c2717e1aee378aabefbfa19ab7c8  .git/patches/master/status\n+f 71596bf71b72c2717e1aee378aabefbfa19ab7c8  .git/patches/topic/status\n+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add\n+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/topic/add\n+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series\n+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/topic/series\n+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify\n+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/topic/modify\n+r 33633e7a1aa31972f125878baf7807be57b1672d  .git/refs/patches/master/modify\n+r 33633e7a1aa31972f125878baf7807be57b1672d  .git/refs/patches/topic/modify\n+r 37d588cc39848368810e88332bd03b083f2ce3ac  .git/refs/patches/master/add\n+r 37d588cc39848368810e88332bd03b083f2ce3ac  .git/refs/patches/topic/add\n+r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba  .git/refs/patches/master/mode\n+r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba  .git/refs/patches/topic/mode\n+r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9  .git/refs/patches/master/remove\n+r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9  .git/refs/patches/topic/remove\n+% guilt pop -a\n+All patches popped.\n+% git for-each-ref\n+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/heads/master\n+d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/topic\n+37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/patches/master/mode\n+33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n+% guilt pop -a\n+No patches applied.\n+% git checkout master\n+Switched to branch \"master\"\n+% guilt pop -a\n+All patches popped.\n+% git branch -d topic\n+Deleted branch topic (was d485041).\n+% rm -r .git/patches/topic\n+% git for-each-ref\n+d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n+% list_files\n+d .git/patches\n+d .git/patches/master\n+d .git/refs/patches\n+d .git/refs/patches/master\n+d .git/refs/patches/topic\n+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode\n+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove\n+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add\n+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series\n+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify\n+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status\n+% guilt new newpatch\n+% git for-each-ref --format=%(refname)\n+refs/heads/master\n+refs/patches/master/newpatch\n+% guilt pop\n+All patches popped.\n+% guilt push\n+Applying patch..newpatch\n+Patch applied.\n+% git for-each-ref\n+25465dc1687f3833ecbd4e8bca437e522d7026db commit\trefs/heads/master\n+25465dc1687f3833ecbd4e8bca437e522d7026db commit\trefs/patches/master/newpatch\n+% git branch\n+* master\n+% guilt applied\n+newpatch\n+% guilt commit -a\n+% git for-each-ref\n+25465dc1687f3833ecbd4e8bca437e522d7026db commit\trefs/heads/master\n+% git branch\n+* master\n+% guilt push -a\n+Applying patch..modify\n+Patch applied.\n+Applying patch..add\n+Patch applied.\n+Applying patch..remove\n+Patch applied.\n+Applying patch..mode\n+Patch applied.\n+% guilt applied\n+modify\n+add\n+remove\n+mode\n+% git branch\n+* master\n+% git for-each-ref\n+fefbdcef61022d473838926619f31e030dd04fdc commit\trefs/heads/master\n+5effcbeb303e8433935151d8c69f3bf63db1e8ef commit\trefs/patches/master/add\n+fefbdcef61022d473838926619f31e030dd04fdc commit\trefs/patches/master/mode\n+9509f22e2e627756d87b42432931c45955b74234 commit\trefs/patches/master/modify\n+9cbe2fc643b1a9e2179a8738f80424a1c2aa202d commit\trefs/patches/master/remove\n+% guilt commit -n 2\n+% git for-each-ref\n+fefbdcef61022d473838926619f31e030dd04fdc commit\trefs/heads/master\n+fefbdcef61022d473838926619f31e030dd04fdc commit\trefs/patches/master/mode\n+9cbe2fc643b1a9e2179a8738f80424a1c2aa202d commit\trefs/patches/master/remove\n+% git branch\n+* master\n+% guilt commit -n 2\n+% git for-each-ref\n+fefbdcef61022d473838926619f31e030dd04fdc commit\trefs/heads/master\n+% git branch\n+* master\n+% guilt series\ndiff --git a/regression/t-062.sh b/regression/t-062.sh\nnew file mode 100755\nindex 0000000..ffefb9c\n--- /dev/null\n+++ b/regression/t-062.sh\n@@ -0,0 +1,150 @@\n+#!/bin/bash\n+#\n+# Test the branch-switching upgrade code\n+#\n+\n+source $REG_DIR/scaffold\n+\n+old_style_branch() {\n+\t# Modify the refs so that it looks as if the patch series was applied\n+\t# by an old version of guilt.\n+\tcmd git update-ref refs/heads/$1 refs/heads/guilt/$1\n+\tcmd git symbolic-ref HEAD refs/heads/$1\n+\tcmd git update-ref -d refs/heads/guilt/$1\n+}\n+\n+remove_topic() {\n+\tcmd guilt pop -a\n+\tif git rev-parse --verify --quiet guilt/master >/dev/null\n+\tthen\n+\t\tcmd git checkout guilt/master\n+\telse\n+\t\tcmd git checkout master\n+\tfi\n+\tcmd guilt pop -a\n+\tcmd git branch -d $1\n+\tcmd rm -r .git/patches/$1\n+\tcmd git for-each-ref\n+\tcmd list_files\n+}\n+\n+function fixup_time_info\n+{\n+\ttouch -a -m -t \"$TOUCH_DATE\" \".git/patches/master/$1\"\n+}\n+\n+cmd setup_repo\n+\n+cmd git config guilt.reusebranch true\n+\n+cmd guilt push -a\n+cmd list_files\n+cmd git for-each-ref\n+\n+# Pop and push patches.  Check that the repo is converted to new-style\n+# refs when no patches are applied and a patch is pushed.\n+old_style_branch master\n+cmd git for-each-ref\n+\n+cmd list_files\n+\n+for i in `seq 5`\n+do\n+\tcmd guilt pop\n+\tcmd git for-each-ref\n+\tcmd guilt push\n+\tcmd git for-each-ref\n+\tcmd guilt pop\n+\tcmd git for-each-ref\n+done\n+\n+# Check that \"pop -a\" does the right thing.\n+cmd guilt push -a\n+\n+old_style_branch master\n+\n+cmd git for-each-ref\n+\n+cmd guilt pop -a\n+\n+cmd git for-each-ref\n+\n+# Check that pushing two patches converts the repo to now-style (since\n+# it currently has no patches applied).\n+cmd guilt push add\n+cmd git for-each-ref\n+\n+# Check guilt branch with a few patches applied.\n+old_style_branch master\n+cmd guilt branch topic\n+cmd git for-each-ref\n+\n+# Check that the topic branch is converted to new-style.\n+cmd guilt pop -a\n+cmd guilt push\n+cmd git for-each-ref\n+\n+remove_topic topic\n+\n+# Check guilt branch with the full patch series applied.\n+cmd guilt push -a\n+old_style_branch master\n+cmd guilt branch topic\n+cmd git for-each-ref\n+\n+remove_topic topic\n+\n+# Check guilt branch with no patches applied.\n+# This gives us a new-style checkout.\n+cmd guilt branch topic\n+cmd git for-each-ref\n+cmd list_files\n+\n+remove_topic topic\n+\n+# Check guilt branch in a new-style directory with all patches\n+# applied.  (Strictly speaking, this test should probably move to a\n+# file devoted to testing \"guilt branch\".)\n+cmd guilt push -a\n+cmd guilt branch topic\n+cmd git for-each-ref\n+cmd list_files\n+cmd guilt pop -a\n+cmd git for-each-ref\n+\n+remove_topic topic\n+\n+# Check that \"guilt new\" does the right thing when no patches are\n+# applied.  (Strictly speaking, this test should maybe move to\n+# t-025.sh).\n+\n+cmd guilt new newpatch\n+cmd git for-each-ref '--format=%(refname)'\n+cmd guilt pop\n+fixup_time_info newpatch\n+cmd guilt push\n+cmd git for-each-ref\n+\n+# Check that \"guilt commit\" does the right thing when committing all\n+# applied patches.  (Strictly speaking, this test should maybe move to\n+# t-030.sh).\n+cmd git branch\n+cmd guilt applied\n+cmd guilt commit -a\n+cmd git for-each-ref\n+cmd git branch\n+\n+# Check that \"guilt commit\" does the right thing when committing only\n+# a few of the applied patches.  (Strictly speaking, this test should\n+# maybe move to t-030.sh).\n+cmd guilt push -a\n+cmd guilt applied\n+cmd git branch\n+cmd git for-each-ref\n+cmd guilt commit -n 2\n+cmd git for-each-ref\n+cmd git branch\n+cmd guilt commit -n 2\n+cmd git for-each-ref\n+cmd git branch\n+cmd guilt series\n-- \n1.8.2\n"},{"id":"218175","messageId":"20130522134212.GB13731@poseidon.cudanet.local","threadId":"33893","inReplyTo":"x2ip2b6udr.fsf@bacon.lysator.liu.se","subject":"Re: [PATCH] Added guilt.reusebranch configuration option.","fromName":"Josef 'Jeff' Sipek","fromEmail":"jeffpc@josefsipek.net","sentAt":"2013-05-22T13:42:12Z","receivedAt":"2013-05-22T13:42:12Z","isPatch":true,"sender":{"key":"jeffpc@josefsipek.net","avatar":null},"body":"On Wed, May 22, 2013 at 03:01:36PM +0200, Per Cederqvist wrote:\n> When the option is true (the default), Guilt does not create a new Git\n> branch when patches are applied.  This way, you can switch between\n> Guilt 0.35 and the current version of Guilt with no issues.\n> \n> At a future time, maybe a year after Guilt with guilt.reusebranch\n> support is released, the default should be changed to \"false\" to take\n> advantage of the ability to use a separate Git branch when patches are\n> applied.\n\nSo, I've been using the always-on prefix code and I do like it.  It makes me\nreasonably happy that other people that work on the same repo won't screw it\nup.  So, with that said, I'm tempted to actually make the default the\nnew-style prefix.  If someone (there's at least Ted) wants the old behavior,\nthey'll have the config.\n\nIOW, I'm tempted to apply this patch with a minor tweak: change the default\nto new-style.\n\n> Signed-off-by: Per Cederqvist <cederp@opera.com>\n> ---\n> \n> This is an alternative solution to the same problem.  I've been running\n> with this code for a while.  I don't remember if I sent it to the list\n> before, but if I did it was apparently lost.  Sorry if I never sent it.\n\nFor all I know, I just dropped this patch on the floor by accident :/\n\nJeff.\n\n> This version includes some regression tests.\n> \n> (I'm having mail problems. Apologies if you receive this patch twice.)\n> \n>     /ceder\n> \n>  guilt                |  29 +++-\n>  regression/scaffold  |   1 +\n>  regression/t-062.out | 457 +++++++++++++++++++++++++++++++++++++++++++++++++++\n>  regression/t-062.sh  | 150 +++++++++++++++++\n>  4 files changed, 632 insertions(+), 5 deletions(-)\n>  create mode 100644 regression/t-062.out\n>  create mode 100755 regression/t-062.sh\n> \n> diff --git a/guilt b/guilt\n> index 66a671a..108d4e7 100755\n> --- a/guilt\n> +++ b/guilt\n> @@ -836,6 +836,9 @@ guilt_push_diff_context=1\n>  # default diffstat value: true or false\n>  DIFFSTAT_DEFAULT=\"false\"\n>  \n> +# default old_style_prefix value: true or false\n> +REUSE_BRANCH_DEFAULT=\"true\"\n> +\n>  # Prefix for guilt branches.\n>  GUILT_PREFIX=guilt/\n>  \n> @@ -847,6 +850,10 @@ GUILT_PREFIX=guilt/\n>  diffstat=`git config --bool guilt.diffstat`\n>  [ -z \"$diffstat\" ] && diffstat=$DIFFSTAT_DEFAULT\n>  \n> +# reuse Git branch?\n> +reuse_branch=`git config --bool guilt.reusebranch`\n> +[ -z \"$reuse_branch\" ] && reuse_branch=$REUSE_BRANCH_DEFAULT\n> +\n>  #\n>  # The following gets run every time this file is source'd\n>  #\n> @@ -911,13 +918,25 @@ else\n>  \tdie \"Unsupported operating system: $UNAME_S\"\n>  fi\n>  \n> -if [ \"$branch\" = \"$raw_git_branch\" ] && [ -n \"`get_top 2>/dev/null`\" ]\n> +if [ -n \"`get_top 2>/dev/null`\" ]\n>  then\n> -    # This is for compat with old repositories that still have a\n> -    # pushed patch without the new-style branch prefix.\n> -    old_style_prefix=true\n> +\t# If there is at least one pushed patch, we set\n> +\t# old_style_prefix according to how it was pushed.  It is only\n> +\t# possible to change the prefix style while no patches are\n> +\t# applied.\n> +\tif [ \"$branch\" = \"$raw_git_branch\" ]\n> +\tthen\n> +\t\told_style_prefix=true\n> +\telse\n> +\t\told_style_prefix=false\n> +\tfi\n>  else\n> -    old_style_prefix=false\n> +\tif $reuse_branch\n> +\tthen\n> +\t\told_style_prefix=true\n> +\telse\n> +\t\told_style_prefix=false\n> +\tfi\n>  fi\n>  \n>  _main \"$@\"\n> diff --git a/regression/scaffold b/regression/scaffold\n> index 5c8b73e..acddb07 100644\n> --- a/regression/scaffold\n> +++ b/regression/scaffold\n> @@ -88,6 +88,7 @@ function setup_git_repo\n>  \tgit config log.date default\n>  \tgit config log.decorate no\n>  \tgit config guilt.diffstat false\n> +\tgit config guilt.reusebranch false\n>  }\n>  \n>  function setup_guilt_repo\n> diff --git a/regression/t-062.out b/regression/t-062.out\n> new file mode 100644\n> index 0000000..d00b3f6\n> --- /dev/null\n> +++ b/regression/t-062.out\n> @@ -0,0 +1,457 @@\n> +% setup_repo\n> +% git config guilt.reusebranch true\n> +% guilt push -a\n> +Applying patch..modify\n> +Patch applied.\n> +Applying patch..add\n> +Patch applied.\n> +Applying patch..remove\n> +Patch applied.\n> +Applying patch..mode\n> +Patch applied.\n> +% list_files\n> +d .git/patches\n> +d .git/patches/master\n> +d .git/refs/patches\n> +d .git/refs/patches/master\n> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode\n> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove\n> +f 71596bf71b72c2717e1aee378aabefbfa19ab7c8  .git/patches/master/status\n> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add\n> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series\n> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify\n> +r 33633e7a1aa31972f125878baf7807be57b1672d  .git/refs/patches/master/modify\n> +r 37d588cc39848368810e88332bd03b083f2ce3ac  .git/refs/patches/master/add\n> +r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba  .git/refs/patches/master/mode\n> +r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9  .git/refs/patches/master/remove\n> +% git for-each-ref\n> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/heads/master\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/patches/master/mode\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n> +% git update-ref refs/heads/master refs/heads/guilt/master\n> +fatal: refs/heads/guilt/master: not a valid SHA1\n> +% git symbolic-ref HEAD refs/heads/master\n> +% git update-ref -d refs/heads/guilt/master\n> +% git for-each-ref\n> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/heads/master\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/patches/master/mode\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n> +% list_files\n> +d .git/patches\n> +d .git/patches/master\n> +d .git/refs/patches\n> +d .git/refs/patches/master\n> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode\n> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove\n> +f 71596bf71b72c2717e1aee378aabefbfa19ab7c8  .git/patches/master/status\n> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add\n> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series\n> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify\n> +r 33633e7a1aa31972f125878baf7807be57b1672d  .git/refs/patches/master/modify\n> +r 37d588cc39848368810e88332bd03b083f2ce3ac  .git/refs/patches/master/add\n> +r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba  .git/refs/patches/master/mode\n> +r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9  .git/refs/patches/master/remove\n> +% guilt pop\n> +Now at remove.\n> +% git for-each-ref\n> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/heads/master\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n> +% guilt push\n> +Applying patch..mode\n> +Patch applied.\n> +% git for-each-ref\n> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/heads/master\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/patches/master/mode\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n> +% guilt pop\n> +Now at remove.\n> +% git for-each-ref\n> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/heads/master\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n> +% guilt pop\n> +Now at add.\n> +% git for-each-ref\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/heads/master\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +% guilt push\n> +Applying patch..remove\n> +Patch applied.\n> +% git for-each-ref\n> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/heads/master\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n> +% guilt pop\n> +Now at add.\n> +% git for-each-ref\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/heads/master\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +% guilt pop\n> +Now at modify.\n> +% git for-each-ref\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/heads/master\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +% guilt push\n> +Applying patch..add\n> +Patch applied.\n> +% git for-each-ref\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/heads/master\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +% guilt pop\n> +Now at modify.\n> +% git for-each-ref\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/heads/master\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +% guilt pop\n> +All patches popped.\n> +% git for-each-ref\n> +d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n> +% guilt push\n> +Applying patch..modify\n> +Patch applied.\n> +% git for-each-ref\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/heads/master\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +% guilt pop\n> +All patches popped.\n> +% git for-each-ref\n> +d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n> +% guilt pop\n> +No patches applied.\n> +% git for-each-ref\n> +d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n> +% guilt push\n> +Applying patch..modify\n> +Patch applied.\n> +% git for-each-ref\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/heads/master\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +% guilt pop\n> +All patches popped.\n> +% git for-each-ref\n> +d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n> +% guilt push -a\n> +Applying patch..modify\n> +Patch applied.\n> +Applying patch..add\n> +Patch applied.\n> +Applying patch..remove\n> +Patch applied.\n> +Applying patch..mode\n> +Patch applied.\n> +% git update-ref refs/heads/master refs/heads/guilt/master\n> +fatal: refs/heads/guilt/master: not a valid SHA1\n> +% git symbolic-ref HEAD refs/heads/master\n> +% git update-ref -d refs/heads/guilt/master\n> +% git for-each-ref\n> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/heads/master\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/patches/master/mode\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n> +% guilt pop -a\n> +All patches popped.\n> +% git for-each-ref\n> +d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n> +% guilt push add\n> +Applying patch..modify\n> +Patch applied.\n> +Applying patch..add\n> +Patch applied.\n> +% git for-each-ref\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/heads/master\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +% git update-ref refs/heads/master refs/heads/guilt/master\n> +fatal: refs/heads/guilt/master: not a valid SHA1\n> +% git symbolic-ref HEAD refs/heads/master\n> +% git update-ref -d refs/heads/guilt/master\n> +% guilt branch topic\n> +Switched to branch \"topic\"\n> +% git for-each-ref\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/heads/master\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/heads/topic\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/topic/add\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/topic/modify\n> +% guilt pop -a\n> +All patches popped.\n> +% guilt push\n> +Applying patch..modify\n> +Patch applied.\n> +% git for-each-ref\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/heads/master\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/heads/topic\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/topic/modify\n> +% guilt pop -a\n> +All patches popped.\n> +% git checkout master\n> +Switched to branch \"master\"\n> +% guilt pop -a\n> +All patches popped.\n> +% git branch -d topic\n> +Deleted branch topic (was d485041).\n> +% rm -r .git/patches/topic\n> +% git for-each-ref\n> +d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n> +% list_files\n> +d .git/patches\n> +d .git/patches/master\n> +d .git/refs/patches\n> +d .git/refs/patches/master\n> +d .git/refs/patches/topic\n> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode\n> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove\n> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add\n> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series\n> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify\n> +f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status\n> +% guilt push -a\n> +Applying patch..modify\n> +Patch applied.\n> +Applying patch..add\n> +Patch applied.\n> +Applying patch..remove\n> +Patch applied.\n> +Applying patch..mode\n> +Patch applied.\n> +% git update-ref refs/heads/master refs/heads/guilt/master\n> +fatal: refs/heads/guilt/master: not a valid SHA1\n> +% git symbolic-ref HEAD refs/heads/master\n> +% git update-ref -d refs/heads/guilt/master\n> +% guilt branch topic\n> +Switched to branch \"topic\"\n> +% git for-each-ref\n> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/heads/master\n> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/heads/topic\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/patches/master/mode\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/topic/add\n> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/patches/topic/mode\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/topic/modify\n> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/topic/remove\n> +% guilt pop -a\n> +All patches popped.\n> +% git checkout master\n> +Switched to branch \"master\"\n> +% guilt pop -a\n> +All patches popped.\n> +% git branch -d topic\n> +Deleted branch topic (was d485041).\n> +% rm -r .git/patches/topic\n> +% git for-each-ref\n> +d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n> +% list_files\n> +d .git/patches\n> +d .git/patches/master\n> +d .git/refs/patches\n> +d .git/refs/patches/master\n> +d .git/refs/patches/topic\n> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode\n> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove\n> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add\n> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series\n> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify\n> +f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status\n> +% guilt branch topic\n> +Switched to branch \"topic\"\n> +% git for-each-ref\n> +d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n> +d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/topic\n> +% list_files\n> +d .git/patches\n> +d .git/patches/master\n> +d .git/patches/topic\n> +d .git/refs/patches\n> +d .git/refs/patches/master\n> +d .git/refs/patches/topic\n> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode\n> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/topic/mode\n> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove\n> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/topic/remove\n> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add\n> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/topic/add\n> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series\n> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/topic/series\n> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify\n> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/topic/modify\n> +f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status\n> +f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/topic/status\n> +% guilt pop -a\n> +No patches applied.\n> +% git checkout master\n> +Switched to branch \"master\"\n> +% guilt pop -a\n> +No patches applied.\n> +% git branch -d topic\n> +Deleted branch topic (was d485041).\n> +% rm -r .git/patches/topic\n> +% git for-each-ref\n> +d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n> +% list_files\n> +d .git/patches\n> +d .git/patches/master\n> +d .git/refs/patches\n> +d .git/refs/patches/master\n> +d .git/refs/patches/topic\n> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode\n> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove\n> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add\n> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series\n> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify\n> +f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status\n> +% guilt push -a\n> +Applying patch..modify\n> +Patch applied.\n> +Applying patch..add\n> +Patch applied.\n> +Applying patch..remove\n> +Patch applied.\n> +Applying patch..mode\n> +Patch applied.\n> +% guilt branch topic\n> +Switched to branch \"topic\"\n> +% git for-each-ref\n> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/heads/master\n> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/heads/topic\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/patches/master/mode\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/topic/add\n> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/patches/topic/mode\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/topic/modify\n> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/topic/remove\n> +% list_files\n> +d .git/patches\n> +d .git/patches/master\n> +d .git/patches/topic\n> +d .git/refs/patches\n> +d .git/refs/patches/master\n> +d .git/refs/patches/topic\n> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode\n> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/topic/mode\n> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove\n> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/topic/remove\n> +f 71596bf71b72c2717e1aee378aabefbfa19ab7c8  .git/patches/master/status\n> +f 71596bf71b72c2717e1aee378aabefbfa19ab7c8  .git/patches/topic/status\n> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add\n> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/topic/add\n> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series\n> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/topic/series\n> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify\n> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/topic/modify\n> +r 33633e7a1aa31972f125878baf7807be57b1672d  .git/refs/patches/master/modify\n> +r 33633e7a1aa31972f125878baf7807be57b1672d  .git/refs/patches/topic/modify\n> +r 37d588cc39848368810e88332bd03b083f2ce3ac  .git/refs/patches/master/add\n> +r 37d588cc39848368810e88332bd03b083f2ce3ac  .git/refs/patches/topic/add\n> +r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba  .git/refs/patches/master/mode\n> +r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba  .git/refs/patches/topic/mode\n> +r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9  .git/refs/patches/master/remove\n> +r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9  .git/refs/patches/topic/remove\n> +% guilt pop -a\n> +All patches popped.\n> +% git for-each-ref\n> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/heads/master\n> +d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/topic\n> +37d588cc39848368810e88332bd03b083f2ce3ac commit\trefs/patches/master/add\n> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit\trefs/patches/master/mode\n> +33633e7a1aa31972f125878baf7807be57b1672d commit\trefs/patches/master/modify\n> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit\trefs/patches/master/remove\n> +% guilt pop -a\n> +No patches applied.\n> +% git checkout master\n> +Switched to branch \"master\"\n> +% guilt pop -a\n> +All patches popped.\n> +% git branch -d topic\n> +Deleted branch topic (was d485041).\n> +% rm -r .git/patches/topic\n> +% git for-each-ref\n> +d4850419ccc1146c7169f500725ce504b9774ed0 commit\trefs/heads/master\n> +% list_files\n> +d .git/patches\n> +d .git/patches/master\n> +d .git/refs/patches\n> +d .git/refs/patches/master\n> +d .git/refs/patches/topic\n> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode\n> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove\n> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add\n> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series\n> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify\n> +f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status\n> +% guilt new newpatch\n> +% git for-each-ref --format=%(refname)\n> +refs/heads/master\n> +refs/patches/master/newpatch\n> +% guilt pop\n> +All patches popped.\n> +% guilt push\n> +Applying patch..newpatch\n> +Patch applied.\n> +% git for-each-ref\n> +25465dc1687f3833ecbd4e8bca437e522d7026db commit\trefs/heads/master\n> +25465dc1687f3833ecbd4e8bca437e522d7026db commit\trefs/patches/master/newpatch\n> +% git branch\n> +* master\n> +% guilt applied\n> +newpatch\n> +% guilt commit -a\n> +% git for-each-ref\n> +25465dc1687f3833ecbd4e8bca437e522d7026db commit\trefs/heads/master\n> +% git branch\n> +* master\n> +% guilt push -a\n> +Applying patch..modify\n> +Patch applied.\n> +Applying patch..add\n> +Patch applied.\n> +Applying patch..remove\n> +Patch applied.\n> +Applying patch..mode\n> +Patch applied.\n> +% guilt applied\n> +modify\n> +add\n> +remove\n> +mode\n> +% git branch\n> +* master\n> +% git for-each-ref\n> +fefbdcef61022d473838926619f31e030dd04fdc commit\trefs/heads/master\n> +5effcbeb303e8433935151d8c69f3bf63db1e8ef commit\trefs/patches/master/add\n> +fefbdcef61022d473838926619f31e030dd04fdc commit\trefs/patches/master/mode\n> +9509f22e2e627756d87b42432931c45955b74234 commit\trefs/patches/master/modify\n> +9cbe2fc643b1a9e2179a8738f80424a1c2aa202d commit\trefs/patches/master/remove\n> +% guilt commit -n 2\n> +% git for-each-ref\n> +fefbdcef61022d473838926619f31e030dd04fdc commit\trefs/heads/master\n> +fefbdcef61022d473838926619f31e030dd04fdc commit\trefs/patches/master/mode\n> +9cbe2fc643b1a9e2179a8738f80424a1c2aa202d commit\trefs/patches/master/remove\n> +% git branch\n> +* master\n> +% guilt commit -n 2\n> +% git for-each-ref\n> +fefbdcef61022d473838926619f31e030dd04fdc commit\trefs/heads/master\n> +% git branch\n> +* master\n> +% guilt series\n> diff --git a/regression/t-062.sh b/regression/t-062.sh\n> new file mode 100755\n> index 0000000..ffefb9c\n> --- /dev/null\n> +++ b/regression/t-062.sh\n> @@ -0,0 +1,150 @@\n> +#!/bin/bash\n> +#\n> +# Test the branch-switching upgrade code\n> +#\n> +\n> +source $REG_DIR/scaffold\n> +\n> +old_style_branch() {\n> +\t# Modify the refs so that it looks as if the patch series was applied\n> +\t# by an old version of guilt.\n> +\tcmd git update-ref refs/heads/$1 refs/heads/guilt/$1\n> +\tcmd git symbolic-ref HEAD refs/heads/$1\n> +\tcmd git update-ref -d refs/heads/guilt/$1\n> +}\n> +\n> +remove_topic() {\n> +\tcmd guilt pop -a\n> +\tif git rev-parse --verify --quiet guilt/master >/dev/null\n> +\tthen\n> +\t\tcmd git checkout guilt/master\n> +\telse\n> +\t\tcmd git checkout master\n> +\tfi\n> +\tcmd guilt pop -a\n> +\tcmd git branch -d $1\n> +\tcmd rm -r .git/patches/$1\n> +\tcmd git for-each-ref\n> +\tcmd list_files\n> +}\n> +\n> +function fixup_time_info\n> +{\n> +\ttouch -a -m -t \"$TOUCH_DATE\" \".git/patches/master/$1\"\n> +}\n> +\n> +cmd setup_repo\n> +\n> +cmd git config guilt.reusebranch true\n> +\n> +cmd guilt push -a\n> +cmd list_files\n> +cmd git for-each-ref\n> +\n> +# Pop and push patches.  Check that the repo is converted to new-style\n> +# refs when no patches are applied and a patch is pushed.\n> +old_style_branch master\n> +cmd git for-each-ref\n> +\n> +cmd list_files\n> +\n> +for i in `seq 5`\n> +do\n> +\tcmd guilt pop\n> +\tcmd git for-each-ref\n> +\tcmd guilt push\n> +\tcmd git for-each-ref\n> +\tcmd guilt pop\n> +\tcmd git for-each-ref\n> +done\n> +\n> +# Check that \"pop -a\" does the right thing.\n> +cmd guilt push -a\n> +\n> +old_style_branch master\n> +\n> +cmd git for-each-ref\n> +\n> +cmd guilt pop -a\n> +\n> +cmd git for-each-ref\n> +\n> +# Check that pushing two patches converts the repo to now-style (since\n> +# it currently has no patches applied).\n> +cmd guilt push add\n> +cmd git for-each-ref\n> +\n> +# Check guilt branch with a few patches applied.\n> +old_style_branch master\n> +cmd guilt branch topic\n> +cmd git for-each-ref\n> +\n> +# Check that the topic branch is converted to new-style.\n> +cmd guilt pop -a\n> +cmd guilt push\n> +cmd git for-each-ref\n> +\n> +remove_topic topic\n> +\n> +# Check guilt branch with the full patch series applied.\n> +cmd guilt push -a\n> +old_style_branch master\n> +cmd guilt branch topic\n> +cmd git for-each-ref\n> +\n> +remove_topic topic\n> +\n> +# Check guilt branch with no patches applied.\n> +# This gives us a new-style checkout.\n> +cmd guilt branch topic\n> +cmd git for-each-ref\n> +cmd list_files\n> +\n> +remove_topic topic\n> +\n> +# Check guilt branch in a new-style directory with all patches\n> +# applied.  (Strictly speaking, this test should probably move to a\n> +# file devoted to testing \"guilt branch\".)\n> +cmd guilt push -a\n> +cmd guilt branch topic\n> +cmd git for-each-ref\n> +cmd list_files\n> +cmd guilt pop -a\n> +cmd git for-each-ref\n> +\n> +remove_topic topic\n> +\n> +# Check that \"guilt new\" does the right thing when no patches are\n> +# applied.  (Strictly speaking, this test should maybe move to\n> +# t-025.sh).\n> +\n> +cmd guilt new newpatch\n> +cmd git for-each-ref '--format=%(refname)'\n> +cmd guilt pop\n> +fixup_time_info newpatch\n> +cmd guilt push\n> +cmd git for-each-ref\n> +\n> +# Check that \"guilt commit\" does the right thing when committing all\n> +# applied patches.  (Strictly speaking, this test should maybe move to\n> +# t-030.sh).\n> +cmd git branch\n> +cmd guilt applied\n> +cmd guilt commit -a\n> +cmd git for-each-ref\n> +cmd git branch\n> +\n> +# Check that \"guilt commit\" does the right thing when committing only\n> +# a few of the applied patches.  (Strictly speaking, this test should\n> +# maybe move to t-030.sh).\n> +cmd guilt push -a\n> +cmd guilt applied\n> +cmd git branch\n> +cmd git for-each-ref\n> +cmd guilt commit -n 2\n> +cmd git for-each-ref\n> +cmd git branch\n> +cmd guilt commit -n 2\n> +cmd git for-each-ref\n> +cmd git branch\n> +cmd guilt series\n> -- \n> 1.8.2\n> \n\n-- \nOnce you have their hardware. Never give it back.\n(The First Rule of Hardware Acquisition)\n"},{"id":"218182","messageId":"20130522144531.GB2777@thunk.org","threadId":"33893","inReplyTo":"20130522134212.GB13731@poseidon.cudanet.local","subject":"Re: [PATCH] Added guilt.reusebranch configuration option.","fromName":"Theodore Ts'o","fromEmail":"tytso@mit.edu","sentAt":"2013-05-22T14:45:31Z","receivedAt":"2013-05-22T14:45:31Z","isPatch":true,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"I just had another idea (although I haven't had a chance to code up\nanything yet).  Perhaps instead of, or in addition to, a global\nsetting (i.e., guilt.reusebranch), perhaps we should have a per-branch\nsetting, such as branch.<branch>.guiltReuseBranch?\n\nI was actually thinking that it might be interesting to have a\nbranch.<branch>.rewindable, which would change the guilt defaults, and\ncould also key changes in key git behavior which makes it less likely\nthat a user shoots him or herself in the foot --- i.e., give warnings\nif he or she has modified the branch in such a way that\nremotes.origin.<branch> is no longer contained within the branch head.\n\n\t\t\t      \t     \t       \t      \t  - Ted\n"},{"id":"218189","messageId":"20130522163139.GF13731@poseidon.cudanet.local","threadId":"33893","inReplyTo":"20130522144531.GB2777@thunk.org","subject":"Re: [PATCH] Added guilt.reusebranch configuration option.","fromName":"Josef 'Jeff' Sipek","fromEmail":"jeffpc@josefsipek.net","sentAt":"2013-05-22T16:31:39Z","receivedAt":"2013-05-22T16:31:39Z","isPatch":true,"sender":{"key":"jeffpc@josefsipek.net","avatar":null},"body":"On Wed, May 22, 2013 at 10:45:31AM -0400, Theodore Ts'o wrote:\n> I just had another idea (although I haven't had a chance to code up\n> anything yet).  Perhaps instead of, or in addition to, a global\n> setting (i.e., guilt.reusebranch), perhaps we should have a per-branch\n> setting, such as branch.<branch>.guiltReuseBranch?\n> \n> I was actually thinking that it might be interesting to have a\n> branch.<branch>.rewindable, which would change the guilt defaults, and\n> could also key changes in key git behavior which makes it less likely\n> that a user shoots him or herself in the foot --- i.e., give warnings\n> if he or she has modified the branch in such a way that\n> remotes.origin.<branch> is no longer contained within the branch head.\n\nInteresting!  I wonder what git people have to say about this.\n\nJeff.\n\n-- \nWe have joy, we have fun, we have Linux on a Sun...\n"},{"id":"218197","messageId":"7v8v36kiau.fsf@alter.siamese.dyndns.org","threadId":"33893","inReplyTo":"20130522144531.GB2777@thunk.org","subject":"Re: [PATCH] Added guilt.reusebranch configuration option.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-22T17:58:49Z","receivedAt":"2013-05-22T17:58:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Theodore Ts'o <tytso@mit.edu> writes:\n\n> I was actually thinking that it might be interesting to have a\n> branch.<branch>.rewindable, which would change the guilt defaults, and\n> could also key changes in key git behavior which makes it less likely\n> that a user shoots him or herself in the foot --- i.e., give warnings\n> if he or she has modified the branch in such a way that\n> remotes.origin.<branch> is no longer contained within the branch head.\n\nAt least \"rebase\" can pay attention to it and might make the world a\nbetter place.\n\nYour final \"git push\" needs to be forced if you rewound beyond\nremotes.origin.<branch> so in that sense, there already is a sefety,\nbut it is better to give the user a chance to notice that before the\nuser spends more time to polish the rewound topic to perfection,\nonly to see the push rejected.\n"},{"id":"218198","messageId":"20130522180403.GB20848@thunk.org","threadId":"33893","inReplyTo":"7v8v36kiau.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Added guilt.reusebranch configuration option.","fromName":"Theodore Ts'o","fromEmail":"tytso@mit.edu","sentAt":"2013-05-22T18:04:03Z","receivedAt":"2013-05-22T18:04:03Z","isPatch":true,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"On Wed, May 22, 2013 at 10:58:49AM -0700, Junio C Hamano wrote:\n> Theodore Ts'o <tytso@mit.edu> writes:\n> \n> > I was actually thinking that it might be interesting to have a\n> > branch.<branch>.rewindable, which would change the guilt defaults, and\n> > could also key changes in key git behavior which makes it less likely\n> > that a user shoots him or herself in the foot --- i.e., give warnings\n> > if he or she has modified the branch in such a way that\n> > remotes.origin.<branch> is no longer contained within the branch head.\n> \n> At least \"rebase\" can pay attention to it and might make the world a\n> better place.\n\nYeah, rebase was the primary command I was thinking about.  The other\none would be \"git commit --amend\" after the branch had been pushed\nout.\n\n\t\t\t\t\t- Ted\n"},{"id":"218201","messageId":"7vvc6aj14r.fsf@alter.siamese.dyndns.org","threadId":"33893","inReplyTo":"20130522180403.GB20848@thunk.org","subject":"Re: [PATCH] Added guilt.reusebranch configuration option.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-22T18:55:00Z","receivedAt":"2013-05-22T18:55:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Theodore Ts'o <tytso@mit.edu> writes:\n\n> On Wed, May 22, 2013 at 10:58:49AM -0700, Junio C Hamano wrote:\n>> Theodore Ts'o <tytso@mit.edu> writes:\n>> \n>> > I was actually thinking that it might be interesting to have a\n>> > branch.<branch>.rewindable, which would change the guilt defaults, and\n>> > could also key changes in key git behavior which makes it less likely\n>> > that a user shoots him or herself in the foot --- i.e., give warnings\n>> > if he or she has modified the branch in such a way that\n>> > remotes.origin.<branch> is no longer contained within the branch head.\n>> \n>> At least \"rebase\" can pay attention to it and might make the world a\n>> better place.\n>\n> Yeah, rebase was the primary command I was thinking about.  The other\n> one would be \"git commit --amend\" after the branch had been pushed\n> out.\n\nIt may or may not matter for the kernel folks, but let me pick your\nbrain while we are on this subject.\n\nThe \"upstream\" (your remotes.origin.<branch>) is that on top of\nwhich you build your work.  You clone from there to bootstrap\nyourself, you add your work (which may include integrating the work\nof your contributors, if you are a mid-tier maintainer/integrator\naka a lieutenant) on top of it, and arrange the result to reach the\n\"upstream\" in some way.\n\nFor the simplest (and still widely used) workflow that employs a\ncentral shared repository, the way to make the result to reach the\n\"upstream\" is by directly pushing into it yourself.  In that sense,\nthe word \"upstream\" and the traditional behaviour of \"git push\" that\npushes back to the 'origin' (or branch.<branch>.remote) to update\nyour \"upstream\" (or branch.<branch>.merge at 'origin') both make\nperfect sense.\n\nAlso, if you are rebasing, @{u} refers to that place you integrate\nwith, i.e. your \"upstream\", in the central shared repository\nworkflow.\n\nBut in a triangular workflow, the way to make the result reach the\n\"upstream\" is *not* by pushing there yourself.  For developers at\nthe leaf level, it is to push to their own repository (often on\nGitHub), which is different from where they (initially) clone from\nin order to bootstrap themselves, and (subsequently) pull from in\norder to keep them up-to-date.  And then they request the published\nwork to be pulled by the \"upstream\".\n\nEven in a triangular workflow, @{u} should still refer to the place\nyou integrate with, i.e. your \"upstream\", not to the place you push\nto publish the result of your work.\n\nThis branch.<branch>.rewindable safety however cannot be tied to\n@{u}.  The bottom boundary you want to be warned when you cross is\nthe change you pushed out to your publishing repository, and it may\nnot have reached remotes.origin.<branch> yet.\n\nWe will be introducing remote.pushdefault configuration in the\nupcoming 1.8.3 release, so that you can say:\n\n\t[remote \"origin\"]\n        \turl = git://g.k.o/pub/scm/linux/kernel/git/torvalds/linux.git/\n\t\tfetch = +refs/heads/*:refs/remotes/origin/*\n\n\t[remote \"ext4\"]\n        \turl = g.k.o:/pub/scm/linux/kernel/git/tytso/ext4.git/\n\t\tfetch = +refs/heads/*:refs/remotes/ext4/*\n\n\t[remote]\n        \tpushdefault = ext4\n\nand hopefully it would let you do this:\n\n\tgit checkout master\n        ... after working on it ...\n        git push\n\nAs remote.pushdefault is set to ext4, without any extra arguments,\nthe result will pushed to the \"ext4\" remote.  If you are using the\ntraditional push.default=matching, it may also try to push out dev,\ndev-next and other branches you may have in your local repository\nand at k.org; if you are using push.default=simple or other \"single\nbranch\" modes like \"current\", \"upstream\", etc, it will only push out\nyour current branch (i.e. \"master\") to \"ext4\" remote.\n\nYou may however be using your local \"master\" branch for your\ndevelopment, and pushing the result out to \"dev\".  With only the\nremote.pushdefault setting to push to ext4 (instead of origin), you\nstill would have to say\n\n\tgit push ext4 master:dev\n\nThere is another change discussed on the list recently to also let\nyou configure your local \"master\" branch to update \"dev\" in your\npublishing repository.  It may go like this:\n\n\t[branch \"master\"]\n        \tpush = refs/heads/dev\n\nIn any case, refs/remotes/ext4/dev would be the remote tracking\nbranch (not refs/remotes/origin/anything) that keeps track of what\nyou pushed out there the last time.  And that would be what your new\nsafety based on \"branch.master.rewindable = no\" needs to check\nagainst, not \"refs/remotes/origin/master\" which is your master@{u}.\n"},{"id":"218225","messageId":"20130523021123.GA23155@thunk.org","threadId":"33893","inReplyTo":"7vvc6aj14r.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Added guilt.reusebranch configuration option.","fromName":"Theodore Ts'o","fromEmail":"tytso@mit.edu","sentAt":"2013-05-23T02:11:23Z","receivedAt":"2013-05-23T02:11:23Z","isPatch":true,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"On Wed, May 22, 2013 at 11:55:00AM -0700, Junio C Hamano wrote:\n> But in a triangular workflow, the way to make the result reach the\n> \"upstream\" is *not* by pushing there yourself.  For developers at\n> the leaf level, it is to push to their own repository (often on\n> GitHub), which is different from where they (initially) clone from\n> in order to bootstrap themselves, and (subsequently) pull from in\n> order to keep them up-to-date.  And then they request the published\n> work to be pulled by the \"upstream\".\n\nYep, what I do personally is to call the destination of this \"publish\", i.e.:\n\n[remote \"publish\"]\n\turl = ssh://gitolite@ra.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.g\n\tpush = +master:master\n\tpush = +origin:origin\n\tpush = +dev:dev\n\nSo my typical work flow when I am ready to submit to Linus is:\n\n   git tag -s ext4_for_linus\n   git push publish\n    <wait for this to propagate from ra.kernel.org to git.kernel.org,\n     typically ~5 minutes>\n   git request-pull git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git origin > /tmp/pull\n    <use /tmp/pull as the e-mail body to send to Linus, cc'ing\n     LKML and linux-ext4@vger.kernel.org>\n\nBut actually, it's much more common that I am doing a \"git push\npublish\" so that (a) it can get picked up by the daily linux-next tree\n(for integration testing even before Linus pulls it into his tree),\nand (b) so other ext4 developers so they can either test or develop\nagainst the ext4 tree in progress.\n\nI suppose it would be convenient for \"git push\" to push to the\n\"publish\" target, but I don't get confused about pushing to origin,\nsince semantically what I am doing is publishing the current state of\nthe ext4 tree so other people can see it.  So \"git push publish\" makes\na lot of sense to me.\n\n> Even in a triangular workflow, @{u} should still refer to the place\n> you integrate with, i.e. your \"upstream\", not to the place you push\n> to publish the result of your work.\n> \n> This branch.<branch>.rewindable safety however cannot be tied to\n> @{u}.  The bottom boundary you want to be warned when you cross is\n> the change you pushed out to your publishing repository, and it may\n> not have reached remotes.origin.<branch> yet.\n\nIndeed, and in fact for my use case what I promise people is that all\nof the commits between origin..master are non-rewindable.  It's the\ncommits betewen master..dev which are rewindable.  So for me, I'd\nstill use the safety feature even for my rewindable branch, but\ninstead of using remotes/publish/dev the \"no-rewind\" point, I'd want\nto use remotes/publish/master as the \"no-rewind\" point.\n\nRight now I do this just by being careful, but if there was an\nautomatic safety mechanism, it would save me a bit of work, since\notherwise I might not catch my mistake until I do the \"git push\npublish\", at which point I curse and then start consulting the reflog\nto back the state of my tree out, and then reapplying the work I had\nto the right tree.\n\n> We will be introducing remote.pushdefault configuration in the\n> upcoming 1.8.3 release, so that you can say.....\n>\n> and hopefully it would let you do this:\n> \n> \tgit checkout master\n>         ... after working on it ...\n>         git push\n\nYes, that would be convenient.  BTW, one of the other things which I\ndo for e2fsprogs is that I use multiple publishing points, which is\nmostly for historical reasons --- it used to be that repo.or.cz wasn't\nall that reliable, and the 10-15 minute replication time from\nra.kernel.org to git.kernel.org got really old.\n\nSo what I do is something like this:\n\ngit push publish ; git push repo ; git push code\n\nwhere....\n\n[remote \"publish\"]\n\turl = ssh://gitolite@ra.kernel.org/pub/scm/fs/ext2/e2fsprogs.git\n\tfetch = +refs/heads/*:refs/heads/*\n\tpush = next\n\tpush = master\n\tpush = maint\n\tpush = debian\n\tpush = +pu\n\n[remote \"code\"]\n\turl = https://code.google.com/p/e2fsprogs/\n\tfetch = +refs/heads/*:refs/heads/*\n\tpush = next\n\tpush = master\n\tpush = maint\n\tpush = debian\n\tpush = +pu\n\n[remote \"repo\"]\n\turl = ssh://repo.or.cz/srv/git/e2fsprogs.git\n\tpush = next\n\tpush = master\n\tpush = maint\n\tpush = debian\n\tpush = +pu\n\nI don't know if this is something you'd want git to encourage, or\nsupport explicitly, but I thought I'd mention it.\n\n\t\t\t\t\t\t- Ted\n"},{"id":"218245","messageId":"CALkWK0kyRno4eMYHXC3RkJFCVZ6DJWgFX=pR+WCu8=Gaf9q=Mw@mail.gmail.com","threadId":"33893","inReplyTo":"20130523021123.GA23155@thunk.org","subject":"Re: [PATCH] Added guilt.reusebranch configuration option.","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-05-23T09:52:50Z","receivedAt":"2013-05-23T09:52:50Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Theodore Ts'o wrote:\n> Right now I do this just by being careful, but if there was an\n> automatic safety mechanism, it would save me a bit of work, since\n> otherwise I might not catch my mistake until I do the \"git push\n> publish\", at which point I curse and then start consulting the reflog\n> to back the state of my tree out, and then reapplying the work I had\n> to the right tree.\n\nMy scenario is a bit different, and I think this safety feature is\nhighly overrated.  It's not that \"I'll never rewind some branches, but\nrewind other branches\", but rather \"I might rewind anything at any\ntime, but I want immediate information so I can quickly inspect @{1}\nto see if that was undesirable\".  To put it another way, my philosophy\nis not \"auto-deny unintended changes\", but rather \"tell me immediately\nabout undesirable changes\".  To this effect, my prompt looks like:\n\nartagnon|push-current-head=:~/src/git$\n\nThe = indicates that I'm in sync with upstream, and that there's\nnothing to push.  When I make some changes, that character changes to\n>, which means that there are ff changes to push.  Finally,\n\nartagnon|push-current-head<>:~/src/git$\n\nhas my immediate attention.  <> means that I've diverged from\nupstream.  Since the prompt is present all the time, I catch the\ndivergence just-in-time.  Moreover, I push very frequently resetting\nthe prompt to = periodically.\n\nSo, do you still need this rewinding safety thing?\n\n> So what I do is something like this:\n>\n> git push publish ; git push repo ; git push code\n\nWhile we can definitely make the UI better for this (maybe push\n--multiple?), there is no fundamental change: we have to re-initialize\nall the refspecs, connect to the remote via the transport layer and\nprepare a packfile to send.  In other words, it's impossible to make\nit any faster than what you get with the above.\n\n> where....\n>\n> [remote \"publish\"]\n>         url = ssh://gitolite@ra.kernel.org/pub/scm/fs/ext2/e2fsprogs.git\n>         fetch = +refs/heads/*:refs/heads/*\n>         push = next\n>         push = master\n>         push = maint\n>         push = debian\n>         push = +pu\n\nSo you're a batched-push person.  And the above makes it clear that\nyou don't want to explicitly differentiate between a push and push -f\n(the +pu thing).  And this assumes that you never create any new\nbranches (I branch out all the time), otherwise you'd have rules for\nrefs/heads/*.  Just out of curiosity, do you ever have ref-renaming\nrequirements (like push = refs/heads/*:refs/heads/tt/*)?  We were\ndiscussing that on another thread, but I haven't found an\nimplementation I'm happy with yet.\n"},{"id":"218296","messageId":"20130523183759.GB1275@thunk.org","threadId":"33893","inReplyTo":"CALkWK0kyRno4eMYHXC3RkJFCVZ6DJWgFX=pR+WCu8=Gaf9q=Mw@mail.gmail.com","subject":"Re: [PATCH] Added guilt.reusebranch configuration option.","fromName":"Theodore Ts'o","fromEmail":"tytso@mit.edu","sentAt":"2013-05-23T18:37:59Z","receivedAt":"2013-05-23T18:37:59Z","isPatch":true,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"On Thu, May 23, 2013 at 03:22:50PM +0530, Ramkumar Ramachandra wrote:\n> Theodore Ts'o wrote:\n> > Right now I do this just by being careful, but if there was an\n> > automatic safety mechanism, it would save me a bit of work, since\n> > otherwise I might not catch my mistake until I do the \"git push\n> > publish\", at which point I curse and then start consulting the reflog\n> > to back the state of my tree out, and then reapplying the work I had\n> > to the right tree.\n> \n> My scenario is a bit different, and I think this safety feature is\n> highly overrated.  It's not that \"I'll never rewind some branches, but\n> rewind other branches\", but rather \"I might rewind anything at any\n> time, but I want immediate information so I can quickly inspect @{1}\n> to see if that was undesirable\".\n\nSpekaing of which, what I'd really appreciate is timestamps associated\nwith the reflog.  That's because the most common time when I've\nscrewed something up is after doing a \"git rebase -i\" and so the\nreflog has a *huge* number of entries on it, and figuring out which\nentry in the reflog is the right one is painful.  If could tell at a\nglance when each entry of the reflog was created, it would make it a\nlot easier to untangle a tree mangled by git rebase -i.\n\nIn practice, it means I waste five minutes carefully inspecting a few\ndozen entries on the reflog, so it's not a disaster, although I'm\ngenerally cursing the whole time while I'm trying to untangle the\nwhole mess.\n\nThis issue with reflogs not having timestamps isn't primarily about\nrewind safety, BTW; it's just one of the things which make consulting\nthe reflog painful --- and it's much more likely happens after I screw\nup a git rebase -i, generally because of what happens when there's a\nmerge conflict and then I accidentally fold two commits together\nunintentionally.  The times when I've screwed up a non-rewinding\nbranch and then needed to recover after discovering the problem when I\ntry to publish said branch are admittedly rare; maybe once or twice\ntimes in the past twelve months.\n\n> So, do you still need this rewinding safety thing?\n\nMeh; I don't *need* it.  But then again, I'm an fairly experienced git\nuser.  The fact that I use guilt without the \"guilt/master\" safety\nfeature and have never gotten bitten by it --- in fact I deliberately\npublish rewindable branches with a guilt patch series applies speaks\nto the fact that I'm pretty experienced at rewindable heads.\n\nThe only reason why I suggested it is because I believe it would be\nuseful for people with less experience, and perhaps it would help make\nrewindable branches less scary, and less subject to a lot of the\nfearmongering that you see on the blogosphere.\n\n> \n> > So what I do is something like this:\n> >\n> > git push publish ; git push repo ; git push code\n> \n> While we can definitely make the UI better for this (maybe push\n> --multiple?), there is no fundamental change: we have to re-initialize\n> all the refspecs, connect to the remote via the transport layer and\n> prepare a packfile to send.  In other words, it's impossible to make\n> it any faster than what you get with the above.\n\nSure, and if I cared I'd make a git alias to automate this, instead of\ndepending on finger macros.\n\n> So you're a batched-push person.  And the above makes it clear that\n> you don't want to explicitly differentiate between a push and push -f\n> (the +pu thing).  And this assumes that you never create any new\n> branches (I branch out all the time), otherwise you'd have rules for\n> refs/heads/*.\n\nI create new branches all the time.  But they are for my own personal\ntesting purposes.  So it's fairer to say that I rarely *publish* new\nbranches; I generally stick to the standard set of next, master,\nmaint, and pu.  And part of that is that even publishing this number\nof branches is enough to sometimes confuse the e2fsprogs developers\nwho are pulling from my tree.\n\nSo what I've done in the past is to create a whole bunch of feature\nbranches, and then merge them into the pu branch, and then only\npublish the pu branch.  And I try to get the feature branches cleaned\nup as quickly as I have time, so they can appear on the maint or\nmaster/next branches sooner rather than later.\n\n> Just out of curiosity, do you ever have ref-renaming\n> requirements (like push = refs/heads/*:refs/heads/tt/*)?  We were\n> discussing that on another thread, but I haven't found an\n> implementation I'm happy with yet.\n\nIn general, no, I don't do that, for the reasons stated above --- even\npublishing four branches gets to be confusing enough for people who\nare looking at my tree.\n\nI'm sure other people and other communities use git differently, so\nplease insert the standard disclaimer that there's more than one way\nto skin a cat.\n\nRegards,\n\n\t\t\t\t\t\t- Ted\n"},{"id":"218297","messageId":"7vtxlted1t.fsf@alter.siamese.dyndns.org","threadId":"33893","inReplyTo":"20130523021123.GA23155@thunk.org","subject":"Re: [PATCH] Added guilt.reusebranch configuration option.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-23T19:01:02Z","receivedAt":"2013-05-23T19:01:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Theodore Ts'o <tytso@mit.edu> writes:\n\n> On Wed, May 22, 2013 at 11:55:00AM -0700, Junio C Hamano wrote:\n>> But in a triangular workflow, the way to make the result reach the\n>> \"upstream\" is *not* by pushing there yourself.  For developers at\n>> the leaf level, it is to push to their own repository (often on\n>> GitHub), which is different from where they (initially) clone from\n>> in order to bootstrap themselves, and (subsequently) pull from in\n>> order to keep them up-to-date.  And then they request the published\n>> work to be pulled by the \"upstream\".\n>\n> Yep, what I do personally is to call the destination of this \"publish\", i.e.:\n>\n> [remote \"publish\"]\n> \turl = ssh://gitolite@ra.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.g\n> \tpush = +master:master\n> \tpush = +origin:origin\n> \tpush = +dev:dev\n>\n> So my typical work flow when I am ready to submit to Linus is:\n>\n>    git tag -s ext4_for_linus\n>    git push publish\n>     <wait for this to propagate from ra.kernel.org to git.kernel.org,\n>      typically ~5 minutes>\n\nAnd at this point I presume that you wish this \"push\" automatically\npushed out ext4_for_linus, just like \"fetch\" by default grabs tags\nthat point into the history being fetched?\n\nI think \"push --follow-tags\" in the upcoming 1.8.3 would work for\nyou if that is the case.\n\n>    git request-pull git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git origin > /tmp/pull\n>     <use /tmp/pull as the e-mail body to send to Linus, cc'ing\n>      LKML and linux-ext4@vger.kernel.org>\n>\n> But actually, it's much more common that I am doing a \"git push\n> publish\" so that (a) it can get picked up by the daily linux-next tree\n> (for integration testing even before Linus pulls it into his tree),\n> and (b) so other ext4 developers so they can either test or develop\n> against the ext4 tree in progress.\n>\n> I suppose it would be convenient for \"git push\" to push to the\n> \"publish\" target, but I don't get confused about pushing to origin,\n> since semantically what I am doing is publishing the current state of\n> the ext4 tree so other people can see it.  So \"git push publish\" makes\n> a lot of sense to me.\n\nNoted.\n\n>> Even in a triangular workflow, @{u} should still refer to the place\n>> you integrate with, i.e. your \"upstream\", not to the place you push\n>> to publish the result of your work.\n>> \n>> This branch.<branch>.rewindable safety however cannot be tied to\n>> @{u}.  The bottom boundary you want to be warned when you cross is\n>> the change you pushed out to your publishing repository, and it may\n>> not have reached remotes.origin.<branch> yet.\n>\n> Indeed, and in fact for my use case what I promise people is that all\n> of the commits between origin..master are non-rewindable.  It's the\n> commits betewen master..dev which are rewindable.  So for me, I'd\n> still use the safety feature even for my rewindable branch, but\n> instead of using remotes/publish/dev the \"no-rewind\" point, I'd want\n> to use remotes/publish/master as the \"no-rewind\" point.\n\nSounds sensible.\n\n> Right now I do this just by being careful, but if there was an\n> automatic safety mechanism, it would save me a bit of work, since\n> otherwise I might not catch my mistake until I do the \"git push\n> publish\", at which point I curse and then start consulting the reflog\n> to back the state of my tree out, and then reapplying the work I had\n> to the right tree.\n\nYes, exactly.\n\n> Yes, that would be convenient.  BTW, one of the other things which I\n> do for e2fsprogs is that I use multiple publishing points, which is\n> mostly for historical reasons --- it used to be that repo.or.cz wasn't\n> all that reliable, and the 10-15 minute replication time from\n> ra.kernel.org to git.kernel.org got really old.\n>\n> So what I do is something like this:\n>\n> git push publish ; git push repo ; git push code\n>\n> where....\n>\n> [remote \"publish\"]\n> \turl = ssh://gitolite@ra.kernel.org/pub/scm/fs/ext2/e2fsprogs.git\n> ...\n> [remote \"repo\"]\n> ...\n> I don't know if this is something you'd want git to encourage, or\n> support explicitly, but I thought I'd mention it.\n\nI think you can have more than one destination URLs to a single\nremote you are pushing as long as what are pushed and how are common\nto them, that is, something like this:\n\n[remote \"publish\"]\n\t; where do we fetch/pull from and how?\n\turl = ssh://gitolite@ra.kernel.org/pub/scm/fs/ext2/e2fsprogs.git\n\tfetch = +refs/heads/*:refs/heads/*\n\t; where do we push to and how?\n\tpushurl = ssh://gitolite@ra.kernel.org/pub/scm/fs/ext2/e2fsprogs.git\n\tpushurl = https://code.google.com/p/e2fsprogs/\n\tpushurl = ssh://repo.or.cz/srv/git/e2fsprogs.git\n\tpush = next\n\tpush = master\n\tpush = maint\n\tpush = debian\n\tpush = +pu\n"},{"id":"218298","messageId":"CALkWK0nXRxL706t4EJoc2SHjwEdjCa_Q1UXZcwz8tsdDmQOneA@mail.gmail.com","threadId":"33893","inReplyTo":"20130523183759.GB1275@thunk.org","subject":"Re: [PATCH] Added guilt.reusebranch configuration option.","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-05-23T19:06:51Z","receivedAt":"2013-05-23T19:06:51Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Theodore Ts'o wrote:\n> Spekaing of which, what I'd really appreciate is timestamps associated\n> with the reflog.  That's because the most common time when I've\n> screwed something up is after doing a \"git rebase -i\" and so the\n> reflog has a *huge* number of entries on it, and figuring out which\n> entry in the reflog is the right one is painful.  If could tell at a\n> glance when each entry of the reflog was created, it would make it a\n> lot easier to untangle a tree mangled by git rebase -i.\n\nYeah, I completely agree with this one.  I've wished for the reflog to\nbe presented in a nicer ui, with humanized timestamps and colors.\n\n> Meh; I don't *need* it.  But then again, I'm an fairly experienced git\n> user.  The fact that I use guilt without the \"guilt/master\" safety\n> feature and have never gotten bitten by it --- in fact I deliberately\n> publish rewindable branches with a guilt patch series applies speaks\n> to the fact that I'm pretty experienced at rewindable heads.\n\nOh, and thanks for mentioning guilt: I just learnt about it.\n\n> The only reason why I suggested it is because I believe it would be\n> useful for people with less experience, and perhaps it would help make\n> rewindable branches less scary, and less subject to a lot of the\n> fearmongering that you see on the blogosphere.\n\nMy message was a critique.  I'm not denying that the feature may be\nuseful; it's just that we should have a good rationalization of the\nusecase and design something carefully.\n\n> Sure, and if I cared I'd make a git alias to automate this, instead of\n> depending on finger macros.\n\nYes.  My comment was more of question: can --multiple be more than a\nfor loop written in shell?  If not, is it worth writing?  Are there\nenough users?\n\nJunio mentioned pushurl in the other email: if they're perfect\nmirrors, won't pushurl suffice?\n\n> I create new branches all the time.  But they are for my own personal\n> testing purposes.  So it's fairer to say that I rarely *publish* new\n> branches; I generally stick to the standard set of next, master,\n> maint, and pu.  And part of that is that even publishing this number\n> of branches is enough to sometimes confuse the e2fsprogs developers\n> who are pulling from my tree.\n\nJust for contrast: I never keep anything locally.  I publish as much\nof my setup as humanly possible so that I'm not tied to one machine.\n\n> In general, no, I don't do that, for the reasons stated above --- even\n> publishing four branches gets to be confusing enough for people who\n> are looking at my tree.\n\nJust publish different branches to different locations?  Isn't that\nwhy we got triangular workflows?\n\n> I'm sure other people and other communities use git differently, so\n> please insert the standard disclaimer that there's more than one way\n> to skin a cat.\n\nOfcourse.  I believe in being all-inclusive, and not dropping a single\nfeature that has users.\n"},{"id":"218299","messageId":"7vobc1ecfg.fsf@alter.siamese.dyndns.org","threadId":"33893","inReplyTo":"20130523183759.GB1275@thunk.org","subject":"Re: [PATCH] Added guilt.reusebranch configuration option.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-23T19:14:27Z","receivedAt":"2013-05-23T19:14:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Theodore Ts'o <tytso@mit.edu> writes:\n\n> Spekaing of which, what I'd really appreciate is timestamps associated\n> with the reflog.  That's because the most common time when I've\n> screwed something up is after doing a \"git rebase -i\" and so the\n> reflog has a *huge* number of entries on it, and figuring out which\n> entry in the reflog is the right one is painful.  If could tell at a\n> glance when each entry of the reflog was created, it would make it a\n> lot easier to untangle a tree mangled by git rebase -i.\n\nDo you mean you want to go back to one specific step in \"rebase -i\",\nor you mean you want to go back to the state before \"rebase -i\"?\n\nIf the latter, one nice thing to know may be that \"git log -g\" is\nlike \"git log -g HEAD@{0}\" and inspects the reflog associated with\nHEAD, and you can view individual steps of \"rebase -i\".  On the\nother hand, \"git log -g @{0}\" (or \"git log -g master@{0}\" if you are\non 'master' branch) will inspect the reflog associated with the\ncurrent branch, and \"rebase -i\" appears as a single event (i.e. the\ntip before rewinding and replaying all the changes is replaced with\nthe tip after that whole series of replaying).  So the latter is\nwhat you want to use if you are interested in the state before the\nwhole \"rebase -i\" operation.\n\nAlso you can ask \"git log -g HEAD@{now}\" and \"git log -g @{now}\".  I\nagree with you that \"git log --oneline -g @{now}\" is very handy, and\n\"git log --oneline --relative-date -g @{now}\" is even better, as I\ncan clearly see where the flurry of recent activities ends and which\nreflog entry is the one I was at 20 minutes ago before I started.\n\n> This issue with reflogs not having timestamps isn't primarily about\n> rewind safety,...\n\nI think I may have answered this part with the above.\n\n> So what I've done in the past is to create a whole bunch of feature\n> branches, and then merge them into the pu branch, and then only\n> publish the pu branch.  And I try to get the feature branches cleaned\n> up as quickly as I have time, so they can appear on the maint or\n> master/next branches sooner rather than later.\n\nSounds very similar to somebody else is doing ;-)\n\n>> Just out of curiosity, do you ever have ref-renaming\n>> requirements (like push = refs/heads/*:refs/heads/tt/*)?  We were\n>> discussing that on another thread, but I haven't found an\n>> implementation I'm happy with yet.\n>\n> In general, no, I don't do that, for the reasons stated above --- even\n> publishing four branches gets to be confusing enough for people who\n> are looking at my tree.\n>\n> I'm sure other people and other communities use git differently, so\n> please insert the standard disclaimer that there's more than one way\n> to skin a cat.\n\nAgreed to both counts.  Thanks for comments.\n"}]}