Re: [PATCH] cherry-pick: add --allow-empty-message option

2012-08-06 Thread Neil Horman
On Thu, Aug 02, 2012 at 11:38:51AM +0100, Chris Webb wrote:
 Scripts such as git rebase -i cannot currently cherry-pick commits which
 have an empty commit message, as git cherry-pick calls git commit
 without the --allow-empty-message option.
 
 Add an --allow-empty-message option to git cherry-pick which is passed
 through to git commit, so this behaviour can be overridden.
 
 Signed-off-by: Chris Webb ch...@arachsys.com
Sorry for the late response, but I just pulled back into town.

Having read over this thread, I think this is definately the way to go.  As
discussed having cherry-pick stop and give the user a chance to fix empty
history messages by default, and providing a switch to override that behavior
makes sense to me.  That said, shouldn't there be extra code here in the rebase
scripts to automate commit migration in that path as well?
Neil

 
--
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] cherry-pick: add --allow-empty-message option

2012-08-06 Thread Chris Webb
Neil Horman nhor...@tuxdriver.com writes:

 Having read over this thread, I think this is definately the way to go.  As
 discussed having cherry-pick stop and give the user a chance to fix empty
 history messages by default, and providing a switch to override that behavior
 makes sense to me.  That said, shouldn't there be extra code here in the 
 rebase
 scripts to automate commit migration in that path as well?

Yes, this patch just adds the support to the low-level git cherry-pick as
you say. I'll follow up with a patch to use the new feature in rebase [-i]
when I get some free time, hopefully later this week.

Cheers,

Chris.
--
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] cherry-pick: add --allow-empty-message option

2012-08-06 Thread Neil Horman
On Mon, Aug 06, 2012 at 12:00:16PM +0100, Chris Webb wrote:
 Neil Horman nhor...@tuxdriver.com writes:
 
  Having read over this thread, I think this is definately the way to go.  As
  discussed having cherry-pick stop and give the user a chance to fix empty
  history messages by default, and providing a switch to override that 
  behavior
  makes sense to me.  That said, shouldn't there be extra code here in the 
  rebase
  scripts to automate commit migration in that path as well?
 
 Yes, this patch just adds the support to the low-level git cherry-pick as
 you say. I'll follow up with a patch to use the new feature in rebase [-i]
 when I get some free time, hopefully later this week.
 
 Cheers,
 
 Chris.
 
Ok, then
Acked-by: Neil Horman nhor...@tuxdriver.com

--
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] cherry-pick: add --allow-empty-message option

2012-08-02 Thread Chris Webb
Scripts such as git rebase -i cannot currently cherry-pick commits which
have an empty commit message, as git cherry-pick calls git commit
without the --allow-empty-message option.

Add an --allow-empty-message option to git cherry-pick which is passed
through to git commit, so this behaviour can be overridden.

Signed-off-by: Chris Webb ch...@arachsys.com
---
 Documentation/git-cherry-pick.txt | 5 +
 builtin/revert.c  | 2 ++
 sequencer.c   | 3 +++
 sequencer.h   | 1 +
 t/t3505-cherry-pick-empty.sh  | 5 +
 5 files changed, 16 insertions(+)

diff --git a/Documentation/git-cherry-pick.txt 
b/Documentation/git-cherry-pick.txt
index 0e170a5..c205d23 100644
--- a/Documentation/git-cherry-pick.txt
+++ b/Documentation/git-cherry-pick.txt
@@ -118,6 +118,11 @@ effect to your index in a row.
previous commit are dropped.  To force the inclusion of those commits
use `--keep-redundant-commits`.
 
+--allow-empty-message::
+   By default, cherry-picking a commit with an empty message will fail.
+   This option overrides that behaviour, allowing commits with empty
+   messages to be cherry picked.
+
 --keep-redundant-commits::
If a commit being cherry picked duplicates a commit already in the
current history, it will become empty.  By default these
diff --git a/builtin/revert.c b/builtin/revert.c
index 82d1bf8..5652f23 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -117,6 +117,7 @@ static void parse_args(int argc, const char **argv, struct 
replay_opts *opts)
OPT_END(),
OPT_END(),
OPT_END(),
+   OPT_END(),
};
 
if (opts-action == REPLAY_PICK) {
@@ -124,6 +125,7 @@ static void parse_args(int argc, const char **argv, struct 
replay_opts *opts)
OPT_BOOLEAN('x', NULL, opts-record_origin, append 
commit name),
OPT_BOOLEAN(0, ff, opts-allow_ff, allow 
fast-forward),
OPT_BOOLEAN(0, allow-empty, opts-allow_empty, 
preserve initially empty commits),
+   OPT_BOOLEAN(0, allow-empty-message, 
opts-allow_empty_message, allow commits with empty messages),
OPT_BOOLEAN(0, keep-redundant-commits, 
opts-keep_redundant_commits, keep redundant, empty commits),
OPT_END(),
};
diff --git a/sequencer.c b/sequencer.c
index bf078f2..1ea5293 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -311,6 +311,9 @@ static int run_git_commit(const char *defmsg, struct 
replay_opts *opts,
if (allow_empty)
argv_array_push(array, --allow-empty);
 
+   if (opts-allow_empty_message)
+   argv_array_push(array, --allow-empty-message);
+
rc = run_command_v_opt(array.argv, RUN_GIT_CMD);
argv_array_clear(array);
return rc;
diff --git a/sequencer.h b/sequencer.h
index aa5f17c..d849420 100644
--- a/sequencer.h
+++ b/sequencer.h
@@ -30,6 +30,7 @@ struct replay_opts {
int allow_ff;
int allow_rerere_auto;
int allow_empty;
+   int allow_empty_message;
int keep_redundant_commits;
 
int mainline;
diff --git a/t/t3505-cherry-pick-empty.sh b/t/t3505-cherry-pick-empty.sh
index 5a1340c..a0c6e30 100755
--- a/t/t3505-cherry-pick-empty.sh
+++ b/t/t3505-cherry-pick-empty.sh
@@ -53,6 +53,11 @@ test_expect_success 'index lockfile was removed' '
 
 '
 
+test_expect_success 'cherry-pick a commit with an empty message with 
--allow-empty-message' '
+   git checkout -f master 
+   git cherry-pick --allow-empty-message empty-branch
+'
+
 test_expect_success 'cherry pick an empty non-ff commit without --allow-empty' 
'
git checkout master 
echo fourth file2 
--
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