Re: [PATCH] guilt: update reflog with annotations of guilt-command being run

2016-08-11 Thread Josef 'Jeff' Sipek
On Sat, Jul 09, 2016 at 18:16:05 -0400, Theodore Ts'o wrote:
> Many of the updates made by guilt use git update-ref, which means that
> the output of "git reflog" is extremely unedifying, e.g:

This has been an annoyance for me as well.  Thanks for fixing it.  I'll give
it a test run, and likely push it out later today.

Jeff.

> ff0031d HEAD@{177}: reset: moving to ff0031d848a0cd7002606f9feef958de8d5edf19
> 90f4305 HEAD@{178}:
> a638d43 HEAD@{179}:
> ff0031d HEAD@{180}:
> 079788d HEAD@{181}:
> 87a6280 HEAD@{182}:
> 5b9554d HEAD@{183}:
> de9e918 HEAD@{184}: reset: moving to de9e9181bc066d63d78b768e95b5d949e2a8673a
> 5b9554d HEAD@{185}:
> 
> So teach guilt to use the "set_reflog_action" helper, and since
> git-update-ref doesn't respect the GIT_REFLOG_ACTION environment
> variable, use its -m option so that "git reflog" can look like this
> instead:
> 
> 1eaa566 HEAD@{11}: guilt-push: track-more-dependencies-on-transaction-commit
> ab714af HEAD@{12}: guilt-push: move-lockdep-tracking-to-journal_s
> 7a4b188 HEAD@{13}: guilt-push: move-lockdep-instrumentation-for-jbd2-handles
> 78d9625 HEAD@{14}: guilt-push: 
> respect-nobarrier-mount-option-in-nojournal-mode
> d08854f HEAD@{15}: guilt-pop: updating HEAD
> d08854f HEAD@{16}: guilt-pop: updating HEAD
> d08854f HEAD@{17}: guilt-push: 
> optimize-ext4_should_retry_alloc-to-improve-ENOSPC-performance
> 
> Signed-off-by: Theodore Ts'o <ty...@mit.edu>
> Cc: Josef 'Jeff' Sipek <jef...@josefsipek.net>
> ---
>  guilt | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/guilt b/guilt
> index 35177b9..38d426b 100755
> --- a/guilt
> +++ b/guilt
> @@ -114,6 +114,7 @@ if [ $# -ne 0 ]; then
>   disp "" >&2
>   exit 1
>   fi
> + set_reflog_action "guilt-$CMDNAME"
>  
>   shift
>  else
> @@ -640,7 +641,7 @@ commit()
>   commitish=`git commit-tree $treeish -p $2 < "$TMP_MSG"`
>   if $old_style_prefix || git rev-parse --verify --quiet 
> refs/heads/$GUILT_PREFIX$branch >/dev/null
>   then
> - git update-ref HEAD $commitish
> + git update-ref -m "$GIT_REFLOG_ACTION" HEAD $commitish
>   else
>   git branch $GUILT_PREFIX$branch $commitish
>   git symbolic-ref HEAD refs/heads/$GUILT_PREFIX$branch
> @@ -687,7 +688,8 @@ push_patch()
>   fi
>   fi
>  
> - commit "$pname" HEAD
> + GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: $pname" \
> + commit "$pname" HEAD
>  
>   echo "$pname" >> "$applied"
>  
> -- 
> 2.5.0
> 

-- 
Real Programmers consider "what you see is what you get" to be just as bad a
concept in Text Editors as it is in women. No, the Real Programmer wants a
"you asked for it, you got it" text editor -- complicated, cryptic,
powerful, unforgiving, dangerous.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 3/5] doc: don't use guilt-foo invocations in examples.

2015-01-23 Thread Jeff Sipek
On Fri, Jan 23, 2015 at 02:24:57PM +0100, Per Cederqvist wrote:
 Note: there is one place where I replace guilt-repair with guilt
 repair instead of +guilt repair+.  At least the version of docbook
 I'm using mishandles the + signs in that particular spot (even
 though it works properly for +guilt select+ in another file.  I know
 too little docbook to be able to find the cause.

Yeah, a bit of a mystery to me too.  Regardless,

Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net


 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  Documentation/guilt-add.txt| 2 +-
  Documentation/guilt-delete.txt | 2 +-
  Documentation/guilt-diff.txt   | 2 +-
  Documentation/guilt-help.txt   | 4 ++--
  Documentation/guilt-new.txt| 6 +++---
  Documentation/guilt-repair.txt | 2 +-
  Documentation/guilt-select.txt | 4 ++--
  7 files changed, 11 insertions(+), 11 deletions(-)
 
 diff --git a/Documentation/guilt-add.txt b/Documentation/guilt-add.txt
 index 6d2785a..a276f09 100644
 --- a/Documentation/guilt-add.txt
 +++ b/Documentation/guilt-add.txt
 @@ -24,7 +24,7 @@ EXAMPLES
  Create and add a new file example.c
  
   $ touch example.c
 - $ guilt-add example.c
 + $ guilt add example.c
  
  Author
  --
 diff --git a/Documentation/guilt-delete.txt b/Documentation/guilt-delete.txt
 index ef57dc6..4e8c28c 100644
 --- a/Documentation/guilt-delete.txt
 +++ b/Documentation/guilt-delete.txt
 @@ -25,7 +25,7 @@ EXAMPLES
  
  Delete a patch called 'foobar':
  
 - $ guilt-delete foobar
 + $ guilt delete foobar
  
  Author
  --
 diff --git a/Documentation/guilt-diff.txt b/Documentation/guilt-diff.txt
 index 986ceca..0ee062c 100644
 --- a/Documentation/guilt-diff.txt
 +++ b/Documentation/guilt-diff.txt
 @@ -18,7 +18,7 @@ OPTIONS
  ---
  -z::
   Output a interdiff against the top-most applied patch. This should
 - produce the same diff as +guilt-new -f foo+.
 + produce the same diff as +guilt new -f foo+.
  
  path...::
   Restrict diff output to a given set of files.
 diff --git a/Documentation/guilt-help.txt b/Documentation/guilt-help.txt
 index ed6a5cf..df0e0fb 100644
 --- a/Documentation/guilt-help.txt
 +++ b/Documentation/guilt-help.txt
 @@ -18,11 +18,11 @@ EXAMPLES
  
  Open the guilt-status man page 
  
 - $ guilt-help status
 + $ guilt help status
  
  Open the guilt man page 
  
 - $ guilt-help
 + $ guilt help
  
  Author
  --
 diff --git a/Documentation/guilt-new.txt b/Documentation/guilt-new.txt
 index a2c8a4c..698dcb7 100644
 --- a/Documentation/guilt-new.txt
 +++ b/Documentation/guilt-new.txt
 @@ -42,16 +42,16 @@ EXAMPLES
  
  Create a new patch called 'foobar':
  
 - $ guilt-new foobar
 + $ guilt new foobar
  
  Create a patch called 'foo' and supply a patch description interactively:
  
 - $ guilt-new -e foo
 + $ guilt new -e foo
  
  Create a patch called 'bar' with a provided patch description and sign off
  on the patch:
  
 - $ guilt-new -s -m patch-fu bar
 + $ guilt new -s -m patch-fu bar
  
  Author
  --
 diff --git a/Documentation/guilt-repair.txt b/Documentation/guilt-repair.txt
 index 4aa472b..4faf113 100644
 --- a/Documentation/guilt-repair.txt
 +++ b/Documentation/guilt-repair.txt
 @@ -22,7 +22,7 @@ Perform various repository repairs. You must specify one 
 mode of repair:
   WARNING: Running this command may result in commits and working
   directory changes being lost. You may want to create a new reference
   (e.g., branch, or reflog) to the original HEAD before using
 - guilt-repair.
 + guilt repair.
  
  --status::
   Upgrade the status file from old format to new.
 diff --git a/Documentation/guilt-select.txt b/Documentation/guilt-select.txt
 index f7fb5f7..dd5833e 100644
 --- a/Documentation/guilt-select.txt
 +++ b/Documentation/guilt-select.txt
 @@ -19,10 +19,10 @@ the following way:
  * An unguarded patch is always applied.
  
  * A patch with a positive guard is applied *only* if the guard is
 -selected with guilt-select.
 +selected with +guilt select+.
  
  * A patch with a negative guard is applied *unless* the guard is
 -selected with guilt-select.
 +selected with +guilt select+.
  
  OPTIONS
  ---
 -- 
 2.1.0
 

-- 
mainframe, n.:
  An obsolete device still used by thousands of obsolete companies serving
  billions of obsolete customers and making huge obsolete profits for their
  obsolete shareholders. And this year's run twice as fast as last year's.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 1/5] Fix generation of Documentation/usage-%.txt.

2015-01-23 Thread Jeff Sipek
On Fri, Jan 23, 2015 at 03:33:03PM +0100, Per Cederqvist wrote:
 On Fri, Jan 23, 2015 at 3:21 PM, Jeff Sipek jef...@josefsipek.net wrote:
  On Fri, Jan 23, 2015 at 02:24:55PM +0100, Per Cederqvist wrote:
  The old rule worked, most of the time, but had several issues:
 
   - It depended on the corresponding guilt-*.txt file, but the usage.sh
 script actually reads ../guilt-foo.
 
   - Actually, each usage-%.txt depended on all guilt-*.txt files, so
 make had to do more work than necessary if a single file was
 altered.
 
   - The construct broke parallel make, which would spawn several
 usage.sh at once.  This leads to unnecessary work, and could
 potentially result in broken usage files if the echo some_string 
 some_file construct used by usage.sh isn't atomic.
 
  Fixed by letting the usage.sh script update a single file, and writing
  a proper implicit make rule.  This makes parallel make work a lot
  better.
 
  Nice!
 
  There is a small downside, though, as usage.sh will now be run once
  for each command (if everything is regenerated).  I think it is worth
  to pay that price to get the correctness.  This command is still very
  fast compared to the docbook processing.
 
  Given how much simple usage.sh got, I'm thinking it might be worth it to
  just remove it, and just shove the rule into the makefile itself.
 
  Ok, I tried to write it.  I came up with the following.  (Note: I have *not*
  tested it.)  It's not *that* ugly.
 
  usage-guilt-%.txt: ../guilt-% usage.sh
  echo '$(basename $)' `sed -n -e '/^USAGE=/{s/USAGE=//; s/$//; 
  p; q}' $`  $@
 
  What do you think?  Too opaque?  Your change looks good.
 
 Too opaque,

Between that and the other patch in the series that modifies usage.sh, your
patch is good as is.

Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

 and not tested enough. It doesn't work, since make will
 handle all $.  You need to write $$ instead of $ in at least one of the
 places.  I would stick with usage.sh, as getting the quoting right when
 you have make, shell, subshells, and sed all at the same time is just
 too painful.

And this is comming from the person that rewrote cmd/shouldfail in a way
that the average shell user will go whaaa?? :P  (To be fair, I don't know
of a simpler way to make cmd/shouldfail.)

 But it is of course up to you. You are the maintainer. :-)

Heh.

Jeff.

-- 
Real Programmers consider what you see is what you get to be just as bad a
concept in Text Editors as it is in women. No, the Real Programmer wants a
you asked for it, you got it text editor -- complicated, cryptic,
powerful, unforgiving, dangerous.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 1/2] guilt graph: Simplify getfiles.

2015-01-23 Thread Jeff Sipek
Neat.

Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Fri, Jan 23, 2015 at 03:21:06PM +0100, Per Cederqvist wrote:
 git diff-tree by default emits TAB-separated fields.  cut by defaults
 processes TAB-separated fields.  Simplify getfiles() by using TAB as
 the separator.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt-graph | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/guilt-graph b/guilt-graph
 index 0857e0d..d90c2f1 100755
 --- a/guilt-graph
 +++ b/guilt-graph
 @@ -36,7 +36,7 @@ fi
  
  getfiles()
  {
 - git diff-tree -r $1^ $1 | tr '\t' ' ' | cut -d' ' -f6
 + git diff-tree -r $1^ $1 | cut -f2
  }
  
  cache=$GUILT_DIR/$branch/.graphcache.$$
 -- 
 2.1.0
 

-- 
C is quirky, flawed, and an enormous success.
- Dennis M. Ritchie.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 2/2] Teach guilt graph the -x exclude-pattern option.

2015-01-23 Thread Jeff Sipek
On Fri, Jan 23, 2015 at 03:21:07PM +0100, Per Cederqvist wrote:
 Some projects keep a ChangeLog which every commit modifies.  This
 makes the graph a very uninteresting single line of commits.  It is
 sometimes useful to see how the graph would look if we ignore the
 ChangeLog file.
 
 The new -x option is useful in situations like this.  It can be
 repeated several times to ignore many files.  Each argument is saved
 to a temporary file and grep -v -f $TEMPORARY is used to filter out
 the file names you want to ignore.

Cool idea.

 Also added a minimal test case and documentation.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  Documentation/guilt-graph.txt |  5 +
  guilt-graph   | 24 ++--
  regression/t-033.out  | 12 
  regression/t-033.sh   |  3 +++
  4 files changed, 38 insertions(+), 6 deletions(-)
 
 diff --git a/Documentation/guilt-graph.txt b/Documentation/guilt-graph.txt
 index f43206e..eeed321 100644
 --- a/Documentation/guilt-graph.txt
 +++ b/Documentation/guilt-graph.txt
 @@ -16,6 +16,11 @@ patches.
  
  OPTIONS
  ---
 +-x pattern::
 + Ignore files that matches the given grep pattern. Can be
 + repeated to ignore several files. This can be useful to ignore
 + for instance ChangeLog files that every commit modifies.
 +
  patchname::
   Instead of starting with the topmost applied patch, start with
   patchname.
 diff --git a/guilt-graph b/guilt-graph
 index d90c2f1..4d5fe46 100755
 --- a/guilt-graph
 +++ b/guilt-graph
 @@ -3,7 +3,7 @@
  # Copyright (c) Josef Jeff Sipek, 2007-2013
  #
  
 -USAGE=[patchname]
 +USAGE=[-x exclude-pattern]... [patchname]
  if [ -z $GUILT_VERSION ]; then
   echo Invoking `basename $0` directly is no longer supported. 2
   exit 1
 @@ -11,6 +11,22 @@ fi
  
  _main() {
  
 +cache=$GUILT_DIR/$branch/.graphcache.$$
 +xclude=$GUILT_DIR/$branch/.graphexclude.$$
 +trap rm -rf \$cache\ \$xclude\ 0
 +mkdir $cache
 +$xclude
 +
 +while [ $# -gt 0 ]; do
 +if [ $1 = -x ]  [ $# -ge 2 ]; then
 + echo $2  $xclude
 + shift
 + shift
 +else
 + break
 +fi

Spaces used for indentation.  Otherwise looks good.

Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

 +done
 +
  if [ $# -gt 1 ]; then
   usage
  fi
 @@ -39,10 +55,6 @@ getfiles()
   git diff-tree -r $1^ $1 | cut -f2
  }
  
 -cache=$GUILT_DIR/$branch/.graphcache.$$
 -mkdir $cache
 -trap rm -rf \$cache\ 0
 -
  disp digraph G {
  
  current=$top
 @@ -66,7 +78,7 @@ while [ $current != $base ]; do
   rm -f $cache/dep
   touch $cache/dep
  
 - getfiles $current | while read f; do
 + getfiles $current | grep -v -f $xclude | while read f; do
   # hash the filename
   fh=`echo $f | sha1 | cut -d' ' -f1`
   if [ -e $cache/$fh ]; then
 diff --git a/regression/t-033.out b/regression/t-033.out
 index c120d4f..1ed371f 100644
 --- a/regression/t-033.out
 +++ b/regression/t-033.out
 @@ -88,3 +88,15 @@ digraph G {
   ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch]
   891bc14b5603474c9743fd04f3da888644413dc5 - 
 ff2775f8d1dc753f635830adcc3a067e0b681e2d; // ?
  }
 +%% The same graph, but excluding deps introduced by file.txt.
 +% guilt graph -x file.txt
 +digraph G {
 +# checking rev bc7df666a646739eaf559af23cab72f2bfd01f0e
 + bc7df666a646739eaf559af23cab72f2bfd01f0e 
 [label=a-\betterquicker'-patch.patch]
 +# checking rev 891bc14b5603474c9743fd04f3da888644413dc5
 + 891bc14b5603474c9743fd04f3da888644413dc5 [label=c.patch]
 +# checking rev c7014443c33d2b0237293687ceb9cbd38313df65
 + c7014443c33d2b0237293687ceb9cbd38313df65 [label=b.patch]
 +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d
 + ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch]
 +}
 diff --git a/regression/t-033.sh b/regression/t-033.sh
 index 9fe1827..ae22914 100755
 --- a/regression/t-033.sh
 +++ b/regression/t-033.sh
 @@ -59,3 +59,6 @@ cmd git add file.txt
  cmd guilt refresh
  fixup_time_info a-\betterquicker'-patch.patch
  cmd guilt graph
 +
 +echo %% The same graph, but excluding deps introduced by file.txt.
 +cmd guilt graph -x file.txt
 -- 
 2.1.0
 

-- 
Computer Science is no more about computers than astronomy is about
telescopes.
- Edsger Dijkstra
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 1/5] Fix generation of Documentation/usage-%.txt.

2015-01-23 Thread Jeff Sipek
On Fri, Jan 23, 2015 at 02:24:55PM +0100, Per Cederqvist wrote:
 The old rule worked, most of the time, but had several issues:
 
  - It depended on the corresponding guilt-*.txt file, but the usage.sh
script actually reads ../guilt-foo.
 
  - Actually, each usage-%.txt depended on all guilt-*.txt files, so
make had to do more work than necessary if a single file was
altered.
 
  - The construct broke parallel make, which would spawn several
usage.sh at once.  This leads to unnecessary work, and could
potentially result in broken usage files if the echo some_string 
some_file construct used by usage.sh isn't atomic.

 Fixed by letting the usage.sh script update a single file, and writing
 a proper implicit make rule.  This makes parallel make work a lot
 better.

Nice!

 There is a small downside, though, as usage.sh will now be run once
 for each command (if everything is regenerated).  I think it is worth
 to pay that price to get the correctness.  This command is still very
 fast compared to the docbook processing.

Given how much simple usage.sh got, I'm thinking it might be worth it to
just remove it, and just shove the rule into the makefile itself.

Ok, I tried to write it.  I came up with the following.  (Note: I have *not*
tested it.)  It's not *that* ugly.

usage-guilt-%.txt: ../guilt-% usage.sh
echo '$(basename $)' `sed -n -e '/^USAGE=/{s/USAGE=//; s/$//; p; 
q}' $`  $@

What do you think?  Too opaque?  Your change looks good.

Jeff.

 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  Documentation/Makefile | 4 ++--
  Documentation/usage.sh | 8 +++-
  2 files changed, 5 insertions(+), 7 deletions(-)
 
 diff --git a/Documentation/Makefile b/Documentation/Makefile
 index b6c3285..ec3c9e8 100644
 --- a/Documentation/Makefile
 +++ b/Documentation/Makefile
 @@ -66,8 +66,8 @@ clean:
   rm -f usage-*.txt
   rm -f version.txt
  
 -usage-%.txt: $(MAN1_TXT) usage.sh
 - sh ./usage.sh
 +usage-guilt-%.txt: ../guilt-% usage.sh
 + sh ./usage.sh $

  %.html : %.txt footer.txt version.txt
   $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf $(ASCIIDOC_EXTRA) $
 diff --git a/Documentation/usage.sh b/Documentation/usage.sh
 index 20fdca4..629f546 100644
 --- a/Documentation/usage.sh
 +++ b/Documentation/usage.sh
 @@ -1,7 +1,5 @@
  #!/bin/sh
  
 -for i in `ls ../guilt-*`; do
 - name=$(basename $i)
 - u=$(grep USAGE $i |  sed 's/USAGE=//' | sed 's/$//') 
 - echo '$name' $u   usage-$name.txt
 -done
 +name=$(basename $1)
 +u=$(grep USAGE $1 |  sed 's/USAGE=//' | sed 's/$//') 
 +echo '$name' $u   usage-$name.txt
 -- 
 2.1.0
 

-- 
The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man.
- George Bernard Shaw
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 2/5] doc: guilt.xml depends on cmds.txt.

2015-01-23 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Fri, Jan 23, 2015 at 02:24:56PM +0100, Per Cederqvist wrote:
 Specify an explicit dependency, to stop make from trying to generate
 guilt.xml if cmds.txt could not be created.  The asciidoc will fail
 and produce an error message that might hide the original error
 message.
 
 The added dependency causes make to not remove the guilt.xml file.
 Add *.xml to .gitignore.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  Documentation/.gitignore | 3 +++
  Documentation/Makefile   | 2 ++
  2 files changed, 5 insertions(+)
 
 diff --git a/Documentation/.gitignore b/Documentation/.gitignore
 index c4f0588..9b8d4da 100644
 --- a/Documentation/.gitignore
 +++ b/Documentation/.gitignore
 @@ -11,3 +11,6 @@ version.txt
  
  # Generated file dependency list
  doc.dep
 +
 +# Intermediate generated files
 +*.xml
 diff --git a/Documentation/Makefile b/Documentation/Makefile
 index ec3c9e8..2574125 100644
 --- a/Documentation/Makefile
 +++ b/Documentation/Makefile
 @@ -60,6 +60,8 @@ cmds.txt: cmd-list.sh $(MAN1_TXT)
  
  guilt.7 guilt.html: guilt.txt footer.txt version.txt
  
 +guilt.xml: cmds.txt
 +
  clean:
   rm -f *.xml *.html *.1 *.7 doc.dep
   rm -f cmds.txt
 -- 
 2.1.0
 

-- 
The obvious mathematical breakthrough would be development of an easy way to
factor large prime numbers.
- Bill Gates, The Road Ahead, pg. 265
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 4/5] doc: don't use guilt-foo invocations in usage messages.

2015-01-23 Thread Jeff Sipek
Ah, I see you changed usage.sh here.  I guess that kinda invalidates my
comment for patch 1/5.

On Fri, Jan 23, 2015 at 02:24:58PM +0100, Per Cederqvist wrote:
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  Documentation/usage.sh | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/Documentation/usage.sh b/Documentation/usage.sh
 index 629f546..9cc49f7
 --- a/Documentation/usage.sh
 +++ b/Documentation/usage.sh
 @@ -2,4 +2,4 @@
  
  name=$(basename $1)
  u=$(grep USAGE $1 |  sed 's/USAGE=//' | sed 's/$//') 
 -echo '$name' $u   usage-$name.txt
 +echo '`echo $name|sed -e 's/^guilt-/guilt /'`' $u   usage-$name.txt

Tiny nitpick: spaces around the |, otherwise looks good.

Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net


 -- 
 2.1.0
 

-- 
Si hoc legere scis nimium eruditionis habes.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 5/5] doc: git doesn't use git-foo invocations.

2015-01-23 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Fri, Jan 23, 2015 at 02:24:59PM +0100, Per Cederqvist wrote:
 Make them into reference to the man pages instead.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  Documentation/guilt-add.txt | 2 +-
  Documentation/guilt-refresh.txt | 2 +-
  Documentation/guilt-rm.txt  | 2 +-
  3 files changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/Documentation/guilt-add.txt b/Documentation/guilt-add.txt
 index a276f09..067b6ca 100644
 --- a/Documentation/guilt-add.txt
 +++ b/Documentation/guilt-add.txt
 @@ -11,7 +11,7 @@ include::usage-guilt-add.txt[]
  
  DESCRIPTION
  ---
 -Adds the files specified to git using git-add making it available to guilt.
 +Adds the files specified to git using git-add(1) making it available to 
 guilt.
  
  OPTIONS
  ---
 diff --git a/Documentation/guilt-refresh.txt b/Documentation/guilt-refresh.txt
 index 7757bdc..98076e3 100644
 --- a/Documentation/guilt-refresh.txt
 +++ b/Documentation/guilt-refresh.txt
 @@ -23,7 +23,7 @@ OPTIONS
  Include a diffstat output in the patch file. Useful for cases where
  patches will be submitted with other tools.
  +
 -If the command line option is omitted, the corresponding git-config
 +If the command line option is omitted, the corresponding git-config(1)
  option guilt.diffstat will be queried. So this would enable diffstat
  output by default:
  
 diff --git a/Documentation/guilt-rm.txt b/Documentation/guilt-rm.txt
 index 71b49fe..cfe471e 100644
 --- a/Documentation/guilt-rm.txt
 +++ b/Documentation/guilt-rm.txt
 @@ -11,7 +11,7 @@ include::usage-guilt-rm.txt[]
  
  DESCRIPTION
  ---
 -Removes the files specified from git using git-rm
 +Removes the files specified from git using git-rm(1).
  
  OPTIONS
  ---
 -- 
 2.1.0
 

-- 
The obvious mathematical breakthrough would be development of an easy way to
factor large prime numbers.
- Bill Gates, The Road Ahead, pg. 265
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v4 15/33] Produce legal patch names in guilt-import-commit.

2015-01-22 Thread Jeff Sipek
I just tried to run the regression suite on my OpenIndiana laptop and I got
this failure.

034: --- t-034.out  2015-01-22 14:02:23.634515474 +
+++ /tmp/guilt.log.148782015-01-22 14:03:54.258790788 +
@@ -83,7 +83,7 @@
 [master aedb74f] @
  Author: Author Name author@email
  1 file changed, 1 insertion(+)
-% create_commit a Backslash\is\forbidden.
+% create_commit a Backslash\is
   orbidden.
 [master 0a46f8f] Backslash\is\forbidden.
  Author: Author Name author@email
  1 file changed, 1 insertion(+)
Test failed!

Test:   034
Log file:   /tmp/guilt.log.14878
Repo dir:   /tmp/guilt reg.12106

make[1]: *** [all] Error 1


It's obviously the cmd command printing that's busted.  The following change
makes the test suite pass.  Does it work for you?  (If so, I'll commit it after
pulling your whole series.)

Thanks,

Jeff.


diff --git a/regression/scaffold b/regression/scaffold
index 97cff4e..593e9da 100644
--- a/regression/scaffold
+++ b/regression/scaffold
@@ -50,7 +50,7 @@ function filter_dd
 # usage: cmd cmd..
 function cmd
 {
-   echo % $@
+   printf %% %s\n $*
if ! (
exec 31
rv=`(($@ 21; echo $? 4) | replace_path 3 ) 41`

On Sun, May 18, 2014 at 11:59:51PM +0200, Per Cederqvist wrote:
 Try harder to create patch names that adhere to the rules in
 git-check-ref-format(1) when deriving a patch name from the commit
 message.  Verify that the derived name using git check-ref-format,
 and as a final fallback simply use the patch name x (to ensure that
 the code is future-proof in case new rules are added in the future).
 
 Always append a .patch suffix to the patch name.
 
 Added test cases.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
 ---
  guilt-import-commit  |  20 +-
  regression/t-034.out | 567 
 +++
  regression/t-034.sh  |  71 +++
  3 files changed, 656 insertions(+), 2 deletions(-)
  create mode 100644 regression/t-034.out
  create mode 100755 regression/t-034.sh
 
 diff --git a/guilt-import-commit b/guilt-import-commit
 index f14647c..6260c56 100755
 --- a/guilt-import-commit
 +++ b/guilt-import-commit
 @@ -28,19 +28,35 @@ disp Current head: `git rev-parse \`git_branch\`` 2
  for rev in `git rev-list $rhash`; do
   s=`git log --pretty=oneline -1 $rev | cut -c 42-`
  
 + # Try to convert the first line of the commit message to a
 + # valid patch name.
   fname=`echo $s | sed -e s//and/g -e s/[ :]/_/g -e s,[/\\],-,g \
   -e s/['\\[{}]//g -e 's/]//g' -e 's/\*/-/g' \
 - -e 's/\?/-/g' | tr A-Z a-z`
 + -e 's/\?/-/g' -e 's/\.\.\.*/./g' -e 's/^\.//' \
 + -e 's/\.patch$//' -e 's/\.$//' | tr A-Z a-z`
 +
 + if ! valid_patchname $fname; then
 + # Try harder to make it a legal commit name by
 + # removing all but a few safe characters.
 + fname=`echo $fname|tr -d -c _a-zA-Z0-9---/\\n`
 + fi
 + if ! valid_patchname $fname; then
 + # If we failed to derive a legal patch name, use the
 + # name x.  (If this happens, we likely have to
 + # append a suffix to make the name unique.)
 + fname=x
 + fi
  
   disp Converting `echo $rev | cut -c 1-8` as $fname
  
   mangle_prefix=1
   fname_base=$fname
 - while [ -f $GUILT_DIR/$branch/$fname ]; do
 + while [ -f $GUILT_DIR/$branch/$fname.patch ]; do
   fname=$fname_base-$mangle_prefix
   mangle_prefix=`expr $mangle_prefix + 1`
   disp Patch under that name exists...trying '$fname'
   done
 + fname=$fname.patch
  
   (
   do_make_header $rev
 diff --git a/regression/t-034.out b/regression/t-034.out
 new file mode 100644
 index 000..7bc9459
 --- /dev/null
 +++ b/regression/t-034.out
 @@ -0,0 +1,567 @@
 +% setup_git_repo
 +% git tag base
 +% create_commit a The sequence /. is forbidden.
 +[master eebb76e] The sequence /. is forbidden.
 + Author: Author Name author@email
 + 1 file changed, 1 insertion(+)
 + create mode 100644 a
 +% create_commit a The sequence .lock/ is forbidden.
 +[master 45e81b5] The sequence .lock/ is forbidden.
 + Author: Author Name author@email
 + 1 file changed, 1 insertion(+)
 +% create_commit a A/component/may/not/end/in/foo.lock
 +[master bbf3f59] A/component/may/not/end/in/foo.lock
 + Author: Author Name author@email
 + 1 file changed, 1 insertion(+)
 +% create_commit a Two consecutive dots (..) is forbidden.
 +[master 1535e67] Two consecutive dots (..) is forbidden.
 + Author: Author Name author@email
 + 1 file changed, 1 insertion(+)
 +% create_commit a Check/multiple/../dots/./foo..patch
 +[master 48eb60c] Check/multiple/../dots/./foo..patch
 + Author: Author Name author@email
 + 1 file changed, 1 insertion(+)
 +% create_commit a Space

Re: [GUILT v4 14/33] Use git check-ref-format to validate patch names.

2015-01-22 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Sun, May 18, 2014 at 11:59:50PM +0200, Per Cederqvist wrote:
 The valid_patchname now lets git check-ref-format do its job instead
 of trying (and failing) to implement the same rules.  See
 git-check-ref-format(1) for a list of the rules.  Re-implement rules
 added to git check-ref-format after Git 1.5.0, so that guilt rejects
 the same names no matter what version of Git we are using (but
 versions prior to 1.5.0 are not supported).
 
 Refer to the git-check-ref-format(1) man page in the error messages
 produced when valid_patchname indicates that the name is bad.
 
 Added testcases that breaks most of the rules in that man-page.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt|  46 +-
  guilt-fork   |   2 +-
  guilt-import |   2 +-
  guilt-new|   2 +-
  regression/t-025.out | 426 
 +--
  regression/t-025.sh  |  12 +-
  regression/t-032.out |   4 +-
  7 files changed, 474 insertions(+), 20 deletions(-)
 
 diff --git a/guilt b/guilt
 index 3fc524e..9567a78 100755
 --- a/guilt
 +++ b/guilt
 @@ -132,14 +132,50 @@ fi
  # usage: valid_patchname patchname
  valid_patchname()
  {
 + # Once we only support Git 1.7.8 and newer, the command below
 + # could be replaced with:
 + #
 + # git check-ref-format --allow-onelevel $1
 + #
 + # Instead, we arbitrarily prepend one level.  The result
 + # should be the same, and this is portable to all existing
 + # versions of Git.
 + git check-ref-format a/$1
 + if [ $? -ne 0 ]; then
 + return 1
 + fi
 +
 + # We want to reject all names that Git 2.0.0 rejects.  In case
 + # we are running an older version, we explicitly check some
 + # cases that were added to Git after version 1.5.0.  This code
 + # aims to support Git version 1.5.0 and newer.
 +
 + # Git 1.7.6.4 and newer rejects the DEL character.
 + if [ `echo $1|tr -d '\177'` != $1 ]; then
 + return 1
 + fi
 +
 + # Git 1.7.8 and newer rejects refs that start or end with
 + # slash or contain multiple adjacent slashes.
   case $1 in
 - /*|./*|../*|*/./*|*/../*|*/.|*/..|*/|*\ *|*\*)
 + /*|*/|*//*)
   return 1;;
 - *:*)
 - return 1;;
 - *)
 - return 0;;
   esac
 +
 + # Git 1.7.8 and newer rejects refname components that end in
 + # .lock.
 + case $1 in
 + *.lock/*|*.lock)
 + return 1;;
 + esac
 +
 + # Git 1.8.5 and newer rejects refnames that are made up of the
 + # single character @.
 + if [ $1 = @ ]; then
 + return 1
 + fi
 +
 + return 0
  }
  
  get_branch()
 diff --git a/guilt-fork b/guilt-fork
 index a85d391..6447e55 100755
 --- a/guilt-fork
 +++ b/guilt-fork
 @@ -37,7 +37,7 @@ else
  fi
  
  if ! valid_patchname $newpatch; then
 - die The specified patch name contains invalid characters (:).
 + die The specified patch name is invalid according to 
 git-check-ref-format(1).
  fi
  
  if [ -e $GUILT_DIR/$branch/$newpatch ]; then
 diff --git a/guilt-import b/guilt-import
 index 3e9b3bb..928e325 100755
 --- a/guilt-import
 +++ b/guilt-import
 @@ -40,7 +40,7 @@ if [ -e $GUILT_DIR/$branch/$newname ]; then
  fi
  
  if ! valid_patchname $newname; then
 - die The specified patch name contains invalid characters (:).
 + die The specified patch name is invalid according to 
 git-check-ref-format(1).
  fi
  
  # create any directories as needed
 diff --git a/guilt-new b/guilt-new
 index 9528438..9f7fa44 100755
 --- a/guilt-new
 +++ b/guilt-new
 @@ -64,7 +64,7 @@ fi
  
  if ! valid_patchname $patch; then
   disp Patchname is invalid. 2
 - die it cannot begin with '/', './' or '../', or contain /./, /../, or 
 whitespace
 + die It must follow the rules in git-check-ref-format(1).
  fi
  
  # create any directories as needed
 diff --git a/regression/t-025.out b/regression/t-025.out
 index 7811ab1..01bc406 100644
 --- a/regression/t-025.out
 +++ b/regression/t-025.out
 @@ -141,7 +141,7 @@ f da39a3ee5e6b4b0d3255bfef95601890afd80709  
 .git/patches/master/prepend
  r acdeef96ee30eb34bbbf65d11de5cf7da4b5fee8  .git/refs/patches/master/prepend
  % guilt new white space
  Patchname is invalid.
 -it cannot begin with '/', './' or '../', or contain /./, /../, or whitespace
 +It must follow the rules in git-check-ref-format(1).
  % list_files
  d .git/patches
  d .git/patches/master
 @@ -211,7 +211,7 @@ f da39a3ee5e6b4b0d3255bfef95601890afd80709  
 .git/patches/master/prepend
  r acdeef96ee30eb34bbbf65d11de5cf7da4b5fee8  .git/refs/patches/master/prepend
  % guilt new /abc
  Patchname is invalid.
 -it cannot begin with '/', './' or '../', or contain /./, /../, or whitespace
 +It must follow the rules in git-check-ref-format(1).
  % list_files

Re: [GUILT v4 33/33] Document the exit status of guilt push and guilt pop.

2015-01-22 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net


Ok, I think this is all of the patches.  I'll wait for you to tell me if the
cmd() echo to printf change breaks anything for you.  If not, I'll pull your
series (via git), tag a 0.36-rc1, and push the whole thing to repo.or.cz. :)

Sorry for making this take so long :(

Jeff.

On Mon, May 19, 2014 at 12:00:09AM +0200, Per Cederqvist wrote:
 ---
  Documentation/guilt-pop.txt  | 3 +++
  Documentation/guilt-push.txt | 3 +++
  2 files changed, 6 insertions(+)
 
 diff --git a/Documentation/guilt-pop.txt b/Documentation/guilt-pop.txt
 index 36fea9e..b0b89cc 100644
 --- a/Documentation/guilt-pop.txt
 +++ b/Documentation/guilt-pop.txt
 @@ -26,6 +26,9 @@ OPTIONS
  
  If no patchname is given, pop the top-most patch.
  
 +Exit with a non-zero exit status if requested to pop more patches
 +than there are on the stack.
 +
  Author
  --
  Written by Josef Jeff Sipek jef...@josefsipek.net
 diff --git a/Documentation/guilt-push.txt b/Documentation/guilt-push.txt
 index 6ee86b9..6439f21 100644
 --- a/Documentation/guilt-push.txt
 +++ b/Documentation/guilt-push.txt
 @@ -26,6 +26,9 @@ OPTIONS
  
  If no patchname is given, push the next patch in the series onto the tree.
  
 +Exit with a non-zero exit status if requested to push more patches
 +than there are in the series.
 +
  Author
  --
  Written by Josef Jeff Sipek jef...@josefsipek.net
 -- 
 1.8.3.1
 

-- 
Computer Science is no more about computers than astronomy is about
telescopes.
- Edsger Dijkstra
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v4 09/33] Test suite: properly check the exit status of commands.

2015-01-22 Thread Jeff Sipek
On Sun, May 18, 2014 at 11:59:45PM +0200, Per Cederqvist wrote:
 The cmd and shouldfail functions checked the exit status of the
 replace_path function instead of the actual command that was running.
 (The $? construct checks the exit status of the last command in a
 pipeline, not the first command.)
 
 Print an explicit error message if a command that should fail actually
 succeeds.

This is a god idea.

The patch still looks good.

Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net


 Updated t-032.sh, which used shouldfail instead of cmd in one
 place.  (The comment in the script makes it clear that the command is
 expected to succeed.)
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  regression/scaffold | 23 ---
  regression/t-032.sh |  2 +-
  2 files changed, 17 insertions(+), 8 deletions(-)
 
 diff --git a/regression/scaffold b/regression/scaffold
 index 5c8b73e..2e04c83 100644
 --- a/regression/scaffold
 +++ b/regression/scaffold
 @@ -51,19 +51,28 @@ function filter_dd
  function cmd
  {
   echo % $@
 - $@ 21 | replace_path  return 0
 - return 1
 + if ! (
 + exec 31
 + rv=`(($@ 21; echo $? 4) | replace_path 3 ) 41`
 + exit $rv
 + ) ; then
 + echo % FAIL: The above command should succeed but failed.
 + exit 1
 + fi
  }
  
  # usage: shouldfail cmd..
  function shouldfail
  {
   echo % $@
 - (
 - $@ 21 || return 0
 - return 1
 - ) | replace_path
 - return $?
 + if (
 + exec 31
 + rv=`(($@ 21; echo $? 4) | replace_path 3 ) 41`
 + exit $rv
 + ) ; then
 + echo % FAIL: The above command should fail but succeeded.
 + exit 1
 + fi
  }
  
  # usage: list_files
 diff --git a/regression/t-032.sh b/regression/t-032.sh
 index b1d5f19..bba401e 100755
 --- a/regression/t-032.sh
 +++ b/regression/t-032.sh
 @@ -28,7 +28,7 @@ shouldfail guilt import -P foo3 foo
  cmd guilt import -P foo2 foo
  
  # ok
 -shouldfail guilt import foo
 +cmd guilt import foo
  
  # duplicate patch name (implicit)
  shouldfail guilt import foo
 -- 
 1.8.3.1
 

-- 
Intellectuals solve problems; geniuses prevent them
- Albert Einstein
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v4 32/33] Improved doc and tests for guilt header.

2015-01-22 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net


On Mon, May 19, 2014 at 12:00:08AM +0200, Per Cederqvist wrote:
 ---
  Documentation/guilt-header.txt | 5 -
  regression/t-028.out   | 9 +
  regression/t-028.sh| 3 +++
  3 files changed, 16 insertions(+), 1 deletion(-)
 
 diff --git a/Documentation/guilt-header.txt b/Documentation/guilt-header.txt
 index 870bfaf..71b2e66 100644
 --- a/Documentation/guilt-header.txt
 +++ b/Documentation/guilt-header.txt
 @@ -18,7 +18,10 @@ Prints either the topmost patch's header or the header of 
 a specified patch.
  -E::
   Open the raw patch in an editor, instead of printing it.
  patchname::
 - Name of the patch.
 + Name of the patch. If a patch with exactly this name exists,
 + use it. Otherwise, treat the name as a regexp; if the regexp
 + matches a single patch, use it. Otherwise, list all matching
 + patch names to stderr and fail.
  
  Author
  --
 diff --git a/regression/t-028.out b/regression/t-028.out
 index ea72a3a..39ac900 100644
 --- a/regression/t-028.out
 +++ b/regression/t-028.out
 @@ -56,3 +56,12 @@ Patch non-existant is not in the series
remove
mode
patch-with-some-desc
 +% guilt header de
 +de does not uniquely identify a patch. Did you mean any of these?
 +  mode
 +  patch-with-some-desc
 +% guilt header des
 +blah blah blah
 +
 +Signed-off-by: Commiter Name commiter@email
 +
 diff --git a/regression/t-028.sh b/regression/t-028.sh
 index 2ce0378..cd3088c 100755
 --- a/regression/t-028.sh
 +++ b/regression/t-028.sh
 @@ -35,4 +35,7 @@ shouldfail guilt header non-existant
  # patch name is a regexp that just happens to match an existing patch.
  shouldfail guilt header '.*'
  
 +shouldfail guilt header de
 +cmd guilt header des
 +
  # FIXME: how do we check that -e works?
 -- 
 1.8.3.1
 

-- 
You measure democracy by the freedom it gives its dissidents, not the
freedom it gives its assimilated conformists.
- Abbie Hoffman
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[ANNOUNCE] Guilt v0.36-rc1

2015-01-22 Thread Josef 'Jeff' Sipek
Guilt v0.36-rc1 is available for download.

Guilt (Git Quilt) is a series of shell scripts which add a Mercurial
queues-like functionality and interface to git.

Tarballs:
http://guilt.31bits.net/src/

Git repo:
git://repo.or.cz/guilt.git


This is the first release candidate for the long awaited v0.36.  Yes, it's
been *way* too long since the last release, but hopefully that will change
going forward.  By far, the most changes come from Per Cederqvist who
cleaned up some rather dark corners in the code.  Thanks!

As always, patches, and other feedback is welcome.

Josef Jeff Sipek.


Changes since v0.35:

Alan Jenkins (5):
  [GUILT 1/6] Refuse to push corrupt patches
  [GUILT 2/6] guilt-header: fix patch corruption
  [GUILT 3/6] Handle paths that contain spaces
  [GUILT 4/6] Run regression tests in a directory which contains spaces
  [GUILT 5/6] Allow guilt scripts to be run from a directory which contains 
spaces

Dave Chinner (1):
  guilt: fix from: xxx filtering in the patch description

Jari Aalto (1):
  Documentation/Makefile: Run xmlto with --skip-validation

Jonathan Nieder (1):
  Drop unneeded git version check.

Josef 'Jeff' Sipek (12):
  [GUILT 6/6] Allow the regression tests to be run from a directory with 
spaces in
  guilt: remove a useless cat
  commit: don't lose commits
  fix direct invocation messages
  guilt: fix -h invocation
  Documentation: update HOWTO to use 'guilt foo'
  Documentation: clean up the makefile
  Documentation: guilt  git don't use hyphenated commands
  regress: setup_git_repo can assert that the repo is setup as intended
  FreeBSD is much like Darwin
  regress: cmd and shouldfail shouldn't print escapes
  Guilt v0.36-rc1

Per Cederqvist (43):
  get rid of cat: write error: Broken pipe error message
  [GUILT] handle branches with slashes in guilt-graph
  Testsuite: get rid of Broken pipe errors from yes.
  The tests should not fail if log.date or log.decorate are set.
  get rid of cat: write error: Broken pipe error message
  The tests should not fail if log.date or log.decorate are set.
  Testsuite: get rid of Broken pipe errors from yes.
  Handle empty patches and patches with only a header.
  Fix fatal guilt graph error in sha1sum invocation.
  Change git branch when patches are applied.
  The tests should not fail if guilt.diffstat is set.
  Allow guilt delete -f to run from a dir which contains spaces.
  Added test case for guilt delete -f.
  Allow guilt import-commit to run from a dir which contains spaces.
  guilt new: Accept more than 4 arguments.
  Fix the do_get_patch function.
  Added test cases for guilt fold.
  Added more test cases for guilt new: empty patches.
  Test suite: properly check the exit status of commands.
  Run test_failed if the exit status of a test script is bad.
  test suite: remove pointless redirection.
  guilt header: more robust header selection.
  Check that guilt header '.*' fails.
  Use git check-ref-format to validate patch names.
  Produce legal patch names in guilt-import-commit.
  Fix backslash handling when creating names of imported patches.
  guilt graph no longer loops when no patches are applied.
  guilt-graph: Handle commas in branch names.
  Check that guilt graph works when working on a branch with a comma.
  guilt graph: Handle patch names containing quotes.
  The log.decorate setting should not influence import-commit.
  The log.decorate setting should not influence patchbomb.
  The log.decorate setting should not influence guilt rebase.
  disp no longer processes backslashes.
  guilt push now fails when there are no more patches to push.
  guilt pop now fails when there are no more patches to pop.
  Minor testsuite fix.
  Fix coding style errors in t-061.sh.
  Added guilt.reusebranch configuration option.
  Added a short style guide, and Emacs settings.
  Don't use git log -p in the test suite.
  Improved doc and tests for guilt header.
  Document the exit status of guilt push and guilt pop.

Theodore Ts'o (2):
  guilt: skip empty line after from: line in patch descriptoin
  guilt: fix date parsing

-- 
The obvious mathematical breakthrough would be development of an easy way to
factor large prime numbers.
- Bill Gates, The Road Ahead, pg. 265
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 12/29] guilt header: more robust header selection.

2014-05-16 Thread Jeff Sipek
On Fri, May 16, 2014 at 11:51:37AM +0200, Per Cederqvist wrote:
 On Fri, May 16, 2014 at 12:46 AM, Jeff Sipek jef...@josefsipek.net wrote:
  On Tue, May 13, 2014 at 10:30:48PM +0200, Per Cederqvist wrote:
  If you run something like guilt header '.*' the command would crash,
  because the grep comand that tries to ensure that the patch exist
  would detect a match, but the later code expected the match to be
  exact.
 
  Fixed by comparing exact strings.
 
  And as a creeping feature guilt header will now try to use the
  supplied patch name as an unachored regexp if no exact match was
  found.  If the regexp yields a unique match, it is used; if more than
  one patch matches, the names of all patches are listed and the command
  fails.  (Exercise left to the reader: generalized this so that guilt
  push also accepts a unique regular expression.)
 
  Signed-off-by: Per Cederqvist ced...@opera.com
  ---
   guilt-header | 28 +---
   1 file changed, 25 insertions(+), 3 deletions(-)
 
  diff --git a/guilt-header b/guilt-header
  index 41e00cc..4701b31 100755
  --- a/guilt-header
  +++ b/guilt-header
  @@ -45,10 +45,32 @@ esac
   [ -z $patch ]  die No patches applied.
 
   # check that patch exists in the series
  -ret=`get_full_series | grep -e ^$patch\$ | wc -l`
  -if [ $ret -eq 0 ]; then
  - die Patch $patch is not in the series
  +full_series=`get_tmp_file series`
  +get_full_series  $full_series
  +found_patch=
  +while read x; do
  + if [ $x = $patch ]; then
  + found_patch=$patch
  + break
  + fi
  +done  $full_series
 
  We have to use a temp file instead of a 'get_full_series | while read x; do 
  ...'
  because that'd create a subshell, correct?
 
 Yes. Also (and probably less importantly) we sometimes need to run grep on
 the same output (see the creation of TMP_MATCHES below) and it would
 be a bit wasteful to run get_full_series twice. (The assumption is that it is
 cheaper to create a temp file than to recompute the value. I have not measured
 this, though.)

I think this is a fair assumption.

  +if [ -z $found_patch ]; then
  + TMP_MATCHES=`get_tmp_file series`
  + grep $patch  $full_series  $TMP_MATCHES
  + nr=`wc -l  $TMP_MATCHES`
  + if [ $nr -gt 1 ]; then
  + echo $patch does not uniquely identify a patch. Did you 
  mean any of these? 2
  + sed 's/^/  /' $TMP_MATCHES 2
  + rm -f $TMP_MATCHES
  + exit 1
  + elif [ $nr -eq 0 ]; then
  + rm -f $TMP_MATCHES
  + die Patch $patch is not in the series
  + fi
  + found_patch=`cat $TMP_MATCHES`
  + rm -f $TMP_MATCHES
   fi
  +patch=$found_patch
 
  Do we not delete $full_series?
 
 Good catch. Will fix in the next version of the series.
 
 I'll also rename the variable $TMP_FULL_SERIES to adhere
 to the apparent coding style. (But I will not fix guilt-patchbomb
 that uses $dir as a temporary variable.)

Ok.

Thanks,

Jeff.

-- 
*NOTE: This message is ROT-13 encrypted twice for extra protection*
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v3 08/31] Added more test cases for guilt new: empty patches.

2014-05-16 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Fri, May 16, 2014 at 04:45:55PM +0200, Per Cederqvist wrote:
 Test that empty patches are handled correctly, both with and without
 the guilt.diffstat configuration option.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  regression/t-020.out | 269 
 +++
  regression/t-020.sh  |  60 
  2 files changed, 329 insertions(+)
 
 diff --git a/regression/t-020.out b/regression/t-020.out
 index af45734..42433dc 100644
 --- a/regression/t-020.out
 +++ b/regression/t-020.out
 @@ -1128,3 +1128,272 @@ 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 empty.patch
 +% guilt pop
 +All patches popped.
 +% guilt push
 +Applying patch..empty.patch
 +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 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
 +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
 +f d15a1d2d34493f790c78ddacb8815b0b9536ee2b  .git/patches/master/series
 +f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/empty.patch
 +f e90b964f01cbef60bbe00c38c55d9ea86618a66a  .git/patches/master/status
 +r c7a139f532a43c3c8b0e068cac04f8f6af0f94e1  
 .git/refs/patches/master/empty.patch
 +% git log -p
 +commit c7a139f532a43c3c8b0e068cac04f8f6af0f94e1
 +Author: Author Name author@email
 +Date:   Mon Jan 1 00:00:00 2007 +
 +
 +patch empty.patch
 +
 +commit d4850419ccc1146c7169f500725ce504b9774ed0
 +Author: Author Name author@email
 +Date:   Mon Jan 1 00:00:00 2007 +
 +
 +initial
 +
 +Signed-off-by: Commiter Name commiter@email
 +
 +diff --git a/def b/def
 +new file mode 100644
 +index 000..8baef1b
 +--- /dev/null
  b/def
 +@@ -0,0 +1 @@
 ++abc
 +% git config guilt.diffstat true
 +% guilt refresh
 +Patch empty.patch refreshed
 +% guilt pop
 +All patches popped.
 +% guilt push
 +Applying patch..empty.patch
 +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 7d261b8caad0f161c21daf5de65eeb521ff8c067  .git/patches/master/empty.patch
 +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
 +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
 +f d15a1d2d34493f790c78ddacb8815b0b9536ee2b  .git/patches/master/series
 +f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/empty.patch~
 +f e90b964f01cbef60bbe00c38c55d9ea86618a66a  .git/patches/master/status
 +r c7a139f532a43c3c8b0e068cac04f8f6af0f94e1  
 .git/refs/patches/master/empty.patch
 +% git log -p
 +commit c7a139f532a43c3c8b0e068cac04f8f6af0f94e1
 +Author: Author Name author@email
 +Date:   Mon Jan 1 00:00:00 2007 +
 +
 +patch empty.patch
 +
 +commit d4850419ccc1146c7169f500725ce504b9774ed0
 +Author: Author Name author@email
 +Date:   Mon Jan 1 00:00:00 2007 +
 +
 +initial
 +
 +Signed-off-by: Commiter Name commiter@email
 +
 +diff --git a/def b/def
 +new file mode 100644
 +index 000..8baef1b
 +--- /dev/null
  b/def
 +@@ -0,0 +1 @@
 ++abc
 +% git config guilt.diffstat false
 +% guilt pop
 +All patches popped.
 +% guilt push
 +Applying patch..empty.patch
 +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 7ad87a0bdb8cf0a57cfc384633edabbb9c2bfa1b  .git/patches/master/empty.patch
 +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
 +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
 +f d15a1d2d34493f790c78ddacb8815b0b9536ee2b  .git/patches/master/series
 +f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/empty.patch~
 +f e90b964f01cbef60bbe00c38c55d9ea86618a66a  .git/patches/master/status
 +r 8ed27228b117c0c88abf3d586bcc43c68e975cea  
 .git/refs/patches/master/empty.patch
 +% git log -p
 +commit 8ed27228b117c0c88abf3d586bcc43c68e975cea
 +Author: Per Cederqvist ce...@lysator.liu.se
 +Date:   Mon Jan 1 00:00:00 2007 +
 +
 +Fix a bug.
 +
 +This commit fixes a serious bug.
 +
 +FIXME:
 +- add a test case
 +- track down the bug
 +- actually fix it
 +
 +commit d4850419ccc1146c7169f500725ce504b9774ed0
 +Author

Re: [GUILT v3 12/31] guilt header: more robust header selection.

2014-05-16 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Fri, May 16, 2014 at 04:45:59PM +0200, Per Cederqvist wrote:
 If you run something like guilt header '.*' the command would crash,
 because the grep comand that tries to ensure that the patch exist
 would detect a match, but the later code expected the match to be
 exact.
 
 Fixed by comparing exact strings.
 
 And as a creeping feature guilt header will now try to use the
 supplied patch name as an unachored regexp if no exact match was
 found.  If the regexp yields a unique match, it is used; if more than
 one patch matches, the names of all patches are listed and the command
 fails.  (Exercise left to the reader: generalized this so that guilt
 push also accepts a unique regular expression.)
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt-header | 29 ++---
  1 file changed, 26 insertions(+), 3 deletions(-)
 
 diff --git a/guilt-header b/guilt-header
 index 41e00cc..c3d24f9 100755
 --- a/guilt-header
 +++ b/guilt-header
 @@ -45,10 +45,33 @@ esac
  [ -z $patch ]  die No patches applied.
  
  # check that patch exists in the series
 -ret=`get_full_series | grep -e ^$patch\$ | wc -l`
 -if [ $ret -eq 0 ]; then
 - die Patch $patch is not in the series
 +TMP_FULL_SERIES=`get_tmp_file series`
 +get_full_series  $TMP_FULL_SERIES
 +found_patch=
 +while read x; do
 + if [ $x = $patch ]; then
 + found_patch=$patch
 + break
 + fi
 +done  $TMP_FULL_SERIES
 +if [ -z $found_patch ]; then
 + TMP_MATCHES=`get_tmp_file series`
 + grep $patch  $TMP_FULL_SERIES  $TMP_MATCHES
 + nr=`wc -l  $TMP_MATCHES`
 + if [ $nr -gt 1 ]; then
 + echo $patch does not uniquely identify a patch. Did you mean 
 any of these? 2
 + sed 's/^/  /' $TMP_MATCHES 2
 + rm -f $TMP_MATCHES $TMP_FULL_SERIES
 + exit 1
 + elif [ $nr -eq 0 ]; then
 + rm -f $TMP_MATCHES $TMP_FULL_SERIES
 + die Patch $patch is not in the series
 + fi
 + found_patch=`cat $TMP_MATCHES`
 + rm -f $TMP_MATCHES
  fi
 +rm -f $TMP_FULL_SERIES
 +patch=$found_patch
  
  # FIXME: warn if we're editing an applied patch
  
 -- 
 1.8.3.1
 

-- 
Failure is not an option,
It comes bundled with your Microsoft product.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v3 29/31] Added guilt.reusebranch configuration option.

2014-05-16 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Fri, May 16, 2014 at 04:46:16PM +0200, Per Cederqvist wrote:
 When the option is true, 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.
 
 By default, the option is false, so that all users will immediately
 get the added protection against pushing a branch upstream with a
 patch applied.  While this might break guilt if a user is running both
 version 0.35 and the current version against the same local
 repository, it will not lead to data loss, and that situation is
 probably rare.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt|  24 ++-
  regression/scaffold  |   1 +
  regression/t-062.out | 420 
 +++
  regression/t-062.sh  | 130 
  4 files changed, 569 insertions(+), 6 deletions(-)
  create mode 100644 regression/t-062.out
  create mode 100755 regression/t-062.sh
 
 diff --git a/guilt b/guilt
 index 9947acc..ac7d046 100755
 --- a/guilt
 +++ b/guilt
 @@ -853,6 +853,9 @@ guilt_push_diff_context=1
  # default diffstat value: true or false
  DIFFSTAT_DEFAULT=false
  
 +# default guilt.reusebranch value: true or false
 +REUSE_BRANCH_DEFAULT=false
 +
  # Prefix for guilt branches.
  GUILT_PREFIX=guilt/
  
 @@ -864,6 +867,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
  #
 @@ -928,13 +935,18 @@ 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.
 -old_style_prefix=true
 +if [ -n `get_top 2/dev/null` ]; then
 + # 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
 + old_style_prefix=$reuse_branch
  fi
  
  _main $@
 diff --git a/regression/scaffold b/regression/scaffold
 index e4d7487..e4d2f35 100644
 --- a/regression/scaffold
 +++ b/regression/scaffold
 @@ -93,6 +93,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 000..ad5c081
 --- /dev/null
 +++ b/regression/t-062.out
 @@ -0,0 +1,420 @@
 +% 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
 +% 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

Re: [GUILT v3 14/31] Use git check-ref-format to validate patch names.

2014-05-16 Thread Jeff Sipek
On Fri, May 16, 2014 at 04:46:01PM +0200, Per Cederqvist wrote:
 The valid_patchname now lets git check-ref-format do its job instead
 of trying (and failing) to implement the same rules.  See
 git-check-ref-format(1) for a list of the rules.
 
 Refer to the git-check-ref-format(1) man page in the error messages
 produced when valid_patchname indicates that the name is bad.
 
 Added testcases that breaks most of the rules in that man-page.
 
 Git version 1.8.5 no longer allows the single character @ as a
 branch name.  Guilt always rejects that name, for increased
 compatibility.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
 ---
  guilt|  21 ++-
  guilt-fork   |   2 +-
  guilt-import |   2 +-
  guilt-new|   2 +-
  regression/t-025.out | 426 
 +--
  regression/t-025.sh  |  12 +-
  regression/t-032.out |   4 +-
  7 files changed, 446 insertions(+), 23 deletions(-)
 
 diff --git a/guilt b/guilt
 index 3fc524e..23cc2da 100755
 --- a/guilt
 +++ b/guilt
 @@ -132,14 +132,19 @@ fi
  # usage: valid_patchname patchname
  valid_patchname()
  {
 - case $1 in
 - /*|./*|../*|*/./*|*/../*|*/.|*/..|*/|*\ *|*\*)
 - return 1;;
 - *:*)
 - return 1;;
 - *)
 - return 0;;
 - esac
 + if git check-ref-format --allow-onelevel $1; then

I know I already signed off on this, but I just tried to run the regression
suite with your changes on 1.7.3.2.  It blows up because --allow-onelevel is
not recognized.  Yes, 1.7 is a bit on the old side but I think it's
reasonable to still support it.  Thoughts?

 + # Starting with Git version 1.8.5, a branch cannot be
 + # the single character @.  Make sure guilt rejects
 + # that name even if we are currently using an older
 + # version of Git.  This ensures that the test suite
 + # runs fine using any version of Git.
 + if [ $1 = @ ]; then
 + return 1
 + fi
 + return 0
 + else
 + return 1
 + fi
  }
  
  get_branch()
 diff --git a/guilt-fork b/guilt-fork
 index a85d391..6447e55 100755
 --- a/guilt-fork
 +++ b/guilt-fork
 @@ -37,7 +37,7 @@ else
  fi
  
  if ! valid_patchname $newpatch; then
 - die The specified patch name contains invalid characters (:).
 + die The specified patch name is invalid according to 
 git-check-ref-format(1).
  fi
  
  if [ -e $GUILT_DIR/$branch/$newpatch ]; then
 diff --git a/guilt-import b/guilt-import
 index 3e9b3bb..928e325 100755
 --- a/guilt-import
 +++ b/guilt-import
 @@ -40,7 +40,7 @@ if [ -e $GUILT_DIR/$branch/$newname ]; then
  fi
  
  if ! valid_patchname $newname; then
 - die The specified patch name contains invalid characters (:).
 + die The specified patch name is invalid according to 
 git-check-ref-format(1).
  fi
  
  # create any directories as needed
 diff --git a/guilt-new b/guilt-new
 index 9528438..9f7fa44 100755
 --- a/guilt-new
 +++ b/guilt-new
 @@ -64,7 +64,7 @@ fi
  
  if ! valid_patchname $patch; then
   disp Patchname is invalid. 2
 - die it cannot begin with '/', './' or '../', or contain /./, /../, or 
 whitespace
 + die It must follow the rules in git-check-ref-format(1).
  fi
  
  # create any directories as needed
 diff --git a/regression/t-025.out b/regression/t-025.out
 index 7811ab1..01bc406 100644
 --- a/regression/t-025.out
 +++ b/regression/t-025.out
 @@ -141,7 +141,7 @@ f da39a3ee5e6b4b0d3255bfef95601890afd80709  
 .git/patches/master/prepend
  r acdeef96ee30eb34bbbf65d11de5cf7da4b5fee8  .git/refs/patches/master/prepend
  % guilt new white space
  Patchname is invalid.
 -it cannot begin with '/', './' or '../', or contain /./, /../, or whitespace
 +It must follow the rules in git-check-ref-format(1).
  % list_files
  d .git/patches
  d .git/patches/master
 @@ -211,7 +211,7 @@ f da39a3ee5e6b4b0d3255bfef95601890afd80709  
 .git/patches/master/prepend
  r acdeef96ee30eb34bbbf65d11de5cf7da4b5fee8  .git/refs/patches/master/prepend
  % guilt new /abc
  Patchname is invalid.
 -it cannot begin with '/', './' or '../', or contain /./, /../, or whitespace
 +It must follow the rules in git-check-ref-format(1).
  % list_files
  d .git/patches
  d .git/patches/master
 @@ -235,7 +235,7 @@ f da39a3ee5e6b4b0d3255bfef95601890afd80709  
 .git/patches/master/prepend
  r acdeef96ee30eb34bbbf65d11de5cf7da4b5fee8  .git/refs/patches/master/prepend
  % guilt new ./blah
  Patchname is invalid.
 -it cannot begin with '/', './' or '../', or contain /./, /../, or whitespace
 +It must follow the rules in git-check-ref-format(1).
  % list_files
  d .git/patches
  d .git/patches/master
 @@ -259,7 +259,7 @@ f da39a3ee5e6b4b0d3255bfef95601890afd80709  
 .git/patches/master/prepend
  r acdeef96ee30eb34bbbf65d11de5cf7da4b5fee8  .git/refs

Re: [GUILT v3 09/31] Test suite: properly check the exit status of commands.

2014-05-16 Thread Jeff Sipek
On Fri, May 16, 2014 at 04:45:56PM +0200, Per Cederqvist wrote:
 The cmd and shouldfail functions checked the exit status of the
 replace_path function instead of the actual command that was running.
 (The $? construct checks the exit status of the last command in a
 pipeline, not the first command.)
 
 Updated t-032.sh, which used shouldfail instead of cmd in one
 place.  (The comment in the script makes it clear that the command is
 expected to succeed.)
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  regression/scaffold | 17 +++--
  regression/t-032.sh |  2 +-
  2 files changed, 12 insertions(+), 7 deletions(-)
 
 diff --git a/regression/scaffold b/regression/scaffold
 index 5c8b73e..e4d7487 100644
 --- a/regression/scaffold
 +++ b/regression/scaffold
 @@ -51,18 +51,23 @@ function filter_dd
  function cmd
  {
   echo % $@
 - $@ 21 | replace_path  return 0
 - return 1
 + (
 + exec 31
 + rv=`(($@ 21; echo $? 4) | replace_path 3 ) 41`

Wow.  This took a while to decipher :)

Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net


 + exit $rv
 + )
 + return $?
  }
  
  # usage: shouldfail cmd..
  function shouldfail
  {
   echo % $@
 - (
 - $@ 21 || return 0
 - return 1
 - ) | replace_path
 + ! (
 + exec 31
 + rv=`(($@ 21; echo $? 4) | replace_path 3 ) 41`
 + exit $rv
 + )
   return $?
  }
  
 diff --git a/regression/t-032.sh b/regression/t-032.sh
 index b1d5f19..bba401e 100755
 --- a/regression/t-032.sh
 +++ b/regression/t-032.sh
 @@ -28,7 +28,7 @@ shouldfail guilt import -P foo3 foo
  cmd guilt import -P foo2 foo
  
  # ok
 -shouldfail guilt import foo
 +cmd guilt import foo
  
  # duplicate patch name (implicit)
  shouldfail guilt import foo
 -- 
 1.8.3.1
 

-- 
Fact: 28.1% of all statistics are generated randomly.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 28/29] Added guilt.reusebranch configuration option.

2014-05-15 Thread Jeff Sipek
On Thu, May 15, 2014 at 09:37:05AM +0200, Per Cederqvist wrote:
 On Wed, May 14, 2014 at 5:53 PM, Jeff Sipek jef...@josefsipek.net wrote:
  On Tue, May 13, 2014 at 10:31:04PM +0200, Per Cederqvist wrote:
...
  +
  +for i in `seq 5`; do
  + if [ $i -ge 5 ]; then
  + shouldfail guilt pop
  + else
  + cmd guilt pop
  + fi
  + 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.
 
  What exactly is the right thing?  no-op since the above loop poped
  everything?  (I'd make the comment say what the right thing is.)
 
 I'll rephrase that block of code like this:
 
 # Check that pop -a properly pops all patches.
 cmd guilt push -a
 cmd git for-each-ref
 cmd guilt pop -a
 cmd git for-each-ref
 
 Is that more clear? The test pushes all patches, checks that they
 are applied, removes them, checks that it worked.

Yeah.

Thanks,

Jeff.

-- 
NT is to UNIX what a doughnut is to a particle accelerator.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 12/29] guilt header: more robust header selection.

2014-05-15 Thread Jeff Sipek
On Tue, May 13, 2014 at 10:30:48PM +0200, Per Cederqvist wrote:
 If you run something like guilt header '.*' the command would crash,
 because the grep comand that tries to ensure that the patch exist
 would detect a match, but the later code expected the match to be
 exact.
 
 Fixed by comparing exact strings.
 
 And as a creeping feature guilt header will now try to use the
 supplied patch name as an unachored regexp if no exact match was
 found.  If the regexp yields a unique match, it is used; if more than
 one patch matches, the names of all patches are listed and the command
 fails.  (Exercise left to the reader: generalized this so that guilt
 push also accepts a unique regular expression.)
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt-header | 28 +---
  1 file changed, 25 insertions(+), 3 deletions(-)
 
 diff --git a/guilt-header b/guilt-header
 index 41e00cc..4701b31 100755
 --- a/guilt-header
 +++ b/guilt-header
 @@ -45,10 +45,32 @@ esac
  [ -z $patch ]  die No patches applied.
  
  # check that patch exists in the series
 -ret=`get_full_series | grep -e ^$patch\$ | wc -l`
 -if [ $ret -eq 0 ]; then
 - die Patch $patch is not in the series
 +full_series=`get_tmp_file series`
 +get_full_series  $full_series
 +found_patch=
 +while read x; do
 + if [ $x = $patch ]; then
 + found_patch=$patch
 + break
 + fi
 +done  $full_series

We have to use a temp file instead of a 'get_full_series | while read x; do ...'
because that'd create a subshell, correct?

 +if [ -z $found_patch ]; then
 + TMP_MATCHES=`get_tmp_file series`
 + grep $patch  $full_series  $TMP_MATCHES
 + nr=`wc -l  $TMP_MATCHES`
 + if [ $nr -gt 1 ]; then
 + echo $patch does not uniquely identify a patch. Did you mean 
 any of these? 2
 + sed 's/^/  /' $TMP_MATCHES 2
 + rm -f $TMP_MATCHES
 + exit 1
 + elif [ $nr -eq 0 ]; then
 + rm -f $TMP_MATCHES
 + die Patch $patch is not in the series
 + fi
 + found_patch=`cat $TMP_MATCHES`
 + rm -f $TMP_MATCHES
  fi
 +patch=$found_patch

Do we not delete $full_series?

  
  # FIXME: warn if we're editing an applied patch
  
 -- 
 1.8.3.1
 

-- 
OpenIndiana ibdm: 8 cores, 12 GB RAM
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 13/29] Check that guilt header '.*' fails.

2014-05-15 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Tue, May 13, 2014 at 10:30:49PM +0200, Per Cederqvist wrote:
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  regression/t-028.out | 7 +++
  regression/t-028.sh  | 4 
  2 files changed, 11 insertions(+)
 
 diff --git a/regression/t-028.out b/regression/t-028.out
 index 1564c09..ea72a3a 100644
 --- a/regression/t-028.out
 +++ b/regression/t-028.out
 @@ -49,3 +49,10 @@ Signed-off-by: Commiter Name commiter@email
  
  % guilt header non-existant
  Patch non-existant is not in the series
 +% guilt header .*
 +.* does not uniquely identify a patch. Did you mean any of these?
 +  modify
 +  add
 +  remove
 +  mode
 +  patch-with-some-desc
 diff --git a/regression/t-028.sh b/regression/t-028.sh
 index 88e9adb..2ce0378 100755
 --- a/regression/t-028.sh
 +++ b/regression/t-028.sh
 @@ -31,4 +31,8 @@ done
  
  shouldfail guilt header non-existant
  
 +# This is an evil variant of a non-existant patch.  However, this
 +# patch name is a regexp that just happens to match an existing patch.
 +shouldfail guilt header '.*'
 +
  # FIXME: how do we check that -e works?
 -- 
 1.8.3.1
 

-- 
Si hoc legere scis nimium eruditionis habes.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 14/29] Use git check-ref-format to validate patch names.

2014-05-15 Thread Jeff Sipek
On Tue, May 13, 2014 at 10:30:50PM +0200, Per Cederqvist wrote:
 The valid_patchname now lets git check-ref-format do its job instead
 of trying (and failing) to implement the same rules.  See
 git-check-ref-format(1) for a list of the rules.
 
 Refer to the git-check-ref-format(1) man page in the error messages
 produced when valid_patchname indicates that the name is bad.
 
 Added testcases that breaks most of the rules in that man-page.
 
 Git version 1.8.5 no longer allows the single character @ as a
 branch name.  Guilt always rejects that name, for increased
 compatibility.

Very nice.

Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net


 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt|  21 ++-
  guilt-fork   |   2 +-
  guilt-import |   2 +-
  guilt-new|   2 +-
  regression/t-025.out | 426 
 +--
  regression/t-025.sh  |  12 +-
  regression/t-032.out |   4 +-
  7 files changed, 446 insertions(+), 23 deletions(-)
 
 diff --git a/guilt b/guilt
 index 3fc524e..23cc2da 100755
 --- a/guilt
 +++ b/guilt
 @@ -132,14 +132,19 @@ fi
  # usage: valid_patchname patchname
  valid_patchname()
  {
 - case $1 in
 - /*|./*|../*|*/./*|*/../*|*/.|*/..|*/|*\ *|*\*)
 - return 1;;
 - *:*)
 - return 1;;
 - *)
 - return 0;;
 - esac
 + if git check-ref-format --allow-onelevel $1; then
 + # Starting with Git version 1.8.5, a branch cannot be
 + # the single character @.  Make sure guilt rejects
 + # that name even if we are currently using an older
 + # version of Git.  This ensures that the test suite
 + # runs fine using any version of Git.
 + if [ $1 = @ ]; then
 + return 1
 + fi
 + return 0
 + else
 + return 1
 + fi
  }
  
  get_branch()
 diff --git a/guilt-fork b/guilt-fork
 index a85d391..6447e55 100755
 --- a/guilt-fork
 +++ b/guilt-fork
 @@ -37,7 +37,7 @@ else
  fi
  
  if ! valid_patchname $newpatch; then
 - die The specified patch name contains invalid characters (:).
 + die The specified patch name is invalid according to 
 git-check-ref-format(1).
  fi
  
  if [ -e $GUILT_DIR/$branch/$newpatch ]; then
 diff --git a/guilt-import b/guilt-import
 index 3e9b3bb..928e325 100755
 --- a/guilt-import
 +++ b/guilt-import
 @@ -40,7 +40,7 @@ if [ -e $GUILT_DIR/$branch/$newname ]; then
  fi
  
  if ! valid_patchname $newname; then
 - die The specified patch name contains invalid characters (:).
 + die The specified patch name is invalid according to 
 git-check-ref-format(1).
  fi
  
  # create any directories as needed
 diff --git a/guilt-new b/guilt-new
 index 9528438..9f7fa44 100755
 --- a/guilt-new
 +++ b/guilt-new
 @@ -64,7 +64,7 @@ fi
  
  if ! valid_patchname $patch; then
   disp Patchname is invalid. 2
 - die it cannot begin with '/', './' or '../', or contain /./, /../, or 
 whitespace
 + die It must follow the rules in git-check-ref-format(1).
  fi
  
  # create any directories as needed
 diff --git a/regression/t-025.out b/regression/t-025.out
 index 7811ab1..01bc406 100644
 --- a/regression/t-025.out
 +++ b/regression/t-025.out
 @@ -141,7 +141,7 @@ f da39a3ee5e6b4b0d3255bfef95601890afd80709  
 .git/patches/master/prepend
  r acdeef96ee30eb34bbbf65d11de5cf7da4b5fee8  .git/refs/patches/master/prepend
  % guilt new white space
  Patchname is invalid.
 -it cannot begin with '/', './' or '../', or contain /./, /../, or whitespace
 +It must follow the rules in git-check-ref-format(1).
  % list_files
  d .git/patches
  d .git/patches/master
 @@ -211,7 +211,7 @@ f da39a3ee5e6b4b0d3255bfef95601890afd80709  
 .git/patches/master/prepend
  r acdeef96ee30eb34bbbf65d11de5cf7da4b5fee8  .git/refs/patches/master/prepend
  % guilt new /abc
  Patchname is invalid.
 -it cannot begin with '/', './' or '../', or contain /./, /../, or whitespace
 +It must follow the rules in git-check-ref-format(1).
  % list_files
  d .git/patches
  d .git/patches/master
 @@ -235,7 +235,7 @@ f da39a3ee5e6b4b0d3255bfef95601890afd80709  
 .git/patches/master/prepend
  r acdeef96ee30eb34bbbf65d11de5cf7da4b5fee8  .git/refs/patches/master/prepend
  % guilt new ./blah
  Patchname is invalid.
 -it cannot begin with '/', './' or '../', or contain /./, /../, or whitespace
 +It must follow the rules in git-check-ref-format(1).
  % list_files
  d .git/patches
  d .git/patches/master
 @@ -259,7 +259,7 @@ f da39a3ee5e6b4b0d3255bfef95601890afd80709  
 .git/patches/master/prepend
  r acdeef96ee30eb34bbbf65d11de5cf7da4b5fee8  .git/refs/patches/master/prepend
  % guilt new ../blah
  Patchname is invalid.
 -it cannot begin with '/', './' or '../', or contain /./, /../, or whitespace
 +It must follow the rules in git-check-ref-format(1).
  % list_files
  d .git/patches
  d .git/patches/master

Re: [GUILT v2 15/29] Produce legal patch names in guilt-import-commit.

2014-05-15 Thread Jeff Sipek
On Tue, May 13, 2014 at 10:30:51PM +0200, Per Cederqvist wrote:
 Try harder to create patch names that adhere to the rules in
 git-check-ref-format(1) when deriving a patch name from the commit
 message.  Verify that the derived name using git check-ref-format,
 and as a final fallback simply use the patch name x (to ensure that
 the code is future-proof in case new rules are added in the future).
 
 Always append a .patch suffix to the patch name.
 
 Added test cases.

Also very nice.

Thanks,

Jeff.

Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

-- 
We have joy, we have fun, we have Linux on a Sun...
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 16/29] Fix backslash handling when creating names of imported patches.

2014-05-14 Thread Jeff Sipek
On Wed, May 14, 2014 at 10:56:18AM +0200, Per Cederqvist wrote:
 On Wed, May 14, 2014 at 12:09 AM, Jeff Sipek jef...@josefsipek.net wrote:
  On Tue, May 13, 2014 at 10:30:52PM +0200, Per Cederqvist wrote:
  The 'echo %s' construct sometimes processes escape sequences.  (This
 
  %s?  Should this be $s?
 
 Yes. Will fix that typo in v3 of the patch series.

ok, Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

 /ceder
 
  Otherwise, looks good.
 
  happens, for instance, under Ubuntu 14.04 when /bin/sh is actually
  dash.)  We don't want that to happen when we are importing commits, so
  use 'printf %s $s' instead.
 
  (The -E option of bash that explicitly disables backslash expansion is
  not portable; it is not supported by dash.)
 
  Signed-off-by: Per Cederqvist ced...@opera.com
  ---
   guilt-import-commit  |  2 +-
   regression/t-034.out | 14 +++---
   2 files changed, 8 insertions(+), 8 deletions(-)
 
  diff --git a/guilt-import-commit b/guilt-import-commit
  index 6260c56..45f2404 100755
  --- a/guilt-import-commit
  +++ b/guilt-import-commit
  @@ -30,7 +30,7 @@ for rev in `git rev-list $rhash`; do
 
# Try to convert the first line of the commit message to a
# valid patch name.
  - fname=`echo $s | sed -e s//and/g -e s/[ :]/_/g -e s,[/\\],-,g 
  \
  + fname=`printf %s $s | sed -e s//and/g -e s/[ :]/_/g -e 
  s,[/\\],-,g \
-e s/['\\[{}]//g -e 's/]//g' -e 's/\*/-/g' \
-e 's/\?/-/g' -e 's/\.\.\.*/./g' -e 's/^\.//' \
-e 's/\.patch$//' -e 's/\.$//' | tr A-Z a-z`
  diff --git a/regression/t-034.out b/regression/t-034.out
  index 7bc9459..bda4399 100644
  --- a/regression/t-034.out
  +++ b/regression/t-034.out
  @@ -236,7 +236,7 @@ Date:   Mon Jan 1 00:00:00 2007 +
   About to begin conversion...
   Current head: 2a8b1889aa5066193bac978e6bf5073ffcfa6541
   Converting 2a8b1889 as can-have-embedded-single-slashes
  -Converting 0a46f8fa as backslash-isorbidden
  +Converting 0a46f8fa as backslash-is-forbidden
   Converting aedb74fd as x
   Converting 30187ed0 as cannot@have@the@sequence@at-brace
   Converting 106e8e5a as cannot_end_in_
  @@ -300,7 +300,7 @@ Applying patch..cannot@have@the@sequence@at-brace.patch
   Patch applied.
   Applying patch..x.patch
   Patch applied.
  -Applying patch..backslash-isorbidden.patch
  +Applying patch..backslash-is-forbidden.patch
   Patch applied.
   Applying patch..can-have-embedded-single-slashes.patch
   Patch applied.
  @@ -311,7 +311,7 @@ Date:   Mon Jan 1 00:00:00 2007 +
 
   Can/have/embedded/single/slashes
 
  -commit 7c3ffa4f940c862e9f11f5d4a5ae421f7a8d3141 
  (refs/patches/master/backslash-isorbidden.patch)
  +commit 7c3ffa4f940c862e9f11f5d4a5ae421f7a8d3141 
  (refs/patches/master/backslash-is-forbidden.patch)
   Author: Author Name author@email
   Date:   Mon Jan 1 00:00:00 2007 +
 
  @@ -518,8 +518,6 @@ d .git/patches/master
   d .git/refs/patches
   d .git/refs/patches/master
   f 06beca7069b9e576bd431f65d13862ed5d3e2a0f  
  .git/patches/master/ctrlisforbidden.patch
  -f 08267ec6783ea9d1adae55b275198f7594764ed0  .git/patches/master/series
  -f 08267ec6783ea9d1adae55b275198f7594764ed0  .git/patches/master/status
   f 09b7e9be44ae5ec3a4bb30f5ee9d4ebc2c042f64  
  .git/patches/master/two_consecutive_dots_(.)_is_forbidden.patch
   f 0b971c9a17aeca2319c93d700ffd98acc2a93451  
  .git/patches/master/question-mark-is-forbidden.patch
   f 2b8392f63d61efc12add554555adae30883993cc  
  .git/patches/master/cannot-end-in-slash-.patch
  @@ -529,7 +527,7 @@ f 34e07c584032df137f19bdb66d93f316f00a5ac8  
  .git/patches/master/tildeisforbidden
   f 49bab499826b63deb2bd704629d60c7268c57aee  
  .git/patches/master/the_sequence_-._is_forbidden.patch
   f 5bcddb8ccb6e6e5e8a61e9e56cb2e0f70cbab2f5  
  .git/patches/master/cannot@have@the@sequence@at-brace.patch
   f 637b982fe14a240de181ae63226b27e0c406b3dc  
  .git/patches/master/asterisk-is-forbidden.patch
  -f 698f8a7d41a64e3b6be1a3eba86574078b22a5f3  
  .git/patches/master/backslash-isorbidden.patch
  +f 698f8a7d41a64e3b6be1a3eba86574078b22a5f3  
  .git/patches/master/backslash-is-forbidden.patch
   f 7b103c3c7ae298cd2334f6f49da48bae1424f77b  
  .git/patches/master/crisalsoforbidden.patch
   f 9b810b8c63779c51d2e7f61ab59cd49835041563  .git/patches/master/x.patch
   f a22958d9ae9976fd7b2b5a9d0bcd44bf7ad9b08a  
  .git/patches/master/caretisforbidden.patch
  @@ -537,6 +535,8 @@ f ab325bf5a432937fc6f231d3e8a773a62d53952b  
  .git/patches/master/multiple-slashes
   f cb9cffbd4465bddee266c20ccebd14eb687eaa89  
  .git/patches/master/delisforbidden.patch
   f d0885a1a1fdee0fd1e4fedce3f7acd3100540bc4  
  .git/patches/master/openbracketisforbidden.patch
   f d2903523fb66a346596eabbdd1bda4e52b266440  
  .git/patches/master/check-multiple-.-dots-.-foo.patch
  +f da90de1c84138194524994e0bc3bc4ca8189c999  .git/patches/master/series
  +f da90de1c84138194524994e0bc3bc4ca8189c999  .git/patches/master/status
   f

Re: [GUILT v2 25/29] guilt push now fails when there are no more patches to push.

2014-05-14 Thread Jeff Sipek
On Wed, May 14, 2014 at 11:27:19AM +0200, Per Cederqvist wrote:
 On Tue, May 13, 2014 at 11:41 PM, Jeff Sipek jef...@josefsipek.net wrote:
  On Tue, May 13, 2014 at 10:31:01PM +0200, Per Cederqvist wrote:
  This makes it easier to script operations on the entire queue, for
  example run the test suite on each patch in the queue:
 
  guilt pop -a;while guilt push; do make test||break; done
 
  This brings guilt push in line with the push operation in Mercurial
  Queues (hg qpush), which fails when there are no patches to apply.
 
  Updated the test suite.
 
  guilt push -a still does not fail.  (It successfully manages to
  ensure that all patches are pushed, even if it did not have to do
  anything to make it so.)
 
  Signed-off-by: Per Cederqvist ced...@opera.com
  ---
   guilt-push   | 19 ++-
   regression/t-020.out | 89 
  
   regression/t-020.sh  | 13 +++-
   3 files changed, 113 insertions(+), 8 deletions(-)
  ...
  diff --git a/regression/t-020.sh b/regression/t-020.sh
  index 906aec6..0f9f85d 100755
  --- a/regression/t-020.sh
  +++ b/regression/t-020.sh
  @@ -26,6 +26,17 @@ guilt series | while read n ; do
   done
 
   #
  +# pushing when there is nothing to push
  +#
  +
  +shouldfail guilt push
  +cmd guilt push -a
  +
  +cmd list_files
  +
  +cmd git log -p
 
  I don't particularly care for the git-log.  Otherwise it looks good.
 
  Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
 
 In my defense, I was just continuing the pattern already
 established in that file. Anyhow, I'll add a new commit to
 the patch series that removes all git log -p from all tests.
 (They are present in both t-020.sh and t-021.sh.)

Sounds good.  Thanks,

Jeff.

 /ceder
 
  +
  +#
   # pop all
   #
   cmd guilt pop --all
  @@ -61,7 +72,7 @@ cmd guilt pop --all
 
   npatches=`guilt series | wc -l`
   for n in `_seq -2 $npatches`; do
  - if [ $n -ge 0 ]; then
  + if [ $n -gt 0 ]; then
cmd guilt push -n $n
else
shouldfail guilt push -n $n
  --
  1.8.3.1
 
 
  --
  Evolution, n.:
A hypothetical process whereby infinitely improbable events occur with
alarming frequency, order arises from chaos, and no one is given credit.

-- 
UNIX is user-friendly ... it's just selective about who its friends are
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 28/29] Added guilt.reusebranch configuration option.

2014-05-14 Thread Jeff Sipek
On Tue, May 13, 2014 at 10:31:04PM +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.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt|  28 +++-
  regression/scaffold  |   1 +
  regression/t-062.out | 441 
 +++
  regression/t-062.sh  | 137 
  4 files changed, 601 insertions(+), 6 deletions(-)
  create mode 100644 regression/t-062.out
  create mode 100755 regression/t-062.sh
...
 diff --git a/guilt b/guilt
 index 9947acc..7c830eb 100755
 --- a/guilt
 +++ b/guilt
...
 @@ -928,13 +935,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.
 -old_style_prefix=true
 +if [ -n `get_top 2/dev/null` ]; then
 + # 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

I don't know if this is a good idea or not, but:

old_style_prefix=$reuse_branch

  fi
  
  _main $@
 diff --git a/regression/scaffold b/regression/scaffold
 index e4d7487..e4d2f35 100644
 --- a/regression/scaffold
 +++ b/regression/scaffold
 @@ -93,6 +93,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.sh b/regression/t-062.sh
 new file mode 100755
 index 000..85596ca
 --- /dev/null
 +++ b/regression/t-062.sh
 @@ -0,0 +1,137 @@
...
 +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
 +
 +cmd git for-each-ref
 +
 +cmd list_files

duplicate list_files  for-each-ref

 +
 +for i in `seq 5`; do
 + if [ $i -ge 5 ]; then
 + shouldfail guilt pop
 + else
 + cmd guilt pop
 + fi
 + 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.

What exactly is the right thing?  no-op since the above loop poped
everything?  (I'd make the comment say what the right thing is.)

Jeff.

-- 
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like
that.
- Linus Torvalds
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 08/29] Added more test cases for guilt new: empty patches.

2014-05-14 Thread Jeff Sipek
On Tue, May 13, 2014 at 10:30:44PM +0200, Per Cederqvist wrote:
 Test that empty patches are handled correctly, both with and without
 the guilt.diffstat configuration option.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  regression/t-020.out | 250 
 +++
  regression/t-020.sh  |  60 +
  2 files changed, 310 insertions(+)
 
 diff --git a/regression/t-020.out b/regression/t-020.out
 index af45734..7e07efa 100644
 --- a/regression/t-020.out
 +++ b/regression/t-020.out
 @@ -1128,3 +1128,253 @@ f 9c18cc7abe6b87f18503714a80a677b4094eb457  
 .git/patches/master/add
...
 +% git log -p
 +commit c7a139f532a43c3c8b0e068cac04f8f6af0f94e1
 +Author: Author Name author@email
 +Date:   Mon Jan 1 00:00:00 2007 +
 +
 +patch empty.patch
 +
 +commit d4850419ccc1146c7169f500725ce504b9774ed0
 +Author: Author Name author@email
 +Date:   Mon Jan 1 00:00:00 2007 +
 +
 +initial
 +
 +Signed-off-by: Commiter Name commiter@email
 +
 +diff --git a/def b/def
 +new file mode 100644
 +index 000..8baef1b
 +--- /dev/null
  b/def
 +@@ -0,0 +1 @@
 ++abc
 +% git config guilt.diffstat false
 +---
 +

I'm a bit confused about the above.  It looks like contents of an empty
patch with an empty diffstat.  But the only time I see a cat in the .sh file
is when you rewrite... oh I got it.  I'll comment about it by the 'cat'.

...
 diff --git a/regression/t-020.sh b/regression/t-020.sh
 index cdd08ba..906aec6 100755
 --- a/regression/t-020.sh
 +++ b/regression/t-020.sh
 @@ -5,6 +5,13 @@
  
  source $REG_DIR/scaffold
  
 +function fixup_time_info
 +{
 + cmd guilt pop
 + touch -a -m -t $TOUCH_DATE .git/patches/master/$1
 + cmd guilt push
 +}
 +
  cmd setup_repo
  
  #
 @@ -69,6 +76,59 @@ done
  
  cmd list_files
  
 +# push an empty patch with no commit message
 +cmd guilt new empty.patch
 +fixup_time_info empty.patch
 +cmd list_files
 +cmd git log -p
 +
 +# Ensure we can push the empty patch even when guilt.diffstat is true.
 +cmd git config guilt.diffstat true
 +cmd guilt refresh
 +fixup_time_info empty.patch
 +cmd list_files
 +cmd git log -p
 +cmd git config guilt.diffstat false
 +
 +# Let the patch have a commit message, but no data.
 +cat .git/patches/master/empty.patch EOF

cat  .git/.../empty.patch EOF
...
EOF

Otherwise, you'll just cat the existing patch and that's it.

 +Fix a bug.
 +
 +From: Per Cederqvist ce...@lysator.liu.se
 +
 +This commit fixes a serious bug.
 +
 +FIXME:
 +- add a test case
 +- track down the bug
 +- actually fix it
 +EOF
 +
 +fixup_time_info empty.patch
 +cmd list_files
 +cmd git log -p
 +
 +# And once more, with an empty diffstat.
 +
 +cmd git config guilt.diffstat true
 +cmd guilt refresh
 +fixup_time_info empty.patch
 +cmd list_files
 +cmd git log -p
 +
 +# Restore the diffstat setting and remove the empty patch.
 +cmd git config guilt.diffstat false
 +cmd guilt refresh
 +fixup_time_info empty.patch
 +cmd list_files
 +cmd git log -p
 +# (Cannot delete an applied patch)
 +shouldfail guilt delete empty.patch
 +cmd guilt pop -a
 +cmd guilt delete -f empty.patch
 +cmd list_files
 +cmd git log -p
 +
  # FIXME:
  #   --all
  #   -a
 -- 
 1.8.3.1
 

-- 
Fact: 23.6% of all statistics are generated randomly.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 00/29] Teach guilt import-commit how to create legal patch names, and more

2014-05-13 Thread Jeff Sipek
On Tue, May 13, 2014 at 04:45:47PM -0400, Theodore Ts'o wrote:
 On Tue, May 13, 2014 at 10:30:36PM +0200, Per Cederqvist wrote:
...
   - Changed behavior: by default, guilt no longer changes branch when
 you push a patch.  You need to do git config guilt.reusebranch
 false to re-enable that.  This patch sets the default value of
 guilt.reusebranch to true; it should in my opinion change to false
 a year or two after the next release.
 
 We've been living with the origin - guilt/origin branch change
 for a year already, and in fact, these days I've gotten used to the
 new behavior.  Is it really worth it to change the default?

So, at first I was skeptical about the branch name prefix change.  I've used
it for about a year now, and I love it.  When I first read Per's idea to
change the default to the old-style, I was a bit sad but I understand the
motivation.

I'm open to either mode being the default since it's easy enough for me to
change it for me (thanks, ~/.gitconfig) but I think more people should
benefit from the added safety against accidental git-push.  (I also like
being able to use guilt/master..master to get only the commits I care
about.)  Thoughts?

Jeff.

-- 
Intellectuals solve problems; geniuses prevent them
- Albert Einstein
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 29/29] Added a short style guide, and Emacs settings.

2014-05-13 Thread Jeff Sipek
On Tue, May 13, 2014 at 10:31:05PM +0200, Per Cederqvist wrote:
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  .dir-locals.el |  3 +++
  Documentation/Contributing | 15 +++
  2 files changed, 18 insertions(+)
  create mode 100644 .dir-locals.el
 
 diff --git a/.dir-locals.el b/.dir-locals.el
 new file mode 100644
 index 000..50ef2b7
 --- /dev/null
 +++ b/.dir-locals.el
 @@ -0,0 +1,3 @@
 +((nil . ((indent-tabs-mode . t)
 +  (tab-width . 8)))
 + (sh-mode . ((sh-basic-offset . 8

I'll have to trust you on this one.  All I see is a bunch of cons cells :)

 diff --git a/Documentation/Contributing b/Documentation/Contributing
 index abf3480..0da49d6 100644
 --- a/Documentation/Contributing
 +++ b/Documentation/Contributing
 @@ -4,6 +4,21 @@ Documentation/SubmittingPatches file. :)
  
  1) Hack on the code a bit
  
 +Please follow this style guide:
 +
 + - Use tabs for indentation.
 +
 + - Put then on the same line as if.
 +
 + - Follow the style of the existing code, except if it breaks the
 +   above guidlines.
 +
 + - If you change the code to conform to the style guide, please do so
 +   in a separate commit that does not change anything else.
 +
 +Please check that you change does not break make test.  Please add
 +new testcases for any new functionality, and if you fix a bug.
 +

Adding this blurb here is a good idea.  Thanks!

Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

  2) Make a patch:
  
  Use diff -up or diff -uprN to create patches. Or simply use git to
 -- 
 1.8.3.1
 

-- 
Evolution, n.:
  A hypothetical process whereby infinitely improbable events occur with
  alarming frequency, order arises from chaos, and no one is given credit.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 04/29] Allow guilt import-commit to run from a dir which contains spaces.

2014-05-13 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Tue, May 13, 2014 at 10:30:40PM +0200, Per Cederqvist wrote:
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt-import-commit | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/guilt-import-commit b/guilt-import-commit
 index 20dcee2..f14647c 100755
 --- a/guilt-import-commit
 +++ b/guilt-import-commit
 @@ -23,7 +23,7 @@ if ! must_commit_first; then
  fi
  
  disp About to begin conversion... 2
 -disp Current head: `cat $GIT_DIR/refs/heads/\`git_branch\`` 2
 +disp Current head: `git rev-parse \`git_branch\`` 2
  
  for rev in `git rev-list $rhash`; do
   s=`git log --pretty=oneline -1 $rev | cut -c 42-`
 @@ -46,7 +46,7 @@ for rev in `git rev-list $rhash`; do
   do_make_header $rev
   echo 
   git diff --binary $rev^..$rev
 - )  $GUILT_DIR/$branch/$fname
 + )  $GUILT_DIR/$branch/$fname
  
   # FIXME: grab the GIT_AUTHOR_DATE from the commit object and set the
   # timestamp on the patch
 @@ -68,6 +68,6 @@ for rev in `git rev-list $rhash`; do
  done
  
  disp Done. 2
 -disp Current head: `cat $GIT_DIR/refs/heads/\`git_branch\`` 2
 +disp Current head: `git rev-parse \`git_branch\`` 2
  
  }
 -- 
 1.8.3.1
 

-- 
Once you have their hardware. Never give it back.
(The First Rule of Hardware Acquisition)
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 06/29] Fix the do_get_patch function.

2014-05-13 Thread Jeff Sipek
On Tue, May 13, 2014 at 10:30:42PM +0200, Per Cederqvist wrote:
 A patch file consists of:
 
 (1) the description
 (2) optional diffstat
 (3) the patches
 
 When extracting the patch, we only want part 3.  The do_get_patch used
 to give us part 2 and part 3.  That made for instance this series of
 operations fail if guilt.diffstat is true:
 
 guilt push empty-1
 guilt push empty-2
 guilt pop
 guilt fold empty-2
 guilt pop
 guilt push

I would probably include the actual error here.  I got the following (using
patch names a  b):

$ guilt pop
Now at a.
$ guilt fold b
error: No changes
$ guilt pop
All patches popped.
$ guilt pu
Applying patch..a
error: No changes
To force apply this patch, use 'guilt push -f'


The diff itself is good.

Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/guilt b/guilt
 index 8701481..3fc524e 100755
 --- a/guilt
 +++ b/guilt
 @@ -334,7 +334,7 @@ do_get_patch()
  {
   awk '
  BEGIN{}
 -/^(diff |---$|--- )/ {patch = 1}
 +/^(diff |--- )/ {patch = 1}
  patch == 1 {print $0}
  END{}
  '  $1
 -- 
 1.8.3.1
 

-- 
I already backed up the [server] once, I can do it again.
- a sysadmin threatening to do more frequent backups
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 07/29] Added test cases for guilt fold.

2014-05-13 Thread Jeff Sipek
On Tue, May 13, 2014 at 10:30:43PM +0200, Per Cederqvist wrote:
 Test that we can combine any combination of patches with empty and
 non-empty messages, both with and without guilt.diffstat.  (All
 patches are empty.)
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  regression/t-035.out | 467 
 +++
  regression/t-035.sh  |  62 +++
  2 files changed, 529 insertions(+)
  create mode 100644 regression/t-035.out
  create mode 100755 regression/t-035.sh

...
 diff --git a/regression/t-035.sh b/regression/t-035.sh
 new file mode 100755
 index 000..e914b32
 --- /dev/null
 +++ b/regression/t-035.sh
 @@ -0,0 +1,62 @@
 +#!/bin/bash
 +#
 +# Test the fold code
 +#
 +
 +source $REG_DIR/scaffold
 +
 +cmd setup_repo
 +
 +function fixup_time_info
 +{
 + cmd guilt pop
 + touch -a -m -t $TOUCH_DATE .git/patches/master/$1
 + cmd guilt push
 +}
 +
 +function empty_patch
 +{
 + cmd guilt new empty$1
 + fixup_time_info empty$1
 +}
 +
 +function nonempty_patch
 +{
 + if [ $1 = -2 ]; then
 + msg=Another commit message.
 + else
 + msg=A commit message.
 + fi
 +
 + cmd guilt new -f -s -m $msg nonempty$1
 + fixup_time_info nonempty$1
 +}
 +
 +for using_diffstat in true false; do
 + cmd git config guilt.diffstat $using_diffstat
 + for patcha in empty nonempty; do
 + for patchb in empty nonempty; do
 +
 + if [ $patcha = $patchb ]
 + then

I know that this is before patch 29, but ... style? ;)

Otherwise, looks good.  I like this way better than the unrolled loop in v1
of this patch.

Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net


 + suffixa=-1
 + suffixb=-2
 + else
 + suffixa=
 + suffixb=
 + fi
 +
 + echo %% $patcha + $patchb (diffstat=$using_diffstat)
 + ${patcha}_patch $suffixa
 + ${patchb}_patch $suffixb
 + cmd guilt pop
 + cmd guilt fold $patchb$suffixb
 + fixup_time_info $patcha$suffixa
 + cmd list_files
 + cmd guilt pop
 + cmd guilt delete -f $patcha$suffixa
 + cmd list_files
 +
 + done
 + done
 +done
 -- 
 1.8.3.1
 

-- 
*NOTE: This message is ROT-13 encrypted twice for extra protection*
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 19/28] Check that guilt graph works when working on a branch with a comma.

2014-05-13 Thread Jeff Sipek
On Fri, Mar 21, 2014 at 08:31:57AM +0100, Per Cederqvist wrote:
 git branch names can contain commas.  Check that guilt graph works
 even in that case.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  regression/t-033.out | 62 
 
  regression/t-033.sh  | 37 +++
  2 files changed, 99 insertions(+)
 
 diff --git a/regression/t-033.out b/regression/t-033.out
 index 76613f9..e638d7b 100644
 --- a/regression/t-033.out
 +++ b/regression/t-033.out
 @@ -1,3 +1,65 @@
  % setup_repo
  % guilt graph
  No patch applied.
 +% git checkout -b a,graph master
 +Switched to a new branch 'a,graph'
 +% guilt init
 +% guilt new a.patch
 +% guilt pop
 +All patches popped.
 +% guilt push
 +Applying patch..a.patch
 +Patch applied.
 +% guilt graph
 +digraph G {
 +# checking rev 95275d7c05c6a6176d3941374115b91272877f6c
 + 95275d7c05c6a6176d3941374115b91272877f6c [label=a.patch]
 +}
 +% git add file.txt
 +% guilt refresh
 +Patch a.patch refreshed
 +% guilt pop
 +All patches popped.
 +% guilt push
 +Applying patch..a.patch
 +Patch applied.
 +% guilt graph
 +digraph G {
 +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d
 + ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch]
 +}
 +% guilt new b.patch
 +% git add file2.txt
 +% guilt refresh
 +Patch b.patch refreshed
 +% guilt pop
 +Now at a.patch.
 +% guilt push
 +Applying patch..b.patch
 +Patch applied.
 +% guilt graph
 +digraph G {
 +# checking rev c7014443c33d2b0237293687ceb9cbd38313df65
 + c7014443c33d2b0237293687ceb9cbd38313df65 [label=b.patch]
 +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d
 + ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch]
 +}
 +% guilt new c.patch
 +% git add file.txt
 +% guilt refresh
 +Patch c.patch refreshed
 +% guilt pop
 +Now at b.patch.
 +% guilt push
 +Applying patch..c.patch
 +Patch applied.
 +% guilt graph
 +digraph G {
 +# checking rev 891bc14b5603474c9743fd04f3da888644413dc5
 + 891bc14b5603474c9743fd04f3da888644413dc5 [label=c.patch]
 +# checking rev c7014443c33d2b0237293687ceb9cbd38313df65
 + c7014443c33d2b0237293687ceb9cbd38313df65 [label=b.patch]
 +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d
 + ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch]
 + 891bc14b5603474c9743fd04f3da888644413dc5 - 
 ff2775f8d1dc753f635830adcc3a067e0b681e2d; // ?
 +}
 diff --git a/regression/t-033.sh b/regression/t-033.sh
 index ae40577..57dce78 100755
 --- a/regression/t-033.sh
 +++ b/regression/t-033.sh
 @@ -3,9 +3,46 @@
  # Test the graph code
  #
  
 +function fixup_time_info
 +{
 + cmd guilt pop
 + touch -a -m -t $TOUCH_DATE .git/patches/a,graph/$1
 + cmd guilt push
 +}
 +
  source $REG_DIR/scaffold
  
  cmd setup_repo
  

A comment here to justify this seemingly useless guilt-graph call?  Maybe
adding one of the '%%' lines between each section.  Otherwise, this looks
good.

  shouldfail guilt graph
  
 +cmd git checkout -b a,graph master
 +
 +cmd guilt init
 +
 +cmd guilt new a.patch
 +
 +fixup_time_info a.patch
 +cmd guilt graph
 +
 +cmd echo a  file.txt
 +cmd git add file.txt
 +cmd guilt refresh
 +fixup_time_info a.patch
 +cmd guilt graph
 +
 +# An unrelated file. No deps.
 +cmd guilt new b.patch
 +cmd echo b  file2.txt
 +cmd git add file2.txt
 +cmd guilt refresh
 +fixup_time_info b.patch
 +cmd guilt graph
 +
 +# An change to an old file. Should add a dependency.
 +cmd guilt new c.patch
 +cmd echo c  file.txt
 +cmd git add file.txt
 +cmd guilt refresh
 +fixup_time_info c.patch
 +cmd guilt graph
 -- 
 1.8.3.1
 

-- 
Ready; T=0.01/0.01 17:32:39
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 19/28] Check that guilt graph works when working on a branch with a comma.

2014-05-13 Thread Jeff Sipek
Sorry, I accidentally replied to the v1 of this patch...

On Tue, May 13, 2014 at 05:33:21PM -0400, Jeff Sipek wrote:
 On Fri, Mar 21, 2014 at 08:31:57AM +0100, Per Cederqvist wrote:
  git branch names can contain commas.  Check that guilt graph works
  even in that case.
  
  Signed-off-by: Per Cederqvist ced...@opera.com
  ---
   regression/t-033.out | 62 
  
   regression/t-033.sh  | 37 +++
   2 files changed, 99 insertions(+)
  
  diff --git a/regression/t-033.out b/regression/t-033.out
  index 76613f9..e638d7b 100644
  --- a/regression/t-033.out
  +++ b/regression/t-033.out
  @@ -1,3 +1,65 @@
   % setup_repo
   % guilt graph
   No patch applied.
  +% git checkout -b a,graph master
  +Switched to a new branch 'a,graph'
  +% guilt init
  +% guilt new a.patch
  +% guilt pop
  +All patches popped.
  +% guilt push
  +Applying patch..a.patch
  +Patch applied.
  +% guilt graph
  +digraph G {
  +# checking rev 95275d7c05c6a6176d3941374115b91272877f6c
  +   95275d7c05c6a6176d3941374115b91272877f6c [label=a.patch]
  +}
  +% git add file.txt
  +% guilt refresh
  +Patch a.patch refreshed
  +% guilt pop
  +All patches popped.
  +% guilt push
  +Applying patch..a.patch
  +Patch applied.
  +% guilt graph
  +digraph G {
  +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d
  +   ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch]
  +}
  +% guilt new b.patch
  +% git add file2.txt
  +% guilt refresh
  +Patch b.patch refreshed
  +% guilt pop
  +Now at a.patch.
  +% guilt push
  +Applying patch..b.patch
  +Patch applied.
  +% guilt graph
  +digraph G {
  +# checking rev c7014443c33d2b0237293687ceb9cbd38313df65
  +   c7014443c33d2b0237293687ceb9cbd38313df65 [label=b.patch]
  +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d
  +   ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch]
  +}
  +% guilt new c.patch
  +% git add file.txt
  +% guilt refresh
  +Patch c.patch refreshed
  +% guilt pop
  +Now at b.patch.
  +% guilt push
  +Applying patch..c.patch
  +Patch applied.
  +% guilt graph
  +digraph G {
  +# checking rev 891bc14b5603474c9743fd04f3da888644413dc5
  +   891bc14b5603474c9743fd04f3da888644413dc5 [label=c.patch]
  +# checking rev c7014443c33d2b0237293687ceb9cbd38313df65
  +   c7014443c33d2b0237293687ceb9cbd38313df65 [label=b.patch]
  +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d
  +   ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch]
  +   891bc14b5603474c9743fd04f3da888644413dc5 - 
  ff2775f8d1dc753f635830adcc3a067e0b681e2d; // ?
  +}
  diff --git a/regression/t-033.sh b/regression/t-033.sh
  index ae40577..57dce78 100755
  --- a/regression/t-033.sh
  +++ b/regression/t-033.sh
  @@ -3,9 +3,46 @@
   # Test the graph code
   #
   
  +function fixup_time_info
  +{
  +   cmd guilt pop
  +   touch -a -m -t $TOUCH_DATE .git/patches/a,graph/$1
  +   cmd guilt push
  +}
  +
   source $REG_DIR/scaffold
   
   cmd setup_repo
   
 
 A comment here to justify this seemingly useless guilt-graph call?  Maybe
 adding one of the '%%' lines between each section.  Otherwise, this looks
 good.
 
   shouldfail guilt graph
   
  +cmd git checkout -b a,graph master
  +
  +cmd guilt init
  +
  +cmd guilt new a.patch
  +
  +fixup_time_info a.patch
  +cmd guilt graph
  +
  +cmd echo a  file.txt
  +cmd git add file.txt
  +cmd guilt refresh
  +fixup_time_info a.patch
  +cmd guilt graph
  +
  +# An unrelated file. No deps.
  +cmd guilt new b.patch
  +cmd echo b  file2.txt
  +cmd git add file2.txt
  +cmd guilt refresh
  +fixup_time_info b.patch
  +cmd guilt graph
  +
  +# An change to an old file. Should add a dependency.
  +cmd guilt new c.patch
  +cmd echo c  file.txt
  +cmd git add file.txt
  +cmd guilt refresh
  +fixup_time_info c.patch
  +cmd guilt graph
  -- 
  1.8.3.1
  
 
 -- 
 Ready; T=0.01/0.01 17:32:39

-- 
C is quirky, flawed, and an enormous success.
- Dennis M. Ritchie.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 19/29] Check that guilt graph works when working on a branch with a comma.

2014-05-13 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net


On Tue, May 13, 2014 at 10:30:55PM +0200, Per Cederqvist wrote:
 git branch names can contain commas.  Check that guilt graph works
 even in that case.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  regression/t-033.out | 65 
 
  regression/t-033.sh  | 39 +++
  2 files changed, 104 insertions(+)
 
 diff --git a/regression/t-033.out b/regression/t-033.out
 index 76613f9..3d1c61f 100644
 --- a/regression/t-033.out
 +++ b/regression/t-033.out
 @@ -1,3 +1,68 @@
  % setup_repo
  % guilt graph
  No patch applied.
 +%% Testing branch a,graph
 +% git checkout -b a,graph master
 +Switched to a new branch 'a,graph'
 +% guilt init
 +% guilt new a.patch
 +% guilt pop
 +All patches popped.
 +% guilt push
 +Applying patch..a.patch
 +Patch applied.
 +% guilt graph
 +digraph G {
 +# checking rev 95275d7c05c6a6176d3941374115b91272877f6c
 + 95275d7c05c6a6176d3941374115b91272877f6c [label=a.patch]
 +}
 +% git add file.txt
 +% guilt refresh
 +Patch a.patch refreshed
 +% guilt pop
 +All patches popped.
 +% guilt push
 +Applying patch..a.patch
 +Patch applied.
 +% guilt graph
 +digraph G {
 +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d
 + ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch]
 +}
 +%% Adding an unrelated file in a new patch. No deps.
 +% guilt new b.patch
 +% git add file2.txt
 +% guilt refresh
 +Patch b.patch refreshed
 +% guilt pop
 +Now at a.patch.
 +% guilt push
 +Applying patch..b.patch
 +Patch applied.
 +% guilt graph
 +digraph G {
 +# checking rev c7014443c33d2b0237293687ceb9cbd38313df65
 + c7014443c33d2b0237293687ceb9cbd38313df65 [label=b.patch]
 +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d
 + ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch]
 +}
 +%% Changing a file already changed in the first patch adds a dependency.
 +% guilt new c.patch
 +% git add file.txt
 +% guilt refresh
 +Patch c.patch refreshed
 +% guilt pop
 +Now at b.patch.
 +% guilt push
 +Applying patch..c.patch
 +Patch applied.
 +% guilt graph
 +digraph G {
 +# checking rev 891bc14b5603474c9743fd04f3da888644413dc5
 + 891bc14b5603474c9743fd04f3da888644413dc5 [label=c.patch]
 +# checking rev c7014443c33d2b0237293687ceb9cbd38313df65
 + c7014443c33d2b0237293687ceb9cbd38313df65 [label=b.patch]
 +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d
 + ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch]
 + 891bc14b5603474c9743fd04f3da888644413dc5 - 
 ff2775f8d1dc753f635830adcc3a067e0b681e2d; // ?
 +}
 diff --git a/regression/t-033.sh b/regression/t-033.sh
 index a3a8981..fac081e 100755
 --- a/regression/t-033.sh
 +++ b/regression/t-033.sh
 @@ -3,6 +3,13 @@
  # Test the graph code
  #
  
 +function fixup_time_info
 +{
 + cmd guilt pop
 + touch -a -m -t $TOUCH_DATE .git/patches/a,graph/$1
 + cmd guilt push
 +}
 +
  source $REG_DIR/scaffold
  
  cmd setup_repo
 @@ -11,3 +18,35 @@ cmd setup_repo
  # message when no patches are applied.  (An older version of guilt
  # used to enter an endless loop in this situation.)
  shouldfail guilt graph
 +
 +echo %% Testing branch a,graph
 +cmd git checkout -b a,graph master
 +
 +cmd guilt init
 +
 +cmd guilt new a.patch
 +
 +fixup_time_info a.patch
 +cmd guilt graph
 +
 +cmd echo a  file.txt
 +cmd git add file.txt
 +cmd guilt refresh
 +fixup_time_info a.patch
 +cmd guilt graph
 +
 +echo %% Adding an unrelated file in a new patch. No deps.
 +cmd guilt new b.patch
 +cmd echo b  file2.txt
 +cmd git add file2.txt
 +cmd guilt refresh
 +fixup_time_info b.patch
 +cmd guilt graph
 +
 +echo %% Changing a file already changed in the first patch adds a 
 dependency.
 +cmd guilt new c.patch
 +cmd echo c  file.txt
 +cmd git add file.txt
 +cmd guilt refresh
 +fixup_time_info c.patch
 +cmd guilt graph
 -- 
 1.8.3.1
 

-- 
Research, n.:
  Consider Columbus:
He didn't know where he was going.
When he got there he didn't know where he was.
When he got back he didn't know where he had been.
And he did it all on someone else's money.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 25/29] guilt push now fails when there are no more patches to push.

2014-05-13 Thread Jeff Sipek
On Tue, May 13, 2014 at 10:31:01PM +0200, Per Cederqvist wrote:
 This makes it easier to script operations on the entire queue, for
 example run the test suite on each patch in the queue:
 
 guilt pop -a;while guilt push; do make test||break; done
 
 This brings guilt push in line with the push operation in Mercurial
 Queues (hg qpush), which fails when there are no patches to apply.
 
 Updated the test suite.
 
 guilt push -a still does not fail.  (It successfully manages to
 ensure that all patches are pushed, even if it did not have to do
 anything to make it so.)
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt-push   | 19 ++-
  regression/t-020.out | 89 
 
  regression/t-020.sh  | 13 +++-
  3 files changed, 113 insertions(+), 8 deletions(-)
...
 diff --git a/regression/t-020.sh b/regression/t-020.sh
 index 906aec6..0f9f85d 100755
 --- a/regression/t-020.sh
 +++ b/regression/t-020.sh
 @@ -26,6 +26,17 @@ guilt series | while read n ; do
  done
  
  #
 +# pushing when there is nothing to push
 +#
 +
 +shouldfail guilt push
 +cmd guilt push -a
 +
 +cmd list_files
 +
 +cmd git log -p

I don't particularly care for the git-log.  Otherwise it looks good.

Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net


 +
 +#
  # pop all
  #
  cmd guilt pop --all
 @@ -61,7 +72,7 @@ cmd guilt pop --all
  
  npatches=`guilt series | wc -l`
  for n in `_seq -2 $npatches`; do
 - if [ $n -ge 0 ]; then
 + if [ $n -gt 0 ]; then
   cmd guilt push -n $n
   else
   shouldfail guilt push -n $n
 -- 
 1.8.3.1
 

-- 
Evolution, n.:
  A hypothetical process whereby infinitely improbable events occur with
  alarming frequency, order arises from chaos, and no one is given credit.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 24/29] disp no longer processes backslashes.

2014-05-13 Thread Jeff Sipek
On Tue, May 13, 2014 at 10:31:00PM +0200, Per Cederqvist wrote:
 Only one invocation of disp or _disp actually needed backslash
 processing.  In quite a few instances, it was wrong to do backslash
 processing, as the message contained data derived from the user.
 
 Created the new function disp_e that should be used when backslash
 processing is required, and changed disp and _disp to use printf
 code %s instead of %b.

Minor nit: %s (to match %b)

Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net


 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt | 17 +
  1 file changed, 13 insertions(+), 4 deletions(-)
 
 diff --git a/guilt b/guilt
 index 23cc2da..9947acc 100755
 --- a/guilt
 +++ b/guilt
 @@ -36,15 +36,24 @@ usage()
   exit 1
  }
  
 -# echo -n is a bashism, use printf instead
 +# Print arguments, but no trailing newline.
 +# (echo -n is a bashism, use printf instead)
  _disp()
  {
 - printf %b $*
 + printf %s $*
  }
  
 -# echo -e is a bashism, use printf instead
 +# Print arguments.
 +# (echo -E is a bashism, use printf instead)
  disp()
  {
 + printf %s\n $*
 +}
 +
 +# Print arguments, processing backslash sequences.
 +# (echo -e is a bashism, use printf instead)
 +disp_e()
 +{
   printf %b\n $*
  }
  
 @@ -117,7 +126,7 @@ else
  
   disp 
   disp Example:
 - disp \tguilt push
 + disp_e \tguilt push
  
   # now, let's exit
   exit 1
 -- 
 1.8.3.1
 

-- 
Reality is merely an illusion, albeit a very persistent one.
- Albert Einstein
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 20/29] guilt graph: Handle patch names containing quotes.

2014-05-13 Thread Jeff Sipek
On Tue, May 13, 2014 at 10:30:56PM +0200, Per Cederqvist wrote:
 Quote quotes with a backslash in the guilt graph output.  Otherwise,
 the dot file could contain syntax errors.
 
 Added a test case.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt-graph  |  2 ++
  regression/t-033.out | 22 ++
  regression/t-033.sh  |  9 +
  3 files changed, 33 insertions(+)
 
 diff --git a/guilt-graph b/guilt-graph
 index 924a63e..0857e0d 100755
 --- a/guilt-graph
 +++ b/guilt-graph
 @@ -57,6 +57,8 @@ while [ $current != $base ]; do
  }`
   [ -z $pname ]  pname=?
  
 + pname=`printf \%s\ \$pname\ | sed 's/\/\/g'`

Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net


 +
   disp # checking rev $current
   disp   \$current\ [label=\$pname\]
  
 diff --git a/regression/t-033.out b/regression/t-033.out
 index 3d1c61f..c120d4f 100644
 --- a/regression/t-033.out
 +++ b/regression/t-033.out
 @@ -66,3 +66,25 @@ digraph G {
   ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch]
   891bc14b5603474c9743fd04f3da888644413dc5 - 
 ff2775f8d1dc753f635830adcc3a067e0b681e2d; // ?
  }
 +% guilt new a-betterquicker'-patch.patch
 +% git add file.txt
 +% guilt refresh
 +Patch a-betterquicker'-patch.patch refreshed
 +% guilt pop
 +Now at c.patch.
 +% guilt push
 +Applying patch..a-betterquicker'-patch.patch
 +Patch applied.
 +% guilt graph
 +digraph G {
 +# checking rev bc7df666a646739eaf559af23cab72f2bfd01f0e
 + bc7df666a646739eaf559af23cab72f2bfd01f0e 
 [label=a-\betterquicker'-patch.patch]
 +# checking rev 891bc14b5603474c9743fd04f3da888644413dc5
 + 891bc14b5603474c9743fd04f3da888644413dc5 [label=c.patch]
 + bc7df666a646739eaf559af23cab72f2bfd01f0e - 
 891bc14b5603474c9743fd04f3da888644413dc5; // ?
 +# checking rev c7014443c33d2b0237293687ceb9cbd38313df65
 + c7014443c33d2b0237293687ceb9cbd38313df65 [label=b.patch]
 +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d
 + ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch]
 + 891bc14b5603474c9743fd04f3da888644413dc5 - 
 ff2775f8d1dc753f635830adcc3a067e0b681e2d; // ?
 +}
 diff --git a/regression/t-033.sh b/regression/t-033.sh
 index fac081e..9fe1827 100755
 --- a/regression/t-033.sh
 +++ b/regression/t-033.sh
 @@ -50,3 +50,12 @@ cmd git add file.txt
  cmd guilt refresh
  fixup_time_info c.patch
  cmd guilt graph
 +
 +# A patch name that contains funky characters, including unbalanced
 +# quotes.
 +cmd guilt new a-\betterquicker'-patch.patch
 +cmd echo d  file.txt
 +cmd git add file.txt
 +cmd guilt refresh
 +fixup_time_info a-\betterquicker'-patch.patch
 +cmd guilt graph
 -- 
 1.8.3.1
 

-- 
C is quirky, flawed, and an enormous success.
- Dennis M. Ritchie.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 17/29] guilt graph no longer loops when no patches are applied.

2014-05-13 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Tue, May 13, 2014 at 10:30:53PM +0200, Per Cederqvist wrote:
 Give an error message if no patches are applied.  Added a test case
 that never terminates unless this fix is applied.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt-graph  |  9 +++--
  regression/t-033.out |  3 +++
  regression/t-033.sh  | 13 +
  3 files changed, 23 insertions(+), 2 deletions(-)
  create mode 100644 regression/t-033.out
  create mode 100755 regression/t-033.sh
 
 diff --git a/guilt-graph b/guilt-graph
 index b3469dc..56d0e77 100755
 --- a/guilt-graph
 +++ b/guilt-graph
 @@ -17,8 +17,13 @@ fi
  
  patchname=$1
  
 -bottom=`git rev-parse refs/patches/$branch/$(head_n 1  $applied)`
 -base=`git rev-parse $bottom^`
 +bottompatch=$(head_n 1  $applied)
 +if [ -z $bottompatch ]; then
 + echo No patch applied. 2
 + exit 1
 +fi
 +
 +base=`git rev-parse refs/patches/${branch}/${bottompatch}^`
  
  if [ -z $patchname ]; then
   top=`git rev-parse HEAD`
 diff --git a/regression/t-033.out b/regression/t-033.out
 new file mode 100644
 index 000..76613f9
 --- /dev/null
 +++ b/regression/t-033.out
 @@ -0,0 +1,3 @@
 +% setup_repo
 +% guilt graph
 +No patch applied.
 diff --git a/regression/t-033.sh b/regression/t-033.sh
 new file mode 100755
 index 000..a3a8981
 --- /dev/null
 +++ b/regression/t-033.sh
 @@ -0,0 +1,13 @@
 +#!/bin/bash
 +#
 +# Test the graph code
 +#
 +
 +source $REG_DIR/scaffold
 +
 +cmd setup_repo
 +
 +# Check that guilt graph gives a proper No patch applied error
 +# message when no patches are applied.  (An older version of guilt
 +# used to enter an endless loop in this situation.)
 +shouldfail guilt graph
 -- 
 1.8.3.1
 

-- 
Reality is merely an illusion, albeit a very persistent one.
- Albert Einstein
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 10/29] Run test_failed if the exit status of a test script is bad.

2014-05-13 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Tue, May 13, 2014 at 10:30:46PM +0200, Per Cederqvist wrote:
 There were two problems with the old code:
 
  - Since set -e is in effect (that is set in scaffold) the run-test
script exited immediately if a t-*.sh script failed.  This is not
nice, as we want the error report that test_failed prints.
 
  - The code ran cd - between running the t-*.sh script and checking
the exit status, so the exit status was lost.  (Actually, the exit
status was saved in $ERR, but nothing ever looked at $ERR.)
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  regression/run-tests | 10 +++---
  1 file changed, 7 insertions(+), 3 deletions(-)
 
 diff --git a/regression/run-tests b/regression/run-tests
 index a10e796..8e0af9f 100755
 --- a/regression/run-tests
 +++ b/regression/run-tests
 @@ -55,11 +55,15 @@ function run_test
  
   # run the test
   cd $REPODIR  /dev/null
 - $REG_DIR/t-$1.sh 21  $LOGFILE
 - ERR=$?
 + if $REG_DIR/t-$1.sh 21  $LOGFILE; then
 + ERR=false
 + else
 + ERR=true
 + fi
 +
   cd -  /dev/null
  
 - [ $? -ne 0 ]  test_failed
 + $ERR  test_failed
   diff -u t-$1.out $LOGFILE || test_failed
  
   echo done.
 -- 
 1.8.3.1
 

-- 
Reality is merely an illusion, albeit a very persistent one.
- Albert Einstein
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT v2 16/29] Fix backslash handling when creating names of imported patches.

2014-05-13 Thread Jeff Sipek
On Tue, May 13, 2014 at 10:30:52PM +0200, Per Cederqvist wrote:
 The 'echo %s' construct sometimes processes escape sequences.  (This

%s?  Should this be $s?

Otherwise, looks good.

 happens, for instance, under Ubuntu 14.04 when /bin/sh is actually
 dash.)  We don't want that to happen when we are importing commits, so
 use 'printf %s $s' instead.
 
 (The -E option of bash that explicitly disables backslash expansion is
 not portable; it is not supported by dash.)
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt-import-commit  |  2 +-
  regression/t-034.out | 14 +++---
  2 files changed, 8 insertions(+), 8 deletions(-)
 
 diff --git a/guilt-import-commit b/guilt-import-commit
 index 6260c56..45f2404 100755
 --- a/guilt-import-commit
 +++ b/guilt-import-commit
 @@ -30,7 +30,7 @@ for rev in `git rev-list $rhash`; do
  
   # Try to convert the first line of the commit message to a
   # valid patch name.
 - fname=`echo $s | sed -e s//and/g -e s/[ :]/_/g -e s,[/\\],-,g \
 + fname=`printf %s $s | sed -e s//and/g -e s/[ :]/_/g -e 
 s,[/\\],-,g \
   -e s/['\\[{}]//g -e 's/]//g' -e 's/\*/-/g' \
   -e 's/\?/-/g' -e 's/\.\.\.*/./g' -e 's/^\.//' \
   -e 's/\.patch$//' -e 's/\.$//' | tr A-Z a-z`
 diff --git a/regression/t-034.out b/regression/t-034.out
 index 7bc9459..bda4399 100644
 --- a/regression/t-034.out
 +++ b/regression/t-034.out
 @@ -236,7 +236,7 @@ Date:   Mon Jan 1 00:00:00 2007 +
  About to begin conversion...
  Current head: 2a8b1889aa5066193bac978e6bf5073ffcfa6541
  Converting 2a8b1889 as can-have-embedded-single-slashes
 -Converting 0a46f8fa as backslash-isorbidden
 +Converting 0a46f8fa as backslash-is-forbidden
  Converting aedb74fd as x
  Converting 30187ed0 as cannot@have@the@sequence@at-brace
  Converting 106e8e5a as cannot_end_in_
 @@ -300,7 +300,7 @@ Applying patch..cannot@have@the@sequence@at-brace.patch
  Patch applied.
  Applying patch..x.patch
  Patch applied.
 -Applying patch..backslash-isorbidden.patch
 +Applying patch..backslash-is-forbidden.patch
  Patch applied.
  Applying patch..can-have-embedded-single-slashes.patch
  Patch applied.
 @@ -311,7 +311,7 @@ Date:   Mon Jan 1 00:00:00 2007 +
  
  Can/have/embedded/single/slashes
  
 -commit 7c3ffa4f940c862e9f11f5d4a5ae421f7a8d3141 
 (refs/patches/master/backslash-isorbidden.patch)
 +commit 7c3ffa4f940c862e9f11f5d4a5ae421f7a8d3141 
 (refs/patches/master/backslash-is-forbidden.patch)
  Author: Author Name author@email
  Date:   Mon Jan 1 00:00:00 2007 +
  
 @@ -518,8 +518,6 @@ d .git/patches/master
  d .git/refs/patches
  d .git/refs/patches/master
  f 06beca7069b9e576bd431f65d13862ed5d3e2a0f  
 .git/patches/master/ctrlisforbidden.patch
 -f 08267ec6783ea9d1adae55b275198f7594764ed0  .git/patches/master/series
 -f 08267ec6783ea9d1adae55b275198f7594764ed0  .git/patches/master/status
  f 09b7e9be44ae5ec3a4bb30f5ee9d4ebc2c042f64  
 .git/patches/master/two_consecutive_dots_(.)_is_forbidden.patch
  f 0b971c9a17aeca2319c93d700ffd98acc2a93451  
 .git/patches/master/question-mark-is-forbidden.patch
  f 2b8392f63d61efc12add554555adae30883993cc  
 .git/patches/master/cannot-end-in-slash-.patch
 @@ -529,7 +527,7 @@ f 34e07c584032df137f19bdb66d93f316f00a5ac8  
 .git/patches/master/tildeisforbidden
  f 49bab499826b63deb2bd704629d60c7268c57aee  
 .git/patches/master/the_sequence_-._is_forbidden.patch
  f 5bcddb8ccb6e6e5e8a61e9e56cb2e0f70cbab2f5  
 .git/patches/master/cannot@have@the@sequence@at-brace.patch
  f 637b982fe14a240de181ae63226b27e0c406b3dc  
 .git/patches/master/asterisk-is-forbidden.patch
 -f 698f8a7d41a64e3b6be1a3eba86574078b22a5f3  
 .git/patches/master/backslash-isorbidden.patch
 +f 698f8a7d41a64e3b6be1a3eba86574078b22a5f3  
 .git/patches/master/backslash-is-forbidden.patch
  f 7b103c3c7ae298cd2334f6f49da48bae1424f77b  
 .git/patches/master/crisalsoforbidden.patch
  f 9b810b8c63779c51d2e7f61ab59cd49835041563  .git/patches/master/x.patch
  f a22958d9ae9976fd7b2b5a9d0bcd44bf7ad9b08a  
 .git/patches/master/caretisforbidden.patch
 @@ -537,6 +535,8 @@ f ab325bf5a432937fc6f231d3e8a773a62d53952b  
 .git/patches/master/multiple-slashes
  f cb9cffbd4465bddee266c20ccebd14eb687eaa89  
 .git/patches/master/delisforbidden.patch
  f d0885a1a1fdee0fd1e4fedce3f7acd3100540bc4  
 .git/patches/master/openbracketisforbidden.patch
  f d2903523fb66a346596eabbdd1bda4e52b266440  
 .git/patches/master/check-multiple-.-dots-.-foo.patch
 +f da90de1c84138194524994e0bc3bc4ca8189c999  .git/patches/master/series
 +f da90de1c84138194524994e0bc3bc4ca8189c999  .git/patches/master/status
  f dfc11f76394059909671af036598c5fbe33001ba  
 .git/patches/master/space_is_forbidden.patch
  f e47474c52d6c893f36d0457f885a6dd1267742bb  
 .git/patches/master/colon_is_forbidden.patch
  f e7a5f8912592d9891e6159f5827c8b4f372cc406  
 .git/patches/master/the_sequence_.lock-_is_forbidden.patch
 @@ -548,7 +548,7 @@ r 1626a11d979a1e9e775c766484172212277153df  
 

Re: [GUILT v2 26/29] guilt pop now fails when there are no more patches to pop.

2014-05-13 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Tue, May 13, 2014 at 10:31:02PM +0200, Per Cederqvist wrote:
 This is analogous to how guilt push now fails when there are no more
 patches to push.  Like push, the --all argument still succeeds even
 if there was no need to pop anything.
 
 Updated the test suite.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt-pop| 17 +++--
  regression/t-021.out |  2 ++
  regression/t-021.sh  |  6 ++
  regression/t-061.sh  |  6 +-
  4 files changed, 24 insertions(+), 7 deletions(-)
 
 diff --git a/guilt-pop b/guilt-pop
 index f0e647f..191313e 100755
 --- a/guilt-pop
 +++ b/guilt-pop
 @@ -49,9 +49,19 @@ fi
  patch=$1
  [ ! -z $all ]  patch=-a
  
 +# Treat guilt pop as guilt pop -n 1.
 +if [ -z $patch ]; then
 + patch=1
 + num=t
 +fi
 +
  if [ ! -s $applied ]; then
   disp No patches applied.
 - exit 0
 + if [ $patch = -a ]; then
 + exit 0
 + else
 + exit 1
 + fi
  elif [ $patch = -a ]; then
   # we are supposed to pop all patches
  
 @@ -68,11 +78,6 @@ elif [ ! -z $num ]; then
   # catch underflow
   [ $eidx -lt 0 ]  eidx=0
   [ $eidx -eq $sidx ]  die No patches requested to be removed.
 -elif [ -z $patch ]; then
 - # we are supposed to pop only the current patch on the stack
 -
 - sidx=`wc -l  $applied`
 - eidx=`expr $sidx - 1`
  else
   # we're supposed to pop only up to a patch, make sure the patch is
   # in the series
 diff --git a/regression/t-021.out b/regression/t-021.out
 index 9b42d9c..58be12f 100644
 --- a/regression/t-021.out
 +++ b/regression/t-021.out
 @@ -287,6 +287,8 @@ index 000..8baef1b
  +++ b/def
  @@ -0,0 +1 @@
  +abc
 +% guilt pop
 +No patches applied.
  % guilt push --all
  Applying patch..modify
  Patch applied.
 diff --git a/regression/t-021.sh b/regression/t-021.sh
 index 614e870..e0d2dc1 100755
 --- a/regression/t-021.sh
 +++ b/regression/t-021.sh
 @@ -23,6 +23,12 @@ guilt series | _tac | while read n ; do
  done
  
  #
 +# pop when there is nothing to pop
 +#
 +
 +shouldfail guilt pop
 +
 +#
  # push all
  #
  cmd guilt push --all
 diff --git a/regression/t-061.sh b/regression/t-061.sh
 index 1411baa..6192f1b 100755
 --- a/regression/t-061.sh
 +++ b/regression/t-061.sh
 @@ -48,7 +48,11 @@ cmd list_files
  
  for i in `seq 5`
  do
 - cmd guilt pop
 + if [ $i -ge 5 ]; then
 + shouldfail guilt pop
 + else
 + cmd guilt pop
 + fi
   cmd git for-each-ref
   cmd guilt push
   cmd git for-each-ref
 -- 
 1.8.3.1
 

-- 
Linux, n.:
  Generous programmers from around the world all join forces to help
  you shoot yourself in the foot for free. 
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 07/28] Added test cases for guilt fold.

2014-05-08 Thread Jeff Sipek
On Thu, May 08, 2014 at 09:41:22PM +0200, Per Cederqvist wrote:
 On Wed, May 7, 2014 at 11:06 PM, Jeff Sipek jef...@josefsipek.net wrote:
  On Wed, May 07, 2014 at 10:59:56PM +0200, Per Cederqvist wrote:
  On Tue, May 6, 2014 at 9:40 PM, Jeff Sipek jef...@josefsipek.net wrote:
   On Fri, Mar 21, 2014 at 08:31:45AM +0100, Per Cederqvist wrote:
   Test that we can combine any combination of patches with empty and
   non-empty messages, both with and without guilt.diffstat.  (All
   patches are empty.)
  
   I feel like we should have *some* content there - most of the time, I 
   care
   more about the diffs getting folded than the commit message :)
 
  I added these tests for a reason: the reproduce a bug in guilt that I 
  found.
 
  I'm afraid that having some content might hide the bug I found. (I'm also
  equally afraid that it might uncover other bugs in guilt, which would delay
  integration of this patch series. So adding more test cases with content
  is a good thing to do, but maybe not in this patch series.)
 
  Fair enough.  I use guilt-fold all the time and it hasn't lost any of my
  diffs, so I'm happy to defer this until some point in the future.
 
  ...
   for using_diffstat in true false ; do
   for patcha in empty nonempty ; do
   for patchb in empty nonempty ; do
   echo %% $patcha + $patchb 
   (diffstat=$using_diffstat)
   ${patcha}_patch $patcha
   ${patchb}_patch $patchb
   cmd guilt pop $patchb
   cmd guilt fold $patchb
   fixup_time_info $patcha
   cmd list_files
   cleanup $patcha
   cmd list_files
   done
   done
   done
  
   Aha!  That's better, IMO.
 
  I'll try that and post a version 2 of the series. It might take a few
  days, though.
 
  No problem.  I'm still the slower one of the two of us. :/
 
  Jeff.
 
 There were a few details that made it a bit more complex than that,
 but I think the end result was still an improvement.

The devil's in the details :)

 The most obvious detail is that if you add two empty patches, you
 cannot name them both empty, so when $patcha and $patchb is the same
 you have to add suffixes.
 
 The other detail is that my tests used different commit messages when
 both commits contained a message.  I want to retain that behaviour, so
 that added a few lines of complexity.
 
 I'll post an updated patch series once I've gone through all your
 comments.  In the meantime, you can see my new implementation here:
 
 http://repo.or.cz/w/guilt/ceder.git/commitdiff/3107dc73eaff020da18024c3b5f5f92b94d17852?hp=6df110c95133d6e557ce3dbcb6fd39bc797f877b#patch2

Much better than the original, IMO.

Thanks,

Jeff.

-- 
We have joy, we have fun, we have Linux on a Sun...
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 07/28] Added test cases for guilt fold.

2014-05-07 Thread Jeff Sipek
On Wed, May 07, 2014 at 10:59:56PM +0200, Per Cederqvist wrote:
 On Tue, May 6, 2014 at 9:40 PM, Jeff Sipek jef...@josefsipek.net wrote:
  On Fri, Mar 21, 2014 at 08:31:45AM +0100, Per Cederqvist wrote:
  Test that we can combine any combination of patches with empty and
  non-empty messages, both with and without guilt.diffstat.  (All
  patches are empty.)
 
  I feel like we should have *some* content there - most of the time, I care
  more about the diffs getting folded than the commit message :)
 
 I added these tests for a reason: the reproduce a bug in guilt that I found.
 
 I'm afraid that having some content might hide the bug I found. (I'm also
 equally afraid that it might uncover other bugs in guilt, which would delay
 integration of this patch series. So adding more test cases with content
 is a good thing to do, but maybe not in this patch series.)

Fair enough.  I use guilt-fold all the time and it hasn't lost any of my
diffs, so I'm happy to defer this until some point in the future.

...
  for using_diffstat in true false ; do
  for patcha in empty nonempty ; do
  for patchb in empty nonempty ; do
  echo %% $patcha + $patchb 
  (diffstat=$using_diffstat)
  ${patcha}_patch $patcha
  ${patchb}_patch $patchb
  cmd guilt pop $patchb
  cmd guilt fold $patchb
  fixup_time_info $patcha
  cmd list_files
  cleanup $patcha
  cmd list_files
  done
  done
  done
 
  Aha!  That's better, IMO.
 
 I'll try that and post a version 2 of the series. It might take a few
 days, though.

No problem.  I'm still the slower one of the two of us. :/

Jeff.

-- 
Keyboard not found!
Press F1 to enter Setup
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 27/28] Minor testsuite fix.

2014-05-07 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Fri, Mar 21, 2014 at 08:32:05AM +0100, Per Cederqvist wrote:
 Fix remove_topic() in t-061.sh so that it doesn't print a git hash.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  regression/t-061.out | 1 -
  regression/t-061.sh  | 2 +-
  2 files changed, 1 insertion(+), 2 deletions(-)
 
 diff --git a/regression/t-061.out b/regression/t-061.out
 index ef0f335..60ad56d 100644
 --- a/regression/t-061.out
 +++ b/regression/t-061.out
 @@ -381,7 +381,6 @@ ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit   
 refs/patches/master/mode
  ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit  
 refs/patches/master/remove
  % guilt pop -a
  No patches applied.
 -ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba
  % git checkout guilt/master
  Switched to branch guilt/master
  % guilt pop -a
 diff --git a/regression/t-061.sh b/regression/t-061.sh
 index a9a4fea..b573885 100755
 --- a/regression/t-061.sh
 +++ b/regression/t-061.sh
 @@ -15,7 +15,7 @@ old_style_branch() {
  
  remove_topic() {
   cmd guilt pop -a
 - if git rev-parse --verify --quiet guilt/master
 + if git rev-parse --verify --quiet guilt/master /dev/null
   then
   cmd git checkout guilt/master
   else
 -- 
 1.8.3.1
 

-- 
Fact: 12.5% of all statistics are generated randomly.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 24/28] disp no longer processes backslashes.

2014-05-07 Thread Jeff Sipek
On Fri, Mar 21, 2014 at 08:32:02AM +0100, Per Cederqvist wrote:
 Only one invocation of disp or _disp actually needed backslash
 processing.  In quite a few instances, it was wrong to do backslash
 processing, as the message contained data derived from the user.
 
 Created the new function disp_e that should be used when backslash
 processing is required, and changed disp and disp_ to use printf

s/disp_/_disp/

otherwise LGTM

 code %s instead of %b.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt | 17 +
  1 file changed, 13 insertions(+), 4 deletions(-)
 
 diff --git a/guilt b/guilt
 index ca922aa..36cfd1e 100755
 --- a/guilt
 +++ b/guilt
 @@ -36,15 +36,24 @@ usage()
   exit 1
  }
  
 -# echo -n is a bashism, use printf instead
 +# Print arguments, but no trailing newline.
 +# (echo -n is a bashism, use printf instead)
  _disp()
  {
 - printf %b $*
 + printf %s $*
  }
  
 -# echo -e is a bashism, use printf instead
 +# Print arguments.
 +# (echo -E is a bashism, use printf instead)
  disp()
  {
 + printf %s\n $*
 +}
 +
 +# Print arguments, processing backslash sequences.
 +# (echo -e is a bashism, use printf instead)
 +disp_e()
 +{
   printf %b\n $*
  }
  
 @@ -117,7 +126,7 @@ else
  
   disp 
   disp Example:
 - disp \tguilt push
 + disp_e \tguilt push
  
   # now, let's exit
   exit 1
 -- 
 1.8.3.1
 

-- 
We have joy, we have fun, we have Linux on a Sun...
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 25/28] guilt push now fails when there are no more patches to push.

2014-05-07 Thread Jeff Sipek
On Fri, Mar 21, 2014 at 08:32:03AM +0100, Per Cederqvist wrote:
 This makes it easier to script operations on the entire queue, for
 example run the test suite on each patch in the queue:
 
 guilt pop -a;while guilt push; do make test||break; done
 
 This brings guilt push in line with the push operation in Mercurial
 Queues (hg qpush), which fails when there are no patches to apply.
 
 Updated the test suite.
 
 guilt push -a still does not fail.  (It successfully manages to
 ensure that all patches are pushed, even if it did not have to do
 anything to make it so.)
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt-push   | 14 -
  regression/t-020.out | 89 
 
  regression/t-020.sh  | 13 +++-
  3 files changed, 108 insertions(+), 8 deletions(-)
 
 diff --git a/guilt-push b/guilt-push
 index 67687e7..350 100755
 --- a/guilt-push
 +++ b/guilt-push
 @@ -55,6 +55,7 @@ fi
  
  patch=$1
  [ ! -z $all ]  patch=-a
 +[ -z $patch ]  { patch=1; num=t; }

I don't think there's any other place in the repo that does this.  Instead
you see a lot of if-then-fi.  To keep it consistent, I'd suggest:

if [ -z $patch ] ; then
patch=1
num=t
fi

Ah, this took me a while to figure out.  The above turns:

$ guilt push

into 

$ guilt push -n 1

I'd throw in a comment.

(Note to self, this file is a huge mess and could use a bit of cleanup.)

 @@ -78,11 +79,6 @@ elif [ ! -z $num ]; then
   # clamp to minimum
   [ $tidx -lt $eidx ]  eidx=$tidx
  
 -elif [ -z $patch ]; then
 - # we are supposed to push only the next patch onto the stack
 -
 - eidx=`wc -l  $applied`
 - eidx=`expr $eidx + 1`
  else
   # we're supposed to push only up to a patch, make sure the patch is
   # in the series
 @@ -109,7 +105,11 @@ if [ $sidx -gt $eidx ]; then
   else
   disp File series fully applied, ends at patch `get_series | 
 tail -n 1`
   fi
 - exit 0
 + if [ -n $all ]; then
 + exit 0
 + else
 + exit 1
 + fi

This changes the output on stdout.  E.g.,

$ guilt pu
$ guilt pu -n 1
File series fully applied, ends at patch crashdump

With this patch, both will print the message. Right?

  fi
  
  get_series | sed -n -e ${sidx},${eidx}p | while read p

Jeff.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 04/28] Allow guilt import-commit to run from a dir which contains spaces.

2014-05-06 Thread Jeff Sipek
On Sun, Mar 23, 2014 at 10:13:53PM +0100, Per Cederqvist wrote:
 On Sun, Mar 23, 2014 at 9:07 PM, Jeff Sipek jef...@josefsipek.net wrote:
  On Sun, Mar 23, 2014 at 08:57:08PM +0100, Per Cederqvist wrote:
  On Sun, Mar 23, 2014 at 6:04 PM, Jeff Sipek jef...@josefsipek.net wrote:
 
   On Fri, Mar 21, 2014 at 08:31:42AM +0100, Per Cederqvist wrote:
  
   Signed-off-by: Per Cederqvist ced...@opera.com
   ---
guilt-import-commit | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
  
   diff --git a/guilt-import-commit b/guilt-import-commit
   index 20dcee2..9488ded 100755
   --- a/guilt-import-commit
   +++ b/guilt-import-commit
   @@ -23,7 +23,7 @@ if ! must_commit_first; then
fi
  
disp About to begin conversion... 2
   -disp Current head: `cat $GIT_DIR/refs/heads/\`git_branch\`` 2
   +disp Current head: `cat \$GIT_DIR\/refs/heads/\`git_branch\`` 2
  
   I wonder if it'd be better to use 'git rev-parse' here instead of 
   looking at
   the refs directly.
  
   IOW,
  
   disp Current head: `git rev-parse \`git_branch\`` 2
 
  That is probably a good idea. I only made the minimum change
  required to get the test suite to pass.
 
  I totally understand.
 
   Maybe even $() instead of the inner `` to clean it up some more.
 
  Yes, given that that construct is already used in several places
  it is apparently portable enough for guilt. (I guess nobody uses
  /bin/sh on Solaris to run guilt. It doesn't support the $(...)
  construct.)
 
  Hrm?  I'm using OpenIndiana (OpenSolaris derivative) and my /bin/sh seems to
  be a symlink to ksh93.  What version of Solaris are you seeing this behavior
  on?
 
 Solaris 10:
 
 Last login: Sun Mar 23 20:53:28 2014 from c80-217-121-12.
 Sun Microsystems Inc.   SunOS 5.10  Generic January 2005
 You have mail.
 500 ceder@bacon uname -a
 SunOS bacon 5.10 Generic_147147-26 sun4u sparc SUNW,Sun-Fire-15000
 501 ceder@bacon /bin/sh
 $ echo `id`
 uid=105(ceder) gid=20105(ceder)
 $ echo $(id)
 syntax error: `(' unexpected
 
 /bin/sh is a symlink to /sbin/sh.
 
 On Solaris 10, you are supposed to use /usr/xpg4/bin/sh if you want
 a competent standards-compliant shell. /bin/sh is provided as a very
 backward-compatible shell.

Ok, I finally got back to this series...

I'd say let's use the nested ``.

Jeff.

-- 
Hegh QaQ law'
quvHa'ghach QaQ puS
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 06/28] Fix and simplify the do_get_patch function.

2014-05-06 Thread Jeff Sipek
On Sun, Mar 23, 2014 at 10:03:48PM +0100, Per Cederqvist wrote:
 On Sun, Mar 23, 2014 at 6:09 PM, Jeff Sipek jef...@josefsipek.net wrote:
 
  On Fri, Mar 21, 2014 at 08:31:44AM +0100, Per Cederqvist wrote:
  When extracting the patch, we only want the actual patches.  We don't
  want the --- delimiter.  Simplify the extraction by simply deleting
  everything before the first diff  line.  (Use sed instead of awk to
  simplify the code.)
 
  Without this patch, guilt fold and guilt push sometimes fails if
  guilt.diffstat is true.

Hrm, I just did a test and guilt-push seems to work with a patch such as:

aoeuaoeu
this is
---
not a patch!
---
 foo |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/foo b/foo
index e69de29..203a557 100644
--- a/foo
+++ b/foo
@@ -0,0 +1 @@
+aoue

What sort of thing breaks fold/push?

...
  diff --git a/guilt b/guilt
  index 8701481..c59cd0f 100755
  --- a/guilt
  +++ b/guilt
  @@ -332,12 +332,7 @@ do_make_header()
   # usage: do_get_patch patchfile
   do_get_patch()
   {
  - awk '
  -BEGIN{}
  -/^(diff |---$|--- )/ {patch = 1}
  -patch == 1 {print $0}
  -END{}
  -'  $1
  + sed -n '/^diff /,$p'  $1
 
  So, the thought behind this mess was to allow minimal patches to work.  The
  'diff' line is *not* required by patch(1)!
 
 I see. I can see that this is sometimes useful, even though I think
 it is more important that guilt actually works with the patches itself
 creates.

Fair enough.  I'm convinced that we should assume that all patches start
with 'diff '.

...
 I had to solve a similar problem when I wrote my utility for diffing two
 diff files (https://git.lysator.liu.se/pdiffdiff). Based on the experience
 I got doing that, I propose this new do_get_patch function:
...
 
 The idea is to collect lines that *might* start the patch in
 patchheader. Once we detect the start of the patch (via a
 line that matches ---  or any of the mode change lines)
 we print the patcheader and the current line. If we get a
 line that neither looks like a patchheader nor starts a patch,
 we discard the patcheader. This is the case of a commit
 message with a line that starts with diff .
 
 The function above solves the issue with lines that
 start with diff  in the commit message.  On the other
 hand, it introduces the same issue for lines that start
 with for instance old mode .

Hrm.  I'm open to revisiting the get-patch/get-header functions to address
the ambiguity issues in the future.

 Actually, a smaller change that probably fixes the
 issue with diffstat is to replace
 
 /^(diff |---$|--- )/ {patch = 1}
 
 witih
 
 /^(diff |--- )/ {patch = 1}
 
 as the problem with the original implementation is that
 the ---\n line that starts the diffstat should not start
 the patch.

(Thinking out loud...) I suppose there are three portions to a patch file...

(1) the description
(2) optional diffstat
(3) the patch

You just convinced me that the patch should start with '^diff '.  Currently,
the diffstat begins with '^---$'.  Sadly, the description can contain what
looks like the beginning of a diffstat or a patch.  In the case of
do_get_patch, we're only interested in the patch, so we can just look for
'^diff ' (because garbage before the diff itself seems to be ignored by
git).  (If we wanted to allow patches without the 'diff ' line, we'd need
'^(diff |--- )'.)

I feel like I'm missing something.

Jeff.

-- 
I'm somewhere between geek and normal.
- Linus Torvalds
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 07/28] Added test cases for guilt fold.

2014-05-06 Thread Jeff Sipek
On Fri, Mar 21, 2014 at 08:31:45AM +0100, Per Cederqvist wrote:
 Test that we can combine any combination of patches with empty and
 non-empty messages, both with and without guilt.diffstat.  (All
 patches are empty.)

I feel like we should have *some* content there - most of the time, I care
more about the diffs getting folded than the commit message :)

 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  regression/t-035.out | 659 
 +++
  regression/t-035.sh  |  88 +++
  2 files changed, 747 insertions(+)
  create mode 100644 regression/t-035.out
  create mode 100755 regression/t-035.sh
 
 diff --git a/regression/t-035.out b/regression/t-035.out
 new file mode 100644
 index 000..04af146
 --- /dev/null
 +++ b/regression/t-035.out
 @@ -0,0 +1,659 @@
 +% setup_repo
 +% git config guilt.diffstat true
 +%% empty + empty (diffstat=true)
 +% guilt new empty-1
 +% guilt pop
 +All patches popped.
 +% guilt push
 +Applying patch..empty-1
 +Patch applied.
 +% guilt new empty-2
 +% guilt pop
 +Now at empty-1.
 +% guilt push
 +Applying patch..empty-2
 +Patch applied.
 +% guilt pop
 +Now at empty-1.
 +% guilt fold empty-2
 +% guilt pop
 +All patches popped.
 +% guilt push
 +Applying patch..empty-1
 +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 4ea806e306f0228a8ef41f186035e7b04097f1f2  .git/patches/master/status
 +f 7d261b8caad0f161c21daf5de65eeb521ff8c067  .git/patches/master/empty-1
 +f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
 +f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
 +f d28d87b88c1e24d637e390dc3603cfa7c1715711  .git/patches/master/series
 +f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/empty-1~
 +f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/empty-2~
 +r bde3d337af70f36836ad606c800d194006f883b3  .git/refs/patches/master/empty-1
 +% git log -p

Strictly speaking, git log isn't necessary since list_files prints the
hashes of each of the files as well as the refs for all the applied patches.
If anything mismatches, the hashes will catch it.  I'm ok with keeping the
git log here as long as people can't mess up the formatting with git
config/etc.

...
 diff --git a/regression/t-035.sh b/regression/t-035.sh
 new file mode 100755
 index 000..aed3ef2
 --- /dev/null
 +++ b/regression/t-035.sh
 @@ -0,0 +1,88 @@
 +#!/bin/bash
 +#
 +# Test the fold code
 +#
 +
 +source $REG_DIR/scaffold
 +
 +cmd setup_repo
 +
 +function fixup_time_info
 +{
 + cmd guilt pop
 + touch -a -m -t $TOUCH_DATE .git/patches/master/$1
 + cmd guilt push
 +}
 +
 +function test_fold
 +{
 +using_diffstat=$1
 +
 +cmd git config guilt.diffstat $using_diffstat
 +
 +# Empty message + empty message = empty message.
 +echo %% empty + empty (diffstat=$using_diffstat)
 +cmd guilt new empty-1
 +fixup_time_info empty-1
 +cmd guilt new empty-2
 +fixup_time_info empty-2
 +cmd guilt pop
 +cmd guilt fold empty-2
 +fixup_time_info empty-1
 +cmd list_files
 +cmd git log -p
 +cmd guilt pop
 +cmd guilt delete -f empty-1
 +cmd list_files
 +
 +# Empty message + non-empty message
 +echo %% empty + non-empty (diffstat=$using_diffstat)
 +cmd guilt new empty
 +fixup_time_info empty
 +cmd echo test  a

I see these redirected echos... what are they for?

 +cmd guilt new -f -s -m A commit message. non-empty
 +fixup_time_info non-empty
 +cmd guilt pop
 +cmd guilt fold non-empty
 +fixup_time_info empty
 +cmd list_files
 +cmd git log -p
 +cmd guilt pop
 +cmd guilt delete -f empty
 +cmd list_files

Maybe make two helper functions.. one to make a patch with an empty message
and one to make a patch with a non-empty message.  Then each of these blocks
would look a bit cleaner.

echo %% empty + non-empty (diffstat=$using_diffstat)
empty_patch empty
nonempty_patch non-empty
cmd guilt pop non-empty
cmd guilt fold non-empty
fixup_time_info empty
cmd list_files
cleanup empty
cmd list_files

cleanup()
{
guilt pop $1
guilt delete -f $1
}

Eh, it's not as clean as I thought it would be, but I think it's still a
bit better.  Ok, how about:

for using_diffstat in true false ; do
for patcha in empty nonempty ; do
for patchb in empty nonempty ; do
echo %% $patcha + $patchb (diffstat=$using_diffstat)
${patcha}_patch $patcha
${patchb}_patch $patchb
cmd guilt pop $patchb
cmd guilt fold $patchb
fixup_time_info $patcha
cmd 

Re: [GUILT 10/28] Run test_failed if the exit status of a test script is bad.

2014-05-06 Thread Jeff Sipek
On Fri, Mar 21, 2014 at 08:31:48AM +0100, Per Cederqvist wrote:
 There were two problems with the old code:
 
  - Since set -e is in effect (that is set in scaffold) the run-test
script exited immediately if a t-*.sh script failed.  This is not
nice, as we want the error report that test_failed prints.
 
  - The code ran cd - between running the t-*.sh script and checking
the exit status, so the exit status was lost.  (Actually, the exit
status was saved in $ERR, but nothing ever looked at $ERR.)

Oops :)

 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  regression/run-tests | 11 ---
  1 file changed, 8 insertions(+), 3 deletions(-)
 
 diff --git a/regression/run-tests b/regression/run-tests
 index a10e796..d39f9ef 100755
 --- a/regression/run-tests
 +++ b/regression/run-tests
 @@ -55,11 +55,16 @@ function run_test
  
   # run the test
   cd $REPODIR  /dev/null
 - $REG_DIR/t-$1.sh 21  $LOGFILE
 - ERR=$?
 + if $REG_DIR/t-$1.sh 21  $LOGFILE
 + then
 + ERR=false
 + else
 + ERR=true

I'm going to comment on this here... Coding style.  Guilt is a bit of a
hodge-podge of style as my personal style for shell changed over the years
and various contributors threw in some more.  I need to get better at
spotting style mismatch during review.  With that said, I have two comments
about the above:

(1) I'd put the 'then' on the same line as 'if' but I don't feel strongly
enough about this to reject this patch.

(2) Tabs for indentation.  I do feel strongly about this one :)

Jeff.

 + fi
 +
   cd -  /dev/null
  
 - [ $? -ne 0 ]  test_failed
 + $ERR  test_failed
   diff -u t-$1.out $LOGFILE || test_failed
  
   echo done.
 -- 
 1.8.3.1
 

-- 
I'm somewhere between geek and normal.
- Linus Torvalds
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 11/28] test suite: remove pointless redirection.

2014-05-06 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Fri, Mar 21, 2014 at 08:31:49AM +0100, Per Cederqvist wrote:
 The shouldfail function already redirects stderr to stdout, so there
 is no need to do the same in t-028.sh and t-021.sh.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  regression/t-021.sh | 2 +-
  regression/t-025.sh | 2 +-
  regression/t-028.sh | 2 +-
  3 files changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/regression/t-021.sh b/regression/t-021.sh
 index 6337d7b..614e870 100755
 --- a/regression/t-021.sh
 +++ b/regression/t-021.sh
 @@ -61,7 +61,7 @@ for n in `_seq -2 $npatches`; do
   if [ $n -gt 0 ]; then
   cmd guilt pop -n $n
   else
 - shouldfail guilt pop -n $n 21
 + shouldfail guilt pop -n $n
   fi
  
   cmd list_files
 diff --git a/regression/t-025.sh b/regression/t-025.sh
 index 3824608..985fed4 100755
 --- a/regression/t-025.sh
 +++ b/regression/t-025.sh
 @@ -44,7 +44,7 @@ shouldfail guilt new white space
  cmd list_files
  
  for pname in prepend mode /abc ./blah ../blah abc/./blah abc/../blah abc/. 
 abc/.. abc/ ; do
 - shouldfail guilt new $pname 21
 + shouldfail guilt new $pname
  
   cmd list_files
  done
 diff --git a/regression/t-028.sh b/regression/t-028.sh
 index 8480100..88e9adb 100755
 --- a/regression/t-028.sh
 +++ b/regression/t-028.sh
 @@ -29,6 +29,6 @@ guilt series | while read n; do
   cmd guilt header $n
  done
  
 -shouldfail guilt header non-existant 21
 +shouldfail guilt header non-existant
  
  # FIXME: how do we check that -e works?
 -- 
 1.8.3.1
 

-- 
Failure is not an option,
It comes bundled with your Microsoft product.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 17/28] guilt graph no longer loops when no patches are applied.

2014-05-06 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Fri, Mar 21, 2014 at 08:31:55AM +0100, Per Cederqvist wrote:
 Give an error message if no patches are applied.  Added a test case
 that never terminates unless this fix is applied.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt-graph  | 10 --
  regression/t-033.out |  3 +++
  regression/t-033.sh  | 11 +++
  3 files changed, 22 insertions(+), 2 deletions(-)
  create mode 100644 regression/t-033.out
  create mode 100755 regression/t-033.sh
 
 diff --git a/guilt-graph b/guilt-graph
 index b3469dc..00301d5 100755
 --- a/guilt-graph
 +++ b/guilt-graph
 @@ -17,8 +17,14 @@ fi
  
  patchname=$1
  
 -bottom=`git rev-parse refs/patches/$branch/$(head_n 1  $applied)`
 -base=`git rev-parse $bottom^`
 +bottompatch=$(head_n 1  $applied)
 +if [ -z $bottompatch ]
 +then
 + echo No patch applied. 2
 + exit 1
 +fi
 +
 +base=`git rev-parse refs/patches/${branch}/${bottompatch}^`
  
  if [ -z $patchname ]; then
   top=`git rev-parse HEAD`
 diff --git a/regression/t-033.out b/regression/t-033.out
 new file mode 100644
 index 000..76613f9
 --- /dev/null
 +++ b/regression/t-033.out
 @@ -0,0 +1,3 @@
 +% setup_repo
 +% guilt graph
 +No patch applied.
 diff --git a/regression/t-033.sh b/regression/t-033.sh
 new file mode 100755
 index 000..ae40577
 --- /dev/null
 +++ b/regression/t-033.sh
 @@ -0,0 +1,11 @@
 +#!/bin/bash
 +#
 +# Test the graph code
 +#
 +
 +source $REG_DIR/scaffold
 +
 +cmd setup_repo
 +
 +shouldfail guilt graph
 +
 -- 
 1.8.3.1
 

-- 
You measure democracy by the freedom it gives its dissidents, not the
freedom it gives its assimilated conformists.
- Abbie Hoffman
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 18/28] guilt-graph: Handle commas in branch names.

2014-05-06 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Fri, Mar 21, 2014 at 08:31:56AM +0100, Per Cederqvist wrote:
 This fix relies on the fact that git branch names can not contain :.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt-graph | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/guilt-graph b/guilt-graph
 index 00301d5..575f03b 100755
 --- a/guilt-graph
 +++ b/guilt-graph
 @@ -52,7 +52,7 @@ safebranch=`echo $branch|sed 's%/%/%g'`
  while [ $current != $base ]; do
   pname=`git show-ref | sed -n -e 
  /^$current refs\/patches\/$safebranch/ {
 - s,^$current refs/patches/$branch/,,
 + s:^$current refs/patches/$branch/::
   p
   q
  }`
 -- 
 1.8.3.1
 

-- 
Computer Science is no more about computers than astronomy is about
telescopes.
- Edsger Dijkstra
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 19/28] Check that guilt graph works when working on a branch with a comma.

2014-05-06 Thread Jeff Sipek
On Fri, Mar 21, 2014 at 08:31:57AM +0100, Per Cederqvist wrote:
 git branch names can contain commas.  Check that guilt graph works
 even in that case.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  regression/t-033.out | 62 
 
  regression/t-033.sh  | 37 +++
  2 files changed, 99 insertions(+)
 
 diff --git a/regression/t-033.out b/regression/t-033.out
 index 76613f9..e638d7b 100644
 --- a/regression/t-033.out
 +++ b/regression/t-033.out
 @@ -1,3 +1,65 @@
  % setup_repo
  % guilt graph
  No patch applied.
 +% git checkout -b a,graph master
 +Switched to a new branch 'a,graph'
 +% guilt init
 +% guilt new a.patch
 +% guilt pop
 +All patches popped.
 +% guilt push
 +Applying patch..a.patch
 +Patch applied.
 +% guilt graph
 +digraph G {
 +# checking rev 95275d7c05c6a6176d3941374115b91272877f6c
 + 95275d7c05c6a6176d3941374115b91272877f6c [label=a.patch]
 +}
 +% git add file.txt
 +% guilt refresh
 +Patch a.patch refreshed
 +% guilt pop
 +All patches popped.
 +% guilt push
 +Applying patch..a.patch
 +Patch applied.
 +% guilt graph
 +digraph G {
 +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d
 + ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch]
 +}
 +% guilt new b.patch
 +% git add file2.txt
 +% guilt refresh
 +Patch b.patch refreshed
 +% guilt pop
 +Now at a.patch.
 +% guilt push
 +Applying patch..b.patch
 +Patch applied.
 +% guilt graph
 +digraph G {
 +# checking rev c7014443c33d2b0237293687ceb9cbd38313df65
 + c7014443c33d2b0237293687ceb9cbd38313df65 [label=b.patch]
 +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d
 + ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch]
 +}
 +% guilt new c.patch
 +% git add file.txt
 +% guilt refresh
 +Patch c.patch refreshed
 +% guilt pop
 +Now at b.patch.
 +% guilt push
 +Applying patch..c.patch
 +Patch applied.
 +% guilt graph
 +digraph G {
 +# checking rev 891bc14b5603474c9743fd04f3da888644413dc5
 + 891bc14b5603474c9743fd04f3da888644413dc5 [label=c.patch]
 +# checking rev c7014443c33d2b0237293687ceb9cbd38313df65
 + c7014443c33d2b0237293687ceb9cbd38313df65 [label=b.patch]
 +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d
 + ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch]
 + 891bc14b5603474c9743fd04f3da888644413dc5 - 
 ff2775f8d1dc753f635830adcc3a067e0b681e2d; // ?
 +}
 diff --git a/regression/t-033.sh b/regression/t-033.sh
 index ae40577..57dce78 100755
 --- a/regression/t-033.sh
 +++ b/regression/t-033.sh
 @@ -3,9 +3,46 @@
  # Test the graph code
  #
  
 +function fixup_time_info
 +{
 + cmd guilt pop
 + touch -a -m -t $TOUCH_DATE .git/patches/a,graph/$1
 + cmd guilt push
 +}
 +
  source $REG_DIR/scaffold
  
  cmd setup_repo
  

A comment here to justify this seemingly useless guilt-graph call?  Maybe
adding one of the '%%' lines between each section.  Otherwise, this looks
good.

  shouldfail guilt graph
  
 +cmd git checkout -b a,graph master
 +
 +cmd guilt init
 +
 +cmd guilt new a.patch
 +
 +fixup_time_info a.patch
 +cmd guilt graph
 +
 +cmd echo a  file.txt
 +cmd git add file.txt
 +cmd guilt refresh
 +fixup_time_info a.patch
 +cmd guilt graph
 +
 +# An unrelated file. No deps.
 +cmd guilt new b.patch
 +cmd echo b  file2.txt
 +cmd git add file2.txt
 +cmd guilt refresh
 +fixup_time_info b.patch
 +cmd guilt graph
 +
 +# An change to an old file. Should add a dependency.
 +cmd guilt new c.patch
 +cmd echo c  file.txt
 +cmd git add file.txt
 +cmd guilt refresh
 +fixup_time_info c.patch
 +cmd guilt graph
 -- 
 1.8.3.1
 

-- 
It used to be said [...] that AIX looks like one space alien discovered
Unix, and described it to another different space alien who then implemented
AIX. But their universal translators were broken and they'd had to gesture a
lot.
- Paul Tomblin 
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 20/28] guilt graph: Handle patch names containing quotes.

2014-05-06 Thread Jeff Sipek
On Fri, Mar 21, 2014 at 03:57:37AM -0400, Eric Sunshine wrote:
 On Fri, Mar 21, 2014 at 3:31 AM, Per Cederqvist ced...@opera.com wrote:
  Quote quotes with a backslash in the guitl graph output.  Otherwise,
 
 s/guitl/guilt/

Yep.

  the dot file could contain syntax errors.
 
  Added a test case.
  ---
   guilt-graph  |  2 ++
   regression/t-033.out | 22 ++
   regression/t-033.sh  |  9 +
   3 files changed, 33 insertions(+)
 
  diff --git a/guilt-graph b/guilt-graph
  index 575f03b..24ab83b 100755
  --- a/guilt-graph
  +++ b/guilt-graph
  @@ -58,6 +58,8 @@ while [ $current != $base ]; do
   }`
  [ -z $pname ]  pname=?
 
  +   pname=`printf \%s\ $pname|sed 's/\/\/g'`

Some of this filtering is getting a bit unwieldy.  I'd add spaces around the
|.  Do we want to be paranoid and add quotes around $pname?  If not, then it
looks good.

  +
  disp # checking rev $current
  disp   \$current\ [label=\$pname\]
 
  diff --git a/regression/t-033.out b/regression/t-033.out
  index e638d7b..1c28ea9 100644
  --- a/regression/t-033.out
  +++ b/regression/t-033.out
  @@ -63,3 +63,25 @@ digraph G {
  ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch]
  891bc14b5603474c9743fd04f3da888644413dc5 - 
  ff2775f8d1dc753f635830adcc3a067e0b681e2d; // ?
   }
  +% guilt new a-betterquicker'-patch.patch
  +% git add file.txt
  +% guilt refresh
  +Patch a-betterquicker'-patch.patch refreshed
  +% guilt pop
  +Now at c.patch.
  +% guilt push
  +Applying patch..a-betterquicker'-patch.patch
  +Patch applied.
  +% guilt graph
  +digraph G {
  +# checking rev bc7df666a646739eaf559af23cab72f2bfd01f0e
  +   bc7df666a646739eaf559af23cab72f2bfd01f0e 
  [label=a-\betterquicker'-patch.patch]
  +# checking rev 891bc14b5603474c9743fd04f3da888644413dc5
  +   891bc14b5603474c9743fd04f3da888644413dc5 [label=c.patch]
  +   bc7df666a646739eaf559af23cab72f2bfd01f0e - 
  891bc14b5603474c9743fd04f3da888644413dc5; // ?
  +# checking rev c7014443c33d2b0237293687ceb9cbd38313df65
  +   c7014443c33d2b0237293687ceb9cbd38313df65 [label=b.patch]
  +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d
  +   ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch]
  +   891bc14b5603474c9743fd04f3da888644413dc5 - 
  ff2775f8d1dc753f635830adcc3a067e0b681e2d; // ?
  +}
  diff --git a/regression/t-033.sh b/regression/t-033.sh
  index 57dce78..968292c 100755
  --- a/regression/t-033.sh
  +++ b/regression/t-033.sh
  @@ -46,3 +46,12 @@ cmd git add file.txt
   cmd guilt refresh
   fixup_time_info c.patch
   cmd guilt graph
  +
  +# A patch name that contains funky characters, including unbalanced
  +# quotes.
  +cmd guilt new a-\betterquicker'-patch.patch
  +cmd echo d  file.txt
  +cmd git add file.txt
  +cmd guilt refresh
  +fixup_time_info a-\betterquicker'-patch.patch
  +cmd guilt graph
  --
  1.8.3.1
 
  --
  To unsubscribe from this list: send the line unsubscribe git in
  the body of a message to majord...@vger.kernel.org
  More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
All parts should go together without forcing.  You must remember that the
parts you are reassembling were disassembled by you.  Therefore, if you
can’t get them together again, there must be a reason.  By all means, do not
use a hammer.
— IBM Manual, 1925
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 21/28] The log.decorate setting should not influence import-commit.

2014-05-06 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Fri, Mar 21, 2014 at 08:31:59AM +0100, Per Cederqvist wrote:
 Use --no-decorate in the call to git log that tries to read the commit
 message to produce patch names.  Otherwise, if the user has set
 log.decorate to short or full, the patch name will be less useful.
 
 Modify the t-034.sh test case to demonstrate that this is needed.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt-import-commit  | 2 +-
  regression/t-034.out | 2 ++
  regression/t-034.sh  | 2 ++
  3 files changed, 5 insertions(+), 1 deletion(-)
 
 diff --git a/guilt-import-commit b/guilt-import-commit
 index 6eb2f4e..703f034 100755
 --- a/guilt-import-commit
 +++ b/guilt-import-commit
 @@ -26,7 +26,7 @@ disp About to begin conversion... 2
  disp Current head: `cat \$GIT_DIR\/refs/heads/\`git_branch\`` 2
  
  for rev in `git rev-list $rhash`; do
 - s=`git log --pretty=oneline -1 $rev | cut -c 42-`
 + s=`git log --no-decorate --pretty=oneline -1 $rev | cut -c 42-`
  
   # Try to convert the first line of the commit message to a
   # valid patch name.
 diff --git a/regression/t-034.out b/regression/t-034.out
 index bda4399..5d81bd4 100644
 --- a/regression/t-034.out
 +++ b/regression/t-034.out
 @@ -232,6 +232,7 @@ Date:   Mon Jan 1 00:00:00 2007 +
  
  Signed-off-by: Commiter Name commiter@email
  % guilt init
 +% git config log.decorate short
  % guilt import-commit base..HEAD
  About to begin conversion...
  Current head: 2a8b1889aa5066193bac978e6bf5073ffcfa6541
 @@ -259,6 +260,7 @@ Converting 45e81b51 as the_sequence_.lock-_is_forbidden
  Converting eebb76e9 as the_sequence_-._is_forbidden
  Done.
  Current head: d4850419ccc1146c7169f500725ce504b9774ed0
 +% git config log.decorate no
  % guilt push -a
  Applying patch..the_sequence_-._is_forbidden.patch
  Patch applied.
 diff --git a/regression/t-034.sh b/regression/t-034.sh
 index 1055ddb..8179bc7 100755
 --- a/regression/t-034.sh
 +++ b/regression/t-034.sh
 @@ -57,7 +57,9 @@ cmd git log
  
  # Import all the commits to guilt.
  cmd guilt init
 +cmd git config log.decorate short
  cmd guilt import-commit base..HEAD
 +cmd git config log.decorate no
  
  for patch in .git/patches/master/*.patch
  do
 -- 
 1.8.3.1
 

-- 
Evolution, n.:
  A hypothetical process whereby infinitely improbable events occur with
  alarming frequency, order arises from chaos, and no one is given credit.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 22/28] The log.decorate setting should not influence patchbomb.

2014-05-06 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Fri, Mar 21, 2014 at 08:32:00AM +0100, Per Cederqvist wrote:
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt-patchbomb | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/guilt-patchbomb b/guilt-patchbomb
 index 1231418..164b10c 100755
 --- a/guilt-patchbomb
 +++ b/guilt-patchbomb
 @@ -47,7 +47,7 @@ if [ $? -ne 0 ]; then
  fi
  
  # display the list of commits to be sent as patches
 -git log --pretty=oneline $r | cut -c 1-8,41- | $pager
 +git log --no-decorate --pretty=oneline $r | cut -c 1-8,41- | $pager
  
  _disp Are these what you want to send? [Y/n] 
  read n
 -- 
 1.8.3.1
 

-- 
Ready; T=0.01/0.01 16:41:35
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 23/28] The log.decorate setting should not influence guilt rebase.

2014-05-06 Thread Jeff Sipek
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net

On Fri, Mar 21, 2014 at 08:32:01AM +0100, Per Cederqvist wrote:
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt-rebase | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/guilt-rebase b/guilt-rebase
 index fd28e48..a1714a0 100755
 --- a/guilt-rebase
 +++ b/guilt-rebase
 @@ -66,7 +66,7 @@ pop_all_patches
  git merge --no-commit $upstream  /dev/null 2 /dev/null
  
  disp 
 -log=`git log -1 --pretty=oneline`
 +log=`git log -1 --no-decorate --pretty=oneline`
  disp HEAD is now at `echo $log | cut -c 1-7`... `echo $log | cut -c 41-`
  
  #
 -- 
 1.8.3.1
 

-- 
Don't drink and derive. Alcohol and algebra don't mix.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 04/28] Allow guilt import-commit to run from a dir which contains spaces.

2014-03-23 Thread Jeff Sipek
On Fri, Mar 21, 2014 at 08:31:42AM +0100, Per Cederqvist wrote:
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt-import-commit | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/guilt-import-commit b/guilt-import-commit
 index 20dcee2..9488ded 100755
 --- a/guilt-import-commit
 +++ b/guilt-import-commit
 @@ -23,7 +23,7 @@ if ! must_commit_first; then
  fi
  
  disp About to begin conversion... 2
 -disp Current head: `cat $GIT_DIR/refs/heads/\`git_branch\`` 2
 +disp Current head: `cat \$GIT_DIR\/refs/heads/\`git_branch\`` 2

I wonder if it'd be better to use 'git rev-parse' here instead of looking at
the refs directly.

IOW,

disp Current head: `git rev-parse \`git_branch\`` 2

Maybe even $() instead of the inner `` to clean it up some more.

Jeff.

  
  for rev in `git rev-list $rhash`; do
   s=`git log --pretty=oneline -1 $rev | cut -c 42-`
 @@ -46,7 +46,7 @@ for rev in `git rev-list $rhash`; do
   do_make_header $rev
   echo 
   git diff --binary $rev^..$rev
 - )  $GUILT_DIR/$branch/$fname
 + )  $GUILT_DIR/$branch/$fname
  
   # FIXME: grab the GIT_AUTHOR_DATE from the commit object and set the
   # timestamp on the patch
 @@ -68,6 +68,6 @@ for rev in `git rev-list $rhash`; do
  done
  
  disp Done. 2
 -disp Current head: `cat $GIT_DIR/refs/heads/\`git_branch\`` 2
 +disp Current head: `cat \$GIT_DIR\/refs/heads/\`git_branch\`` 2
  
  }
 -- 
 1.8.3.1
 

-- 
It used to be said [...] that AIX looks like one space alien discovered
Unix, and described it to another different space alien who then implemented
AIX. But their universal translators were broken and they'd had to gesture a
lot.
- Paul Tomblin 
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 06/28] Fix and simplify the do_get_patch function.

2014-03-23 Thread Jeff Sipek
On Fri, Mar 21, 2014 at 08:31:44AM +0100, Per Cederqvist wrote:
 When extracting the patch, we only want the actual patches.  We don't
 want the --- delimiter.  Simplify the extraction by simply deleting
 everything before the first diff  line.  (Use sed instead of awk to
 simplify the code.)
 
 Without this patch, guilt fold and guilt push sometimes fails if
 guilt.diffstat is true.
 
 Signed-off-by: Per Cederqvist ced...@opera.com
 ---
  guilt | 7 +--
  1 file changed, 1 insertion(+), 6 deletions(-)
 
 diff --git a/guilt b/guilt
 index 8701481..c59cd0f 100755
 --- a/guilt
 +++ b/guilt
 @@ -332,12 +332,7 @@ do_make_header()
  # usage: do_get_patch patchfile
  do_get_patch()
  {
 - awk '
 -BEGIN{}
 -/^(diff |---$|--- )/ {patch = 1}
 -patch == 1 {print $0}
 -END{}
 -'  $1
 + sed -n '/^diff /,$p'  $1

So, the thought behind this mess was to allow minimal patches to work.  The
'diff' line is *not* required by patch(1)!

Is it a problem if a patch description contains a line that starts with
'diff '?  (The current code has this issue as well.)

For the record, this ambiguity is what's on several occasions made me
consider splitting the header and the patch into separate files.  Yeah, it'd
be messier.  :/

  }
  
  # usage: do_get_header patchfile
 -- 
 1.8.3.1
 

-- 
Defenestration n. (formal or joc.):
  The act of removing Windows from your computer in disgust, usually
  followed by the installation of Linux or some other Unix-like operating
  system.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 04/28] Allow guilt import-commit to run from a dir which contains spaces.

2014-03-23 Thread Jeff Sipek
On Sun, Mar 23, 2014 at 08:57:08PM +0100, Per Cederqvist wrote:
 On Sun, Mar 23, 2014 at 6:04 PM, Jeff Sipek jef...@josefsipek.net wrote:
 
  On Fri, Mar 21, 2014 at 08:31:42AM +0100, Per Cederqvist wrote:
 
  Signed-off-by: Per Cederqvist ced...@opera.com
  ---
   guilt-import-commit | 6 +++---
   1 file changed, 3 insertions(+), 3 deletions(-)
 
  diff --git a/guilt-import-commit b/guilt-import-commit
  index 20dcee2..9488ded 100755
  --- a/guilt-import-commit
  +++ b/guilt-import-commit
  @@ -23,7 +23,7 @@ if ! must_commit_first; then
   fi
 
   disp About to begin conversion... 2
  -disp Current head: `cat $GIT_DIR/refs/heads/\`git_branch\`` 2
  +disp Current head: `cat \$GIT_DIR\/refs/heads/\`git_branch\`` 2
 
  I wonder if it'd be better to use 'git rev-parse' here instead of looking at
  the refs directly.
 
  IOW,
 
  disp Current head: `git rev-parse \`git_branch\`` 2
 
 That is probably a good idea. I only made the minimum change
 required to get the test suite to pass.

I totally understand.

  Maybe even $() instead of the inner `` to clean it up some more.
 
 Yes, given that that construct is already used in several places
 it is apparently portable enough for guilt. (I guess nobody uses
 /bin/sh on Solaris to run guilt. It doesn't support the $(...)
 construct.)

Hrm?  I'm using OpenIndiana (OpenSolaris derivative) and my /bin/sh seems to
be a symlink to ksh93.  What version of Solaris are you seeing this behavior
on?

Jeff.

-- 
The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man.
- George Bernard Shaw
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT 00/28] Teach guilt import-commit how create legal patch names, and more

2014-03-21 Thread Jeff Sipek
On Fri, Mar 21, 2014 at 08:31:38AM +0100, Per Cederqvist wrote:
 I recently found myself sitting on a train with a computer in front of
 me.  I tried to use guilt import-commit, which seemed to work, but
 when I tried to guilt push the commits I had just imported I got
 some errors.  It turned out that guilt import-commit had generated
 invalid patch names.
 
 I decided to fix the issue, and write a test case that demonstrated
 the problem.
 
 One thing led to another, and here I am, a few late nights at a hotel
 and a return trip on the train later, submitting a patch series in 28
 parts.  Sorry about the number of patches, but this is what happens
 when you uncover a bug while writing a test case for the bug you
 uncovered while writing a test case for your original problem.

No problem.  I prefer large number of patches instead of a big wad that's
much harder to follow.

 The patch series consists of:
...
  - Changed behavior: guilt push when there is nothing more to push
now uses exit status 1.  This makes it possible to write shell
loops such as while guilt push; do make test||break; done.  Also,
guilt pop when no patches are applied also uses exit status 1.
(This aligns guilt push and guilt pop with how hg qpush and
hg qpop has worked for several years.)

Sounds fine.

  - Changed behavior: by default, guilt no longer changes branch when
you push a patch.  You need to do git config guilt.reusebranch
false to re-enable that.  This patch sets the default value of
guilt.reusebranch to true; it should in my opinion change to false
a year or two after the next release.

Probably a fair thing to do.  I should really make a release soon :/

I'm sending this off before I go through all the patches so you know that
I've seen this and plan to comment/pull.  It'll probably take a bit to go
through all 28 :)

Thanks,

Jeff.

-- 
Ready; T=0.01/0.01 08:47:23
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT] add FreeBSD support

2013-08-20 Thread Josef 'Jeff' Sipek
On Tue, Aug 20, 2013 at 03:44:16PM +0800, Zheng Liu wrote:
 Hi Josef,
 
 On Fri, Aug 09, 2013 at 11:20:46AM -0400, Josef 'Jeff' Sipek wrote:
  On Fri, Aug 09, 2013 at 11:04:45PM +0800, gnehzuil.liu wrote:
   ?? 2013-8-9??10:46??Josef 'Jeff' Sipek jef...@josefsipek.net д
   
On Fri, Aug 09, 2013 at 08:32:28PM +0800, Zheng Liu wrote:
From: Zheng Liu gnehzuil@gmail.com

Currently guilt doesn't support FreeBSD platform.  This commit tries to
add this support.  The file called 'os.FreeBSD' is copied from 
os.Darwin
due to these two platforms have almost the same command tools.

Out of curiosity, is it identical?  I eyeballed it, and they do look
identical.  There's probably a better way to do this whole os-specific
thing, but this will work well enough for now.
   
   Yes, it is identical.  Sorry, I am a newbie for guilt, but I am happy to
   improve this os-specific thing.Any idea?
  
  So, I'm a bit torn between some build-time checking that generates
  something like an os file based on what it detects and something that
  happens at runtime.  I like that currently there's nothing to do - you just
  clone the repo and you're set.  At the same time, the more code can be
  avoided executing the faster (in theory) guilt gets.
 
 Sorry for the late reply.  I did a simple experiment that tries to fold
 all os.* files into one file and uses a if statement to export functions
 according to different platforms.  But frankly I don't like this because
 it is not very clearly.  So IMHO we'd better add a 'os.FreeBSD' file to
 support FreeBSD platform.

Yeah, sounds like the simplest (at least for the moment).  I'll commit it.
Thanks.

FWIW, the idea I was thinking about was to make make all figure out
various parts of the system and construct an os file.

Jeff.

-- 
UNIX is user-friendly ... it's just selective about who its friends are
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT] add FreeBSD support

2013-08-09 Thread Josef 'Jeff' Sipek
On Fri, Aug 09, 2013 at 08:32:28PM +0800, Zheng Liu wrote:
 From: Zheng Liu gnehzuil@gmail.com
 
 Currently guilt doesn't support FreeBSD platform.  This commit tries to
 add this support.  The file called 'os.FreeBSD' is copied from os.Darwin
 due to these two platforms have almost the same command tools.

Out of curiosity, is it identical?  I eyeballed it, and they do look
identical.  There's probably a better way to do this whole os-specific
thing, but this will work well enough for now.

Jeff.

 Signed-off-by: Zheng Liu gnehzuil@gmail.com
 ---
 Hi all,
 
 After applied this patch, the regression test 010 and 060 will fail because
 of the output format.  After fixing these issues, all the regression tests
 will pass.
 
 P.S. I don't subscribe git@ mailing list.  So please put my email address
 in Cc list.  Thanks!
 
 Regards,
   - Zheng
 
  os.FreeBSD | 70 
 ++
  1 file changed, 70 insertions(+)
  create mode 100644 os.FreeBSD
 
 diff --git a/os.FreeBSD b/os.FreeBSD
 new file mode 100644
 index 000..3f23121
 --- /dev/null
 +++ b/os.FreeBSD
 @@ -0,0 +1,70 @@
 +# usage: touch_date unix ts file
 +touch_date()
 +{
 + touch -t `date -r $1 +%Y%m%d%H%M.%S` $2
 +}
 +
 +# usage: last_modified file
 +last_modified()
 +{
 + stat -f %m $1
 +}
 +
 +# usage: format_last_modified file
 +format_last_modified()
 +{
 + stat -f %Sm -t %Y-%m-%d %H:%M:%S %z $1
 +}
 +
 +# usage: head_n [count]
 +head_n()
 +{
 + if [ $1 -gt 0 ]; then
 + head -n $1
 + fi
 +}
 +
 +# usage: sha1 [file]
 +sha1()
 +{
 + if [ $# = 1 ]
 + then
 + openssl dgst -sha1 $1 | sed s,SHA1.\(.*\).= \(.*\),\2  \1,
 + else
 + openssl dgst -sha1 | sed 's,\(.*= \)*\(.*\),\2  -,'
 + fi
 +}
 +
 +# usage: cp_a src dst
 +cp_a()
 +{
 + cp -pR $1 $2
 +}
 +
 +# usage: _tac
 +_tac()
 +{
 + sed -e '1!G;h;$!d'
 +}
 +
 +_seq()
 +{
 + (
 + if [ $# -eq 1 ]
 + then
 + /usr/bin/jot $1
 + elif [ $# -eq 2 ]
 + then
 + n1=$((${2} - ${1} + 1))
 + n2=$1
 + /usr/bin/jot $n1 $n2
 + elif [ $# -eq 3 ]
 + then
 + num1=$1
 + incr=$2
 + num2=$3
 + /usr/bin/awk -v n1=$num1 -v n2=$num2 -v add=$incr 
 'BEGIN{ for(i=n1; i=n2; i+=add) print i;}' | /usr/bin/sed -E 
 '/e/s/^.+e.+$/0/'
 + fi
 + )
 + return 0
 +}
 -- 
 1.8.3.4
 

-- 
Research, n.:
  Consider Columbus:
He didn't know where he was going.
When he got there he didn't know where he was.
When he got back he didn't know where he had been.
And he did it all on someone else's money.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GUILT] add FreeBSD support

2013-08-09 Thread Josef 'Jeff' Sipek
On Fri, Aug 09, 2013 at 11:04:45PM +0800, gnehzuil.liu wrote:
 �� 2013-8-9��10:46��Josef 'Jeff' Sipek jef...@josefsipek.net д
 
  On Fri, Aug 09, 2013 at 08:32:28PM +0800, Zheng Liu wrote:
  From: Zheng Liu gnehzuil@gmail.com
  
  Currently guilt doesn't support FreeBSD platform.  This commit tries to
  add this support.  The file called 'os.FreeBSD' is copied from os.Darwin
  due to these two platforms have almost the same command tools.
  
  Out of curiosity, is it identical?  I eyeballed it, and they do look
  identical.  There's probably a better way to do this whole os-specific
  thing, but this will work well enough for now.
 
 Yes, it is identical.  Sorry, I am a newbie for guilt, but I am happy to
 improve this os-specific thing.Any idea?

So, I'm a bit torn between some build-time checking that generates
something like an os file based on what it detects and something that
happens at runtime.  I like that currently there's nothing to do - you just
clone the repo and you're set.  At the same time, the more code can be
avoided executing the faster (in theory) guilt gets.

Feel free to experiment.

Jeff.

-- 
The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man.
- George Bernard Shaw
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] guilt: fix date parsing

2013-05-22 Thread Josef 'Jeff' Sipek
On Wed, May 22, 2013 at 08:10:10AM -0400, Theodore Ts'o wrote:
 On Tue, May 21, 2013 at 11:39:21PM -0400, Josef 'Jeff' Sipek wrote:
  I applied this one and the guilt: skip empty line after... patch.
 
 Thanks!  BTW, it looks like you are not using git am -s to apply
 these patches?  The reason why I ask is that whatever you're using
 isn't removing the [XXX] subject prefix (e.g., [PATCH] or [PATCH -v2]
 which is useful for mailing lists, but less useful in the git commit
 descriptions.
 
 If you're using guilt, do you have some script that preformats a Unix
 mbox into guilt-friendly files?  If so, maybe it would be good to
 modify it to strip out the [PATCH] annotations.  If not, let me know,
 since I've been thinking about writing a script to take a Unix mbox,
 and bursts it into a separate patch-per-file with a series file
 suitable for use by guilt, removing mail headers and doing other
 appropriate pre-parsing --- basically, a guilt am which works much
 like git am.  But if someone else has done this already, no point
 duplicating effort.  :-)

You are correct.  I just `guilt import -P blah /tmp/mdir/cur/X` and then
hand-edit the patch to remove headers.  Last night I was thinking about
making a `guilt import-mbox` that'd import a mbox or maildir.  I don't know
off the top of my head how much `git am` would help in this instance.

Feel free to make the import-mbox or whatever command :)

Jeff.

-- 
Only two things are infinite, the universe and human stupidity, and I'm not
sure about the former.
- Albert Einstein
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Added guilt.reusebranch configuration option.

2013-05-22 Thread Josef 'Jeff' Sipek
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 ced...@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 000..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  

Re: [PATCH] Added guilt.reusebranch configuration option.

2013-05-22 Thread Josef 'Jeff' Sipek
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...
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] guilt: force the use of bare branches

2013-05-21 Thread Josef 'Jeff' Sipek
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 ty...@mit.edu
 Cc: Per Cederqvist ced...@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. 
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] guilt: fix date parsing

2013-05-21 Thread Josef 'Jeff' Sipek
I applied this one and the guilt: skip empty line after... patch.

Jeff.

On Tue, May 21, 2013 at 11:13:31PM -0400, Theodore Ts'o wrote:
 If the date field has a space in it, such as:
 
Date: Tue, 14 May 2013 18:37:15 +0200
 
 previously guilt would go belly up:
 
+ export GIT_AUTHOR_DATE=Tue, 14 May 2013 18:37:15 +0200
/usr/local/bin/guilt: 571: export: 14: bad variable name
 
 Fix this.
 
 Signed-off-by: Theodore Ts'o ty...@mit.edu
 ---
  guilt | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/guilt b/guilt
 index 9953bdf..6e8d542 100755
 --- a/guilt
 +++ b/guilt
 @@ -568,7 +568,7 @@ commit()
   author_date_str=`sed -n -e '/^Date:/ { s/^Date: 
 //; p; q; }; /^(diff |---$|--- )/ q' $p`
   fi
   if [ ! -z $author_date_str ]; then
 - export GIT_AUTHOR_DATE=`echo $author_date_str`
 + export GIT_AUTHOR_DATE=$author_date_str
   fi
   fi
  
 -- 
 1.7.12.rc0.22.gcdd159b
 

-- 
The obvious mathematical breakthrough would be development of an easy way to
factor large prime numbers.
- Bill Gates, The Road Ahead, pg. 265
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/7] guilt patches, including git 1.8 support

2013-01-27 Thread Josef 'Jeff' Sipek
On Tue, Jan 15, 2013 at 06:26:06PM -0800, Jonathan Nieder wrote:
 Hi Jeff and other guilty parties,
 
 I collected all the guilt patches I could find on-list and added one
 of my own.  Completely untested, except for running the regression
 tests.  These are also available via git protocol from
 
   git://repo.or.cz/guilt/mob.git mob
 
 Thoughts?

Sorry for taking so long.  I finally reclaimed access to
git://repo.or.cz/guilt.git.  I pulled from mob, and merged it with what I
had locally.

http://repo.or.cz/w/guilt.git

Thanks for collecting all these in one place!

Jeff.

 Jonathan Nieder (1):
   Drop unneeded git version check.
 
 Per Cederqvist (6):
   get rid of cat: write error: Broken pipe error message
   The tests should not fail if log.date or log.decorate are set.
   Testsuite: get rid of Broken pipe errors from yes.
   Handle empty patches and patches with only a header.
   Fix fatal guilt graph error in sha1sum invocation.
   Change git branch when patches are applied.
 
  Documentation/guilt.7 |   4 +
  guilt |  73 +---
  guilt-branch  |  12 +-
  guilt-commit  |   7 +
  guilt-import-commit   |   4 +-
  guilt-repair  |   7 +-
  os.Darwin |   7 +-
  os.Linux  |   7 +-
  os.SunOS  |   7 +-
  regression/scaffold   |   7 +-
  regression/t-029.sh   |   6 +-
  regression/t-052.out  |  24 +--
  regression/t-052.sh   |   7 +-
  regression/t-061.out  | 468 
 ++
  regression/t-061.sh   | 148 
  15 files changed, 743 insertions(+), 45 deletions(-)
  create mode 100644 regression/t-061.out
  create mode 100755 regression/t-061.sh

-- 
I have always wished for my computer to be as easy to use as my telephone;
my wish has come true because I can no longer figure out how to use my
telephone.
- Bjarne Stroustrup
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/7] guilt patches, including git 1.8 support

2013-01-20 Thread Josef 'Jeff' Sipek
On Sun, Jan 20, 2013 at 10:19:39PM +0100, Per Cederqvist wrote:
 On 01/16/13 03:26, Jonathan Nieder wrote:
 Hi Jeff and other guilty parties,
 
 I collected all the guilt patches I could find on-list and added one
 of my own.  Completely untested, except for running the regression
 tests.  These are also available via git protocol from
 
git://repo.or.cz/guilt/mob.git mob
 
 Thoughts?
 
 Regarding the Change git branch when patches are applied feature,
 it has saved me a number of times since I implemented it. I've been
 using it extensively, and have not had any problems with it.
 
 Nevertheless, for backwards compatibility with the currently
 released guilt version I think it should be conditional, and
 disabled per default for one full release cycle.  I've implemented
 this. My code is available from git://repo.or.cz/guilt/ceder.git
 
 The following commits are not included in your list:
 
 a194375 Added guilt.reusebranch configuration option.
 1dd97bd Minor testsuite fix.
 640caee The tests should not fail if guilt.diffstat is set.

At $WORK, we started doing thorough reviews before committing.  I'm kinda
sold on this feature.  I agree with the off-by-default config flag.

 I don't want Guilt to fork. Jeff, it would be really great if
 you could set up a public repo again!

Yep.  I'm trying to reclaim control of the repo.or.cz guilt repo... I no
longer have access to jsi...@cs.sunysb.edu and I don't remember the
password.

Jeff.

-- 
NT is to UNIX what a doughnut is to a particle accelerator.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/7] guilt patches, including git 1.8 support

2013-01-16 Thread Josef 'Jeff' Sipek
On Tue, Jan 15, 2013 at 10:26:06PM -0500, Theodore Ts'o wrote:
 On Tue, Jan 15, 2013 at 06:26:06PM -0800, Jonathan Nieder wrote:
  Hi Jeff and other guilty parties,
  
  I collected all the guilt patches I could find on-list and added one
  of my own.  Completely untested, except for running the regression
  tests.  These are also available via git protocol from
  
git://repo.or.cz/guilt/mob.git mob
 
 Jonathan, thanks for collecting all of the guilt patches!  Your repro
 was also very much really useful since I hadn't grabbed the latest
 patches from jeffpc's repo before it disappeared after the kernel.org
 security shutdown.  

I had repo.or.cz mirroring all along.  :)

 Jeff, do you need some help getting your repro on kernel.org
 re-established?

Yes and no.  I was hoping to find some time to restore all the web content
on my server, and start using repo.or.cz as the public git repo.  With that
said, I have only two sigs for my gpg key.  (Guilt isn't really related to
linux...)

Thanks,

Jeff.

-- 
Only two things are infinite, the universe and human stupidity, and I'm not
sure about the former.
- Albert Einstein
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html