[PATCH v1 08/19] rebase -i: root commits are replayed with an unnecessary option

2014-07-28 Thread Fabian Ruch
The command line used to recreate root commits specifies the
effectless option `-C`. It makes git-commit reuse commit message and
authorship of the named commit. However, the commit being amended
here, which is the sentinel commit, already carries the authorship
and log message of the commit being replayed. Remove the option.

Since `-C` (in contrast to `-c`) does not invoke the editor and the
`--amend` option invokes it by default, disable editor invocation
again by specifying `--no-edit`.

Signed-off-by: Fabian Ruch 
---
 git-rebase--interactive.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 576e0b1..46f436f 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -511,7 +511,7 @@ do_pick () {
   --no-post-rewrite -n -q -C $1 &&
pick_one -n $1 &&
git commit --allow-empty --allow-empty-message \
-  --amend --no-post-rewrite -n -C $1 \
+  --amend --no-post-rewrite -n --no-edit \
   ${gpg_sign_opt:+"$gpg_sign_opt"} ||
die_with_patch $1 "Could not apply $1... $2"
else
-- 
2.0.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 v1 08/19] rebase -i: root commits are replayed with an unnecessary option

2014-08-01 Thread Jeff King
On Tue, Jul 29, 2014 at 01:18:08AM +0200, Fabian Ruch wrote:

> The command line used to recreate root commits specifies the
> effectless option `-C`. It makes git-commit reuse commit message and
> authorship of the named commit. However, the commit being amended
> here, which is the sentinel commit, already carries the authorship
> and log message of the commit being replayed. Remove the option.
> 
> Since `-C` (in contrast to `-c`) does not invoke the editor and the
> `--amend` option invokes it by default, disable editor invocation
> again by specifying `--no-edit`.

I found this description a little backwards. The "-C" does have an
effect, as you noticed in the second paragraph.

I think the reasoning is more like:

  The command line used to recreate root commits uses "-C" to
  suppress the commit editor. This is unnecessarily confusing,
  though, because that suppression is a secondary effect of the
  option. The main purpose of "-C" is to pull the metadata from
  another commit, but here we know that this is a noop, since we
  are amending a commit just created from the same data.

  At the time, commit did not yet know "--no-edit", and this was a
  reasonable way to get the desired behavior. We can switch it to
  use "--no-edit" to make the intended effect more obvious.

-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 v1 08/19] rebase -i: root commits are replayed with an unnecessary option

2014-08-04 Thread Fabian Ruch
Hi Jeff,

Jeff King writes:
> On Tue, Jul 29, 2014 at 01:18:08AM +0200, Fabian Ruch wrote:
>> The command line used to recreate root commits specifies the
>> effectless option `-C`. It makes git-commit reuse commit message and
>> authorship of the named commit. However, the commit being amended
>> here, which is the sentinel commit, already carries the authorship
>> and log message of the commit being replayed. Remove the option.
>>
>> Since `-C` (in contrast to `-c`) does not invoke the editor and the
>> `--amend` option invokes it by default, disable editor invocation
>> again by specifying `--no-edit`.
> 
> I found this description a little backwards. The "-C" does have an
> effect, as you noticed in the second paragraph.
> 
> I think the reasoning is more like:
> 
>   The command line used to recreate root commits uses "-C" to
>   suppress the commit editor. This is unnecessarily confusing,
>   though, because that suppression is a secondary effect of the
>   option. The main purpose of "-C" is to pull the metadata from
>   another commit, but here we know that this is a noop, since we
>   are amending a commit just created from the same data.
> 
>   At the time, commit did not yet know "--no-edit", and this was a
>   reasonable way to get the desired behavior. We can switch it to
>   use "--no-edit" to make the intended effect more obvious.

Thanks again, I shamelessly copied your formulation but squeezed in an
"undocumented" because --no-edit had just been implemented (commit
ca1ba2010), though was then still missing from the git-commit manpage.

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