[PATCH] guilt: fix "from: xxx" filtering in the patch description

Commit 2cc8d35 ([PATCH] guilt: improve patch header handling) caused
a regression with patch header handling.  When using a hand written
patch description in the format:

> Frobnozzle: this is a patch subject
>
> From: Fred McNurk <fred@mcnurt.foo>

the old code filtered the From: line out of the git commit
description, while the new code leaves it in there. The result is
that when using guilt patchbomb, the From line is emitted twice in
the email that is sent - once from the author of the patch, and
again in the body of the commit message.

Fix this by unconditionally filtering the From: field out of the
constructed commit message that is used for git.

This patch was sent out via my local version of guilt that has this
patch applied, so the sending of this patch is demonstration that
this fix has been tested and works...

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
[PATCH]  get rid of "cat: write error: Broken pipe" error message

In some circumstances (like running guilt in a M-x shell buffer in
Emacs) cat may give the above error message when the reader of the
output from cat exits without reading all input from cat.  (In other
circumstances cat is just silently terminated with SIGPIPE.)

Get rid of the error by removing the useless use of cat in
do_get_header and do_get_full_header.

Signed-off-by: Per Cederqvist <cederp@opera.com>
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
[PATCH] Documentation/Makefile: Run xmlto with --skip-validation

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
[GUILT] handle branches with slashes in guilt-graph

Avoid sed errors when the branch name contains a slash.

Signed-off-by: Per Cederqvist <cederp@opera.com>
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
[GUILT 1/6] Refuse to push corrupt patches

"guilt push" would treat corrupt patches as empty,
because "git apply --numstat" prints nothing on stdout.

(You do get an error message on stderr,
 but then guilt says "Patch applied" etc,
 and I didn't notice the earlier error message
 for quite some time.)

Signed-off-by: Alan Jenkins <alan.christopher.jenkins@googlemail.com>
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
[GUILT 2/6] guilt-header: fix patch corruption

Hunks containing the string "END{}" were being corrupted.

Signed-off-by: Alan Jenkins <alan.christopher.jenkins@googlemail.com>
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
[GUILT 3/6] Handle paths that contain spaces

Signed-off-by: Alan Jenkins <alan.christopher.jenkins@googlemail.com>
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
[GUILT 4/6] Run regression tests in a directory which contains spaces

This helped me in finding some of the issues in the previous patch.

Signed-off-by: Alan Jenkins <alan.christopher.jenkins@googlemail.com>
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
[GUILT 5/6] Allow guilt scripts to be run from a directory which contains spaces

`dirname $0` breaks if $0 includes spaces.

I don't need this; it was the result of a mis-understanding.
But here it is anyway; take it if you think it's useful.

Signed-off-by: Alan Jenkins <alan.christopher.jenkins@googlemail.com>
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
[GUILT 6/6] Allow the regression tests to be run from a directory with spaces in

Alan Jenkins <alan.christopher.jenkins@googlemail.com>
sed -i regression/*.sh 's|source $REG_DIR/scaffold|source "$REG_DIR/scaffold"|'

Same as the previous patch: it turned out I don't need this,
but you might think it's a good idea anyway.

Signed-off-by: Alan Jenkins <alan.christopher.jenkins@googlemail.com>
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
guilt: remove a useless cat

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
[PATCH] Testsuite: get rid of "Broken pipe" errors from yes.

Signed-off-by: Per Cederqvist <cederp@opera.com>
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
[PATCH] The tests should not fail if log.date or log.decorate are set.

Explicitly set log.date and log.decorate to their Git default values,
so that git produces the expected output even if log.date and
log.decorate are set by the user in his .gitconfig.

Signed-off-by: Per Cederqvist <cederp@opera.com>
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
get rid of "cat: write error: Broken pipe" error message

In some circumstances (like running guilt in a M-x shell buffer in
Emacs) cat may give the above error message when the reader of the
output from cat exits without reading all input from cat.  (In other
circumstances cat is just silently terminated with SIGPIPE.)

Get rid of the error by removing the useless use of cat in
do_get_header and do_get_full_header.

Signed-off-by: Per Cederqvist <cederp@opera.com>
Acked-by: Jeff Sipek <jeffpc@josefsipek.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
The tests should not fail if log.date or log.decorate are set.

Explicitly set log.date and log.decorate to their Git default values,
so that git produces the expected output even if log.date and
log.decorate are set by the user in his .gitconfig.

Signed-off-by: Per Cederqvist <cederp@opera.com>
Acked-by: Jeff Sipek <jeffpc@josefsipek.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Testsuite: get rid of "Broken pipe" errors from yes.

Signed-off-by: Per Cederqvist <cederp@opera.com>
Acked-by: Jeff Sipek <jeffpc@josefsipek.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Handle empty patches and patches with only a header.

"git apply --numstat" in Git 1.7.10 gives an error message unless the
patch contains a diff, so don't attempt to apply it unless we find a
'^diff'.

Signed-off-by: Per Cederqvist <cederp@opera.com>
Acked-by: Jeff Sipek <jeffpc@josefsipek.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Fix fatal "guilt graph" error in sha1sum invocation.

Fix the compatibility function sha1 so that it reads from
stdin (and not a file with a zero-length file name) when
no argument is supplied.

[jn: adapted to also handle newer versions of OpenSSL,
 based on reports from Andreas Schwab and John Szakmeister.

 $ openssl dgst -sha1</dev/null
 da39a3ee5e6b4b0d3255bfef95601890afd80709
 $ openssl version
 OpenSSL 0.9.8o 01 Jun 2010

 $ openssl dgst -sha1 </dev/null
 (stdin)= da39a3ee5e6b4b0d3255bfef95601890afd80709
 $ openssl version
 OpenSSL 1.0.0d 8 Feb 2011
]

Signed-off-by: Per Cederqvist <cederp@opera.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Change git branch when patches are applied.

Apply patches on a separate branch. The separate branch is
automatically created when Guilt pushes something, and removed when no
patches are applied. The name is formed by prepending "guilt/" to the
original branch.

This breaks the "upstream" relationship, so a mistaken "git push"
while patches are applied will no longer mess up your upstream
repository.

Update the testsuite and documentation.

Thanks to Junio C Hamano for suggesting this solution to my problem.

Signed-off-by: Per Cederqvist <cederp@opera.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Drop unneeded git version check.

Git's compatibility record is pretty good, so there's no need to worry
that newer versions of git will break the "git config" command.

Without this change, guilt errors out for git 1.8.  With it, all
tests pass.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>