Skip to content

Commit ad1d63a

Browse files
dschoGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
rebase: fold git-rebase--common into the -p backend
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 <[email protected]>
1 parent e7385a6 commit ad1d63a

File tree

5 files changed

+56
-73
lines changed

5 files changed

+56
-73
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@
122122
/git-range-diff
123123
/git-read-tree
124124
/git-rebase
125-
/git-rebase--common
126125
/git-rebase--preserve-merges
127126
/git-receive-pack
128127
/git-reflog

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,6 @@ SCRIPT_SH += git-web--browse.sh
624624

625625
SCRIPT_LIB += git-mergetool--lib
626626
SCRIPT_LIB += git-parse-remote
627-
SCRIPT_LIB += git-rebase--common
628627
SCRIPT_LIB += git-rebase--preserve-merges
629628
SCRIPT_LIB += git-sh-setup
630629
SCRIPT_LIB += git-sh-i18n

builtin/rebase.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,8 +1163,7 @@ static int run_specific_rebase(struct rebase_options *opts, enum action action)
11631163
}
11641164

11651165
strbuf_addf(&script_snippet,
1166-
". git-sh-setup && . git-rebase--common &&"
1167-
" . %s && %s", backend, backend_func);
1166+
". git-sh-setup && . %s && %s", backend, backend_func);
11681167
argv[0] = script_snippet.buf;
11691168

11701169
status = run_command_v_opt(argv, RUN_USING_SHELL);

git-rebase--common.sh

Lines changed: 0 additions & 69 deletions
This file was deleted.

git-rebase--preserve-merges.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,61 @@ rewritten_pending="$state_dir"/rewritten-pending
7777
# and leaves CR at the end instead.
7878
cr=$(printf "\015")
7979

80+
resolvemsg="
81+
$(gettext 'Resolve all conflicts manually, mark them as resolved with
82+
"git add/rm <conflicted_files>", then run "git rebase --continue".
83+
You can instead skip this commit: run "git rebase --skip".
84+
To abort and get back to the state before "git rebase", run "git rebase --abort".')
85+
"
86+
87+
write_basic_state () {
88+
echo "$head_name" > "$state_dir"/head-name &&
89+
echo "$onto" > "$state_dir"/onto &&
90+
echo "$orig_head" > "$state_dir"/orig-head &&
91+
test t = "$GIT_QUIET" && : > "$state_dir"/quiet
92+
test t = "$verbose" && : > "$state_dir"/verbose
93+
test -n "$strategy" && echo "$strategy" > "$state_dir"/strategy
94+
test -n "$strategy_opts" && echo "$strategy_opts" > \
95+
"$state_dir"/strategy_opts
96+
test -n "$allow_rerere_autoupdate" && echo "$allow_rerere_autoupdate" > \
97+
"$state_dir"/allow_rerere_autoupdate
98+
test -n "$gpg_sign_opt" && echo "$gpg_sign_opt" > "$state_dir"/gpg_sign_opt
99+
test -n "$signoff" && echo "$signoff" >"$state_dir"/signoff
100+
test -n "$reschedule_failed_exec" && : > "$state_dir"/reschedule-failed-exec
101+
}
102+
103+
apply_autostash () {
104+
if test -f "$state_dir/autostash"
105+
then
106+
stash_sha1=$(cat "$state_dir/autostash")
107+
if git stash apply $stash_sha1 >/dev/null 2>&1
108+
then
109+
echo "$(gettext 'Applied autostash.')" >&2
110+
else
111+
git stash store -m "autostash" -q $stash_sha1 ||
112+
die "$(eval_gettext "Cannot store \$stash_sha1")"
113+
gettext 'Applying autostash resulted in conflicts.
114+
Your changes are safe in the stash.
115+
You can run "git stash pop" or "git stash drop" at any time.
116+
' >&2
117+
fi
118+
fi
119+
}
120+
121+
output () {
122+
case "$verbose" in
123+
'')
124+
output=$("$@" 2>&1 )
125+
status=$?
126+
test $status != 0 && printf "%s\n" "$output"
127+
return $status
128+
;;
129+
*)
130+
"$@"
131+
;;
132+
esac
133+
}
134+
80135
strategy_args=${strategy:+--strategy=$strategy}
81136
test -n "$strategy_opts" &&
82137
eval '

0 commit comments

Comments
 (0)