Re: [PATCH v3 3/6] rebase -i: add short command-name in --autosquash

2017-05-02 Thread Liam Beguin
Hi Johannes,

On Tue, 2017-05-02 at 17:34 +0200, Johannes Schindelin wrote:
> Hi Liam,
> 
> On Tue, 2 May 2017, Liam Beguin wrote:
> 
> > teach `git rebase -i` to recognise short command-names when using the
> > '--autosquash' option. This allows commit with titles beginning with
> > "s! ..." and "f! ..." to be treated the same way as "squash! ..." and
> > "fixup! ..." respectively.
> 
> As the recommended way to generate those commits is by using the
> --fixup/--squash options of git-commit, and as there is *a much higher*
> chance of false positives when using a very short tell-tale such as `f!`
> (which could be an abbreviation for an expletive, likewise `s!`), I do not
> think we will want this change.
> 
> Let's keep handling just fixup!/squash!
> 
> Ciao,
> Johannes

I was not quite sure about this change. My guess was that since --autosquash
needs the whole commit title to find a match, the short version had little
probability of generating a false positive. I thought it made sense to include
the change in this series, but I understand why it's probably not a good idea
to take it. I'll remove it in the next series.

Thanks, 
Liam


Re: [PATCH v3 3/6] rebase -i: add short command-name in --autosquash

2017-05-02 Thread Johannes Schindelin
Hi Liam,

On Tue, 2 May 2017, Liam Beguin wrote:

> teach `git rebase -i` to recognise short command-names when using the
> '--autosquash' option. This allows commit with titles beginning with
> "s! ..." and "f! ..." to be treated the same way as "squash! ..." and
> "fixup! ..." respectively.

As the recommended way to generate those commits is by using the
--fixup/--squash options of git-commit, and as there is *a much higher*
chance of false positives when using a very short tell-tale such as `f!`
(which could be an abbreviation for an expletive, likewise `s!`), I do not
think we will want this change.

Let's keep handling just fixup!/squash!

Ciao,
Johannes


[PATCH v3 3/6] rebase -i: add short command-name in --autosquash

2017-05-01 Thread Liam Beguin
teach `git rebase -i` to recognise short command-names when using the
'--autosquash' option. This allows commit with titles beginning with
"s! ..." and "f! ..." to be treated the same way as "squash! ..." and
"fixup! ..." respectively.

Signed-off-by: Liam Beguin 
---
 Documentation/git-rebase.txt | 2 ++
 git-rebase--interactive.sh   | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 53f4e14a..3e49d8b046ca 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -437,6 +437,8 @@ without an explicit `--interactive`.
commit from `pick` to `squash` (or `fixup`).  Ignores subsequent
"fixup! " or "squash! " after the first, in case you referred to an
earlier fixup/squash with `git commit --fixup/--squash`.
+   Note that their short counterparts, namely "s! ..." and "f! ..."
+   behave the same way.
 +
 This option is only valid when the `--interactive` option is used.
 +
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 4fa621062cdf..61450064c5c4 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -790,7 +790,7 @@ rearrange_squash () {
do
test -z "${format}" || message=$(git log -n 1 --format="%s" 
${sha1})
case "$message" in
-   "squash! "*|"fixup! "*)
+   "squash! "*|"s! "*|"fixup! "*|"f! "*)
action="${message%%!*}"
rest=$message
prefix=
@@ -798,7 +798,7 @@ rearrange_squash () {
while :
do
case "$rest" in
-   "squash! "*|"fixup! "*)
+   "squash! "*|"s! "*|"fixup! "*|"f! "*)
prefix="$prefix${rest%%!*},"
rest="${rest#*! }"
;;
-- 
2.9.3