Re: [PATCH] request-pull: resurrect for-linus - tags/for-linus DWIM

2014-05-18 Thread Michael S. Tsirkin
On Fri, May 16, 2014 at 10:57:50AM -0700, Junio C Hamano wrote:
 Older versions of Git before v1.7.10 did not DWIM
 
 $ git pull $URL for-linus
 
 to the tag tags/for-linus and the users were required to say
 
 $ git pull $URL tags/for-linus
 
 instead.  Because newer versions of Git works either way,
 request-pull used to show tags/for-linus when asked
 
 $ git request-pull origin/master $URL for-linus
 
 The recent updates broke this and in the output we see for-linus
 without the tags/ prefix.
 
 As v1.7.10 is more than 2 years old, this should matter very little
 in practice, but resurrecting it is very simple.

Well RHEL6 apparently comes with git 1.7.1, there are
probably others.

The problem isn't theorectical actually,
the reason I noticed the change in behaviour is because one of
my pull requests got bounced because of it:
http://article.gmane.org/gmane.comp.emulators.qemu/273121


 Signed-off-by: Junio C Hamano gits...@pobox.com


Tested-by: Michael S. Tsirkin m...@redhat.com

 ---
 
  * I _think_ the fix, without breaking the spirit of Linus's I do
not want the thing DWIM based on what the remote end has
original, would be as simple as this patch.  We can queue it as a
regression fix and do another round of -rc4 if those who depend
on request-pull heavily feel strongly about it.
 
  git-request-pull.sh | 6 ++
  t/t5150-request-pull.sh | 8 +++-
  2 files changed, 13 insertions(+), 1 deletion(-)
 
 diff --git a/git-request-pull.sh b/git-request-pull.sh
 index b67513a..d6648b2 100755
 --- a/git-request-pull.sh
 +++ b/git-request-pull.sh
 @@ -118,6 +118,12 @@ then
   status=1
  fi
  
 +# Special case: turn for_linus to tags/for_linus when it is correct
 +if test $ref = refs/tags/$pretty_remote
 +then
 + pretty_remote=tags/$pretty_remote
 +fi
 +
  url=$(git ls-remote --get-url $url)
  
  git show -s --format='The following changes since commit %H:
 diff --git a/t/t5150-request-pull.sh b/t/t5150-request-pull.sh
 index 75d6b38..93e2c65 100755
 --- a/t/t5150-request-pull.sh
 +++ b/t/t5150-request-pull.sh
 @@ -223,7 +223,13 @@ test_expect_success 'pull request format' '
   git request-pull initial $downstream_url 
 tags/full:refs/tags/full
   ) request 
   sed -nf fuzz.sed request request.fuzzy 
 - test_i18ncmp expect request.fuzzy
 + test_i18ncmp expect request.fuzzy 
 +
 + (
 + cd local 
 + git request-pull initial $downstream_url full
 + ) request 
 + grep ' tags/full$'
  '
  
  test_expect_success 'request-pull ignores OPTIONS_KEEPDASHDASH poison' '
 -- 
 2.0.0-rc3-434-g1ba2fe8
--
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 v3] format-patch --signature-file file

2014-05-18 Thread Jeff King
On Sat, May 17, 2014 at 09:02:22AM -0700, Jeremiah Mahler wrote:

 Added feature that allows a signature file to be used with format-patch.
 
   $ git format-patch --signature-file ~/.signature -1
 
 Now signatures with newlines and other special characters can be
 easily included.
 
 Signed-off-by: Jeremiah Mahler jmmah...@gmail.com

This is looking much better. I have a few comments still, inline below.

By the way, did you want to add a format.signaturefile config, too? I do
not care myself, but I would imagine most workflows would end up
specifying it every time.

 @@ -1447,6 +1450,16 @@ int cmd_format_patch(int argc, const char **argv, 
 const char *prefix)
   cover_letter = (config_cover_letter == COVER_ON);
   }
  
 + if (signature_file) {
 + if (signature  signature != git_version_string)
 + die(_(--signature and --signature-file are mutually 
 exclusive));

Technically signature might have come from config, not --signature
on the command-line.  But I don't know if that's even worth worrying
about; presumably the user can figure it out if they set the config.

 + struct strbuf buf = STRBUF_INIT;
 +
 + strbuf_read_file(buf, signature_file, 128);
 + signature = strbuf_detach(buf, NULL);

Your cover letter mentioned generating an error here. Did you want:

  if (strbuf_read_file(buf, signature_file, 128)  0)
die_errno(unable to read signature file '%s', signature_file);

or similar?

 diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
 index 9c80633..fb3dc1b 100755
 --- a/t/t4014-format-patch.sh
 +++ b/t/t4014-format-patch.sh
 @@ -762,6 +762,34 @@ test_expect_success 'format-patch --signature= 
 suppresses signatures' '
   ! grep ^-- \$ output
  '
  
 +cat  expect  EOF

Minor style nits, but we usually omit the whitespace between redirection
operations, and we always quote our here-doc endings unless they
explicitly want to interpolate. So:

  cat expect \EOF

(we also tend to use -\EOF to drop leading tabs, and then include
them inside the test_expect_success properly indented, but as this
expectation is used in multiple places, it's not unreasonable to keep it
separate).

 +test_expect_success 'format-patch --signature-file file' '
 + git format-patch --stdout --signature-file expect -1 output 
 + check_patch output 
 + fgrep -x -f output expect output2 

Both of these fgrep options are in POSIX, but it looks like this will be
the first use for either of them. I'm not sure if they will give us any
portability problems.

We could probably do something like:

  sed -n '/^-- $/,$p'

if we have to.

 + diff expect output2

Please use test_cmp here, which adjusts automatically for less-abled
systems where diff is not available.

 +test_expect_success 'format-patch --signature-file=file' '
 + git format-patch --stdout --signature-file=expect -1 output 
 + check_patch output 
 + fgrep -x -f output expect output2 
 + diff expect output2
 +'

Same comments as above; I note that this is just checking --foo=bar
rather than --foo bar. I don't mind being thorough, but for the most
part we just assume this is tested as part of the parse-options tests,
and don't check it explicitly for each option.

 +test_expect_success 'format-patch --signature and --signature-file die' '
 + ! git format-patch --stdout --signature=foo --signature-file=expect 
 -1 output
 +'

Please use test_must_fail instead of ! here; it is more thorough in
checking that we exited with a non-zero error code (and didn't die from
signal death, for example).

-Peff
--
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] remote-helpers: point at their upstream repositories

2014-05-18 Thread Matthieu Moy
Felipe Contreras felipe.contre...@gmail.com writes:

  % git fetch
  WARNING: git-remote-hg is now maintained independently.
  WARNING: For more information visit https://github.com/felipec/git-remote-hg
  searching for changes
  no changes found

I don't think the situation is as simple as you claim. In many cases,
the first step before the ones you are mentionning are:

  cd $git/contrib/remote-helpers
  cp git-remote-{hg,bzr} somewhere/in/path

They produces no warning if git-remote-{hg,bzr} exist with the warning,
but no such file or directory: contrib/remote-helpers if the directory
has been renamed or removed.

When git-remote-{hg,bzr} are installed with a package manager, the fact
that they are part of Git's core or not is often irrelevant. For
example, Debian splits the git.git source into many packages, so a
Debian user will not see any difference between helpers included in
git.git or outside (e.g. I have to install the package git-svn if I want
to use git-svn).

That said, I'm fine with the add a warning option too.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
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 v3] format-patch --signature-file file

2014-05-18 Thread Jeremiah Mahler
Peff,

Lots of good suggestions.  I had to expand upon the signature
pattern match to get to work.

On Sun, May 18, 2014 at 07:20:20AM -0400, Jeff King wrote:
 On Sat, May 17, 2014 at 09:02:22AM -0700, Jeremiah Mahler wrote:
 
...
  +test_expect_success 'format-patch --signature-file file' '
  +   git format-patch --stdout --signature-file expect -1 output 
  +   check_patch output 
  +   fgrep -x -f output expect output2 
 
 Both of these fgrep options are in POSIX, but it looks like this will be
 the first use for either of them. I'm not sure if they will give us any
 portability problems.
 
 We could probably do something like:
 
   sed -n '/^-- $/,$p'
 

This gets the signature out but it will have '--' and
some trailing blank lines which were not in the original signature.
So then test_cmp won't work directly.

What I came up with was to use head and tail to remove the first line
and the last two lines.  Then test_cmp can be used normally.

test_expect_success 'format-patch --signature-file=file' '
git format-patch --stdout --signature-file=expect -1 output 
check_patch_output output 
sed -n /^-- $/,\$p output | head --lines=-2 | tail --lines=+2 
output2 
test_cmp expect output2
'

-- 
Jeremiah Mahler
jmmah...@gmail.com
http://github.com/jmahler
--
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


[RFC/PATCH] replace: add --graft option

2014-05-18 Thread Christian Couder
The usage string for this option is:

git replace [-f] --graft commit [parent...]

First we create a new commit that is the same as commit
except that its parents are [parents...]

Then we create a replace ref that replace commit with
the commit we just created.

With this new option, it should be straightforward to
convert grafts to replace refs, with something like:

cat .git/info/grafts | while read line
do git replace --graft $line; done

Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/replace.c | 79 ++-
 1 file changed, 78 insertions(+), 1 deletion(-)

diff --git a/builtin/replace.c b/builtin/replace.c
index 1bb491d..4b3705d 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -17,6 +17,7 @@
 static const char * const git_replace_usage[] = {
N_(git replace [-f] object replacement),
N_(git replace [-f] --edit object),
+   N_(git replace [-f] --graft commit [parent...]),
N_(git replace -d object...),
N_(git replace [--format=format] [-l [pattern]]),
NULL
@@ -294,6 +295,71 @@ static int edit_and_replace(const char *object_ref, int 
force)
return replace_object_sha1(object_ref, old, replacement, new, force);
 }
 
+static int read_sha1_commit(const unsigned char *sha1, struct strbuf *dst)
+{
+   void *buf;
+   enum object_type type;
+   unsigned long size;
+
+   buf = read_sha1_file(sha1, type, size);
+   if (!buf)
+   return error(_(cannot read object %s), sha1_to_hex(sha1));
+   if (type != OBJ_COMMIT) {
+   free(buf);
+   return error(_(object %s is not a commit), sha1_to_hex(sha1));
+   }
+   strbuf_attach(dst, buf, size, size + 1);
+   return 0;
+}
+
+static int create_graft(int argc, const char **argv, int force)
+{
+   unsigned char old[20], new[20];
+   const char *old_ref = argv[0];
+   struct strbuf buf = STRBUF_INIT;
+   struct strbuf new_parents = STRBUF_INIT;
+   const char *parent_start, *parent_end;
+   int i;
+
+   if (get_sha1(old_ref, old)  0)
+   die(_(Not a valid object name: '%s'), old_ref);
+   lookup_commit_or_die(old, old_ref);
+   if (read_sha1_commit(old, buf))
+   die(_(Invalid commit: '%s'), old_ref);
+
+   /* find existing parents */
+   parent_start = buf.buf;
+   parent_start += 46; /* tree  + hex sha1 + \n */
+   parent_end = parent_start;
+
+   while (starts_with(parent_end, parent ))
+   parent_end += 48; /* parent  + hex sha1 + \n */
+
+   /* prepare new parents */
+   for (i = 1; i  argc; i++) {
+   unsigned char sha1[20];
+   if (get_sha1(argv[i], sha1)  0)
+   die(_(Not a valid object name: '%s'), argv[i]);
+   lookup_commit_or_die(sha1, argv[i]);
+   strbuf_addf(new_parents, parent %s\n, sha1_to_hex(sha1));
+   }
+
+   /* replace existing parents with new ones */
+   strbuf_splice(buf, parent_start - buf.buf, parent_end - parent_start,
+ new_parents.buf, new_parents.len);
+
+   if (write_sha1_file(buf.buf, buf.len, commit_type, new))
+   die(_(could not write replacement commit for: '%s'), old_ref);
+
+   strbuf_release(new_parents);
+   strbuf_release(buf);
+
+   if (!hashcmp(old, new))
+   return error(new commit is the same as the old one: '%s', 
sha1_to_hex(old));
+
+   return replace_object_sha1(old_ref, old, replacement, new, force);
+}
+
 int cmd_replace(int argc, const char **argv, const char *prefix)
 {
int force = 0;
@@ -303,12 +369,14 @@ int cmd_replace(int argc, const char **argv, const char 
*prefix)
MODE_LIST,
MODE_DELETE,
MODE_EDIT,
+   MODE_GRAFT,
MODE_REPLACE
} cmdmode = MODE_UNSPECIFIED;
struct option options[] = {
OPT_CMDMODE('l', list, cmdmode, N_(list replace refs), 
MODE_LIST),
OPT_CMDMODE('d', delete, cmdmode, N_(delete replace refs), 
MODE_DELETE),
OPT_CMDMODE('e', edit, cmdmode, N_(edit existing object), 
MODE_EDIT),
+   OPT_CMDMODE('g', graft, cmdmode, N_(change a commit's 
parents), MODE_GRAFT),
OPT_BOOL('f', force, force, N_(replace the ref if it 
exists)),
OPT_STRING(0, format, format, N_(format), N_(use this 
format)),
OPT_END()
@@ -325,7 +393,10 @@ int cmd_replace(int argc, const char **argv, const char 
*prefix)
usage_msg_opt(--format cannot be used when not listing,
  git_replace_usage, options);
 
-   if (force  cmdmode != MODE_REPLACE  cmdmode != MODE_EDIT)
+   if (force 
+   cmdmode != MODE_REPLACE 
+   cmdmode != MODE_EDIT 
+   cmdmode != MODE_GRAFT)
usage_msg_opt(-f only makes sense when writing a 

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

2014-05-18 Thread Per Cederqvist
On Fri, May 16, 2014 at 5:20 PM, Jeff Sipek jef...@josefsipek.net wrote:
 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?

Oh.  I was not aware that --allow-onelevel was so new (it was added in
Git 1.7.8).

I'll rewrite this using git check-ref-format a/$1 instead.

 + # 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

There were other changes in Git version 1.7.6.4 and 1.7.8. I'll
add similar code for those as well in the upcoming v4 of the series.
With those changes, the test suite works with Git 1.5.0 and newer
(I've checked all versions made of three numbers, but not those
made of four numbers.)

Jeff, I'll remove your signed-off-by so that you can check the
new code that I will post within a couple of days.

/ceder

 + 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).
  

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

2014-05-18 Thread Per Cederqvist
On Fri, May 16, 2014 at 5:45 PM, Jeff Sipek jef...@josefsipek.net wrote:
 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 :)

Ancien wisdom from the Csh Programming Considered Harmful
article: http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/

These functions work only because of the set -e earlier in scaffold.
The final return statements are not actually reached. I don't like that.
So the next version of the patch series will print an explicit message
like % FAIL: The above command should succeed but failed. or
% FAIL: The above command should fail but succeeded. and do
an explicit exit 1 on failure. I think it makes it easier to debug issues.
(I recently spent a few hours trying to figure our why the test just silently
exited. Turns out the old git version I was running didn't like my .gitconfig,
so it exited with a non-zero exit code...)

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

I'll let you re-check the next version of the code.

/ceder

 + 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


[PATCH v4] format-patch --signature-file file

2014-05-18 Thread Jeremiah Mahler
Added option that allows a signature file to be used with format-patch
so that signatures with newlines and other special characters can be
easily included.

  $ git format-patch --signature-file ~/.signature -1

The config variable format.signaturefile is also provided so that it
can be added by default.

  $ git config format.signaturefile ~/.signature

  $ git format-patch -1

Signed-off-by: Jeremiah Mahler jmmah...@gmail.com
---
 Documentation/config.txt   |  4 
 Documentation/git-format-patch.txt |  4 
 builtin/log.c  | 16 
 t/t4014-format-patch.sh| 33 +
 4 files changed, 57 insertions(+)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 1932e9b..140ed77 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1114,6 +1114,10 @@ format.signature::
Set this variable to the empty string () to suppress
signature generation.
 
+format.signaturefile::
+   Works just like format.signature except the contents of the
+   file specified by this variable will be used as the signature.
+
 format.suffix::
The default for format-patch is to output files with the suffix
`.patch`. Use this variable to change that suffix (make sure to
diff --git a/Documentation/git-format-patch.txt 
b/Documentation/git-format-patch.txt
index 5c0a4ab..c0fd470 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -14,6 +14,7 @@ SYNOPSIS
   [(--attach|--inline)[=boundary] | --no-attach]
   [-s | --signoff]
   [--signature=signature | --no-signature]
+  [--signature-file=file]
   [-n | --numbered | -N | --no-numbered]
   [--start-number n] [--numbered-files]
   [--in-reply-to=Message-Id] [--suffix=.sfx]
@@ -233,6 +234,9 @@ configuration options in linkgit:git-notes[1] to use this 
workflow).
signature option is omitted the signature defaults to the Git version
number.
 
+--signature-file=file::
+   Works just like --signature except the signature is read from a file.
+
 --suffix=.sfx::
Instead of using `.patch` as the suffix for generated
filenames, use specified suffix.  A common alternative is
diff --git a/builtin/log.c b/builtin/log.c
index 39e8836..0a8f417 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -673,6 +673,7 @@ static void add_header(const char *value)
 static int thread;
 static int do_signoff;
 static const char *signature = git_version_string;
+static const char *signature_file;
 static int config_cover_letter;
 
 enum {
@@ -742,6 +743,8 @@ static int git_format_config(const char *var, const char 
*value, void *cb)
}
if (!strcmp(var, format.signature))
return git_config_string(signature, var, value);
+   if (!strcmp(var, format.signaturefile))
+   return git_config_string(signature_file, var, value);
if (!strcmp(var, format.coverletter)) {
if (value  !strcasecmp(value, auto)) {
config_cover_letter = COVER_AUTO;
@@ -1230,6 +1233,8 @@ int cmd_format_patch(int argc, const char **argv, const 
char *prefix)
PARSE_OPT_OPTARG, thread_callback },
OPT_STRING(0, signature, signature, N_(signature),
N_(add a signature)),
+   OPT_FILENAME(0, signature-file, signature_file,
+   N_(add a signature from a file)),
OPT__QUIET(quiet, N_(don't print the patch filenames)),
OPT_END()
};
@@ -1447,6 +1452,17 @@ int cmd_format_patch(int argc, const char **argv, const 
char *prefix)
cover_letter = (config_cover_letter == COVER_ON);
}
 
+   if (signature_file) {
+   if (signature  signature != git_version_string)
+   die(_(cannot specify both signature and 
signature-file));
+
+   struct strbuf buf = STRBUF_INIT;
+
+   if (strbuf_read_file(buf, signature_file, 128)  0)
+   die_errno(_(unable to read signature file '%s'), 
signature_file);
+   signature = strbuf_detach(buf, NULL);
+   }
+
if (in_reply_to || thread || cover_letter)
rev.ref_message_ids = xcalloc(1, sizeof(struct string_list));
if (in_reply_to) {
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 9c80633..c6d44b8 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -762,6 +762,39 @@ test_expect_success 'format-patch --signature= 
suppresses signatures' '
! grep ^-- \$ output
 '
 
+cat expect -\EOF
+
+Test User test.em...@kernel.org
+http://git.kernel.org/cgit/git/git.git
+
+git.kernel.org/?p=git/git.git;a=summary
+
+EOF
+
+test_expect_success 'format-patch --signature-file=file' '
+ 

[PATCH v4] format-patch --signature-file file

2014-05-18 Thread Jeremiah Mahler
v4 of patch to add format-patch --signature-file file option.

This revision includes more suggestions from Jeff King:

  - Added a format.signaturefile config option.

  - Fixed error messages, --signature and format.signature

  - Fixed error checking, dies if strbuf_read_file fails.

  - style: cat  expect  EOF to cat expect -\EOF

  - Eliminated use of fgrep, which is not used anywhere else
in the project.  Possibility of portability problems.
Replaced with sed which is commonly used.

  - Eliminated use of diff in favor of test_cmp.

  - Removed redundant test, --foo=bar and --foo bar

  - Changed to use test_must_fail instead of !

Jeremiah Mahler (1):
  format-patch --signature-file file

 Documentation/config.txt   |  4 
 Documentation/git-format-patch.txt |  4 
 builtin/log.c  | 16 
 t/t4014-format-patch.sh| 33 +
 4 files changed, 57 insertions(+)

-- 
Jeremiah Mahler
jmmah...@gmail.com
http://github.com/jmahler


--
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


[PATCH] rebase --keep-empty -i: add test

2014-05-18 Thread Michael S. Tsirkin
There's some special code in rebase -i to deal
with --keep-empty.
Add test for this combination.

Signed-off-by: Michael S. Tsirkin m...@redhat.com
---
 t/t3404-rebase-interactive.sh | 9 +
 1 file changed, 9 insertions(+)

diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index c0023a5..3b1b863 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -67,6 +67,14 @@ test_expect_success 'setup' '
 SHELL=
 export SHELL
 
+test_expect_success 'rebase --keep-empty' '
+   git checkout -b emptybranch master 
+   git commit --allow-empty -m empty 
+   git rebase --keep-empty -i HEAD~2 
+   git log --oneline actual 
+   test_line_count = 6 actual
+'
+
 test_expect_success 'rebase -i with the exec command' '
git checkout master 
(
-- 
MST
--
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


[PATCH 2/4] git-rebase: document ack

2014-05-18 Thread Michael S. Tsirkin
document ack! behaviour and use

Signed-off-by: Michael S. Tsirkin m...@redhat.com
---
 Documentation/git-rebase.txt | 45 +++-
 1 file changed, 40 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 2a93c64..c27aef4 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -384,7 +384,7 @@ or by giving more than one `--exec`:
 +
 If `--autosquash` is used, exec lines will not be appended for
 the intermediate commits, and will only appear at the end of each
-squash/fixup series.
+squash/fixup/ack series.
 
 --root::
Rebase all commits reachable from branch, instead of
@@ -398,13 +398,13 @@ squash/fixup series.
 
 --autosquash::
 --no-autosquash::
-   When the commit log message begins with squash! ... (or
-   fixup! ...), and there is a commit whose title begins with
+   When the commit log message begins with squash! ... (fixup! ...
+   or ack! ...), and there is a commit whose title begins with
the same ..., automatically modify the todo list of rebase -i
so that the commit marked for squashing comes right after the
commit to be modified, and change the action of the moved
-   commit from `pick` to `squash` (or `fixup`).  Ignores subsequent
-   fixup!  or squash!  after the first, in case you referred to an
+   commit from `pick` to `squash` (`fixup` or `ack`).  Ignores subsequent
+   ack! , fixup!  or squash!  after the first, in case you referred 
to an
earlier fixup/squash with `git commit --fixup/--squash`.
 +
 This option is only valid when the '--interactive' option is used.
@@ -624,6 +624,41 @@ consistent (they compile, pass the testsuite, etc.) you 
should use
 'git stash' to stash away the not-yet-committed changes
 after each commit, test, and amend the commit if fixes are necessary.
 
+
+RECORDING ACKS
+
+
+Interactive mode with --autosquash can be used to concatenate
+commit log for several commits, which is useful to record
+extra information about the commit, such as ack signatures.
+This allows, for example, the following workflow:
+
+1. receive patches by mail and commit
+2. receive by mail ack signatures for the patches
+3. prepare a series for submission
+4. submit
+
+where point 2. consists of several instances of
+   i) create a (possibly empty) commit with signature
+ in the commit message
+
+Sometimes the ack signature added in i. cannot be amended to the
+commit it acks, because that commit is buried deeply in a
+patch series.  That is exactly what rebase --autosquash
+option is for: use it
+after plenty of is, to automaticlly rearrange
+commits, and squashing multiple sign-off commits into
+the commit that is signed.
+
+Start it with the last commit you want to retain as-is:
+
+   git rebase --autosquash -i after-this-commit
+
+An editor will be fired up with all the commits in your current branch
+which come after the given commit. Ack commits will be
+re-arranged to come after the commit that is acked,
+and the action will be utomticlly changed from `pick` to `ack`
+to cause them to be squashed into the acked commit.
 
 RECOVERING FROM UPSTREAM REBASE
 ---
-- 
MST

--
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


[PATCH 3/4] rebase: test ack

2014-05-18 Thread Michael S. Tsirkin
test ack! handling

Signed-off-by: Michael S. Tsirkin m...@redhat.com
---
 t/t3415-rebase-autosquash.sh | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh
index 41370ab..9d7db13 100755
--- a/t/t3415-rebase-autosquash.sh
+++ b/t/t3415-rebase-autosquash.sh
@@ -74,6 +74,21 @@ test_expect_success 'auto squash (option)' '
test_auto_squash final-squash --autosquash
 '
 
+test_expect_success 'auto ack' '
+   ack=Acked-by: xyz
+   msg=$(test_write_lines ack! first commit  $ack)
+   git reset --hard base 
+   git commit --allow-empty -m $msg -- 
+   git tag ack 
+   test_tick 
+   git rebase --autosquash -i HEAD^^^ 
+   git log --oneline actual 
+   git show -s first-commit | grep -v ^commit  expected-msg 
+   echo $ack  expected-msg 
+   git show -s HEAD^ | grep -v ^commit  actual-msg 
+   diff actual-msg expected-msg
+'
+
 test_expect_success 'auto squash (config)' '
git config rebase.autosquash true 
test_auto_squash final-squash-config-true 
-- 
MST

--
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


[PATCH 1/4] rebase -i: add ack action

2014-05-18 Thread Michael S. Tsirkin
This implements a new ack! action for git rebase -i
It is essentially a middle ground between fixup! and squash!:
- commits are squashed silently without editor being started
- commit logs are concatenated (with action line being discarded)
- because of the above, empty commits aren't discarded,
  their log is also included.

I am using it as follows:
git am -s  mailbox #creates first commit
hack ...
get mail with Ack
git commit --allow-empty -m `cat -EOF
ack! first

Acked-by: maintainer
EOF`
repeat cycle
git rebase --autosquash -i origin/master
before public branch push

The cat command above is actually a script that
parses the Ack mail to create the empty commit -
to be submitted separately.

Signed-off-by: Michael S. Tsirkin m...@redhat.com
---
 git-rebase--interactive.sh | 34 +++---
 1 file changed, 27 insertions(+), 7 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 6ec9d3c..821872c 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -140,6 +140,7 @@ Commands:
  r, reword = use commit, but edit the commit message
  e, edit = use commit, but stop for amending
  s, squash = use commit, but meld into previous commit
+ a, ack = like squash, but append commit body only to previous commit
  f, fixup = like squash, but discard this commit's log message
  x, exec = run command (the rest of the line) using shell
 
@@ -412,6 +413,15 @@ update_squash_messages () {
echo
commit_message $2
;;
+   ack)
+   if test -f $fixup_msg
+   then
+   commit_message $2 | git stripspace --strip-comments | 
sed -e '1,2d'  $fixup_msg
+   fi
+   printf '%s\n' $comment_char This is the $(nth_string $count) 
commit message:
+   echo
+   commit_message $2
+   ;;
fixup)
echo
printf '%s\n' $comment_char The $(nth_string $count) commit 
message will be skipped:
@@ -453,7 +463,7 @@ record_in_rewritten() {
echo $oldsha1  $rewritten_pending
 
case $(peek_next_command) in
-   squash|s|fixup|f)
+   squash|s|fixup|f|ack|a)
;;
*)
flush_rewritten_pending
@@ -521,8 +531,11 @@ do_next () {
warn Stopped at $sha1... $rest
exit_with_patch $sha1 0
;;
-   squash|s|fixup|f)
+   squash|s|fixup|f|ack|a)
case $command in
+   ack|a)
+   squash_style=ack
+   ;;
squash|s)
squash_style=squash
;;
@@ -546,7 +559,7 @@ do_next () {
die_failed_squash $sha1 $rest
fi
case $(peek_next_command) in
-   squash|s|fixup|f)
+   squash|s|fixup|f|ack|a)
# This is an intermediate commit; its message will only 
be
# used in case of trouble.  So use the long version:
do_with_author output git commit --amend --no-verify -F 
$squash_msg \
@@ -557,7 +570,7 @@ do_next () {
# This is the final command of this squash/fixup group
if test -f $fixup_msg
then
-   do_with_author git commit --amend --no-verify 
-F $fixup_msg \
+   do_with_author git commit --quiet --amend 
--no-verify -F $fixup_msg \
${gpg_sign_opt:+$gpg_sign_opt} ||
die_failed_squash $sha1 $rest
else
@@ -690,7 +703,7 @@ skip_unnecessary_picks () {
done $todo $todo.new 3$done 
mv -f $todo.new $todo 
case $(peek_next_command) in
-   squash|s|fixup|f)
+   squash|s|fixup|f|ack|a)
record_in_rewritten $onto
;;
esac ||
@@ -732,7 +745,7 @@ rearrange_squash () {
while read -r pick sha1 message
do
case $message in
-   squash! *|fixup! *)
+   squash! *|fixup! *|ack! *)
action=${message%%!*}
rest=$message
prefix=
@@ -740,7 +753,7 @@ rearrange_squash () {
while :
do
case $rest in
-   squash! *|fixup! *)
+   squash! *|fixup! * |ack! *)
prefix=$prefix${rest%%!*},
rest=${rest#*! }
;;
@@ -975,6 +988,13 @@ do
comment_out=
fi
 
+   # keep empty ack! commits around: useful to add 

[PATCH 0/4] ack recoding in commit log

2014-05-18 Thread Michael S. Tsirkin
As a maintainer, I often get patches by mail, then
acked-by,reviewed-by etc responses are sent by separate
mail.

I like making acks commits,
this way they are easy to keep track of
as part of git history.


Since response mail happens to have appropriate
subject matching the patch, it's a natural fit to
then use git rebase mechanics if we want to smash
these acks into the original commit.

I have been using these patches without any problems
for a while now, and find the approach very convenient.

Included:
rebase: new ack! action to handle ack commits
this part seems ready for merge to me,
please review and comment

git-ack: new tool to record an ack
this does not have proper documentation
and tests yet, I definitely intend to
do this but wanted to see whether people
like the UI first.
posting for early review and feedback


Note: yes, I think notes+git replace could be used for this too,
my workflow always includes a rebase with --autosquash
before publishing anyway, so dealing with ack as with any
other commit is nicer.


Michael S. Tsirkin (4):
  rebase -i: add ack action
  git-rebase: document ack
  rebase: test ack
  git-ack: record an ack

 Documentation/git-rebase.txt | 45 ++---
 contrib/git-ack  | 79 
 git-rebase--interactive.sh   | 34 +++
 t/t3415-rebase-autosquash.sh | 15 +
 4 files changed, 161 insertions(+), 12 deletions(-)
 create mode 100755 contrib/git-ack

-- 
MST

--
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


[PATCH 4/4] git-ack: record an ack

2014-05-18 Thread Michael S. Tsirkin
This is a simple script that I use by piping
incoming mail with an ack to it.
It produces an empty ack commit suitable for
squshing with git rebase -i -autosquash.

Works best if people ack individual commits: you simply
pipe each ack to git ack, before pushing your branch,
rebase.

Some people ack series by responding to cover letter
or to commit 1.
To address this usecase, there are two additional
flags: -s saves the ack signature in a file (you can
save several in a row), -r creates an ack for
a given patch using the saved signature.
Thus: pipe ack(s) to git ack -s, then select and pipe
each individual patch to git ack -r.
I don't use these flags much so they likely work
less well.

If it's found useful, this script can either
become a first-class command (with documentation
and tests) or be integrated as a flag into git am.

Limitations: requires that index is clean, this is
so we can create an empty commit recording the ack.

Signed-off-by: Michael S. Tsirkin m...@redhat.com
---
 contrib/git-ack | 84 +
 1 file changed, 84 insertions(+)
 create mode 100755 contrib/git-ack

diff --git a/contrib/git-ack b/contrib/git-ack
new file mode 100755
index 000..4aeb16a
--- /dev/null
+++ b/contrib/git-ack
@@ -0,0 +1,84 @@
+msg=`mktemp`
+patch=`mktemp`
+info=`git mailinfo $msg $patch`
+subj=`echo $info|sed -n 's/^Subject: //p'`
+author=`echo $info|sed -n 's/^Author: //p'`
+email=`echo $info|sed -n 's/^Email: //p'`
+auth=$author $email
+date=`echo $info|sed -n 's/^Date: //p'`
+sign=`mktemp`
+echo ack! $subj  $sign
+echo   $sign
+if
+git diff --cached HEAD
+then
+nop  /dev/null
+else
+echo DIFF in cache. Not acked, reset or commit!
+exit 1
+fi
+GIT_DIR=`pwd`/${GIT_DIR}
+
+usage () {
+   echo Usage: git ack  \
+[-s|--save|-a|--append|-r|--restore |-c|--clear]\n  2;
+exit 1;
+}
+
+append=
+save=
+clear=
+
+while test $# != 0
+do
+   case $1 in
+   -a|--append)
+   append=y
+   ;;
+   -s|--s)
+   save=y
+   ;;
+   -r|--restore)
+   restore=y
+   ;;
+   -c|--clear)
+   clear=y
+;;
+   *)
+   usage ;;
+   esac
+   shift
+done
+
+if
+test $clear
+then
+rm -f ${GIT_DIR}/ACKS
+fi
+
+if
+test $save
+then
+if
+test $append
+then
+cat $msg  ${GIT_DIR}/ACKS
+else
+cat $msg  ${GIT_DIR}/ACKS
+fi
+fi
+
+if
+test $restore
+then
+msg = ${GIT_DIR}/ACKS
+fi
+
+if
+grep '^[A-Z][A-Za-z-]*-by:' $msg  $sign
+then
+git commit --allow-empty -F $sign --author=$auth --date=$date
+else
+echo No signature found!
+exit 2
+fi
-- 
MST

--
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


[GUILT v4 00/33] Teach guilt import-commit how to create legal patch names, and more

2014-05-18 Thread Per Cederqvist
This is version 4 of the patch series I sent back on 21 Mar 2014.  I
have addressed all feedback to date, update the documentation where
needed, improved the error handling in the cmd and shouldfail
functions in the test suite, fixed compatibility with older Git
versions, and added signed-off-by lines from Jeff Sipek for those
commits that I have received an explicit approval from him (but only
if I have not made any other change to that particular commit).

I have added two new patches:

* Patch 32/33 adds documentation and test cases for the new regexp
functionality of guilt header.  This could be folded into patch 12.

* Patch 33/33 adds documentation for the exit value of guilt push
and guilt pop.  This could be folded into patches 25-26.

To see how the patches have evolved, you might find
http://www.lysator.liu.se/~ceder/guilt-oslo-2014-v4/ useful.  It
displays diffs of all the patches between v3 and v4, in pdiffdiff
output format.

Here is the original blurb for the series, slightly edited:

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.

The patch series consists of:

 - A number of fixes to the test suite.

 - A number of bug fixes which I hope are non-controversial.  Most of
   the fixes have test cases.

 - 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.)

 - 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.

 - The humble beginnings of a coding style guide.

A more detailed overview of the patches:

1. Some tests fail if git config guilt.diffstat true is in effect.

2-4. Some commands fail if run from a directory with spaces in its
 name.

5. guilt new had an overly restrictive argument parser.

6-8. guilt.diffstat could break guilt fold and guilt new.

9-10. The test suite did not test exit status properly.

11. Remove pointless redirections in the test suite.

12-13. guilt header tried to check if a patch existed, but the check
was broken.

14-16. Various parts of guilt tried to ensure that patch names were
   legal git branch names, but failed.

17-20. guilt graph failed when no patch was applied, and when a
   branch name contained a comma or a quote.

21-23. git config log.decorate short caused guilt import-commit,
   guilt patchbomb and guilt rebase to fail in various ways.

24. Patches may contain backslashes, but various informative messages
from guilt did backslash processing.

25-26. guilt push and guilt pop should fail when there is nothing
   to do.

28. Fix coding style problems in a test case.

27, 29. These two commits were things I intended to contribute a while
   back, when contributing the Change git branch when patches are
   applied change (commit 67d3af63f422).  These commits makes
   that behavior optional, and it defaults to being disabled, so
   that you can use both Guilt v0.35 (and earlier) and the current
   Guilt code against the same repo.  These commits add some code
   complexity, and you might want to skip them if you think the
   current behavior is better.

30. A coding style guide, with Emacs support.

31. Avoid using git log -p.

32. Test case + doc for guilt header.

33. Doc for guilt push and guilt pop.

This patch series is also available on
http://repo.or.cz/w/guilt/ceder.git in the oslo-2014-v4 branch.  If
you already have a copy of guilt, you should be able to fetch that
branch with something like:

git remote add ceder http://repo.or.cz/r/guilt/ceder.git
git fetch ceder refs/heads/oslo-2014-v4:refs/remotes/ceder/oslo-2014-v4

A few of the regression/t-*.out files contain non-ASCII characters.  I
hope they survive the mail transfer; if not, please use the repo above
to fetch the commits.

Per Cederqvist (33):
  The tests should not fail if guilt.diffstat is set.
  

[GUILT v4 01/33] The tests should not fail if guilt.diffstat is set.

2014-05-18 Thread Per Cederqvist
Explicitly set guilt.diffstat to its default value.  Without this, the
027 test (and possibly others) fail if guilt.diffstat is set to true
in ~/.gitconfig.

Signed-off-by: Per Cederqvist ced...@opera.com
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 regression/scaffold | 1 +
 1 file changed, 1 insertion(+)

diff --git a/regression/scaffold b/regression/scaffold
index 546d8c6..5c8b73e 100644
--- a/regression/scaffold
+++ b/regression/scaffold
@@ -87,6 +87,7 @@ function setup_git_repo
# Explicitly set config that the tests rely on.
git config log.date default
git config log.decorate no
+   git config guilt.diffstat false
 }
 
 function setup_guilt_repo
-- 
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


[GUILT v4 02/33] Allow guilt delete -f to run from a dir which contains spaces.

2014-05-18 Thread Per Cederqvist
Signed-off-by: Per Cederqvist ced...@opera.com
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 guilt-delete | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/guilt-delete b/guilt-delete
index 3e394f8..967ac10 100755
--- a/guilt-delete
+++ b/guilt-delete
@@ -49,7 +49,7 @@ series_remove_patch $patch
 
 guilt_hook delete $patch
 
-[ ! -z $force ]  rm -f $GUILT_DIR/$branch/$patch
+[ ! -z $force ]  rm -f $GUILT_DIR/$branch/$patch
 
 exit 0
 
-- 
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


[GUILT v4 04/33] Allow guilt import-commit to run from a dir which contains spaces.

2014-05-18 Thread Per Cederqvist
Signed-off-by: Per Cederqvist ced...@opera.com
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 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

--
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


[GUILT v4 03/33] Added test case for guilt delete -f.

2014-05-18 Thread Per Cederqvist
Ensure that the file really is deleted.

Signed-off-by: Per Cederqvist ced...@opera.com
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 regression/t-026.out | 15 +++
 regression/t-026.sh  |  5 -
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/regression/t-026.out b/regression/t-026.out
index 3b9fb14..be50b48 100644
--- a/regression/t-026.out
+++ b/regression/t-026.out
@@ -29,3 +29,18 @@ f 7848194fd2e9ee0eb6589482900687d799d60a12  
.git/patches/master/series
 f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
 f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
 f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status
+% guilt new delete-me
+% guilt pop
+All patches popped.
+% guilt delete -f delete-me
+% 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 7848194fd2e9ee0eb6589482900687d799d60a12  .git/patches/master/series
+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status
diff --git a/regression/t-026.sh b/regression/t-026.sh
index 0ccdf85..e25d0df 100755
--- a/regression/t-026.sh
+++ b/regression/t-026.sh
@@ -20,4 +20,7 @@ cmd guilt delete add
 
 cmd list_files
 
-# FIXME: test delete -f
+cmd guilt new delete-me
+cmd guilt pop
+cmd guilt delete -f delete-me
+cmd list_files
-- 
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


[GUILT v4 06/33] Fix the do_get_patch function.

2014-05-18 Thread Per Cederqvist
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 new empty-1
$ guilt new empty-2
$ guilt pop
Now at empty-1
$ guilt fold empty-2
$ guilt pop
All patches popped.
$ guilt push
Applying patch..empty-1
fatal: unrecognized input
To force apply this patch, use 'guilt push -f'

Signed-off-by: Per Cederqvist ced...@opera.com
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 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

--
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


[GUILT v4 07/33] Added test cases for guilt fold.

2014-05-18 Thread Per Cederqvist
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
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 regression/t-035.out | 467 +++
 regression/t-035.sh  |  61 +++
 2 files changed, 528 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..cc16fb4
--- /dev/null
+++ b/regression/t-035.out
@@ -0,0 +1,467 @@
+% 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
+% guilt pop
+All patches popped.
+% guilt delete -f empty-1
+% 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 bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/empty-1~
+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/empty-2~
+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status
+%% empty + nonempty (diffstat=true)
+% guilt new empty
+% guilt pop
+All patches popped.
+% guilt push
+Applying patch..empty
+Patch applied.
+% guilt new -f -s -m A commit message. nonempty
+% guilt pop
+Now at empty.
+% guilt push
+Applying patch..nonempty
+Patch applied.
+% guilt pop
+Now at empty.
+% guilt fold nonempty
+% guilt pop
+All patches popped.
+% guilt push
+Applying patch..empty
+Patch applied.
+% list_files
+d .git/patches
+d .git/patches/master
+d .git/refs/patches
+d .git/refs/patches/master
+f 15aab0fd8b937eb3bb01841693f35dcb75da2faf  .git/patches/master/status
+f 22930c6d1f1938f298a4fca51c57e4b47171db21  .git/patches/master/mode
+f 413390f3906f16f30b054a4fb86c1e014b964504  .git/patches/master/remove
+f 51fcfcf16db2903f19ab4a4a3caacd297ea9f6cd  .git/patches/master/empty~
+f 51fcfcf16db2903f19ab4a4a3caacd297ea9f6cd  .git/patches/master/nonempty~
+f 683678040eef9334d6329e00d5b9babda3e65b57  .git/patches/master/empty
+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
+f a26a22287b500a2a372e42c2bab03599bbe37cdf  .git/patches/master/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/empty-1~
+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/empty-2~
+r 4eedaa32894fc07af3298d8c1178052942a3ca6a  .git/refs/patches/master/empty
+% guilt pop
+All patches popped.
+% guilt delete -f empty
+% 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 51fcfcf16db2903f19ab4a4a3caacd297ea9f6cd  .git/patches/master/empty~
+f 51fcfcf16db2903f19ab4a4a3caacd297ea9f6cd  .git/patches/master/nonempty~
+f 9c18cc7abe6b87f18503714a80a677b4094eb457  .git/patches/master/add
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f  .git/patches/master/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8  .git/patches/master/modify
+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/empty-1~
+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/empty-2~
+f da39a3ee5e6b4b0d3255bfef95601890afd80709  .git/patches/master/status
+%% nonempty + empty (diffstat=true)
+% guilt new -f -s -m A commit 

[GUILT v4 05/33] guilt new: Accept more than 4 arguments.

2014-05-18 Thread Per Cederqvist
The argument parser arbitrarily refused to accept more than 4
arguments.  That made it impossible to run guilt new -f -s -m msg
patch.  Removed the checks for the number of arguments from the
guilt new parser -- the other checks that are already there are
enough to catch all errors.

Give a better error message if -m isn't followed by a message
argument.

Signed-off-by: Per Cederqvist ced...@opera.com
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 guilt-new | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/guilt-new b/guilt-new
index bb68924..9528438 100755
--- a/guilt-new
+++ b/guilt-new
@@ -11,10 +11,6 @@ fi
 
 _main() {
 
-if [ $# -lt 1 ] || [ $# -gt 4 ]; then
-   usage
-fi
-
 while [ $# -gt 0 ] ; do
case $1 in
-f)
@@ -31,6 +27,9 @@ while [ $# -gt 0 ] ; do
fi
;;
-m)
+   if [ $# -eq 1 ]; then
+   usage
+   fi
msg=$2
shift
 
-- 
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


[GUILT v4 08/33] Added more test cases for guilt new: empty patches.

2014-05-18 Thread Per Cederqvist
Test that empty patches are handled correctly, both with and without
the guilt.diffstat configuration option.

Signed-off-by: Per Cederqvist ced...@opera.com
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 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: 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
+--- 

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

2014-05-18 Thread Per Cederqvist
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.

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

--
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


[GUILT v4 10/33] Run test_failed if the exit status of a test script is bad.

2014-05-18 Thread Per Cederqvist
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
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 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

--
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


[GUILT v4 13/33] Check that guilt header '.*' fails.

2014-05-18 Thread Per Cederqvist
Signed-off-by: Per Cederqvist ced...@opera.com
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 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

--
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


[GUILT v4 12/33] guilt header: more robust header selection.

2014-05-18 Thread Per Cederqvist
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 unanchored 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
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 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

--
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


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

2014-05-18 Thread Per Cederqvist
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
 d .git/patches
 d .git/patches/master
@@ -235,7 +235,7 @@ f da39a3ee5e6b4b0d3255bfef95601890afd80709  
.git/patches/master/prepend
 r 

[GUILT v4 11/33] test suite: remove pointless redirection.

2014-05-18 Thread Per Cederqvist
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
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 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

--
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


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

2014-05-18 Thread Per Cederqvist
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 is forbidden.
+[master 10dea83] Space is forbidden.
+ Author: Author Name author@email
+ 1 file changed, 1 insertion(+)
+% create_commit a Tilde~is~forbidden.
+[master 70a83b7] Tilde~is~forbidden.
+ Author: Author Name author@email
+ 1 file changed, 1 insertion(+)
+% create_commit a Caret^is^forbidden.
+[master ee6ef2c] Caret^is^forbidden.
+ Author: Author Name author@email
+ 1 file changed, 1 insertion(+)
+% create_commit a Colon:is:forbidden.
+[master c077fe2] Colon:is:forbidden.
+ Author: Author Name author@email
+ 1 file changed, 1 insertion(+)
+% create_commit a Delisforbidden.
+[master 589ee30] Delisforbidden.
+ Author: Author Name author@email
+ 1 file changed, 1 insertion(+)
+% git branch some-branch
+% git tag some-tag
+% create_commit a Ctrlisforbidden.
+[master e63cdde] Ctrlisforbidden.
+ Author: Author Name author@email
+ 1 file changed, 1 insertion(+)
+% create_commit a CR
is
also
forbidden.
+[master 21ad093] CR
is
also
forbidden.
+ Author: Author Name author@email
+ 1 file changed, 1 insertion(+)
+% create_commit a Question-mark?is?forbidden.
+[master be2fa9b] Question-mark?is?forbidden.
+ Author: Author Name author@email
+ 1 file changed, 1 insertion(+)
+% create_commit a Asterisk*is*forbidden.
+[master af7b50f] Asterisk*is*forbidden.
+ Author: Author Name author@email
+ 1 file changed, 1 insertion(+)
+% 

[GUILT v4 17/33] guilt graph no longer loops when no patches are applied.

2014-05-18 Thread Per Cederqvist
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
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 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

--
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


[GUILT v4 16/33] Fix backslash handling when creating names of imported patches.

2014-05-18 Thread Per Cederqvist
The 'echo $s' construct sometimes processes escape sequences.  (This
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
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 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  
.git/refs/patches/master/asterisk-is
 r 3a0d5ccef0359004fcaa9cee98fbd6a2c4432e74  
.git/refs/patches/master/tildeisforbidden.patch
 r 434e07cacdd8e7eb4723e67cb2d100b3a4121a3a  

[GUILT v4 19/33] Check that guilt graph works when working on a branch with a comma.

2014-05-18 Thread Per Cederqvist
git branch names can contain commas.  Check that guilt graph works
even in that case.

Signed-off-by: Per Cederqvist ced...@opera.com
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 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

--
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


[GUILT v4 18/33] guilt-graph: Handle commas in branch names.

2014-05-18 Thread Per Cederqvist
This fix relies on the fact that git branch names can not contain :.

Signed-off-by: Per Cederqvist ced...@opera.com
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 guilt-graph | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/guilt-graph b/guilt-graph
index 56d0e77..924a63e 100755
--- a/guilt-graph
+++ b/guilt-graph
@@ -51,7 +51,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

--
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


[GUILT v4 20/33] guilt graph: Handle patch names containing quotes.

2014-05-18 Thread Per Cederqvist
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
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 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'`
+
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

--
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


[GUILT v4 21/33] The log.decorate setting should not influence import-commit.

2014-05-18 Thread Per Cederqvist
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
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 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 45f2404..1da7c8e 100755
--- a/guilt-import-commit
+++ b/guilt-import-commit
@@ -26,7 +26,7 @@ disp About to begin conversion... 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-`
+   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 f41f958..648d009 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
touch -a -m -t $TOUCH_DATE $patch
-- 
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


[GUILT v4 22/33] The log.decorate setting should not influence patchbomb.

2014-05-18 Thread Per Cederqvist
Signed-off-by: Per Cederqvist ced...@opera.com
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 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

--
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


[GUILT v4 23/33] The log.decorate setting should not influence guilt rebase.

2014-05-18 Thread Per Cederqvist
Signed-off-by: Per Cederqvist ced...@opera.com
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 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

--
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


[GUILT v4 25/33] guilt push now fails when there are no more patches to push.

2014-05-18 Thread Per Cederqvist
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
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 guilt-push   | 19 ++-
 regression/t-020.out | 89 
 regression/t-020.sh  | 13 +++-
 3 files changed, 113 insertions(+), 8 deletions(-)

diff --git a/guilt-push b/guilt-push
index 67687e7..39c125e 100755
--- a/guilt-push
+++ b/guilt-push
@@ -56,6 +56,12 @@ fi
 patch=$1
 [ ! -z $all ]  patch=-a
 
+# Treat guilt push as guilt push -n 1.
+if [ -z $patch ]; then
+   patch=1
+   num=t
+fi
+
 if [ $patch = -a ]; then
# we are supposed to push all patches, get the last one out of
# series
@@ -65,7 +71,7 @@ if [ $patch = -a ]; then
die There are no patches to push.
fi
 elif [ ! -z $num ]; then
-   # we are supposed to pop a set number of patches
+   # we are supposed to push a set number of patches
 
[ $patch -lt 0 ]  die Invalid number of patches to push.
 
@@ -78,11 +84,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 +110,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
 fi
 
 get_series | sed -n -e ${sidx},${eidx}p | while read p
diff --git a/regression/t-020.out b/regression/t-020.out
index 42433dc..bcb8797 100644
--- a/regression/t-020.out
+++ b/regression/t-020.out
@@ -270,6 +270,95 @@ index 000..8baef1b
 +++ b/def
 @@ -0,0 +1 @@
 +abc
+% guilt push
+File series fully applied, ends at patch mode
+% guilt push -a
+File series fully applied, ends at patch mode
+% 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 log -p
+commit ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba
+Author: Author Name author@email
+Date:   Mon Jan 1 00:00:00 2007 +
+
+patch mode
+
+diff --git a/def b/def
+old mode 100644
+new mode 100755
+
+commit ffb7faa126a6d91bcdd44a494f76b96dd860b8b9
+Author: Author Name author@email
+Date:   Mon Jan 1 00:00:00 2007 +
+
+patch remove
+
+diff --git a/abd b/abd
+deleted file mode 100644
+index fd3896d..000
+--- a/abd
 /dev/null
+@@ -1 +0,0 @@
+-‰öuؽáZâñeÏÈE„£WÀV¼/›U?Ú|¢@6¤8'H¸1G_˜Í§*·ðRҙ¤
ªÂ~·
+\ No newline at end of file
+
+commit 37d588cc39848368810e88332bd03b083f2ce3ac
+Author: Author Name author@email
+Date:   Mon Jan 1 00:00:00 2007 +
+
+patch add
+
+diff --git a/abd b/abd
+new file mode 100644
+index 000..fd3896d
+--- /dev/null
 b/abd
+@@ -0,0 +1 @@
++‰öuؽáZâñeÏÈE„£WÀV¼/›U?Ú|¢@6¤8'H¸1G_˜Í§*·ðRҙ¤
ªÂ~·
+\ No newline at end of file
+
+commit 33633e7a1aa31972f125878baf7807be57b1672d
+Author: Author Name author@email
+Date:   Mon Jan 1 00:00:00 2007 +
+
+patch modify
+
+diff --git a/def b/def
+index 8baef1b..7d69c2f 100644
+--- a/def
 b/def
+@@ -1 +1,2 @@
+ abc
++asjhfksad
+
+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
 % guilt pop --all
 All patches popped.
 % guilt push
diff --git a/regression/t-020.sh b/regression/t-020.sh
index 

[GUILT v4 26/33] guilt pop now fails when there are no more patches to pop.

2014-05-18 Thread Per Cederqvist
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
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 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

--
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


[GUILT v4 27/33] Minor testsuite fix.

2014-05-18 Thread Per Cederqvist
Fix remove_topic() in t-061.sh so that it doesn't print a git hash.

Signed-off-by: Per Cederqvist ced...@opera.com
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 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 6192f1b..db26e12 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

--
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


[GUILT v4 28/33] Fix coding style errors in t-061.sh.

2014-05-18 Thread Per Cederqvist
Signed-off-by: Per Cederqvist ced...@opera.com
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 regression/t-061.sh | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/regression/t-061.sh b/regression/t-061.sh
index db26e12..bda50c7 100755
--- a/regression/t-061.sh
+++ b/regression/t-061.sh
@@ -15,8 +15,7 @@ old_style_branch() {
 
 remove_topic() {
cmd guilt pop -a
-   if git rev-parse --verify --quiet guilt/master /dev/null
-   then
+   if git rev-parse --verify --quiet guilt/master /dev/null; then
cmd git checkout guilt/master
else
cmd git checkout master
@@ -46,8 +45,7 @@ cmd git for-each-ref
 
 cmd list_files
 
-for i in `seq 5`
-do
+for i in `seq 5`; do
if [ $i -ge 5 ]; then
shouldfail guilt pop
else
-- 
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


[GUILT v4 29/33] Added guilt.reusebranch configuration option.

2014-05-18 Thread Per Cederqvist
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
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 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 0500500..ea9d131 100755
--- a/guilt
+++ b/guilt
@@ -884,6 +884,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/
 
@@ -895,6 +898,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
 #
@@ -959,13 +966,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 2e04c83..b3135be 100644
--- a/regression/scaffold
+++ b/regression/scaffold
@@ -97,6 +97,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 commitrefs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commitrefs/patches/master/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commitrefs/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 commitrefs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commitrefs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit
refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit
refs/patches/master/remove
+% guilt push
+Applying patch..mode
+Patch applied.
+% git for-each-ref
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commitrefs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit

[GUILT v4 30/33] Added a short style guide, and Emacs settings.

2014-05-18 Thread Per Cederqvist
Signed-off-by: Per Cederqvist ced...@opera.com
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net
---
 .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
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.
+
 2) Make a patch:
 
 Use diff -up or diff -uprN to create patches. Or simply use git to
-- 
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


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

2014-05-18 Thread Per Cederqvist
---
 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

--
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


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

2014-05-18 Thread Per Cederqvist
---
 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

--
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] remote-helpers: point at their upstream repositories

2014-05-18 Thread Felipe Contreras
Matthieu Moy wrote:
 Felipe Contreras felipe.contre...@gmail.com writes:
 
   % git fetch
   WARNING: git-remote-hg is now maintained independently.
   WARNING: For more information visit 
  https://github.com/felipec/git-remote-hg
   searching for changes
   no changes found
 
 I don't think the situation is as simple as you claim. In many cases,
 the first step before the ones you are mentionning are:
 
   cd $git/contrib/remote-helpers
   cp git-remote-{hg,bzr} somewhere/in/path

In many cases, but not all cases. In other cases they are:

ln -s $git/contrib/remote-helpers/git-remote-hg \
somewhere/in/path/git-remote-hg

Which has to be done only once, and not every time Git is updated.

 They produces no warning if git-remote-{hg,bzr} exist with the warning,
 but no such file or directory: contrib/remote-helpers if the directory
 has been renamed or removed.

So? They'll get the warning the next time they try to use it, and their
workflow won't be interrupted, and the warning will be more useful than
No such file or directory.

 When git-remote-{hg,bzr} are installed with a package manager, the fact
 that they are part of Git's core or not is often irrelevant. For
 example, Debian splits the git.git source into many packages, so a
 Debian user will not see any difference between helpers included in
 git.git or outside (e.g. I have to install the package git-svn if I want
 to use git-svn).

Yet there is no git-hg. And I doubt Jonathan Nieder is going to package
the out-of-tree git-bzr, which as far as I know, is the only out-of-tree
package of these remote helpers in any distro.

-- 
Felipe Contreras
--
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] remote-helpers: point at their upstream repositories

2014-05-18 Thread Junio C Hamano
Felipe Contreras felipe.contre...@gmail.com writes:

  But that being said, this is Felipe's code. While we have a legal right
  to distribute it in v2.0, if he would really prefer it out for v2.0, I
  would respect that.
 
 I am fine with that.

 Are you? Because in two of the three options you list below you wouldn't
 be doing that.

that does not refer to remove them at v2.0 (unconditional).  It
refers to If Felipe really wants for the removal for v2.0, I would
respect that.  And I saw you said you did not want to disrupt v2.0.

If the options I listed all meant removal at v2.0, then I would
understand your complaints, but that is not the case, so I am not
sure what to make of that.

 The fact of the matter is that users cannot depend on packages any more.
 Maybe they'll be packaged, maybe not. If they are it will take a long
 time before they do. In the meantime they'll have to manually install
 them all all out-of-tree tools.

I have always thought that distro packagers are the biggest ally us
project leaders have.  They locate useful pieces of software,
massage them into a shape that fit their distro well and deliver
what we write to their audience.  Packaging stuff that are useful to
their end-users is what they do best, and not leaving useful stuff
unpackaged is in their best interest.

Your statement makes it sound like they are incompetent lazy fools
who do not know what is useful for their users.

I find it disturbing to see such a distrust.  Or am I being too
naive to have too much faith in packaging folks?

I checked the list of packages that depend on git on one of my
boxes (it is a bit old Ubuntu).  I of course expected that many of
them are what comes from our tree split into their own niche tool
packages (e.g. git-svn, git-gui, gitweb...), but I was pleasantly
surprised to see many that I haven't even aware of being packaged.
Of course, tig is among the packages that depend on us which I am
happy to see.

There are things of somewhat questionable value I saw in the list,
of course.  It is already 2014, and I feel fairly safe to feel that
I can say without offending too many people that I doubt git-arch
would be on such a list of packages distros offer to their users, if
it were written as a third-party plug-in today.

It is an (odd) example of a package that is still there mostly by
inertia at this point, and that inertia comes from many things.  It
is in our tree outside contrib/, it was found useful once in the
past and was packaged, the packager already has infrastructure to
cut a separate package out of our tree, and it is more trouble to
retire it and risk breaking minority users than just keep shipping
it.

But hg is not in a situation similar to tla, is it?  I simply cannot
imagine there is no history worthwhile to salvage out of Mercurial
repositories coming anytime in the near future.

After looking at the reverse-depends list of packages, my faith is
strengthened in that the Git ecosystem is truly maturing and useful
third-party plug-ins will be picked up by distro packagers.

Am I delusional?
--
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] remote-helpers: point at their upstream repositories

2014-05-18 Thread Junio C Hamano
Jeff King p...@peff.net writes:

 My concerns were with people not noticing the README. Removing the code
 entirely is the way I thought of to address that. Junio suggested
 another way, which I would also be fine with. And it seems like a
 friendlier way than removal to handle it for v2.0, if we are going to
 remove the code entirely post-v2.0.

 As before, if your desire is to have the code out for v2.0, then say so.
 I think we should respect such a request.

OK.  After thinking about it a bit more, I think renaming the
directory at this point is not a clearly superiour option and the
judgment largely depends on your philosophy on transition.  Let me
explain, backwards from the desired endgame.

I think all of us (including Felipe) agree that in some future time
[*1*], we won't have either of these two scripts in contrib/, but
just like contrib/vim, we will leave a README to help those who read
a stale page on the Web that says remote-hg in contrib/ is the
officially recommended tool to interact with Mercurial.  The README
will tell them that they read a stale page that is no longer true,
and direct them to where they can grab remote-hg/bzr.

We will need to keep contrib/remote-helpers in that endgame state
for quite some time.

If a user of 1.9.x updates to such an endgame version and then runs
the same fetch from Hg, he will not just notice the breakage but is
forced at that point to go to the GitHub URL and switch, but it may
not be a convenient time for him to go through that process.  To
help these users, a step that ships the stale but working scripts
that give warning is necessary before the endgame state, and
Felipe's 77621193 (contrib: remote-helpers: add move warnings
(v2.0), 2014-05-13) is such a change.

My suggestion to rename the directory without smudging the scripts
was meant to be a step that can come before that step, and I think
its necessity is debatable.  It depends on how gradual a transition
you want to give, and being always the more cautious type, I think
having such a step will give packagers who pay attention to what
they package and users who pay attention to what they install
without packaging an early chance to notice and prepare.

 - The endgame will force the user to update at the point when the
   user needs to use it for his real work, when he may not have time
   for sysadmin. 

 - The always warn does not force update at the point of use, but
   it still does not help them to notice well before they try to use
   it for the first time after update;

 - Break the build attempts to help them notice when they try to
   update, not when they need to use the updated one right at this
   moment.

But I am fine with an expedited transition schedule without the
break the build step.  That was an optional first step, because
warn but still work state we must have before the endgame will
give the users the choice of when to adjust anyway.

I also thought about adding an extra step to have even more gradual
transition, by the way.  A step before the endgame will ship these
scripts without anything but instruct and fail (this is not warn
and fail, as it is too late warn, as the scripts are crippled not
to work at this point).

That will still force the user to update at the point when the user
needs to use it, but seeing the instruction (e.g. run this curl
command to fetch from this URL and store it in a file called
git-remote-xx on your $PATH) that is easy to follow immediately
would be better than seeing only a failure (i.e. remote-hg not
found), having to go fish the README, visiting the GitHub pages
and figuring out how to fetch and install the script, which would
be what the user will get with README only, no scripts endgame.

For that matter, the warning message given by 77621193, also README
added by f000c4e6 (remote-helpers: point at their upstream
repositories, 2014-05-15) may want to mention not just the GitHub
URL for the repository as the whole, but the URL to fetch the latest
blob with curl/wget, if we really want to help users go back to
their tasks at hand with minimum interruption.  I know how to
construct a URL to follow the tip of a specific branch and obtain a
full .zip from a GitHub repository, but I do not know offhand if you
can do the same for a single blob.  If we can come up with one, we
should add such a instruction to the warning message and README, as
that instruction will be the only thing to help the users in the
endgame state anyway.

So to summarize, the following timeline is a full possibility:

  1. (optional) break the build by renaming directory and add
 README. Include not just the repository URL but a blob URL
 and instruction to download via wget/curl.

  2. add warning that is given every time the scripts are run and
 give the same instruction as in README.

  3. (optional) cripple the script to make them always fail after
 showing the same warning as above.

  4. Keep README and retire everything else.

but I am perfectly 

Re: [PATCH] rebase --keep-empty -i: add test

2014-05-18 Thread Neil Horman
On Sun, May 18, 2014 at 11:28:39PM +0300, Michael S. Tsirkin wrote:
 There's some special code in rebase -i to deal
 with --keep-empty.
 Add test for this combination.
 
 Signed-off-by: Michael S. Tsirkin m...@redhat.com
Acked-by: Neil Horman nhor...@tuxdriver.com

 ---
  t/t3404-rebase-interactive.sh | 9 +
  1 file changed, 9 insertions(+)
 
 diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
 index c0023a5..3b1b863 100755
 --- a/t/t3404-rebase-interactive.sh
 +++ b/t/t3404-rebase-interactive.sh
 @@ -67,6 +67,14 @@ test_expect_success 'setup' '
  SHELL=
  export SHELL
  
 +test_expect_success 'rebase --keep-empty' '
 + git checkout -b emptybranch master 
 + git commit --allow-empty -m empty 
 + git rebase --keep-empty -i HEAD~2 
 + git log --oneline actual 
 + test_line_count = 6 actual
 +'
 +
  test_expect_success 'rebase -i with the exec command' '
   git checkout master 
   (
 -- 
 MST
 
--
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 2/4] git-rebase: document ack

2014-05-18 Thread Eric Sunshine
On Sun, May 18, 2014 at 5:17 PM, Michael S. Tsirkin m...@redhat.com wrote:
 document ack! behaviour and use

 Signed-off-by: Michael S. Tsirkin m...@redhat.com
 ---
  Documentation/git-rebase.txt | 45 
 +++-
  1 file changed, 40 insertions(+), 5 deletions(-)

 diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
 index 2a93c64..c27aef4 100644
 --- a/Documentation/git-rebase.txt
 +++ b/Documentation/git-rebase.txt
 @@ -384,7 +384,7 @@ or by giving more than one `--exec`:
  +
  If `--autosquash` is used, exec lines will not be appended for
  the intermediate commits, and will only appear at the end of each
 -squash/fixup series.
 +squash/fixup/ack series.

  --root::
 Rebase all commits reachable from branch, instead of
 @@ -398,13 +398,13 @@ squash/fixup series.

  --autosquash::
  --no-autosquash::
 -   When the commit log message begins with squash! ... (or
 -   fixup! ...), and there is a commit whose title begins with
 +   When the commit log message begins with squash! ... (fixup! ...
 +   or ack! ...), and there is a commit whose title begins with
 the same ..., automatically modify the todo list of rebase -i
 so that the commit marked for squashing comes right after the
 commit to be modified, and change the action of the moved
 -   commit from `pick` to `squash` (or `fixup`).  Ignores subsequent
 -   fixup!  or squash!  after the first, in case you referred to an
 +   commit from `pick` to `squash` (`fixup` or `ack`).  Ignores subsequent
 +   ack! , fixup!  or squash!  after the first, in case you 
 referred to an
 earlier fixup/squash with `git commit --fixup/--squash`.
  +
  This option is only valid when the '--interactive' option is used.
 @@ -624,6 +624,41 @@ consistent (they compile, pass the testsuite, etc.) you 
 should use
  'git stash' to stash away the not-yet-committed changes
  after each commit, test, and amend the commit if fixes are necessary.

 +
 +RECORDING ACKS
 +
 +
 +Interactive mode with --autosquash can be used to concatenate
 +commit log for several commits, which is useful to record
 +extra information about the commit, such as ack signatures.
 +This allows, for example, the following workflow:
 +
 +1. receive patches by mail and commit
 +2. receive by mail ack signatures for the patches
 +3. prepare a series for submission
 +4. submit
 +
 +where point 2. consists of several instances of
 +   i) create a (possibly empty) commit with signature
 + in the commit message
 +
 +Sometimes the ack signature added in i. cannot be amended to the
 +commit it acks, because that commit is buried deeply in a
 +patch series.  That is exactly what rebase --autosquash
 +option is for: use it
 +after plenty of is, to automaticlly rearrange
 +commits, and squashing multiple sign-off commits into
 +the commit that is signed.
 +
 +Start it with the last commit you want to retain as-is:
 +
 +   git rebase --autosquash -i after-this-commit
 +
 +An editor will be fired up with all the commits in your current branch
 +which come after the given commit. Ack commits will be
 +re-arranged to come after the commit that is acked,
 +and the action will be utomticlly changed from `pick` to `ack`

s/utomticlly/automatically/

 +to cause them to be squashed into the acked commit.

  RECOVERING FROM UPSTREAM REBASE
  ---
 --
 MST

--
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] git reintegrate v0.3; manager of integration branches

2014-05-18 Thread Felipe Contreras
Hi,

git reintegrate is a helper tool to manage integration branches, it
has all the options of other known tools.

This is a rewrite of John Keeping's git-integration in Ruby, it has
essentially the same features and passes all the git-integration
tests, but it has more features.

One feature that is missing from git-integration is the ability to
parse existing integration branches.

To give a try you can do:

  git clone https://github.com/gitster/git/
  cd git
  git fetch -u origin 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*'
  git checkout pu
  git reintegrate --generate pu master

Which will generate the integration instructions for you:

  % git reintegrate --cat
  base master
  merge jl/submodule-mv

Moving a regular file in a repository with a .gitmodules file was
producing a warning 'Could not find section in .gitmodules where
path=filename'.

  merge ap/remote-hg-unquote-cquote

A fast-import stream expresses a pathname with funny characters by
quoting them in C style; remote-hg remote helper forgot to unquote
such a path.

  merge jk/for-each-ref-skip-parsing
  merge jk/pack-corruption-post-mortem
  merge jk/reset-p-current-head-fix

git reset -p HEAD has codepath to special case it from resetting
to contents of other commits, but recent change broke it.

  ...

It also has support for evil merges, so it should be perfectly
usable for git.git maintenance.

You can edit the instructions with `git reintegrate --edit`.

The simplest way to begin an integration branch is with:

  git reintegrate --create pu master
  git reintegrate --add=branch1 --add=branch2 --add=branch3

To generate the integration branch run `git reintegrate --rebuild`, if
there are merge conflicts, solve them and continue with `git
reintegrate --continue`.

Despite having more features, the code is actually smaller thanks to
Ruby awesomeness.

Enjoy.

https://github.com/felipec/git-reintegrate

Changes since v0.1:

 * Add support for empty commits
 * Add support for pause command
 * Update manpage
 * Add bash completion

Felipe Contreras (26):
  Add copyright and license notices
  Fix EDITOR support with arguments
  Trivial style cleanup
  Improve command regex
  Add support for empty commits
  test: improve check_int()
  Add support for 'pause' command
  doc: rename manpage file
  doc: update options
  doc: add description
  doc: add missing instruction commands
  doc: cleanup . command
  Verify branches after parsing
  test: fix test names
  Remove unused statements
  Update README
  test: cleanup instruction sheets
  Update copyright notices
  Add bash completion
  build: add installation stuff
  readme: add installation instructions
  Add gitignore for documentation
  trvis: initial configuration
  travis: add verbosity
  test: add test-lib helper
  travis: remove Ruby 1.8

-- 
Felipe Contreras
--
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] git related v0.3

2014-05-18 Thread Felipe Contreras
Hi,

This tool finds people that might be interested in a patch, by going
back through the history for each single hunk modified, and finding
people that reviewed, acknowledged, signed, or authored the code the
patch is modifying.

It does this by running `git blame` incrementally on each hunk, and
finding the relevant commit message. After gathering all the relevant
people, it groups them to show what exactly was their role when the
participated in the development of the relevant commit, and on how many
relevant commits they participated. They are only displayed if they pass
a minimum threshold of participation.

It is similar the the `git contacts` tool in the contrib area, which is a
rewrite of this tool, except that `git contacts` does the absolute minimum;
`git related` is way superior in every way.

For example:


% git related master..fc/transport/improv
  Junio C Hamano gits...@pobox.com (signer: 90%, author: 5%)
  Felipe Contreras felipe.contre...@gmail.com (author: 25%, reviewer: 2%)
  Sverre Rabbelier srabbel...@gmail.com (author: 17%, acker: 2%, signer: 7%)
  Jeff King p...@peff.net (acker: 17%, author: 10%)
  Shawn O. Pearce spea...@spearce.org (author: 5%, signer: 2%, cced: 2%)
  Elijah Newren new...@gmail.com (author: 10%)


In addition, it has an option to output the list of commits, instead of the
contributors, which allows you to easily find out the previous changes to the
lines your patches modify.


% git related -c master..fc/transport/improv
  99d9ec0 Merge branch 'fc/transport-helper-no-refspec'
  67c9c78 transport-helper: barf when user tries old:new
  0460ed2 documentation: trivial style cleanups
  126aac5 transport-helper: fix remote helper namespace regression
  21610d8 transport-helper: clarify pushing without refspecs
  a93b4a0 transport-helper: warn when refspec is not used
  664059f transport-helper: update remote helper namespace
  c4458ec fast-export: Allow pruned-references in mark file
  ...


Moreover, when sending patches for review, you can configure `git send-email`
to use `git related` to find relevant people that should be Cc'ed:


% git send-email --cc-cmd='git related' *.patch


Compared to `git related`, `git contacts` has the following limitations:

 1) Doesn't show the amount of involvement
 2) Doesn't show the kind of involvement (reviewer, author) nor
does it group people by their email address
 3) Doesn't have the option to show the commit themselves
 4) Doesn't have any options at all (--since, --min-percent)

Cheers.

https://github.com/felipec/git-related

Changes since v0.1:

 * Fix compatibility with older versions
 * Add -clong option
 * Add manpage
 * Improve performance by grouping line ranges

Felipe Contreras (12):
  Fix compatibility with Ruby 1.9
  Add support for Ruby 1.8
  Fix popen workaround
  Refactor blame parsing
  Pass multiple ranges to `git blame`
  test: add gitingnore file
  Add -clong option
  Add manpage
  build: add installation stuff
  readme: trivial updates
  test: add test-lib helper
  travis: initial configuration

-- 
Felipe Contreras
--
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] git send-series v0.1

2014-05-18 Thread Felipe Contreras
Hi,

This tool allows you to maintain a patch series more easily. You can store the
cover letter, the cc list, version of the series, and other metadata.

By default it will use the currently checked out branch, and show you a
template like this:


version:
cc:

Subject

Content.


The first part is a YAML document with all optional fields, such as 'version',
'cc', 'to'. You can store any information you want using the YAML syntax.

The second part, delimited by a blank line, is the cover letter. The first like
will be used as the subject of the cover letter email, and the rest as the
content of the email.

Then standard tools will be used to send the emails: `git format-patch` and
`git send-email`, which you must have configured before using this helper.

In the end a custom ref will be created to save the current state of the
branch. For example, if you want to see what was the status of your series of
the branch 'feature-a' in version 2, you can use 'sent/feature-a/v2', for
example to create an interdiff to see what changed between one version an the
other.

Enjoy.

https://github.com/felipec/git-send-series

-- 
Felipe Contreras
--
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] remote-helpers: point at their upstream repositories

2014-05-18 Thread Felipe Contreras
Junio C Hamano wrote:
 Felipe Contreras felipe.contre...@gmail.com writes:
 
   But that being said, this is Felipe's code. While we have a legal right
   to distribute it in v2.0, if he would really prefer it out for v2.0, I
   would respect that.
  
  I am fine with that.
 
  Are you? Because in two of the three options you list below you wouldn't
  be doing that.
 
 that does not refer to remove them at v2.0 (unconditional).  It
 refers to If Felipe really wants for the removal for v2.0, I would
 respect that.  And I saw you said you did not want to disrupt v2.0.
 
 If the options I listed all meant removal at v2.0, then I would
 understand your complaints, but that is not the case, so I am not
 sure what to make of that.

It is a weird choice of semantics then. You said you would respect my
wish, but your proposals did not follow my wish.

  The fact of the matter is that users cannot depend on packages any more.
  Maybe they'll be packaged, maybe not. If they are it will take a long
  time before they do. In the meantime they'll have to manually install
  them all all out-of-tree tools.
 
 I have always thought that distro packagers are the biggest ally us
 project leaders have.  They locate useful pieces of software,
 massage them into a shape that fit their distro well and deliver
 what we write to their audience.  Packaging stuff that are useful to
 their end-users is what they do best, and not leaving useful stuff
 unpackaged is in their best interest.

Yet I bet a lot of open-source software is not actually packaged. That's
the reason there's Python's pip, and Ruby gems.

*If* your software is popular enough, then yes, packagers are your
biggest allys, but if not, they aren't.

 Your statement makes it sound like they are incompetent lazy fools
 who do not know what is useful for their users.

This sentence proves you have no idea how packaging is done.

There is no comittee that hunts down packages that are useful for their
users and assigns available packagers to those projects. Exactly the
same way you don't assign Git developers tasks based on what is useful
for our users.

Each packager decides what project they package, just like every Git
developer decides on what feature they work on.

An obscure package might be packaged because a prominent Debian package
maintainer likes it, and a much more useful and popular project might
not be packaged simply because no package maintainer is interested in
it.

Exactly the same happens in Git; people work on relatively obsucre
features such as ref transactions, because they are interested in them,
and features much more useful for our users get ignored, because
there's nobody (of relevance) championing them.

When a popular project that is useful for the users is neglected for
too long, what usually happens is that an outsider steps up and does the
packaging, which then goes through a review process, and that outsider
might become an official maintainer, and maybe start to package other
things too. That's how packagers join the project.

But nothing gets done if no ousider steps up.

Excatly the same happens in Git; when a feature has been neglected for
too long, an outsider comes and tries to implement it, go through a
review process, and eventually start fixing other things too.

So no, there's no comittee that decides what should be packaged, just
like there's no committe that decides what Git features should be
developed.

It's incredibly alarming that you would think packagers in open source
distributions would work any other way.

And it's incredibly funny that you would label people working on such
model as incompetent lazy fools for not knowing what is useful for
their users, when it is *EXACTLY* the same thing you do in Git; you do
not know what is useful for our users; you don't actually care; you just
work on whatever you like to work on.

It's even worst than that, because if somebody steps up to package a
popular project, the package goes in, but when somebody steps up to
implement a feature that improves our user-interface in Git; they get
their knees shot.

 I find it disturbing to see such a distrust.  Or am I being too
 naive to have too much faith in packaging folks?

There is so much wrong with your mode of thinking and the blindness that
you don't see what you yourself do that I don't even know where to
begin.

Yes you are too naive, on many levels.

 I checked the list of packages that depend on git on one of my
 boxes (it is a bit old Ubuntu).  I of course expected that many of
 them are what comes from our tree split into their own niche tool
 packages (e.g. git-svn, git-gui, gitweb...), but I was pleasantly
 surprised to see many that I haven't even aware of being packaged.
 Of course, tig is among the packages that depend on us which I am
 happy to see.
 
 There are things of somewhat questionable value I saw in the list,
 of course.  It is already 2014, and I feel fairly safe to feel that
 I can say without offending too 

bug: autostash is lost after aborted rebase

2014-05-18 Thread Karen Etheridge

scenario: 
- edit some tracked files; do not add them to the index
- git config rebase.autostash true
- git rebase -i HEAD~3 (an autostash will be created)
- delete the entire buffer and save/exit the editor - this will abort the
  rebase

poof, the autostash is gone (it is not reapplied) -- it must be explicitly
applied again via the SHA that was printed earlier.


(please cc me; I am not subscribed to the list.)

--
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] remote-helpers: point at their upstream repositories

2014-05-18 Thread Felipe Contreras
Junio C Hamano wrote:
 My suggestion to rename the directory without smudging the scripts
 was meant to be a step that can come before that step, and I think
 its necessity is debatable.  It depends on how gradual a transition
 you want to give, and being always the more cautious type,

 I think having such a step will give packagers who pay attention to
 what they package and users who pay attention to what they install
 without packaging an early chance to notice and prepare.

Immaginary packagers.

  - The always warn does not force update at the point of use, but
it still does not help them to notice well before they try to use
it for the first time after update;

I don't understand this sentence. They will see a big fat warning every
time they run the tool, of course they'll notice.

  - Break the build attempts to help them notice when they try to
update, not when they need to use the updated one right at this
moment.

This cannot be done.

 But I am fine with an expedited transition schedule without the
 break the build step.  That was an optional first step, because
 warn but still work state we must have before the endgame will
 give the users the choice of when to adjust anyway.
 
 I also thought about adding an extra step to have even more gradual
 transition, by the way.  A step before the endgame will ship these
 scripts without anything but instruct and fail (this is not warn
 and fail, as it is too late warn, as the scripts are crippled not
 to work at this point).
 
 That will still force the user to update at the point when the user
 needs to use it, but seeing the instruction (e.g. run this curl
 command to fetch from this URL and store it in a file called
 git-remote-xx on your $PATH) that is easy to follow immediately
 would be better than seeing only a failure (i.e. remote-hg not
 found), having to go fish the README, visiting the GitHub pages
 and figuring out how to fetch and install the script, which would
 be what the user will get with README only, no scripts endgame.

I don't see what's so complicated about this:

  WARNING: git-remote-hg is now maintained independently.
  WARNING: For more information visit https://github.com/felipec/git-remote-hg

They click that URL, and the are immediately greated with this:

  To enable this, simply add the git-remote-hg script anywhere in your $PATH:

wget https://raw.github.com/felipec/git-remote-hg/master/git-remote-hg -O 
~/bin/git-remote-hg
chmod +x ~/bin/git-remote-hg

Clearly you haven't even bothered to visit the home pages of the
projects you threw to the wolves.

 So to summarize, the following timeline is a full possibility:
 
   1. (optional) break the build by renaming directory and add
  README. Include not just the repository URL but a blob URL
  and instruction to download via wget/curl.

That won't break the build.

   2. add warning that is given every time the scripts are run and
  give the same instruction as in README.
 
   3. (optional) cripple the script to make them always fail after
  showing the same warning as above.

This is what I want, and I already sent the patches for; the scripts
will be stubs. At this point you would have effectively removed the
code, which what I want.
 
   4. Keep README and retire everything else.

After you've removed the code, I don't care what you do, but I'd say you
should remove the stubs after a long period of time.

-- 
Felipe Contreras
--
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: bug: autostash is lost after aborted rebase

2014-05-18 Thread Felipe Contreras
Karen Etheridge wrote:
 
 scenario: 
 - edit some tracked files; do not add them to the index
 - git config rebase.autostash true
 - git rebase -i HEAD~3 (an autostash will be created)
 - delete the entire buffer and save/exit the editor - this will abort the
   rebase
 
 poof, the autostash is gone (it is not reapplied) -- it must be explicitly
 applied again via the SHA that was printed earlier.

Yeah, I noticed this issue while rewriting `git rebase` in Ruby. I also
noticed many other issues and inconsistencies that happen depending on what
arguments you pass to `git rebase`.

I'm in the process of writing a much more improved and consistent
`git rebase` in Ruby with a different interface. Sadly it's still not ready.

 (please cc me; I am not subscribed to the list.)

No need to say that, only on mailing lists that do Reply-To munging, and
Git is not one of them.

Cheers.

-- 
Felipe Contreras
--
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