git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Alban Gruin <alban.gruin@gmail.com>
To: git@vger.kernel.org
Cc: Stefan Beller <sbeller@google.com>,
	Christian Couder <christian.couder@gmail.com>,
	Pratik Karki <predatoramigo@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	phillip.wood@dunelm.org.uk, Wink Saville <wink@saville.com>,
	Alban Gruin <alban.gruin@gmail.com>
Subject: [GSoC][PATCH v2 2/4] rebase: strip unused code in git-rebase--preserve-merges.sh
Date: Tue, 22 May 2018 23:16:23 +0200	[thread overview]
Message-ID: <20180522211625.23893-3-alban.gruin@gmail.com> (raw)
In-Reply-To: <20180522211625.23893-1-alban.gruin@gmail.com>

This removes the code coming from git-rebase--interactive.sh that is not needed
by preserve-merges.

Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
---
 git-rebase--preserve-merges.sh | 65 +++---------------------------------------
 1 file changed, 4 insertions(+), 61 deletions(-)

diff --git a/git-rebase--preserve-merges.sh b/git-rebase--preserve-merges.sh
index 2f4941d0f..c51c7828e 100644
--- a/git-rebase--preserve-merges.sh
+++ b/git-rebase--preserve-merges.sh
@@ -1,12 +1,8 @@
-# This shell script fragment is sourced by git-rebase to implement
-# its interactive mode.  "git rebase --interactive" makes it easy
-# to fix up commits in the middle of a series and rearrange commits.
+# This shell script fragment is sourced by git-rebase to implement its
+# preserve-merges mode.
 #
 # Copyright (c) 2006 Johannes E. Schindelin
 #
-# The original idea comes from Eric W. Biederman, in
-# https://public-inbox.org/git/m1odwkyuf5.fsf_-_@ebiederm.dsl.xmission.com/
-#
 # The file containing rebase commands, comments, and empty lines.
 # This file is created by "git rebase -i" then edited by the user.  As
 # the lines are processed, they are removed from the front of this
@@ -287,17 +283,7 @@ pick_one () {
 		empty_args="--allow-empty"
 	fi
 
-	test -d "$rewritten" &&
-		pick_one_preserving_merges "$@" && return
-	output eval git cherry-pick $allow_rerere_autoupdate $allow_empty_message \
-			${gpg_sign_opt:+$(git rev-parse --sq-quote "$gpg_sign_opt")} \
-			$signoff "$strategy_args" $empty_args $ff "$@"
-
-	# If cherry-pick dies it leaves the to-be-picked commit unrecorded. Reschedule
-	# previous task so this commit is not lost.
-	ret=$?
-	case "$ret" in [01]) ;; *) reschedule_last_action ;; esac
-	return $ret
+	pick_one_preserving_merges "$@"
 }
 
 pick_one_preserving_merges () {
@@ -761,11 +747,6 @@ get_missing_commit_check_level () {
 initiate_action () {
 	case "$1" in
 	continue)
-		if test ! -d "$rewritten"
-		then
-			exec git rebase--helper ${force_rebase:+--no-ff} $allow_empty_message \
-				--continue
-		fi
 		# do we have anything to commit?
 		if git diff-index --cached --quiet HEAD --
 		then
@@ -824,12 +805,6 @@ first and then run 'git rebase --continue' again.")"
 		;;
 	skip)
 		git rerere clear
-
-		if test ! -d "$rewritten"
-		then
-			exec git rebase--helper ${force_rebase:+--no-ff} $allow_empty_message \
-				--continue
-		fi
 		do_rest
 		return 0
 		;;
@@ -944,43 +919,11 @@ EOF
 	}
 
 	expand_todo_ids
-
-	test -d "$rewritten" || test -n "$force_rebase" ||
-	onto="$(git rebase--helper --skip-unnecessary-picks)" ||
-	die "Could not skip unnecessary pick commands"
-
 	checkout_onto
-	if test ! -d "$rewritten"
-	then
-		require_clean_work_tree "rebase"
-		exec git rebase--helper ${force_rebase:+--no-ff} $allow_empty_message \
-			--continue
-	fi
 	do_rest
 }
 
-git_rebase__interactive () {
-	initiate_action "$action"
-	ret=$?
-	if test $ret = 0; then
-		return 0
-	fi
-
-	setup_reflog_action
-	init_basic_state
-
-	init_revisions_and_shortrevisions
-
-	git rebase--helper --make-script ${keep_empty:+--keep-empty} \
-		${rebase_merges:+--rebase-merges} \
-		${rebase_cousins:+--rebase-cousins} \
-		$revisions ${restrict_revision+^$restrict_revision} >"$todo" ||
-	die "$(gettext "Could not generate todo list")"
-
-	complete_action
-}
-
-git_rebase__interactive__preserve_merges () {
+git_rebase__preserve_merges () {
 	initiate_action "$action"
 	ret=$?
 	if test $ret = 0; then
-- 
2.16.1


  parent reply	other threads:[~2018-05-22 21:16 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-22 13:31 [GSoC][PATCH 0/4] rebase: split rebase -p from rebase -i Alban Gruin
2018-05-22 13:31 ` [GSoC][PATCH 1/4] rebase: duplicate git-rebase--interactive.sh to git-rebase--preserve-merges.sh Alban Gruin
2018-05-22 18:26   ` Stefan Beller
2018-05-22 19:15     ` Alban Gruin
2018-05-22 13:31 ` [GSoC][PATCH 2/4] rebase: strip unused code in git-rebase--preserve-merges.sh Alban Gruin
2018-05-22 13:31 ` [GSoC][PATCH 3/4] rebase: use the new git-rebase--preserve-merges.sh Alban Gruin
2018-05-22 13:31 ` [GSoC][PATCH 4/4] rebase: remove -p code from git-rebase--interactive.sh Alban Gruin
2018-05-22 18:29 ` [GSoC][PATCH 0/4] rebase: split rebase -p from rebase -i Stefan Beller
2018-05-22 21:16 ` [GSoC][PATCH v2 " Alban Gruin
2018-05-22 21:16   ` [GSoC][PATCH v2 1/4] rebase: duplicate git-rebase--interactive.sh to git-rebase--preserve-merges.sh Alban Gruin
2018-05-22 21:16   ` Alban Gruin [this message]
2018-05-22 21:16   ` [GSoC][PATCH v2 3/4] rebase: use the new git-rebase--preserve-merges.sh Alban Gruin
2018-05-22 21:16   ` [GSoC][PATCH v2 4/4] rebase: remove -p code from git-rebase--interactive.sh Alban Gruin
2018-05-24 11:49   ` [GSoC][PATCH v3 0/4] rebase: split rebase -p from rebase -i Alban Gruin
2018-05-24 11:49     ` [GSoC][PATCH v3 1/4] rebase: duplicate git-rebase--interactive.sh to git-rebase--preserve-merges.sh Alban Gruin
2018-05-26  2:54       ` Junio C Hamano
2018-05-24 11:49     ` [GSoC][PATCH v3 2/4] rebase: strip unused code in git-rebase--preserve-merges.sh Alban Gruin
2018-05-24 11:49     ` [GSoC][PATCH v3 3/4] rebase: use the new git-rebase--preserve-merges.sh Alban Gruin
2018-05-24 11:49     ` [GSoC][PATCH v3 4/4] rebase: remove -p code from git-rebase--interactive.sh Alban Gruin
2018-05-24 11:52     ` [GSoC][PATCH v3 0/4] rebase: split rebase -p from rebase -i Alban Gruin
2018-05-25  9:51     ` Johannes Schindelin
2018-05-28 12:34     ` [GSoC][PATCH v4 " Alban Gruin
2018-05-28 12:34       ` [GSoC][PATCH v4 1/4] rebase: introduce a dedicated backend for --preserve-merges Alban Gruin
2018-05-28 12:34       ` [GSoC][PATCH v4 2/4] rebase: strip unused code in git-rebase--preserve-merges.sh Alban Gruin
2018-05-28 12:34       ` [GSoC][PATCH v4 3/4] rebase: use the new git-rebase--preserve-merges.sh Alban Gruin
2018-05-28 12:34       ` [GSoC][PATCH v4 4/4] rebase: remove -p code from git-rebase--interactive.sh Alban Gruin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180522211625.23893-3-alban.gruin@gmail.com \
    --to=alban.gruin@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=predatoramigo@gmail.com \
    --cc=sbeller@google.com \
    --cc=wink@saville.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).