Commit graph

10 commits

Author SHA1 Message Date
Andrew Pimlott 22c5b13636 rebase -i: handle fixup! fixup! in --autosquash
In rebase -i --autosquash, ignore all "fixup! " or "squash! " after the
first.  This supports the case when a git commit --fixup/--squash referred
to an earlier fixup/squash instead of the original commit (whether
intentionally, as when the user expressly meant to note that the commit
fixes an earlier fixup; or inadvertently, as when the user meant to refer to
the original commit with :/msg; or out of laziness, as when the user could
remember how to refer to the fixup but not the original).

In the todo list, the full commit message is preserved, in case it provides
useful cues to the user.  A test helper set_cat_todo_editor is introduced to
check this.

Helped-by: Thomas Rast <trast@inf.ethz.ch>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Andrew Pimlott <andrew@pimlott.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-27 13:52:41 -07:00
Stefano Lattarini 3fb0459bc8 tests: modernise style: more uses of test_line_count
Prefer:

  test_line_count <OP> COUNT FILE

over:

  test $(wc -l <FILE) <OP> COUNT

(or similar usages) in several tests.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-11 09:32:20 -07:00
Junio C Hamano 9bec60d3a5 Merge branch 'pn/commit-autosquash'
* pn/commit-autosquash:
  add tests of commit --squash
  commit: --squash option for use with rebase --autosquash
  add tests of commit --fixup
  commit: --fixup option for use with rebase --autosquash
  pretty.c: teach format_commit_message() to reencode the output
  commit: helper methods to reduce redundant blocks of code

Conflicts:
	Documentation/git-commit.txt
	t/t3415-rebase-autosquash.sh
2010-12-03 16:13:06 -08:00
Kevin Ballard 68d5d03bc4 rebase: teach --autosquash to match on sha1 in addition to message
Support lines of the form "fixup! 7a235b" that specify an exact commit
in addition to the normal "squash! Old commit message" form.

Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09 09:44:19 -08:00
Kevin Ballard d3d7a421b1 rebase: better rearranging of fixup!/squash! lines with --autosquash
The current behvaior of --autosquash can duplicate fixup!/squash! lines
if they match multiple commits, and it can also apply them to commits
that come after them in the todo list. Even more oddly, a commit that
looks like "fixup! fixup!" will match itself and be duplicated in the
todo list.

Change the todo list rearranging to mark all commits as used as soon
as they are emitted, and to avoid emitting a fixup/squash commit if the
commit has already been marked as used.

Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09 09:43:54 -08:00
Pat Notz 7951bd3029 add tests of commit --squash
t7500: test expected behavior of commit --squash
t3415: test interaction of commit --squash with rebase --autosquash
t3900: test commit --squash with i18n encodings

Signed-off-by: Pat Notz <patnotz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-04 13:53:36 -07:00
Pat Notz b1a6c0a96f add tests of commit --fixup
t7500: test expected behavior of commit --fixup
t3415: test interaction of commit --fixup with rebase --autosquash
t3900: test commit --fixup with i18n encodings

Signed-off-by: Pat Notz <patnotz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-04 13:53:35 -07:00
Yann Dirson 7c6eafa35a t/t3415: use && where applicable.
Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06 13:46:02 -07:00
Heiko Voigt dd1e5b313a add configuration variable for --autosquash option of interactive rebase
If you use this feature regularly you can now enable it by default. In
case the user wants to override this config on the commandline
--no-autosquash can be used to force disabling.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-14 08:47:29 -07:00
Nanako Shiraishi f59baa502f rebase -i --autosquash: auto-squash commits
Teach a new option, --autosquash, to the interactive rebase.
When the commit log message begins with "!fixup ...", 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 come right after the commit to be modified, and change
the action of the moved commit from pick to squash.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-06 17:18:56 -08:00