git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] guilt: force the use of bare branches
@ 2013-05-22  2:55 Theodore Ts'o
  2013-05-22  3:29 ` Josef 'Jeff' Sipek
  0 siblings, 1 reply; 17+ messages in thread
From: Theodore Ts'o @ 2013-05-22  2:55 UTC (permalink / raw)
  To: jeffpc; +Cc: git, Theodore Ts'o, Per Cederqvist

To make it harder to accidentally do "git push" with a guilt patch
applied, "guilt push" changes branch from e.g. "master" to
"guilt/master" starting with commit 67d3af63f422.  This is a feature
which I use for ext4 development; I actually *do* want to be able to
push patches to the dev branch, which is a rewindable branch much like
git's "pu" branch.

Allow the use of the environment variable GUILT_FORCE_BARE_BRANCH
which disables the new behavior introduced by commit 67d3af63f422.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Per Cederqvist <cederp@opera.com>
---
 guilt | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/guilt b/guilt
index 309437a..9953bdf 100755
--- a/guilt
+++ b/guilt
@@ -914,13 +914,22 @@ else
 	die "Unsupported operating system: $UNAME_S"
 fi
 
-if [ "$branch" = "$raw_git_branch" ] && [ -n "`get_top 2>/dev/null`" ]
-then
-    # This is for compat with old repositories that still have a
-    # pushed patch without the new-style branch prefix.
+if [ -n "`get_top 2>/dev/null`" ]; then
+  #
+  # If we have repositories patches pushed, then use whatever scheme
+  # is currently in use
+  #
+  if [ "$branch" = "$raw_git_branch" ]; then
     old_style_prefix=true
+  else
+    old_style_prefix=false
+  fi
 else
+  if [ -n "$GUILT_FORCE_BARE_BRANCH" ]; then
+    old_style_prefix=true
+  else
     old_style_prefix=false
+  fi
 fi
 
 _main "$@"
-- 
1.7.12.rc0.22.gcdd159b

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH] guilt: force the use of bare branches
  2013-05-22  2:55 [PATCH] guilt: force the use of bare branches Theodore Ts'o
@ 2013-05-22  3:29 ` Josef 'Jeff' Sipek
  2013-05-22 12:11   ` [PATCH -v2] " Theodore Ts'o
  0 siblings, 1 reply; 17+ messages in thread
From: Josef 'Jeff' Sipek @ 2013-05-22  3:29 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: git, Per Cederqvist

On Tue, May 21, 2013 at 10:55:57PM -0400, Theodore Ts'o wrote:
> To make it harder to accidentally do "git push" with a guilt patch
> applied, "guilt push" changes branch from e.g. "master" to
> "guilt/master" starting with commit 67d3af63f422.  This is a feature
> which I use for ext4 development; I actually *do* want to be able to
> push patches to the dev branch, which is a rewindable branch much like
> git's "pu" branch.
> 
> Allow the use of the environment variable GUILT_FORCE_BARE_BRANCH
> which disables the new behavior introduced by commit 67d3af63f422.

Would it make sense to make it git-config-able instead?  As an added bonus,
one can then make the decision on per-repository basis.

Jeff.

> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> Cc: Per Cederqvist <cederp@opera.com>
> ---
>  guilt | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/guilt b/guilt
> index 309437a..9953bdf 100755
> --- a/guilt
> +++ b/guilt
> @@ -914,13 +914,22 @@ else
>  	die "Unsupported operating system: $UNAME_S"
>  fi
>  
> -if [ "$branch" = "$raw_git_branch" ] && [ -n "`get_top 2>/dev/null`" ]
> -then
> -    # This is for compat with old repositories that still have a
> -    # pushed patch without the new-style branch prefix.
> +if [ -n "`get_top 2>/dev/null`" ]; then
> +  #
> +  # If we have repositories patches pushed, then use whatever scheme
> +  # is currently in use
> +  #
> +  if [ "$branch" = "$raw_git_branch" ]; then
>      old_style_prefix=true
> +  else
> +    old_style_prefix=false
> +  fi
>  else
> +  if [ -n "$GUILT_FORCE_BARE_BRANCH" ]; then
> +    old_style_prefix=true
> +  else
>      old_style_prefix=false
> +  fi
>  fi
>  
>  _main "$@"
> -- 
> 1.7.12.rc0.22.gcdd159b
> 

-- 
Linux, n.:
  Generous programmers from around the world all join forces to help
  you shoot yourself in the foot for free. 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH -v2] guilt: force the use of bare branches
  2013-05-22  3:29 ` Josef 'Jeff' Sipek
@ 2013-05-22 12:11   ` Theodore Ts'o
  2013-05-22 12:39     ` Per Cederqvist
  2013-05-22 13:01     ` [PATCH] Added guilt.reusebranch configuration option Per Cederqvist
  0 siblings, 2 replies; 17+ messages in thread
From: Theodore Ts'o @ 2013-05-22 12:11 UTC (permalink / raw)
  To: jeffpc; +Cc: git, Theodore Ts'o, Per Cederqvist

To make it harder to accidentally do "git push" with a guilt patch
applied, "guilt push" changes branch from e.g. "master" to
"guilt/master" starting with commit 67d3af63f422.  This is a feature
which I use for ext4 development; I actually *do* want to be able to
push patches to the dev branch, which is a rewindable branch much like
git's "pu" branch.

Allow the use of the environment variable GUILT_FORCE_BARE_BRANCH
which disables the new behavior introduced by commit 67d3af63f422.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Per Cederqvist <cederp@opera.com>
---
 guilt | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/guilt b/guilt
index e9b2aab..35a84dc 100755
--- a/guilt
+++ b/guilt
@@ -914,13 +914,22 @@ else
 	die "Unsupported operating system: $UNAME_S"
 fi
 
-if [ "$branch" = "$raw_git_branch" ] && [ -n "`get_top 2>/dev/null`" ]
-then
-    # This is for compat with old repositories that still have a
-    # pushed patch without the new-style branch prefix.
+if [ -n "`get_top 2>/dev/null`" ]; then
+  #
+  # If we have repositories patches pushed, then use whatever scheme
+  # is currently in use
+  #
+  if [ "$branch" = "$raw_git_branch" ]; then
     old_style_prefix=true
+  else
+    old_style_prefix=false
+  fi
 else
+  if [ "$(git config --bool --get guilt.bareBranch)" = "true" ]; then
+    old_style_prefix=true
+  else
     old_style_prefix=false
+  fi
 fi
 
 _main "$@"
-- 
1.7.12.rc0.22.gcdd159b

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH -v2] guilt: force the use of bare branches
  2013-05-22 12:11   ` [PATCH -v2] " Theodore Ts'o
@ 2013-05-22 12:39     ` Per Cederqvist
  2013-05-22 13:01     ` [PATCH] Added guilt.reusebranch configuration option Per Cederqvist
  1 sibling, 0 replies; 17+ messages in thread
From: Per Cederqvist @ 2013-05-22 12:39 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: jeffpc, git

On 05/22/13 14:11, Theodore Ts'o wrote:
> To make it harder to accidentally do "git push" with a guilt patch
> applied, "guilt push" changes branch from e.g. "master" to
> "guilt/master" starting with commit 67d3af63f422.  This is a feature
> which I use for ext4 development; I actually *do* want to be able to
> push patches to the dev branch, which is a rewindable branch much like
> git's "pu" branch.
>
> Allow the use of the environment variable GUILT_FORCE_BARE_BRANCH
> which disables the new behavior introduced by commit 67d3af63f422.
>
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> Cc: Per Cederqvist <cederp@opera.com>

I just posted an alternative patch that solves the same issue.
I forgot to add in-reply-to headers, and did change the subject
to "Added guilt.reusebranch configuration option". Sorry if I've
caused any confusion.

     /ceder

> ---
>   guilt | 17 +++++++++++++----
>   1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/guilt b/guilt
> index e9b2aab..35a84dc 100755
> --- a/guilt
> +++ b/guilt
> @@ -914,13 +914,22 @@ else
>   	die "Unsupported operating system: $UNAME_S"
>   fi
>
> -if [ "$branch" = "$raw_git_branch" ] && [ -n "`get_top 2>/dev/null`" ]
> -then
> -    # This is for compat with old repositories that still have a
> -    # pushed patch without the new-style branch prefix.
> +if [ -n "`get_top 2>/dev/null`" ]; then
> +  #
> +  # If we have repositories patches pushed, then use whatever scheme
> +  # is currently in use
> +  #
> +  if [ "$branch" = "$raw_git_branch" ]; then
>       old_style_prefix=true
> +  else
> +    old_style_prefix=false
> +  fi
>   else
> +  if [ "$(git config --bool --get guilt.bareBranch)" = "true" ]; then
> +    old_style_prefix=true
> +  else
>       old_style_prefix=false
> +  fi
>   fi
>
>   _main "$@"
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH] Added guilt.reusebranch configuration option.
  2013-05-22 12:11   ` [PATCH -v2] " Theodore Ts'o
  2013-05-22 12:39     ` Per Cederqvist
@ 2013-05-22 13:01     ` Per Cederqvist
  2013-05-22 13:42       ` Josef 'Jeff' Sipek
  1 sibling, 1 reply; 17+ messages in thread
From: Per Cederqvist @ 2013-05-22 13:01 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: jeffpc, git

When the option is true (the default), Guilt does not create a new Git
branch when patches are applied.  This way, you can switch between
Guilt 0.35 and the current version of Guilt with no issues.

At a future time, maybe a year after Guilt with guilt.reusebranch
support is released, the default should be changed to "false" to take
advantage of the ability to use a separate Git branch when patches are
applied.

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

This is an alternative solution to the same problem.  I've been running
with this code for a while.  I don't remember if I sent it to the list
before, but if I did it was apparently lost.  Sorry if I never sent it.

This version includes some regression tests.

(I'm having mail problems. Apologies if you receive this patch twice.)

    /ceder

 guilt                |  29 +++-
 regression/scaffold  |   1 +
 regression/t-062.out | 457 +++++++++++++++++++++++++++++++++++++++++++++++++++
 regression/t-062.sh  | 150 +++++++++++++++++
 4 files changed, 632 insertions(+), 5 deletions(-)
 create mode 100644 regression/t-062.out
 create mode 100755 regression/t-062.sh

diff --git a/guilt b/guilt
index 66a671a..108d4e7 100755
--- a/guilt
+++ b/guilt
@@ -836,6 +836,9 @@ guilt_push_diff_context=1
 # default diffstat value: true or false
 DIFFSTAT_DEFAULT="false"
 
+# default old_style_prefix value: true or false
+REUSE_BRANCH_DEFAULT="true"
+
 # Prefix for guilt branches.
 GUILT_PREFIX=guilt/
 
@@ -847,6 +850,10 @@ GUILT_PREFIX=guilt/
 diffstat=`git config --bool guilt.diffstat`
 [ -z "$diffstat" ] && diffstat=$DIFFSTAT_DEFAULT
 
+# reuse Git branch?
+reuse_branch=`git config --bool guilt.reusebranch`
+[ -z "$reuse_branch" ] && reuse_branch=$REUSE_BRANCH_DEFAULT
+
 #
 # The following gets run every time this file is source'd
 #
@@ -911,13 +918,25 @@ else
 	die "Unsupported operating system: $UNAME_S"
 fi
 
-if [ "$branch" = "$raw_git_branch" ] && [ -n "`get_top 2>/dev/null`" ]
+if [ -n "`get_top 2>/dev/null`" ]
 then
-    # This is for compat with old repositories that still have a
-    # pushed patch without the new-style branch prefix.
-    old_style_prefix=true
+	# If there is at least one pushed patch, we set
+	# old_style_prefix according to how it was pushed.  It is only
+	# possible to change the prefix style while no patches are
+	# applied.
+	if [ "$branch" = "$raw_git_branch" ]
+	then
+		old_style_prefix=true
+	else
+		old_style_prefix=false
+	fi
 else
-    old_style_prefix=false
+	if $reuse_branch
+	then
+		old_style_prefix=true
+	else
+		old_style_prefix=false
+	fi
 fi
 
 _main "$@"
diff --git a/regression/scaffold b/regression/scaffold
index 5c8b73e..acddb07 100644
--- a/regression/scaffold
+++ b/regression/scaffold
@@ -88,6 +88,7 @@ function setup_git_repo
 	git config log.date default
 	git config log.decorate no
 	git config guilt.diffstat false
+	git config guilt.reusebranch false
 }
 
 function setup_guilt_repo
diff --git a/regression/t-062.out b/regression/t-062.out
new file mode 100644
index 0000000..d00b3f6
--- /dev/null
+++ b/regression/t-062.out
@@ -0,0 +1,457 @@
+% setup_repo
+% git config guilt.reusebranch true
+% guilt push -a
+Applying patch..modify
+Patch applied.
+Applying patch..add
+Patch applied.
+Applying patch..remove
+Patch applied.
+Applying patch..mode
+Patch applied.
+% list_files
+d .git/patches
+d .git/patches/master
+d .git/refs/patches
+d .git/refs/patches/master
+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode
+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove
+f 71596bf71b72c2717e1aee378aabefbfa19ab7c8  .git/patches/master/status
+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
+r 33633e7a1aa31972f125878baf7807be57b1672d  .git/refs/patches/master/modify
+r 37d588cc39848368810e88332bd03b083f2ce3ac  .git/refs/patches/master/add
+r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba  .git/refs/patches/master/mode
+r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9  .git/refs/patches/master/remove
+% git for-each-ref
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/patches/master/mode
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
+% git update-ref refs/heads/master refs/heads/guilt/master
+fatal: refs/heads/guilt/master: not a valid SHA1
+% git symbolic-ref HEAD refs/heads/master
+% git update-ref -d refs/heads/guilt/master
+% git for-each-ref
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/patches/master/mode
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
+% list_files
+d .git/patches
+d .git/patches/master
+d .git/refs/patches
+d .git/refs/patches/master
+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode
+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove
+f 71596bf71b72c2717e1aee378aabefbfa19ab7c8  .git/patches/master/status
+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
+r 33633e7a1aa31972f125878baf7807be57b1672d  .git/refs/patches/master/modify
+r 37d588cc39848368810e88332bd03b083f2ce3ac  .git/refs/patches/master/add
+r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba  .git/refs/patches/master/mode
+r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9  .git/refs/patches/master/remove
+% guilt pop
+Now at remove.
+% git for-each-ref
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
+% guilt push
+Applying patch..mode
+Patch applied.
+% git for-each-ref
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/patches/master/mode
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
+% guilt pop
+Now at remove.
+% git for-each-ref
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
+% guilt pop
+Now at add.
+% git for-each-ref
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+% guilt push
+Applying patch..remove
+Patch applied.
+% git for-each-ref
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
+% guilt pop
+Now at add.
+% git for-each-ref
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+% guilt pop
+Now at modify.
+% git for-each-ref
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/heads/master
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+% guilt push
+Applying patch..add
+Patch applied.
+% git for-each-ref
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+% guilt pop
+Now at modify.
+% git for-each-ref
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/heads/master
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+% guilt pop
+All patches popped.
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
+% guilt push
+Applying patch..modify
+Patch applied.
+% git for-each-ref
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/heads/master
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+% guilt pop
+All patches popped.
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
+% guilt pop
+No patches applied.
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
+% guilt push
+Applying patch..modify
+Patch applied.
+% git for-each-ref
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/heads/master
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+% guilt pop
+All patches popped.
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
+% guilt push -a
+Applying patch..modify
+Patch applied.
+Applying patch..add
+Patch applied.
+Applying patch..remove
+Patch applied.
+Applying patch..mode
+Patch applied.
+% git update-ref refs/heads/master refs/heads/guilt/master
+fatal: refs/heads/guilt/master: not a valid SHA1
+% git symbolic-ref HEAD refs/heads/master
+% git update-ref -d refs/heads/guilt/master
+% git for-each-ref
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/patches/master/mode
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
+% guilt pop -a
+All patches popped.
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
+% guilt push add
+Applying patch..modify
+Patch applied.
+Applying patch..add
+Patch applied.
+% git for-each-ref
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+% git update-ref refs/heads/master refs/heads/guilt/master
+fatal: refs/heads/guilt/master: not a valid SHA1
+% git symbolic-ref HEAD refs/heads/master
+% git update-ref -d refs/heads/guilt/master
+% guilt branch topic
+Switched to branch "topic"
+% git for-each-ref
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/heads/topic
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/topic/add
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/topic/modify
+% guilt pop -a
+All patches popped.
+% guilt push
+Applying patch..modify
+Patch applied.
+% git for-each-ref
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/heads/master
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/heads/topic
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/topic/modify
+% guilt pop -a
+All patches popped.
+% git checkout master
+Switched to branch "master"
+% guilt pop -a
+All patches popped.
+% git branch -d topic
+Deleted branch topic (was d485041).
+% rm -r .git/patches/topic
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
+% list_files
+d .git/patches
+d .git/patches/master
+d .git/refs/patches
+d .git/refs/patches/master
+d .git/refs/patches/topic
+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode
+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove
+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status
+% guilt push -a
+Applying patch..modify
+Patch applied.
+Applying patch..add
+Patch applied.
+Applying patch..remove
+Patch applied.
+Applying patch..mode
+Patch applied.
+% git update-ref refs/heads/master refs/heads/guilt/master
+fatal: refs/heads/guilt/master: not a valid SHA1
+% git symbolic-ref HEAD refs/heads/master
+% git update-ref -d refs/heads/guilt/master
+% guilt branch topic
+Switched to branch "topic"
+% git for-each-ref
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/heads/master
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/heads/topic
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/patches/master/mode
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/topic/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/patches/topic/mode
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/topic/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/topic/remove
+% guilt pop -a
+All patches popped.
+% git checkout master
+Switched to branch "master"
+% guilt pop -a
+All patches popped.
+% git branch -d topic
+Deleted branch topic (was d485041).
+% rm -r .git/patches/topic
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
+% list_files
+d .git/patches
+d .git/patches/master
+d .git/refs/patches
+d .git/refs/patches/master
+d .git/refs/patches/topic
+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode
+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove
+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status
+% guilt branch topic
+Switched to branch "topic"
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
+d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/topic
+% list_files
+d .git/patches
+d .git/patches/master
+d .git/patches/topic
+d .git/refs/patches
+d .git/refs/patches/master
+d .git/refs/patches/topic
+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode
+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/topic/mode
+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove
+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/topic/remove
+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/topic/add
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/topic/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/topic/modify
+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status
+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/topic/status
+% guilt pop -a
+No patches applied.
+% git checkout master
+Switched to branch "master"
+% guilt pop -a
+No patches applied.
+% git branch -d topic
+Deleted branch topic (was d485041).
+% rm -r .git/patches/topic
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
+% list_files
+d .git/patches
+d .git/patches/master
+d .git/refs/patches
+d .git/refs/patches/master
+d .git/refs/patches/topic
+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode
+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove
+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status
+% guilt push -a
+Applying patch..modify
+Patch applied.
+Applying patch..add
+Patch applied.
+Applying patch..remove
+Patch applied.
+Applying patch..mode
+Patch applied.
+% guilt branch topic
+Switched to branch "topic"
+% git for-each-ref
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/heads/master
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/heads/topic
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/patches/master/mode
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/topic/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/patches/topic/mode
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/topic/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/topic/remove
+% list_files
+d .git/patches
+d .git/patches/master
+d .git/patches/topic
+d .git/refs/patches
+d .git/refs/patches/master
+d .git/refs/patches/topic
+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode
+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/topic/mode
+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove
+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/topic/remove
+f 71596bf71b72c2717e1aee378aabefbfa19ab7c8  .git/patches/master/status
+f 71596bf71b72c2717e1aee378aabefbfa19ab7c8  .git/patches/topic/status
+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/topic/add
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/topic/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/topic/modify
+r 33633e7a1aa31972f125878baf7807be57b1672d  .git/refs/patches/master/modify
+r 33633e7a1aa31972f125878baf7807be57b1672d  .git/refs/patches/topic/modify
+r 37d588cc39848368810e88332bd03b083f2ce3ac  .git/refs/patches/master/add
+r 37d588cc39848368810e88332bd03b083f2ce3ac  .git/refs/patches/topic/add
+r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba  .git/refs/patches/master/mode
+r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba  .git/refs/patches/topic/mode
+r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9  .git/refs/patches/master/remove
+r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9  .git/refs/patches/topic/remove
+% guilt pop -a
+All patches popped.
+% git for-each-ref
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/heads/master
+d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/topic
+37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/patches/master/mode
+33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
+% guilt pop -a
+No patches applied.
+% git checkout master
+Switched to branch "master"
+% guilt pop -a
+All patches popped.
+% git branch -d topic
+Deleted branch topic (was d485041).
+% rm -r .git/patches/topic
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
+% list_files
+d .git/patches
+d .git/patches/master
+d .git/refs/patches
+d .git/refs/patches/master
+d .git/refs/patches/topic
+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode
+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove
+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status
+% guilt new newpatch
+% git for-each-ref --format=%(refname)
+refs/heads/master
+refs/patches/master/newpatch
+% guilt pop
+All patches popped.
+% guilt push
+Applying patch..newpatch
+Patch applied.
+% git for-each-ref
+25465dc1687f3833ecbd4e8bca437e522d7026db commit	refs/heads/master
+25465dc1687f3833ecbd4e8bca437e522d7026db commit	refs/patches/master/newpatch
+% git branch
+* master
+% guilt applied
+newpatch
+% guilt commit -a
+% git for-each-ref
+25465dc1687f3833ecbd4e8bca437e522d7026db commit	refs/heads/master
+% git branch
+* master
+% guilt push -a
+Applying patch..modify
+Patch applied.
+Applying patch..add
+Patch applied.
+Applying patch..remove
+Patch applied.
+Applying patch..mode
+Patch applied.
+% guilt applied
+modify
+add
+remove
+mode
+% git branch
+* master
+% git for-each-ref
+fefbdcef61022d473838926619f31e030dd04fdc commit	refs/heads/master
+5effcbeb303e8433935151d8c69f3bf63db1e8ef commit	refs/patches/master/add
+fefbdcef61022d473838926619f31e030dd04fdc commit	refs/patches/master/mode
+9509f22e2e627756d87b42432931c45955b74234 commit	refs/patches/master/modify
+9cbe2fc643b1a9e2179a8738f80424a1c2aa202d commit	refs/patches/master/remove
+% guilt commit -n 2
+% git for-each-ref
+fefbdcef61022d473838926619f31e030dd04fdc commit	refs/heads/master
+fefbdcef61022d473838926619f31e030dd04fdc commit	refs/patches/master/mode
+9cbe2fc643b1a9e2179a8738f80424a1c2aa202d commit	refs/patches/master/remove
+% git branch
+* master
+% guilt commit -n 2
+% git for-each-ref
+fefbdcef61022d473838926619f31e030dd04fdc commit	refs/heads/master
+% git branch
+* master
+% guilt series
diff --git a/regression/t-062.sh b/regression/t-062.sh
new file mode 100755
index 0000000..ffefb9c
--- /dev/null
+++ b/regression/t-062.sh
@@ -0,0 +1,150 @@
+#!/bin/bash
+#
+# Test the branch-switching upgrade code
+#
+
+source $REG_DIR/scaffold
+
+old_style_branch() {
+	# Modify the refs so that it looks as if the patch series was applied
+	# by an old version of guilt.
+	cmd git update-ref refs/heads/$1 refs/heads/guilt/$1
+	cmd git symbolic-ref HEAD refs/heads/$1
+	cmd git update-ref -d refs/heads/guilt/$1
+}
+
+remove_topic() {
+	cmd guilt pop -a
+	if git rev-parse --verify --quiet guilt/master >/dev/null
+	then
+		cmd git checkout guilt/master
+	else
+		cmd git checkout master
+	fi
+	cmd guilt pop -a
+	cmd git branch -d $1
+	cmd rm -r .git/patches/$1
+	cmd git for-each-ref
+	cmd list_files
+}
+
+function fixup_time_info
+{
+	touch -a -m -t "$TOUCH_DATE" ".git/patches/master/$1"
+}
+
+cmd setup_repo
+
+cmd git config guilt.reusebranch true
+
+cmd guilt push -a
+cmd list_files
+cmd git for-each-ref
+
+# Pop and push patches.  Check that the repo is converted to new-style
+# refs when no patches are applied and a patch is pushed.
+old_style_branch master
+cmd git for-each-ref
+
+cmd list_files
+
+for i in `seq 5`
+do
+	cmd guilt pop
+	cmd git for-each-ref
+	cmd guilt push
+	cmd git for-each-ref
+	cmd guilt pop
+	cmd git for-each-ref
+done
+
+# Check that "pop -a" does the right thing.
+cmd guilt push -a
+
+old_style_branch master
+
+cmd git for-each-ref
+
+cmd guilt pop -a
+
+cmd git for-each-ref
+
+# Check that pushing two patches converts the repo to now-style (since
+# it currently has no patches applied).
+cmd guilt push add
+cmd git for-each-ref
+
+# Check guilt branch with a few patches applied.
+old_style_branch master
+cmd guilt branch topic
+cmd git for-each-ref
+
+# Check that the topic branch is converted to new-style.
+cmd guilt pop -a
+cmd guilt push
+cmd git for-each-ref
+
+remove_topic topic
+
+# Check guilt branch with the full patch series applied.
+cmd guilt push -a
+old_style_branch master
+cmd guilt branch topic
+cmd git for-each-ref
+
+remove_topic topic
+
+# Check guilt branch with no patches applied.
+# This gives us a new-style checkout.
+cmd guilt branch topic
+cmd git for-each-ref
+cmd list_files
+
+remove_topic topic
+
+# Check guilt branch in a new-style directory with all patches
+# applied.  (Strictly speaking, this test should probably move to a
+# file devoted to testing "guilt branch".)
+cmd guilt push -a
+cmd guilt branch topic
+cmd git for-each-ref
+cmd list_files
+cmd guilt pop -a
+cmd git for-each-ref
+
+remove_topic topic
+
+# Check that "guilt new" does the right thing when no patches are
+# applied.  (Strictly speaking, this test should maybe move to
+# t-025.sh).
+
+cmd guilt new newpatch
+cmd git for-each-ref '--format=%(refname)'
+cmd guilt pop
+fixup_time_info newpatch
+cmd guilt push
+cmd git for-each-ref
+
+# Check that "guilt commit" does the right thing when committing all
+# applied patches.  (Strictly speaking, this test should maybe move to
+# t-030.sh).
+cmd git branch
+cmd guilt applied
+cmd guilt commit -a
+cmd git for-each-ref
+cmd git branch
+
+# Check that "guilt commit" does the right thing when committing only
+# a few of the applied patches.  (Strictly speaking, this test should
+# maybe move to t-030.sh).
+cmd guilt push -a
+cmd guilt applied
+cmd git branch
+cmd git for-each-ref
+cmd guilt commit -n 2
+cmd git for-each-ref
+cmd git branch
+cmd guilt commit -n 2
+cmd git for-each-ref
+cmd git branch
+cmd guilt series
-- 
1.8.2

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH] Added guilt.reusebranch configuration option.
  2013-05-22 13:01     ` [PATCH] Added guilt.reusebranch configuration option Per Cederqvist
@ 2013-05-22 13:42       ` Josef 'Jeff' Sipek
  2013-05-22 14:45         ` Theodore Ts'o
  0 siblings, 1 reply; 17+ messages in thread
From: Josef 'Jeff' Sipek @ 2013-05-22 13:42 UTC (permalink / raw)
  To: Per Cederqvist; +Cc: Theodore Ts'o, git

On Wed, May 22, 2013 at 03:01:36PM +0200, Per Cederqvist wrote:
> When the option is true (the default), Guilt does not create a new Git
> branch when patches are applied.  This way, you can switch between
> Guilt 0.35 and the current version of Guilt with no issues.
> 
> At a future time, maybe a year after Guilt with guilt.reusebranch
> support is released, the default should be changed to "false" to take
> advantage of the ability to use a separate Git branch when patches are
> applied.

So, I've been using the always-on prefix code and I do like it.  It makes me
reasonably happy that other people that work on the same repo won't screw it
up.  So, with that said, I'm tempted to actually make the default the
new-style prefix.  If someone (there's at least Ted) wants the old behavior,
they'll have the config.

IOW, I'm tempted to apply this patch with a minor tweak: change the default
to new-style.

> Signed-off-by: Per Cederqvist <cederp@opera.com>
> ---
> 
> This is an alternative solution to the same problem.  I've been running
> with this code for a while.  I don't remember if I sent it to the list
> before, but if I did it was apparently lost.  Sorry if I never sent it.

For all I know, I just dropped this patch on the floor by accident :/

Jeff.

> This version includes some regression tests.
> 
> (I'm having mail problems. Apologies if you receive this patch twice.)
> 
>     /ceder
> 
>  guilt                |  29 +++-
>  regression/scaffold  |   1 +
>  regression/t-062.out | 457 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  regression/t-062.sh  | 150 +++++++++++++++++
>  4 files changed, 632 insertions(+), 5 deletions(-)
>  create mode 100644 regression/t-062.out
>  create mode 100755 regression/t-062.sh
> 
> diff --git a/guilt b/guilt
> index 66a671a..108d4e7 100755
> --- a/guilt
> +++ b/guilt
> @@ -836,6 +836,9 @@ guilt_push_diff_context=1
>  # default diffstat value: true or false
>  DIFFSTAT_DEFAULT="false"
>  
> +# default old_style_prefix value: true or false
> +REUSE_BRANCH_DEFAULT="true"
> +
>  # Prefix for guilt branches.
>  GUILT_PREFIX=guilt/
>  
> @@ -847,6 +850,10 @@ GUILT_PREFIX=guilt/
>  diffstat=`git config --bool guilt.diffstat`
>  [ -z "$diffstat" ] && diffstat=$DIFFSTAT_DEFAULT
>  
> +# reuse Git branch?
> +reuse_branch=`git config --bool guilt.reusebranch`
> +[ -z "$reuse_branch" ] && reuse_branch=$REUSE_BRANCH_DEFAULT
> +
>  #
>  # The following gets run every time this file is source'd
>  #
> @@ -911,13 +918,25 @@ else
>  	die "Unsupported operating system: $UNAME_S"
>  fi
>  
> -if [ "$branch" = "$raw_git_branch" ] && [ -n "`get_top 2>/dev/null`" ]
> +if [ -n "`get_top 2>/dev/null`" ]
>  then
> -    # This is for compat with old repositories that still have a
> -    # pushed patch without the new-style branch prefix.
> -    old_style_prefix=true
> +	# If there is at least one pushed patch, we set
> +	# old_style_prefix according to how it was pushed.  It is only
> +	# possible to change the prefix style while no patches are
> +	# applied.
> +	if [ "$branch" = "$raw_git_branch" ]
> +	then
> +		old_style_prefix=true
> +	else
> +		old_style_prefix=false
> +	fi
>  else
> -    old_style_prefix=false
> +	if $reuse_branch
> +	then
> +		old_style_prefix=true
> +	else
> +		old_style_prefix=false
> +	fi
>  fi
>  
>  _main "$@"
> diff --git a/regression/scaffold b/regression/scaffold
> index 5c8b73e..acddb07 100644
> --- a/regression/scaffold
> +++ b/regression/scaffold
> @@ -88,6 +88,7 @@ function setup_git_repo
>  	git config log.date default
>  	git config log.decorate no
>  	git config guilt.diffstat false
> +	git config guilt.reusebranch false
>  }
>  
>  function setup_guilt_repo
> diff --git a/regression/t-062.out b/regression/t-062.out
> new file mode 100644
> index 0000000..d00b3f6
> --- /dev/null
> +++ b/regression/t-062.out
> @@ -0,0 +1,457 @@
> +% setup_repo
> +% git config guilt.reusebranch true
> +% guilt push -a
> +Applying patch..modify
> +Patch applied.
> +Applying patch..add
> +Patch applied.
> +Applying patch..remove
> +Patch applied.
> +Applying patch..mode
> +Patch applied.
> +% list_files
> +d .git/patches
> +d .git/patches/master
> +d .git/refs/patches
> +d .git/refs/patches/master
> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode
> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove
> +f 71596bf71b72c2717e1aee378aabefbfa19ab7c8  .git/patches/master/status
> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series
> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
> +r 33633e7a1aa31972f125878baf7807be57b1672d  .git/refs/patches/master/modify
> +r 37d588cc39848368810e88332bd03b083f2ce3ac  .git/refs/patches/master/add
> +r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba  .git/refs/patches/master/mode
> +r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9  .git/refs/patches/master/remove
> +% git for-each-ref
> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/heads/master
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/patches/master/mode
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
> +% git update-ref refs/heads/master refs/heads/guilt/master
> +fatal: refs/heads/guilt/master: not a valid SHA1
> +% git symbolic-ref HEAD refs/heads/master
> +% git update-ref -d refs/heads/guilt/master
> +% git for-each-ref
> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/heads/master
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/patches/master/mode
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
> +% list_files
> +d .git/patches
> +d .git/patches/master
> +d .git/refs/patches
> +d .git/refs/patches/master
> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode
> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove
> +f 71596bf71b72c2717e1aee378aabefbfa19ab7c8  .git/patches/master/status
> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series
> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
> +r 33633e7a1aa31972f125878baf7807be57b1672d  .git/refs/patches/master/modify
> +r 37d588cc39848368810e88332bd03b083f2ce3ac  .git/refs/patches/master/add
> +r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba  .git/refs/patches/master/mode
> +r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9  .git/refs/patches/master/remove
> +% guilt pop
> +Now at remove.
> +% git for-each-ref
> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/heads/master
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
> +% guilt push
> +Applying patch..mode
> +Patch applied.
> +% git for-each-ref
> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/heads/master
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/patches/master/mode
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
> +% guilt pop
> +Now at remove.
> +% git for-each-ref
> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/heads/master
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
> +% guilt pop
> +Now at add.
> +% git for-each-ref
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/heads/master
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +% guilt push
> +Applying patch..remove
> +Patch applied.
> +% git for-each-ref
> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/heads/master
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
> +% guilt pop
> +Now at add.
> +% git for-each-ref
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/heads/master
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +% guilt pop
> +Now at modify.
> +% git for-each-ref
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/heads/master
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +% guilt push
> +Applying patch..add
> +Patch applied.
> +% git for-each-ref
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/heads/master
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +% guilt pop
> +Now at modify.
> +% git for-each-ref
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/heads/master
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +% guilt pop
> +All patches popped.
> +% git for-each-ref
> +d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
> +% guilt push
> +Applying patch..modify
> +Patch applied.
> +% git for-each-ref
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/heads/master
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +% guilt pop
> +All patches popped.
> +% git for-each-ref
> +d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
> +% guilt pop
> +No patches applied.
> +% git for-each-ref
> +d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
> +% guilt push
> +Applying patch..modify
> +Patch applied.
> +% git for-each-ref
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/heads/master
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +% guilt pop
> +All patches popped.
> +% git for-each-ref
> +d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
> +% guilt push -a
> +Applying patch..modify
> +Patch applied.
> +Applying patch..add
> +Patch applied.
> +Applying patch..remove
> +Patch applied.
> +Applying patch..mode
> +Patch applied.
> +% git update-ref refs/heads/master refs/heads/guilt/master
> +fatal: refs/heads/guilt/master: not a valid SHA1
> +% git symbolic-ref HEAD refs/heads/master
> +% git update-ref -d refs/heads/guilt/master
> +% git for-each-ref
> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/heads/master
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/patches/master/mode
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
> +% guilt pop -a
> +All patches popped.
> +% git for-each-ref
> +d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
> +% guilt push add
> +Applying patch..modify
> +Patch applied.
> +Applying patch..add
> +Patch applied.
> +% git for-each-ref
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/heads/master
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +% git update-ref refs/heads/master refs/heads/guilt/master
> +fatal: refs/heads/guilt/master: not a valid SHA1
> +% git symbolic-ref HEAD refs/heads/master
> +% git update-ref -d refs/heads/guilt/master
> +% guilt branch topic
> +Switched to branch "topic"
> +% git for-each-ref
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/heads/master
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/heads/topic
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/topic/add
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/topic/modify
> +% guilt pop -a
> +All patches popped.
> +% guilt push
> +Applying patch..modify
> +Patch applied.
> +% git for-each-ref
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/heads/master
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/heads/topic
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/topic/modify
> +% guilt pop -a
> +All patches popped.
> +% git checkout master
> +Switched to branch "master"
> +% guilt pop -a
> +All patches popped.
> +% git branch -d topic
> +Deleted branch topic (was d485041).
> +% rm -r .git/patches/topic
> +% git for-each-ref
> +d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
> +% list_files
> +d .git/patches
> +d .git/patches/master
> +d .git/refs/patches
> +d .git/refs/patches/master
> +d .git/refs/patches/topic
> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode
> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove
> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series
> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
> +f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status
> +% guilt push -a
> +Applying patch..modify
> +Patch applied.
> +Applying patch..add
> +Patch applied.
> +Applying patch..remove
> +Patch applied.
> +Applying patch..mode
> +Patch applied.
> +% git update-ref refs/heads/master refs/heads/guilt/master
> +fatal: refs/heads/guilt/master: not a valid SHA1
> +% git symbolic-ref HEAD refs/heads/master
> +% git update-ref -d refs/heads/guilt/master
> +% guilt branch topic
> +Switched to branch "topic"
> +% git for-each-ref
> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/heads/master
> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/heads/topic
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/patches/master/mode
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/topic/add
> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/patches/topic/mode
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/topic/modify
> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/topic/remove
> +% guilt pop -a
> +All patches popped.
> +% git checkout master
> +Switched to branch "master"
> +% guilt pop -a
> +All patches popped.
> +% git branch -d topic
> +Deleted branch topic (was d485041).
> +% rm -r .git/patches/topic
> +% git for-each-ref
> +d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
> +% list_files
> +d .git/patches
> +d .git/patches/master
> +d .git/refs/patches
> +d .git/refs/patches/master
> +d .git/refs/patches/topic
> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode
> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove
> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series
> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
> +f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status
> +% guilt branch topic
> +Switched to branch "topic"
> +% git for-each-ref
> +d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
> +d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/topic
> +% list_files
> +d .git/patches
> +d .git/patches/master
> +d .git/patches/topic
> +d .git/refs/patches
> +d .git/refs/patches/master
> +d .git/refs/patches/topic
> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode
> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/topic/mode
> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove
> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/topic/remove
> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/topic/add
> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series
> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/topic/series
> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/topic/modify
> +f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status
> +f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/topic/status
> +% guilt pop -a
> +No patches applied.
> +% git checkout master
> +Switched to branch "master"
> +% guilt pop -a
> +No patches applied.
> +% git branch -d topic
> +Deleted branch topic (was d485041).
> +% rm -r .git/patches/topic
> +% git for-each-ref
> +d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
> +% list_files
> +d .git/patches
> +d .git/patches/master
> +d .git/refs/patches
> +d .git/refs/patches/master
> +d .git/refs/patches/topic
> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode
> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove
> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series
> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
> +f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status
> +% guilt push -a
> +Applying patch..modify
> +Patch applied.
> +Applying patch..add
> +Patch applied.
> +Applying patch..remove
> +Patch applied.
> +Applying patch..mode
> +Patch applied.
> +% guilt branch topic
> +Switched to branch "topic"
> +% git for-each-ref
> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/heads/master
> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/heads/topic
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/patches/master/mode
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/topic/add
> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/patches/topic/mode
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/topic/modify
> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/topic/remove
> +% list_files
> +d .git/patches
> +d .git/patches/master
> +d .git/patches/topic
> +d .git/refs/patches
> +d .git/refs/patches/master
> +d .git/refs/patches/topic
> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode
> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/topic/mode
> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove
> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/topic/remove
> +f 71596bf71b72c2717e1aee378aabefbfa19ab7c8  .git/patches/master/status
> +f 71596bf71b72c2717e1aee378aabefbfa19ab7c8  .git/patches/topic/status
> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/topic/add
> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series
> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/topic/series
> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/topic/modify
> +r 33633e7a1aa31972f125878baf7807be57b1672d  .git/refs/patches/master/modify
> +r 33633e7a1aa31972f125878baf7807be57b1672d  .git/refs/patches/topic/modify
> +r 37d588cc39848368810e88332bd03b083f2ce3ac  .git/refs/patches/master/add
> +r 37d588cc39848368810e88332bd03b083f2ce3ac  .git/refs/patches/topic/add
> +r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba  .git/refs/patches/master/mode
> +r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba  .git/refs/patches/topic/mode
> +r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9  .git/refs/patches/master/remove
> +r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9  .git/refs/patches/topic/remove
> +% guilt pop -a
> +All patches popped.
> +% git for-each-ref
> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/heads/master
> +d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/topic
> +37d588cc39848368810e88332bd03b083f2ce3ac commit	refs/patches/master/add
> +ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit	refs/patches/master/mode
> +33633e7a1aa31972f125878baf7807be57b1672d commit	refs/patches/master/modify
> +ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit	refs/patches/master/remove
> +% guilt pop -a
> +No patches applied.
> +% git checkout master
> +Switched to branch "master"
> +% guilt pop -a
> +All patches popped.
> +% git branch -d topic
> +Deleted branch topic (was d485041).
> +% rm -r .git/patches/topic
> +% git for-each-ref
> +d4850419ccc1146c7169f500725ce504b9774ed0 commit	refs/heads/master
> +% list_files
> +d .git/patches
> +d .git/patches/master
> +d .git/refs/patches
> +d .git/refs/patches/master
> +d .git/refs/patches/topic
> +f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode
> +f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove
> +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
> +f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series
> +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
> +f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status
> +% guilt new newpatch
> +% git for-each-ref --format=%(refname)
> +refs/heads/master
> +refs/patches/master/newpatch
> +% guilt pop
> +All patches popped.
> +% guilt push
> +Applying patch..newpatch
> +Patch applied.
> +% git for-each-ref
> +25465dc1687f3833ecbd4e8bca437e522d7026db commit	refs/heads/master
> +25465dc1687f3833ecbd4e8bca437e522d7026db commit	refs/patches/master/newpatch
> +% git branch
> +* master
> +% guilt applied
> +newpatch
> +% guilt commit -a
> +% git for-each-ref
> +25465dc1687f3833ecbd4e8bca437e522d7026db commit	refs/heads/master
> +% git branch
> +* master
> +% guilt push -a
> +Applying patch..modify
> +Patch applied.
> +Applying patch..add
> +Patch applied.
> +Applying patch..remove
> +Patch applied.
> +Applying patch..mode
> +Patch applied.
> +% guilt applied
> +modify
> +add
> +remove
> +mode
> +% git branch
> +* master
> +% git for-each-ref
> +fefbdcef61022d473838926619f31e030dd04fdc commit	refs/heads/master
> +5effcbeb303e8433935151d8c69f3bf63db1e8ef commit	refs/patches/master/add
> +fefbdcef61022d473838926619f31e030dd04fdc commit	refs/patches/master/mode
> +9509f22e2e627756d87b42432931c45955b74234 commit	refs/patches/master/modify
> +9cbe2fc643b1a9e2179a8738f80424a1c2aa202d commit	refs/patches/master/remove
> +% guilt commit -n 2
> +% git for-each-ref
> +fefbdcef61022d473838926619f31e030dd04fdc commit	refs/heads/master
> +fefbdcef61022d473838926619f31e030dd04fdc commit	refs/patches/master/mode
> +9cbe2fc643b1a9e2179a8738f80424a1c2aa202d commit	refs/patches/master/remove
> +% git branch
> +* master
> +% guilt commit -n 2
> +% git for-each-ref
> +fefbdcef61022d473838926619f31e030dd04fdc commit	refs/heads/master
> +% git branch
> +* master
> +% guilt series
> diff --git a/regression/t-062.sh b/regression/t-062.sh
> new file mode 100755
> index 0000000..ffefb9c
> --- /dev/null
> +++ b/regression/t-062.sh
> @@ -0,0 +1,150 @@
> +#!/bin/bash
> +#
> +# Test the branch-switching upgrade code
> +#
> +
> +source $REG_DIR/scaffold
> +
> +old_style_branch() {
> +	# Modify the refs so that it looks as if the patch series was applied
> +	# by an old version of guilt.
> +	cmd git update-ref refs/heads/$1 refs/heads/guilt/$1
> +	cmd git symbolic-ref HEAD refs/heads/$1
> +	cmd git update-ref -d refs/heads/guilt/$1
> +}
> +
> +remove_topic() {
> +	cmd guilt pop -a
> +	if git rev-parse --verify --quiet guilt/master >/dev/null
> +	then
> +		cmd git checkout guilt/master
> +	else
> +		cmd git checkout master
> +	fi
> +	cmd guilt pop -a
> +	cmd git branch -d $1
> +	cmd rm -r .git/patches/$1
> +	cmd git for-each-ref
> +	cmd list_files
> +}
> +
> +function fixup_time_info
> +{
> +	touch -a -m -t "$TOUCH_DATE" ".git/patches/master/$1"
> +}
> +
> +cmd setup_repo
> +
> +cmd git config guilt.reusebranch true
> +
> +cmd guilt push -a
> +cmd list_files
> +cmd git for-each-ref
> +
> +# Pop and push patches.  Check that the repo is converted to new-style
> +# refs when no patches are applied and a patch is pushed.
> +old_style_branch master
> +cmd git for-each-ref
> +
> +cmd list_files
> +
> +for i in `seq 5`
> +do
> +	cmd guilt pop
> +	cmd git for-each-ref
> +	cmd guilt push
> +	cmd git for-each-ref
> +	cmd guilt pop
> +	cmd git for-each-ref
> +done
> +
> +# Check that "pop -a" does the right thing.
> +cmd guilt push -a
> +
> +old_style_branch master
> +
> +cmd git for-each-ref
> +
> +cmd guilt pop -a
> +
> +cmd git for-each-ref
> +
> +# Check that pushing two patches converts the repo to now-style (since
> +# it currently has no patches applied).
> +cmd guilt push add
> +cmd git for-each-ref
> +
> +# Check guilt branch with a few patches applied.
> +old_style_branch master
> +cmd guilt branch topic
> +cmd git for-each-ref
> +
> +# Check that the topic branch is converted to new-style.
> +cmd guilt pop -a
> +cmd guilt push
> +cmd git for-each-ref
> +
> +remove_topic topic
> +
> +# Check guilt branch with the full patch series applied.
> +cmd guilt push -a
> +old_style_branch master
> +cmd guilt branch topic
> +cmd git for-each-ref
> +
> +remove_topic topic
> +
> +# Check guilt branch with no patches applied.
> +# This gives us a new-style checkout.
> +cmd guilt branch topic
> +cmd git for-each-ref
> +cmd list_files
> +
> +remove_topic topic
> +
> +# Check guilt branch in a new-style directory with all patches
> +# applied.  (Strictly speaking, this test should probably move to a
> +# file devoted to testing "guilt branch".)
> +cmd guilt push -a
> +cmd guilt branch topic
> +cmd git for-each-ref
> +cmd list_files
> +cmd guilt pop -a
> +cmd git for-each-ref
> +
> +remove_topic topic
> +
> +# Check that "guilt new" does the right thing when no patches are
> +# applied.  (Strictly speaking, this test should maybe move to
> +# t-025.sh).
> +
> +cmd guilt new newpatch
> +cmd git for-each-ref '--format=%(refname)'
> +cmd guilt pop
> +fixup_time_info newpatch
> +cmd guilt push
> +cmd git for-each-ref
> +
> +# Check that "guilt commit" does the right thing when committing all
> +# applied patches.  (Strictly speaking, this test should maybe move to
> +# t-030.sh).
> +cmd git branch
> +cmd guilt applied
> +cmd guilt commit -a
> +cmd git for-each-ref
> +cmd git branch
> +
> +# Check that "guilt commit" does the right thing when committing only
> +# a few of the applied patches.  (Strictly speaking, this test should
> +# maybe move to t-030.sh).
> +cmd guilt push -a
> +cmd guilt applied
> +cmd git branch
> +cmd git for-each-ref
> +cmd guilt commit -n 2
> +cmd git for-each-ref
> +cmd git branch
> +cmd guilt commit -n 2
> +cmd git for-each-ref
> +cmd git branch
> +cmd guilt series
> -- 
> 1.8.2
> 

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Added guilt.reusebranch configuration option.
  2013-05-22 13:42       ` Josef 'Jeff' Sipek
@ 2013-05-22 14:45         ` Theodore Ts'o
  2013-05-22 16:31           ` Josef 'Jeff' Sipek
  2013-05-22 17:58           ` Junio C Hamano
  0 siblings, 2 replies; 17+ messages in thread
From: Theodore Ts'o @ 2013-05-22 14:45 UTC (permalink / raw)
  To: Josef 'Jeff' Sipek; +Cc: Per Cederqvist, git

I just had another idea (although I haven't had a chance to code up
anything yet).  Perhaps instead of, or in addition to, a global
setting (i.e., guilt.reusebranch), perhaps we should have a per-branch
setting, such as branch.<branch>.guiltReuseBranch?

I was actually thinking that it might be interesting to have a
branch.<branch>.rewindable, which would change the guilt defaults, and
could also key changes in key git behavior which makes it less likely
that a user shoots him or herself in the foot --- i.e., give warnings
if he or she has modified the branch in such a way that
remotes.origin.<branch> is no longer contained within the branch head.

			      	     	       	      	  - Ted

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Added guilt.reusebranch configuration option.
  2013-05-22 14:45         ` Theodore Ts'o
@ 2013-05-22 16:31           ` Josef 'Jeff' Sipek
  2013-05-22 17:58           ` Junio C Hamano
  1 sibling, 0 replies; 17+ messages in thread
From: Josef 'Jeff' Sipek @ 2013-05-22 16:31 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Per Cederqvist, git

On Wed, May 22, 2013 at 10:45:31AM -0400, Theodore Ts'o wrote:
> I just had another idea (although I haven't had a chance to code up
> anything yet).  Perhaps instead of, or in addition to, a global
> setting (i.e., guilt.reusebranch), perhaps we should have a per-branch
> setting, such as branch.<branch>.guiltReuseBranch?
> 
> I was actually thinking that it might be interesting to have a
> branch.<branch>.rewindable, which would change the guilt defaults, and
> could also key changes in key git behavior which makes it less likely
> that a user shoots him or herself in the foot --- i.e., give warnings
> if he or she has modified the branch in such a way that
> remotes.origin.<branch> is no longer contained within the branch head.

Interesting!  I wonder what git people have to say about this.

Jeff.

-- 
We have joy, we have fun, we have Linux on a Sun...

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Added guilt.reusebranch configuration option.
  2013-05-22 14:45         ` Theodore Ts'o
  2013-05-22 16:31           ` Josef 'Jeff' Sipek
@ 2013-05-22 17:58           ` Junio C Hamano
  2013-05-22 18:04             ` Theodore Ts'o
  1 sibling, 1 reply; 17+ messages in thread
From: Junio C Hamano @ 2013-05-22 17:58 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Josef 'Jeff' Sipek, Per Cederqvist, git

Theodore Ts'o <tytso@mit.edu> writes:

> I was actually thinking that it might be interesting to have a
> branch.<branch>.rewindable, which would change the guilt defaults, and
> could also key changes in key git behavior which makes it less likely
> that a user shoots him or herself in the foot --- i.e., give warnings
> if he or she has modified the branch in such a way that
> remotes.origin.<branch> is no longer contained within the branch head.

At least "rebase" can pay attention to it and might make the world a
better place.

Your final "git push" needs to be forced if you rewound beyond
remotes.origin.<branch> so in that sense, there already is a sefety,
but it is better to give the user a chance to notice that before the
user spends more time to polish the rewound topic to perfection,
only to see the push rejected.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Added guilt.reusebranch configuration option.
  2013-05-22 17:58           ` Junio C Hamano
@ 2013-05-22 18:04             ` Theodore Ts'o
  2013-05-22 18:55               ` Junio C Hamano
  0 siblings, 1 reply; 17+ messages in thread
From: Theodore Ts'o @ 2013-05-22 18:04 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Josef 'Jeff' Sipek, Per Cederqvist, git

On Wed, May 22, 2013 at 10:58:49AM -0700, Junio C Hamano wrote:
> Theodore Ts'o <tytso@mit.edu> writes:
> 
> > I was actually thinking that it might be interesting to have a
> > branch.<branch>.rewindable, which would change the guilt defaults, and
> > could also key changes in key git behavior which makes it less likely
> > that a user shoots him or herself in the foot --- i.e., give warnings
> > if he or she has modified the branch in such a way that
> > remotes.origin.<branch> is no longer contained within the branch head.
> 
> At least "rebase" can pay attention to it and might make the world a
> better place.

Yeah, rebase was the primary command I was thinking about.  The other
one would be "git commit --amend" after the branch had been pushed
out.

					- Ted

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Added guilt.reusebranch configuration option.
  2013-05-22 18:04             ` Theodore Ts'o
@ 2013-05-22 18:55               ` Junio C Hamano
  2013-05-23  2:11                 ` Theodore Ts'o
  0 siblings, 1 reply; 17+ messages in thread
From: Junio C Hamano @ 2013-05-22 18:55 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Josef 'Jeff' Sipek, Per Cederqvist, git

Theodore Ts'o <tytso@mit.edu> writes:

> On Wed, May 22, 2013 at 10:58:49AM -0700, Junio C Hamano wrote:
>> Theodore Ts'o <tytso@mit.edu> writes:
>> 
>> > I was actually thinking that it might be interesting to have a
>> > branch.<branch>.rewindable, which would change the guilt defaults, and
>> > could also key changes in key git behavior which makes it less likely
>> > that a user shoots him or herself in the foot --- i.e., give warnings
>> > if he or she has modified the branch in such a way that
>> > remotes.origin.<branch> is no longer contained within the branch head.
>> 
>> At least "rebase" can pay attention to it and might make the world a
>> better place.
>
> Yeah, rebase was the primary command I was thinking about.  The other
> one would be "git commit --amend" after the branch had been pushed
> out.

It may or may not matter for the kernel folks, but let me pick your
brain while we are on this subject.

The "upstream" (your remotes.origin.<branch>) is that on top of
which you build your work.  You clone from there to bootstrap
yourself, you add your work (which may include integrating the work
of your contributors, if you are a mid-tier maintainer/integrator
aka a lieutenant) on top of it, and arrange the result to reach the
"upstream" in some way.

For the simplest (and still widely used) workflow that employs a
central shared repository, the way to make the result to reach the
"upstream" is by directly pushing into it yourself.  In that sense,
the word "upstream" and the traditional behaviour of "git push" that
pushes back to the 'origin' (or branch.<branch>.remote) to update
your "upstream" (or branch.<branch>.merge at 'origin') both make
perfect sense.

Also, if you are rebasing, @{u} refers to that place you integrate
with, i.e. your "upstream", in the central shared repository
workflow.

But in a triangular workflow, the way to make the result reach the
"upstream" is *not* by pushing there yourself.  For developers at
the leaf level, it is to push to their own repository (often on
GitHub), which is different from where they (initially) clone from
in order to bootstrap themselves, and (subsequently) pull from in
order to keep them up-to-date.  And then they request the published
work to be pulled by the "upstream".

Even in a triangular workflow, @{u} should still refer to the place
you integrate with, i.e. your "upstream", not to the place you push
to publish the result of your work.

This branch.<branch>.rewindable safety however cannot be tied to
@{u}.  The bottom boundary you want to be warned when you cross is
the change you pushed out to your publishing repository, and it may
not have reached remotes.origin.<branch> yet.

We will be introducing remote.pushdefault configuration in the
upcoming 1.8.3 release, so that you can say:

	[remote "origin"]
        	url = git://g.k.o/pub/scm/linux/kernel/git/torvalds/linux.git/
		fetch = +refs/heads/*:refs/remotes/origin/*

	[remote "ext4"]
        	url = g.k.o:/pub/scm/linux/kernel/git/tytso/ext4.git/
		fetch = +refs/heads/*:refs/remotes/ext4/*

	[remote]
        	pushdefault = ext4

and hopefully it would let you do this:

	git checkout master
        ... after working on it ...
        git push

As remote.pushdefault is set to ext4, without any extra arguments,
the result will pushed to the "ext4" remote.  If you are using the
traditional push.default=matching, it may also try to push out dev,
dev-next and other branches you may have in your local repository
and at k.org; if you are using push.default=simple or other "single
branch" modes like "current", "upstream", etc, it will only push out
your current branch (i.e. "master") to "ext4" remote.

You may however be using your local "master" branch for your
development, and pushing the result out to "dev".  With only the
remote.pushdefault setting to push to ext4 (instead of origin), you
still would have to say

	git push ext4 master:dev

There is another change discussed on the list recently to also let
you configure your local "master" branch to update "dev" in your
publishing repository.  It may go like this:

	[branch "master"]
        	push = refs/heads/dev

In any case, refs/remotes/ext4/dev would be the remote tracking
branch (not refs/remotes/origin/anything) that keeps track of what
you pushed out there the last time.  And that would be what your new
safety based on "branch.master.rewindable = no" needs to check
against, not "refs/remotes/origin/master" which is your master@{u}.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Added guilt.reusebranch configuration option.
  2013-05-22 18:55               ` Junio C Hamano
@ 2013-05-23  2:11                 ` Theodore Ts'o
  2013-05-23  9:52                   ` Ramkumar Ramachandra
  2013-05-23 19:01                   ` Junio C Hamano
  0 siblings, 2 replies; 17+ messages in thread
From: Theodore Ts'o @ 2013-05-23  2:11 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Josef 'Jeff' Sipek, Per Cederqvist, git

On Wed, May 22, 2013 at 11:55:00AM -0700, Junio C Hamano wrote:
> But in a triangular workflow, the way to make the result reach the
> "upstream" is *not* by pushing there yourself.  For developers at
> the leaf level, it is to push to their own repository (often on
> GitHub), which is different from where they (initially) clone from
> in order to bootstrap themselves, and (subsequently) pull from in
> order to keep them up-to-date.  And then they request the published
> work to be pulled by the "upstream".

Yep, what I do personally is to call the destination of this "publish", i.e.:

[remote "publish"]
	url = ssh://gitolite@ra.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.g
	push = +master:master
	push = +origin:origin
	push = +dev:dev

So my typical work flow when I am ready to submit to Linus is:

   git tag -s ext4_for_linus
   git push publish
    <wait for this to propagate from ra.kernel.org to git.kernel.org,
     typically ~5 minutes>
   git request-pull git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git origin > /tmp/pull
    <use /tmp/pull as the e-mail body to send to Linus, cc'ing
     LKML and linux-ext4@vger.kernel.org>

But actually, it's much more common that I am doing a "git push
publish" so that (a) it can get picked up by the daily linux-next tree
(for integration testing even before Linus pulls it into his tree),
and (b) so other ext4 developers so they can either test or develop
against the ext4 tree in progress.

I suppose it would be convenient for "git push" to push to the
"publish" target, but I don't get confused about pushing to origin,
since semantically what I am doing is publishing the current state of
the ext4 tree so other people can see it.  So "git push publish" makes
a lot of sense to me.

> Even in a triangular workflow, @{u} should still refer to the place
> you integrate with, i.e. your "upstream", not to the place you push
> to publish the result of your work.
> 
> This branch.<branch>.rewindable safety however cannot be tied to
> @{u}.  The bottom boundary you want to be warned when you cross is
> the change you pushed out to your publishing repository, and it may
> not have reached remotes.origin.<branch> yet.

Indeed, and in fact for my use case what I promise people is that all
of the commits between origin..master are non-rewindable.  It's the
commits betewen master..dev which are rewindable.  So for me, I'd
still use the safety feature even for my rewindable branch, but
instead of using remotes/publish/dev the "no-rewind" point, I'd want
to use remotes/publish/master as the "no-rewind" point.

Right now I do this just by being careful, but if there was an
automatic safety mechanism, it would save me a bit of work, since
otherwise I might not catch my mistake until I do the "git push
publish", at which point I curse and then start consulting the reflog
to back the state of my tree out, and then reapplying the work I had
to the right tree.

> We will be introducing remote.pushdefault configuration in the
> upcoming 1.8.3 release, so that you can say.....
>
> and hopefully it would let you do this:
> 
> 	git checkout master
>         ... after working on it ...
>         git push

Yes, that would be convenient.  BTW, one of the other things which I
do for e2fsprogs is that I use multiple publishing points, which is
mostly for historical reasons --- it used to be that repo.or.cz wasn't
all that reliable, and the 10-15 minute replication time from
ra.kernel.org to git.kernel.org got really old.

So what I do is something like this:

git push publish ; git push repo ; git push code

where....

[remote "publish"]
	url = ssh://gitolite@ra.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
	fetch = +refs/heads/*:refs/heads/*
	push = next
	push = master
	push = maint
	push = debian
	push = +pu

[remote "code"]
	url = https://code.google.com/p/e2fsprogs/
	fetch = +refs/heads/*:refs/heads/*
	push = next
	push = master
	push = maint
	push = debian
	push = +pu

[remote "repo"]
	url = ssh://repo.or.cz/srv/git/e2fsprogs.git
	push = next
	push = master
	push = maint
	push = debian
	push = +pu

I don't know if this is something you'd want git to encourage, or
support explicitly, but I thought I'd mention it.

						- Ted

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Added guilt.reusebranch configuration option.
  2013-05-23  2:11                 ` Theodore Ts'o
@ 2013-05-23  9:52                   ` Ramkumar Ramachandra
  2013-05-23 18:37                     ` Theodore Ts'o
  2013-05-23 19:01                   ` Junio C Hamano
  1 sibling, 1 reply; 17+ messages in thread
From: Ramkumar Ramachandra @ 2013-05-23  9:52 UTC (permalink / raw)
  To: Theodore Ts'o
  Cc: Junio C Hamano, Josef 'Jeff' Sipek, Per Cederqvist, git

Theodore Ts'o wrote:
> Right now I do this just by being careful, but if there was an
> automatic safety mechanism, it would save me a bit of work, since
> otherwise I might not catch my mistake until I do the "git push
> publish", at which point I curse and then start consulting the reflog
> to back the state of my tree out, and then reapplying the work I had
> to the right tree.

My scenario is a bit different, and I think this safety feature is
highly overrated.  It's not that "I'll never rewind some branches, but
rewind other branches", but rather "I might rewind anything at any
time, but I want immediate information so I can quickly inspect @{1}
to see if that was undesirable".  To put it another way, my philosophy
is not "auto-deny unintended changes", but rather "tell me immediately
about undesirable changes".  To this effect, my prompt looks like:

artagnon|push-current-head=:~/src/git$

The = indicates that I'm in sync with upstream, and that there's
nothing to push.  When I make some changes, that character changes to
>, which means that there are ff changes to push.  Finally,

artagnon|push-current-head<>:~/src/git$

has my immediate attention.  <> means that I've diverged from
upstream.  Since the prompt is present all the time, I catch the
divergence just-in-time.  Moreover, I push very frequently resetting
the prompt to = periodically.

So, do you still need this rewinding safety thing?

> So what I do is something like this:
>
> git push publish ; git push repo ; git push code

While we can definitely make the UI better for this (maybe push
--multiple?), there is no fundamental change: we have to re-initialize
all the refspecs, connect to the remote via the transport layer and
prepare a packfile to send.  In other words, it's impossible to make
it any faster than what you get with the above.

> where....
>
> [remote "publish"]
>         url = ssh://gitolite@ra.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
>         fetch = +refs/heads/*:refs/heads/*
>         push = next
>         push = master
>         push = maint
>         push = debian
>         push = +pu

So you're a batched-push person.  And the above makes it clear that
you don't want to explicitly differentiate between a push and push -f
(the +pu thing).  And this assumes that you never create any new
branches (I branch out all the time), otherwise you'd have rules for
refs/heads/*.  Just out of curiosity, do you ever have ref-renaming
requirements (like push = refs/heads/*:refs/heads/tt/*)?  We were
discussing that on another thread, but I haven't found an
implementation I'm happy with yet.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Added guilt.reusebranch configuration option.
  2013-05-23  9:52                   ` Ramkumar Ramachandra
@ 2013-05-23 18:37                     ` Theodore Ts'o
  2013-05-23 19:06                       ` Ramkumar Ramachandra
  2013-05-23 19:14                       ` Junio C Hamano
  0 siblings, 2 replies; 17+ messages in thread
From: Theodore Ts'o @ 2013-05-23 18:37 UTC (permalink / raw)
  To: Ramkumar Ramachandra
  Cc: Junio C Hamano, Josef 'Jeff' Sipek, Per Cederqvist, git

On Thu, May 23, 2013 at 03:22:50PM +0530, Ramkumar Ramachandra wrote:
> Theodore Ts'o wrote:
> > Right now I do this just by being careful, but if there was an
> > automatic safety mechanism, it would save me a bit of work, since
> > otherwise I might not catch my mistake until I do the "git push
> > publish", at which point I curse and then start consulting the reflog
> > to back the state of my tree out, and then reapplying the work I had
> > to the right tree.
> 
> My scenario is a bit different, and I think this safety feature is
> highly overrated.  It's not that "I'll never rewind some branches, but
> rewind other branches", but rather "I might rewind anything at any
> time, but I want immediate information so I can quickly inspect @{1}
> to see if that was undesirable".

Spekaing of which, what I'd really appreciate is timestamps associated
with the reflog.  That's because the most common time when I've
screwed something up is after doing a "git rebase -i" and so the
reflog has a *huge* number of entries on it, and figuring out which
entry in the reflog is the right one is painful.  If could tell at a
glance when each entry of the reflog was created, it would make it a
lot easier to untangle a tree mangled by git rebase -i.

In practice, it means I waste five minutes carefully inspecting a few
dozen entries on the reflog, so it's not a disaster, although I'm
generally cursing the whole time while I'm trying to untangle the
whole mess.

This issue with reflogs not having timestamps isn't primarily about
rewind safety, BTW; it's just one of the things which make consulting
the reflog painful --- and it's much more likely happens after I screw
up a git rebase -i, generally because of what happens when there's a
merge conflict and then I accidentally fold two commits together
unintentionally.  The times when I've screwed up a non-rewinding
branch and then needed to recover after discovering the problem when I
try to publish said branch are admittedly rare; maybe once or twice
times in the past twelve months.

> So, do you still need this rewinding safety thing?

Meh; I don't *need* it.  But then again, I'm an fairly experienced git
user.  The fact that I use guilt without the "guilt/master" safety
feature and have never gotten bitten by it --- in fact I deliberately
publish rewindable branches with a guilt patch series applies speaks
to the fact that I'm pretty experienced at rewindable heads.

The only reason why I suggested it is because I believe it would be
useful for people with less experience, and perhaps it would help make
rewindable branches less scary, and less subject to a lot of the
fearmongering that you see on the blogosphere.

> 
> > So what I do is something like this:
> >
> > git push publish ; git push repo ; git push code
> 
> While we can definitely make the UI better for this (maybe push
> --multiple?), there is no fundamental change: we have to re-initialize
> all the refspecs, connect to the remote via the transport layer and
> prepare a packfile to send.  In other words, it's impossible to make
> it any faster than what you get with the above.

Sure, and if I cared I'd make a git alias to automate this, instead of
depending on finger macros.

> So you're a batched-push person.  And the above makes it clear that
> you don't want to explicitly differentiate between a push and push -f
> (the +pu thing).  And this assumes that you never create any new
> branches (I branch out all the time), otherwise you'd have rules for
> refs/heads/*.

I create new branches all the time.  But they are for my own personal
testing purposes.  So it's fairer to say that I rarely *publish* new
branches; I generally stick to the standard set of next, master,
maint, and pu.  And part of that is that even publishing this number
of branches is enough to sometimes confuse the e2fsprogs developers
who are pulling from my tree.

So what I've done in the past is to create a whole bunch of feature
branches, and then merge them into the pu branch, and then only
publish the pu branch.  And I try to get the feature branches cleaned
up as quickly as I have time, so they can appear on the maint or
master/next branches sooner rather than later.

> Just out of curiosity, do you ever have ref-renaming
> requirements (like push = refs/heads/*:refs/heads/tt/*)?  We were
> discussing that on another thread, but I haven't found an
> implementation I'm happy with yet.

In general, no, I don't do that, for the reasons stated above --- even
publishing four branches gets to be confusing enough for people who
are looking at my tree.

I'm sure other people and other communities use git differently, so
please insert the standard disclaimer that there's more than one way
to skin a cat.

Regards,

						- Ted

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Added guilt.reusebranch configuration option.
  2013-05-23  2:11                 ` Theodore Ts'o
  2013-05-23  9:52                   ` Ramkumar Ramachandra
@ 2013-05-23 19:01                   ` Junio C Hamano
  1 sibling, 0 replies; 17+ messages in thread
From: Junio C Hamano @ 2013-05-23 19:01 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Josef 'Jeff' Sipek, Per Cederqvist, git

Theodore Ts'o <tytso@mit.edu> writes:

> On Wed, May 22, 2013 at 11:55:00AM -0700, Junio C Hamano wrote:
>> But in a triangular workflow, the way to make the result reach the
>> "upstream" is *not* by pushing there yourself.  For developers at
>> the leaf level, it is to push to their own repository (often on
>> GitHub), which is different from where they (initially) clone from
>> in order to bootstrap themselves, and (subsequently) pull from in
>> order to keep them up-to-date.  And then they request the published
>> work to be pulled by the "upstream".
>
> Yep, what I do personally is to call the destination of this "publish", i.e.:
>
> [remote "publish"]
> 	url = ssh://gitolite@ra.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.g
> 	push = +master:master
> 	push = +origin:origin
> 	push = +dev:dev
>
> So my typical work flow when I am ready to submit to Linus is:
>
>    git tag -s ext4_for_linus
>    git push publish
>     <wait for this to propagate from ra.kernel.org to git.kernel.org,
>      typically ~5 minutes>

And at this point I presume that you wish this "push" automatically
pushed out ext4_for_linus, just like "fetch" by default grabs tags
that point into the history being fetched?

I think "push --follow-tags" in the upcoming 1.8.3 would work for
you if that is the case.

>    git request-pull git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git origin > /tmp/pull
>     <use /tmp/pull as the e-mail body to send to Linus, cc'ing
>      LKML and linux-ext4@vger.kernel.org>
>
> But actually, it's much more common that I am doing a "git push
> publish" so that (a) it can get picked up by the daily linux-next tree
> (for integration testing even before Linus pulls it into his tree),
> and (b) so other ext4 developers so they can either test or develop
> against the ext4 tree in progress.
>
> I suppose it would be convenient for "git push" to push to the
> "publish" target, but I don't get confused about pushing to origin,
> since semantically what I am doing is publishing the current state of
> the ext4 tree so other people can see it.  So "git push publish" makes
> a lot of sense to me.

Noted.

>> Even in a triangular workflow, @{u} should still refer to the place
>> you integrate with, i.e. your "upstream", not to the place you push
>> to publish the result of your work.
>> 
>> This branch.<branch>.rewindable safety however cannot be tied to
>> @{u}.  The bottom boundary you want to be warned when you cross is
>> the change you pushed out to your publishing repository, and it may
>> not have reached remotes.origin.<branch> yet.
>
> Indeed, and in fact for my use case what I promise people is that all
> of the commits between origin..master are non-rewindable.  It's the
> commits betewen master..dev which are rewindable.  So for me, I'd
> still use the safety feature even for my rewindable branch, but
> instead of using remotes/publish/dev the "no-rewind" point, I'd want
> to use remotes/publish/master as the "no-rewind" point.

Sounds sensible.

> Right now I do this just by being careful, but if there was an
> automatic safety mechanism, it would save me a bit of work, since
> otherwise I might not catch my mistake until I do the "git push
> publish", at which point I curse and then start consulting the reflog
> to back the state of my tree out, and then reapplying the work I had
> to the right tree.

Yes, exactly.

> Yes, that would be convenient.  BTW, one of the other things which I
> do for e2fsprogs is that I use multiple publishing points, which is
> mostly for historical reasons --- it used to be that repo.or.cz wasn't
> all that reliable, and the 10-15 minute replication time from
> ra.kernel.org to git.kernel.org got really old.
>
> So what I do is something like this:
>
> git push publish ; git push repo ; git push code
>
> where....
>
> [remote "publish"]
> 	url = ssh://gitolite@ra.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
> ...
> [remote "repo"]
> ...
> I don't know if this is something you'd want git to encourage, or
> support explicitly, but I thought I'd mention it.

I think you can have more than one destination URLs to a single
remote you are pushing as long as what are pushed and how are common
to them, that is, something like this:

[remote "publish"]
	; where do we fetch/pull from and how?
	url = ssh://gitolite@ra.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
	fetch = +refs/heads/*:refs/heads/*
	; where do we push to and how?
	pushurl = ssh://gitolite@ra.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
	pushurl = https://code.google.com/p/e2fsprogs/
	pushurl = ssh://repo.or.cz/srv/git/e2fsprogs.git
	push = next
	push = master
	push = maint
	push = debian
	push = +pu

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Added guilt.reusebranch configuration option.
  2013-05-23 18:37                     ` Theodore Ts'o
@ 2013-05-23 19:06                       ` Ramkumar Ramachandra
  2013-05-23 19:14                       ` Junio C Hamano
  1 sibling, 0 replies; 17+ messages in thread
From: Ramkumar Ramachandra @ 2013-05-23 19:06 UTC (permalink / raw)
  To: Theodore Ts'o
  Cc: Junio C Hamano, Josef 'Jeff' Sipek, Per Cederqvist, git

Theodore Ts'o wrote:
> Spekaing of which, what I'd really appreciate is timestamps associated
> with the reflog.  That's because the most common time when I've
> screwed something up is after doing a "git rebase -i" and so the
> reflog has a *huge* number of entries on it, and figuring out which
> entry in the reflog is the right one is painful.  If could tell at a
> glance when each entry of the reflog was created, it would make it a
> lot easier to untangle a tree mangled by git rebase -i.

Yeah, I completely agree with this one.  I've wished for the reflog to
be presented in a nicer ui, with humanized timestamps and colors.

> Meh; I don't *need* it.  But then again, I'm an fairly experienced git
> user.  The fact that I use guilt without the "guilt/master" safety
> feature and have never gotten bitten by it --- in fact I deliberately
> publish rewindable branches with a guilt patch series applies speaks
> to the fact that I'm pretty experienced at rewindable heads.

Oh, and thanks for mentioning guilt: I just learnt about it.

> The only reason why I suggested it is because I believe it would be
> useful for people with less experience, and perhaps it would help make
> rewindable branches less scary, and less subject to a lot of the
> fearmongering that you see on the blogosphere.

My message was a critique.  I'm not denying that the feature may be
useful; it's just that we should have a good rationalization of the
usecase and design something carefully.

> Sure, and if I cared I'd make a git alias to automate this, instead of
> depending on finger macros.

Yes.  My comment was more of question: can --multiple be more than a
for loop written in shell?  If not, is it worth writing?  Are there
enough users?

Junio mentioned pushurl in the other email: if they're perfect
mirrors, won't pushurl suffice?

> I create new branches all the time.  But they are for my own personal
> testing purposes.  So it's fairer to say that I rarely *publish* new
> branches; I generally stick to the standard set of next, master,
> maint, and pu.  And part of that is that even publishing this number
> of branches is enough to sometimes confuse the e2fsprogs developers
> who are pulling from my tree.

Just for contrast: I never keep anything locally.  I publish as much
of my setup as humanly possible so that I'm not tied to one machine.

> In general, no, I don't do that, for the reasons stated above --- even
> publishing four branches gets to be confusing enough for people who
> are looking at my tree.

Just publish different branches to different locations?  Isn't that
why we got triangular workflows?

> I'm sure other people and other communities use git differently, so
> please insert the standard disclaimer that there's more than one way
> to skin a cat.

Ofcourse.  I believe in being all-inclusive, and not dropping a single
feature that has users.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Added guilt.reusebranch configuration option.
  2013-05-23 18:37                     ` Theodore Ts'o
  2013-05-23 19:06                       ` Ramkumar Ramachandra
@ 2013-05-23 19:14                       ` Junio C Hamano
  1 sibling, 0 replies; 17+ messages in thread
From: Junio C Hamano @ 2013-05-23 19:14 UTC (permalink / raw)
  To: Theodore Ts'o
  Cc: Ramkumar Ramachandra, Josef 'Jeff' Sipek, Per Cederqvist,
	git

Theodore Ts'o <tytso@mit.edu> writes:

> Spekaing of which, what I'd really appreciate is timestamps associated
> with the reflog.  That's because the most common time when I've
> screwed something up is after doing a "git rebase -i" and so the
> reflog has a *huge* number of entries on it, and figuring out which
> entry in the reflog is the right one is painful.  If could tell at a
> glance when each entry of the reflog was created, it would make it a
> lot easier to untangle a tree mangled by git rebase -i.

Do you mean you want to go back to one specific step in "rebase -i",
or you mean you want to go back to the state before "rebase -i"?

If the latter, one nice thing to know may be that "git log -g" is
like "git log -g HEAD@{0}" and inspects the reflog associated with
HEAD, and you can view individual steps of "rebase -i".  On the
other hand, "git log -g @{0}" (or "git log -g master@{0}" if you are
on 'master' branch) will inspect the reflog associated with the
current branch, and "rebase -i" appears as a single event (i.e. the
tip before rewinding and replaying all the changes is replaced with
the tip after that whole series of replaying).  So the latter is
what you want to use if you are interested in the state before the
whole "rebase -i" operation.

Also you can ask "git log -g HEAD@{now}" and "git log -g @{now}".  I
agree with you that "git log --oneline -g @{now}" is very handy, and
"git log --oneline --relative-date -g @{now}" is even better, as I
can clearly see where the flurry of recent activities ends and which
reflog entry is the one I was at 20 minutes ago before I started.

> This issue with reflogs not having timestamps isn't primarily about
> rewind safety,...

I think I may have answered this part with the above.

> So what I've done in the past is to create a whole bunch of feature
> branches, and then merge them into the pu branch, and then only
> publish the pu branch.  And I try to get the feature branches cleaned
> up as quickly as I have time, so they can appear on the maint or
> master/next branches sooner rather than later.

Sounds very similar to somebody else is doing ;-)

>> Just out of curiosity, do you ever have ref-renaming
>> requirements (like push = refs/heads/*:refs/heads/tt/*)?  We were
>> discussing that on another thread, but I haven't found an
>> implementation I'm happy with yet.
>
> In general, no, I don't do that, for the reasons stated above --- even
> publishing four branches gets to be confusing enough for people who
> are looking at my tree.
>
> I'm sure other people and other communities use git differently, so
> please insert the standard disclaimer that there's more than one way
> to skin a cat.

Agreed to both counts.  Thanks for comments.

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2013-05-23 19:14 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-22  2:55 [PATCH] guilt: force the use of bare branches Theodore Ts'o
2013-05-22  3:29 ` Josef 'Jeff' Sipek
2013-05-22 12:11   ` [PATCH -v2] " Theodore Ts'o
2013-05-22 12:39     ` Per Cederqvist
2013-05-22 13:01     ` [PATCH] Added guilt.reusebranch configuration option Per Cederqvist
2013-05-22 13:42       ` Josef 'Jeff' Sipek
2013-05-22 14:45         ` Theodore Ts'o
2013-05-22 16:31           ` Josef 'Jeff' Sipek
2013-05-22 17:58           ` Junio C Hamano
2013-05-22 18:04             ` Theodore Ts'o
2013-05-22 18:55               ` Junio C Hamano
2013-05-23  2:11                 ` Theodore Ts'o
2013-05-23  9:52                   ` Ramkumar Ramachandra
2013-05-23 18:37                     ` Theodore Ts'o
2013-05-23 19:06                       ` Ramkumar Ramachandra
2013-05-23 19:14                       ` Junio C Hamano
2013-05-23 19:01                   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).