All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Clean up after the removal of the scripted rebase
@ 2019-05-14 11:22 Johannes Schindelin via GitGitGadget
  2019-05-14 11:22 ` [PATCH 2/5] t3400: stop referring to " Johannes Schindelin via GitGitGadget
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2019-05-14 11:22 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Technically, there is still one part that is scripted: git rebase
--preserve-merges. But that is already deprecated, and the remaining parts
really are no longer scripted.

Meaning that we do not need git-rebase--am.sh.

While at it, clean up a few other places that reference the scripted rebase,
and also move the functions from git-rebase--common.sh directly into the -p 
backend (because it is the sole remaining user).

Johannes Schindelin (5):
  Drop unused git-rebase--am.sh
  t3400: stop referring to the scripted rebase
  .gitignore: there is no longer a built-in `git-rebase--interactive`
  sequencer: the `am` and `rebase--interactive` scripts are gone
  rebase: fold git-rebase--common into the -p backend

 .gitignore                     |  3 --
 Makefile                       |  2 -
 builtin/rebase.c               |  7 +--
 git-rebase--am.sh              | 85 ----------------------------------
 git-rebase--common.sh          | 69 ---------------------------
 git-rebase--preserve-merges.sh | 55 ++++++++++++++++++++++
 sequencer.c                    |  2 +-
 t/t3400-rebase.sh              |  2 +-
 8 files changed, 58 insertions(+), 167 deletions(-)
 delete mode 100644 git-rebase--am.sh
 delete mode 100644 git-rebase--common.sh


base-commit: ab15ad1a3b4b04a29415aef8c9afa2f64fc194a2
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-194%2Fdscho%2Fdrop-rebase--am.sh-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-194/dscho/drop-rebase--am.sh-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/194
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/5] Drop unused git-rebase--am.sh
  2019-05-14 11:22 [PATCH 0/5] Clean up after the removal of the scripted rebase Johannes Schindelin via GitGitGadget
  2019-05-14 11:22 ` [PATCH 2/5] t3400: stop referring to " Johannes Schindelin via GitGitGadget
@ 2019-05-14 11:22 ` Johannes Schindelin via GitGitGadget
  2019-05-14 11:22 ` [PATCH 3/5] .gitignore: there is no longer a built-in `git-rebase--interactive` Johannes Schindelin via GitGitGadget
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2019-05-14 11:22 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

Since 21853626ea (built-in rebase: call `git am` directly, 2019-01-18),
the built-in rebase already uses the built-in `git am` directly.

Now that d03ebd411c (rebase: remove the rebase.useBuiltin setting,
2019-03-18) even removed the scripted rebase, there is no longer any
user of `git-rebase--am.sh`, so let's just remove it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 .gitignore        |  1 -
 Makefile          |  1 -
 builtin/rebase.c  |  4 ---
 git-rebase--am.sh | 85 -----------------------------------------------
 4 files changed, 91 deletions(-)
 delete mode 100644 git-rebase--am.sh

diff --git a/.gitignore b/.gitignore
index 2374f77a1a..875f3fc6e8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -122,7 +122,6 @@
 /git-range-diff
 /git-read-tree
 /git-rebase
-/git-rebase--am
 /git-rebase--common
 /git-rebase--interactive
 /git-rebase--preserve-merges
diff --git a/Makefile b/Makefile
index f965509b3c..9370d85ff3 100644
--- a/Makefile
+++ b/Makefile
@@ -624,7 +624,6 @@ SCRIPT_SH += git-web--browse.sh
 
 SCRIPT_LIB += git-mergetool--lib
 SCRIPT_LIB += git-parse-remote
-SCRIPT_LIB += git-rebase--am
 SCRIPT_LIB += git-rebase--common
 SCRIPT_LIB += git-rebase--preserve-merges
 SCRIPT_LIB += git-sh-setup
diff --git a/builtin/rebase.c b/builtin/rebase.c
index ba3a574e40..d5f6f403e2 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1153,10 +1153,6 @@ static int run_specific_rebase(struct rebase_options *opts, enum action action)
 	}
 
 	switch (opts->type) {
-	case REBASE_AM:
-		backend = "git-rebase--am";
-		backend_func = "git_rebase__am";
-		break;
 	case REBASE_PRESERVE_MERGES:
 		backend = "git-rebase--preserve-merges";
 		backend_func = "git_rebase__preserve_merges";
diff --git a/git-rebase--am.sh b/git-rebase--am.sh
deleted file mode 100644
index 6416716ee6..0000000000
--- a/git-rebase--am.sh
+++ /dev/null
@@ -1,85 +0,0 @@
-# This shell script fragment is sourced by git-rebase to implement
-# its default, fast, patch-based, non-interactive mode.
-#
-# Copyright (c) 2010 Junio C Hamano.
-#
-
-git_rebase__am () {
-
-case "$action" in
-continue)
-	git am --resolved --resolvemsg="$resolvemsg" \
-		${gpg_sign_opt:+"$gpg_sign_opt"} &&
-	move_to_original_branch
-	return
-	;;
-skip)
-	git am --skip --resolvemsg="$resolvemsg" &&
-	move_to_original_branch
-	return
-	;;
-show-current-patch)
-	exec git am --show-current-patch
-	;;
-esac
-
-if test -z "$rebase_root"
-	# this is now equivalent to ! -z "$upstream"
-then
-	revisions=$upstream...$orig_head
-else
-	revisions=$onto...$orig_head
-fi
-
-ret=0
-rm -f "$GIT_DIR/rebased-patches"
-
-git format-patch -k --stdout --full-index --cherry-pick --right-only \
-	--src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \
-	--pretty=mboxrd --topo-order \
-	$git_format_patch_opt \
-	"$revisions" ${restrict_revision+^$restrict_revision} \
-	>"$GIT_DIR/rebased-patches"
-ret=$?
-
-if test 0 != $ret
-then
-	rm -f "$GIT_DIR/rebased-patches"
-	case "$head_name" in
-	refs/heads/*)
-		git checkout -q "$head_name"
-		;;
-	*)
-		git checkout -q "$orig_head"
-		;;
-	esac
-
-	cat >&2 <<-EOF
-
-	git encountered an error while preparing the patches to replay
-	these revisions:
-
-	    $revisions
-
-	As a result, git cannot rebase them.
-	EOF
-	return $ret
-fi
-
-git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" \
-	--patch-format=mboxrd \
-	$allow_rerere_autoupdate \
-	${gpg_sign_opt:+"$gpg_sign_opt"} <"$GIT_DIR/rebased-patches"
-ret=$?
-
-rm -f "$GIT_DIR/rebased-patches"
-
-if test 0 != $ret
-then
-	test -d "$state_dir" && write_basic_state
-	return $ret
-fi
-
-move_to_original_branch
-
-}
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/5] t3400: stop referring to the scripted rebase
  2019-05-14 11:22 [PATCH 0/5] Clean up after the removal of the scripted rebase Johannes Schindelin via GitGitGadget
@ 2019-05-14 11:22 ` Johannes Schindelin via GitGitGadget
  2019-05-14 11:22 ` [PATCH 1/5] Drop unused git-rebase--am.sh Johannes Schindelin via GitGitGadget
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2019-05-14 11:22 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

One test case's title mentioned the then-current implementation detail
that the `--am` backend was implemented in `git-rebase--am.sh`.

This is no longer the case, so let's update the title to reflect the
current reality.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t3400-rebase.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 42f147858d..80b23fd326 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -285,7 +285,7 @@ EOF
 	test_cmp From_.msg out
 '
 
-test_expect_success 'rebase--am.sh and --show-current-patch' '
+test_expect_success 'rebase --am and --show-current-patch' '
 	test_create_repo conflict-apply &&
 	(
 		cd conflict-apply &&
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/5] .gitignore: there is no longer a built-in `git-rebase--interactive`
  2019-05-14 11:22 [PATCH 0/5] Clean up after the removal of the scripted rebase Johannes Schindelin via GitGitGadget
  2019-05-14 11:22 ` [PATCH 2/5] t3400: stop referring to " Johannes Schindelin via GitGitGadget
  2019-05-14 11:22 ` [PATCH 1/5] Drop unused git-rebase--am.sh Johannes Schindelin via GitGitGadget
@ 2019-05-14 11:22 ` Johannes Schindelin via GitGitGadget
  2019-05-14 11:22 ` [PATCH 4/5] sequencer: the `am` and `rebase--interactive` scripts are gone Johannes Schindelin via GitGitGadget
  2019-05-14 11:22 ` [PATCH 5/5] rebase: fold git-rebase--common into the -p backend Johannes Schindelin via GitGitGadget
  4 siblings, 0 replies; 6+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2019-05-14 11:22 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

This went away in 0609b741a4 (rebase -i: combine rebase--interactive.c
with rebase.c, 2019-04-17).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 .gitignore | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 875f3fc6e8..bcee4fda81 100644
--- a/.gitignore
+++ b/.gitignore
@@ -123,7 +123,6 @@
 /git-read-tree
 /git-rebase
 /git-rebase--common
-/git-rebase--interactive
 /git-rebase--preserve-merges
 /git-receive-pack
 /git-reflog
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/5] sequencer: the `am` and `rebase--interactive` scripts are gone
  2019-05-14 11:22 [PATCH 0/5] Clean up after the removal of the scripted rebase Johannes Schindelin via GitGitGadget
                   ` (2 preceding siblings ...)
  2019-05-14 11:22 ` [PATCH 3/5] .gitignore: there is no longer a built-in `git-rebase--interactive` Johannes Schindelin via GitGitGadget
@ 2019-05-14 11:22 ` Johannes Schindelin via GitGitGadget
  2019-05-14 11:22 ` [PATCH 5/5] rebase: fold git-rebase--common into the -p backend Johannes Schindelin via GitGitGadget
  4 siblings, 0 replies; 6+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2019-05-14 11:22 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

Update a code comment that referred to those files as if they were still
there.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 sequencer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sequencer.c b/sequencer.c
index f88a97fb10..334de14542 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -767,7 +767,7 @@ static int parse_key_value_squoted(char *buf, struct string_list *list)
  *	GIT_AUTHOR_DATE='$author_date'
  *
  * where $author_name, $author_email and $author_date are quoted. We are strict
- * with our parsing, as the file was meant to be eval'd in the old
+ * with our parsing, as the file was meant to be eval'd in the now-removed
  * git-am.sh/git-rebase--interactive.sh scripts, and thus if the file differs
  * from what this function expects, it is better to bail out than to do
  * something that the user does not expect.
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/5] rebase: fold git-rebase--common into the -p backend
  2019-05-14 11:22 [PATCH 0/5] Clean up after the removal of the scripted rebase Johannes Schindelin via GitGitGadget
                   ` (3 preceding siblings ...)
  2019-05-14 11:22 ` [PATCH 4/5] sequencer: the `am` and `rebase--interactive` scripts are gone Johannes Schindelin via GitGitGadget
@ 2019-05-14 11:22 ` Johannes Schindelin via GitGitGadget
  4 siblings, 0 replies; 6+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2019-05-14 11:22 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

The only remaining scripted part of `git rebase` is the
`--preserve-merges` backend. Meaning: there is little reason to keep the
"library of common rebase functions" as a separate file.

While moving the functions to `git-rebase--preserve-merges.sh`, we also
drop the `move_to_original_branch` function that is no longer used.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 .gitignore                     |  1 -
 Makefile                       |  1 -
 builtin/rebase.c               |  3 +-
 git-rebase--common.sh          | 69 ----------------------------------
 git-rebase--preserve-merges.sh | 55 +++++++++++++++++++++++++++
 5 files changed, 56 insertions(+), 73 deletions(-)
 delete mode 100644 git-rebase--common.sh

diff --git a/.gitignore b/.gitignore
index bcee4fda81..4470d7cfc0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -122,7 +122,6 @@
 /git-range-diff
 /git-read-tree
 /git-rebase
-/git-rebase--common
 /git-rebase--preserve-merges
 /git-receive-pack
 /git-reflog
diff --git a/Makefile b/Makefile
index 9370d85ff3..9fc617e38f 100644
--- a/Makefile
+++ b/Makefile
@@ -624,7 +624,6 @@ SCRIPT_SH += git-web--browse.sh
 
 SCRIPT_LIB += git-mergetool--lib
 SCRIPT_LIB += git-parse-remote
-SCRIPT_LIB += git-rebase--common
 SCRIPT_LIB += git-rebase--preserve-merges
 SCRIPT_LIB += git-sh-setup
 SCRIPT_LIB += git-sh-i18n
diff --git a/builtin/rebase.c b/builtin/rebase.c
index d5f6f403e2..9c52144fc4 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1163,8 +1163,7 @@ static int run_specific_rebase(struct rebase_options *opts, enum action action)
 	}
 
 	strbuf_addf(&script_snippet,
-		    ". git-sh-setup && . git-rebase--common &&"
-		    " . %s && %s", backend, backend_func);
+		    ". git-sh-setup && . %s && %s", backend, backend_func);
 	argv[0] = script_snippet.buf;
 
 	status = run_command_v_opt(argv, RUN_USING_SHELL);
diff --git a/git-rebase--common.sh b/git-rebase--common.sh
deleted file mode 100644
index f00e13e5d0..0000000000
--- a/git-rebase--common.sh
+++ /dev/null
@@ -1,69 +0,0 @@
-
-resolvemsg="
-$(gettext 'Resolve all conflicts manually, mark them as resolved with
-"git add/rm <conflicted_files>", then run "git rebase --continue".
-You can instead skip this commit: run "git rebase --skip".
-To abort and get back to the state before "git rebase", run "git rebase --abort".')
-"
-
-write_basic_state () {
-	echo "$head_name" > "$state_dir"/head-name &&
-	echo "$onto" > "$state_dir"/onto &&
-	echo "$orig_head" > "$state_dir"/orig-head &&
-	test t = "$GIT_QUIET" && : > "$state_dir"/quiet
-	test t = "$verbose" && : > "$state_dir"/verbose
-	test -n "$strategy" && echo "$strategy" > "$state_dir"/strategy
-	test -n "$strategy_opts" && echo "$strategy_opts" > \
-		"$state_dir"/strategy_opts
-	test -n "$allow_rerere_autoupdate" && echo "$allow_rerere_autoupdate" > \
-		"$state_dir"/allow_rerere_autoupdate
-	test -n "$gpg_sign_opt" && echo "$gpg_sign_opt" > "$state_dir"/gpg_sign_opt
-	test -n "$signoff" && echo "$signoff" >"$state_dir"/signoff
-	test -n "$reschedule_failed_exec" && : > "$state_dir"/reschedule-failed-exec
-}
-
-apply_autostash () {
-	if test -f "$state_dir/autostash"
-	then
-		stash_sha1=$(cat "$state_dir/autostash")
-		if git stash apply $stash_sha1 >/dev/null 2>&1
-		then
-			echo "$(gettext 'Applied autostash.')" >&2
-		else
-			git stash store -m "autostash" -q $stash_sha1 ||
-			die "$(eval_gettext "Cannot store \$stash_sha1")"
-			gettext 'Applying autostash resulted in conflicts.
-Your changes are safe in the stash.
-You can run "git stash pop" or "git stash drop" at any time.
-' >&2
-		fi
-	fi
-}
-
-move_to_original_branch () {
-	case "$head_name" in
-	refs/*)
-		message="rebase finished: $head_name onto $onto"
-		git update-ref -m "$message" \
-			$head_name $(git rev-parse HEAD) $orig_head &&
-		git symbolic-ref \
-			-m "rebase finished: returning to $head_name" \
-			HEAD $head_name ||
-		die "$(eval_gettext "Could not move back to \$head_name")"
-		;;
-	esac
-}
-
-output () {
-	case "$verbose" in
-	'')
-		output=$("$@" 2>&1 )
-		status=$?
-		test $status != 0 && printf "%s\n" "$output"
-		return $status
-		;;
-	*)
-		"$@"
-		;;
-	esac
-}
diff --git a/git-rebase--preserve-merges.sh b/git-rebase--preserve-merges.sh
index afbb65765d..dec90e9af6 100644
--- a/git-rebase--preserve-merges.sh
+++ b/git-rebase--preserve-merges.sh
@@ -77,6 +77,61 @@ rewritten_pending="$state_dir"/rewritten-pending
 # and leaves CR at the end instead.
 cr=$(printf "\015")
 
+resolvemsg="
+$(gettext 'Resolve all conflicts manually, mark them as resolved with
+"git add/rm <conflicted_files>", then run "git rebase --continue".
+You can instead skip this commit: run "git rebase --skip".
+To abort and get back to the state before "git rebase", run "git rebase --abort".')
+"
+
+write_basic_state () {
+	echo "$head_name" > "$state_dir"/head-name &&
+	echo "$onto" > "$state_dir"/onto &&
+	echo "$orig_head" > "$state_dir"/orig-head &&
+	test t = "$GIT_QUIET" && : > "$state_dir"/quiet
+	test t = "$verbose" && : > "$state_dir"/verbose
+	test -n "$strategy" && echo "$strategy" > "$state_dir"/strategy
+	test -n "$strategy_opts" && echo "$strategy_opts" > \
+		"$state_dir"/strategy_opts
+	test -n "$allow_rerere_autoupdate" && echo "$allow_rerere_autoupdate" > \
+		"$state_dir"/allow_rerere_autoupdate
+	test -n "$gpg_sign_opt" && echo "$gpg_sign_opt" > "$state_dir"/gpg_sign_opt
+	test -n "$signoff" && echo "$signoff" >"$state_dir"/signoff
+	test -n "$reschedule_failed_exec" && : > "$state_dir"/reschedule-failed-exec
+}
+
+apply_autostash () {
+	if test -f "$state_dir/autostash"
+	then
+		stash_sha1=$(cat "$state_dir/autostash")
+		if git stash apply $stash_sha1 >/dev/null 2>&1
+		then
+			echo "$(gettext 'Applied autostash.')" >&2
+		else
+			git stash store -m "autostash" -q $stash_sha1 ||
+			die "$(eval_gettext "Cannot store \$stash_sha1")"
+			gettext 'Applying autostash resulted in conflicts.
+Your changes are safe in the stash.
+You can run "git stash pop" or "git stash drop" at any time.
+' >&2
+		fi
+	fi
+}
+
+output () {
+	case "$verbose" in
+	'')
+		output=$("$@" 2>&1 )
+		status=$?
+		test $status != 0 && printf "%s\n" "$output"
+		return $status
+		;;
+	*)
+		"$@"
+		;;
+	esac
+}
+
 strategy_args=${strategy:+--strategy=$strategy}
 test -n "$strategy_opts" &&
 eval '
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-05-14 11:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-14 11:22 [PATCH 0/5] Clean up after the removal of the scripted rebase Johannes Schindelin via GitGitGadget
2019-05-14 11:22 ` [PATCH 2/5] t3400: stop referring to " Johannes Schindelin via GitGitGadget
2019-05-14 11:22 ` [PATCH 1/5] Drop unused git-rebase--am.sh Johannes Schindelin via GitGitGadget
2019-05-14 11:22 ` [PATCH 3/5] .gitignore: there is no longer a built-in `git-rebase--interactive` Johannes Schindelin via GitGitGadget
2019-05-14 11:22 ` [PATCH 4/5] sequencer: the `am` and `rebase--interactive` scripts are gone Johannes Schindelin via GitGitGadget
2019-05-14 11:22 ` [PATCH 5/5] rebase: fold git-rebase--common into the -p backend Johannes Schindelin via GitGitGadget

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.