Skip to content

Commit 9aadc56

Browse files
agrngitster
authored andcommitted
rebase -i: remove unused modes and functions
This removes the modes `--skip-unnecessary-picks`, `--append-todo-help`, and `--checkout-onto` from rebase--helper.c, the functions of git-rebase--interactive.sh that were rendered useless by the rewrite of complete_action(), and append_todo_help_to_file() from rebase-interactive.c. skip_unnecessary_picks() and checkout_onto() becomes static, as they are only used inside of the sequencer. Signed-off-by: Alban Gruin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f6e76c0 commit 9aadc56

File tree

6 files changed

+6
-102
lines changed

6 files changed

+6
-102
lines changed

builtin/rebase--helper.c

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
1717
int abbreviate_commands = 0, rebase_cousins = -1;
1818
enum {
1919
CONTINUE = 1, ABORT, MAKE_SCRIPT, SHORTEN_OIDS, EXPAND_OIDS,
20-
CHECK_TODO_LIST, SKIP_UNNECESSARY_PICKS, REARRANGE_SQUASH,
21-
ADD_EXEC, APPEND_TODO_HELP, EDIT_TODO, PREPARE_BRANCH,
22-
CHECKOUT_ONTO, COMPLETE_ACTION
20+
CHECK_TODO_LIST, REARRANGE_SQUASH, ADD_EXEC, EDIT_TODO, PREPARE_BRANCH,
21+
COMPLETE_ACTION
2322
} command = 0;
2423
struct option options[] = {
2524
OPT_BOOL(0, "ff", &opts.allow_ff, N_("allow fast-forward")),
@@ -44,21 +43,15 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
4443
N_("expand commit ids in the todo list"), EXPAND_OIDS),
4544
OPT_CMDMODE(0, "check-todo-list", &command,
4645
N_("check the todo list"), CHECK_TODO_LIST),
47-
OPT_CMDMODE(0, "skip-unnecessary-picks", &command,
48-
N_("skip unnecessary picks"), SKIP_UNNECESSARY_PICKS),
4946
OPT_CMDMODE(0, "rearrange-squash", &command,
5047
N_("rearrange fixup/squash lines"), REARRANGE_SQUASH),
5148
OPT_CMDMODE(0, "add-exec-commands", &command,
5249
N_("insert exec commands in todo list"), ADD_EXEC),
53-
OPT_CMDMODE(0, "append-todo-help", &command,
54-
N_("insert the help in the todo list"), APPEND_TODO_HELP),
5550
OPT_CMDMODE(0, "edit-todo", &command,
5651
N_("edit the todo list during an interactive rebase"),
5752
EDIT_TODO),
5853
OPT_CMDMODE(0, "prepare-branch", &command,
5954
N_("prepare the branch to be rebased"), PREPARE_BRANCH),
60-
OPT_CMDMODE(0, "checkout-onto", &command,
61-
N_("checkout a commit"), CHECKOUT_ONTO),
6255
OPT_CMDMODE(0, "complete-action", &command,
6356
N_("complete the action"), COMPLETE_ACTION),
6457
OPT_END()
@@ -94,26 +87,14 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
9487
return !!transform_todos(flags);
9588
if (command == CHECK_TODO_LIST && argc == 1)
9689
return !!check_todo_list();
97-
if (command == SKIP_UNNECESSARY_PICKS && argc == 1) {
98-
struct object_id oid;
99-
int ret = skip_unnecessary_picks(&oid);
100-
101-
if (!ret)
102-
puts(oid_to_hex(&oid));
103-
return !!ret;
104-
}
10590
if (command == REARRANGE_SQUASH && argc == 1)
10691
return !!rearrange_squash();
10792
if (command == ADD_EXEC && argc == 2)
10893
return !!sequencer_add_exec_commands(argv[1]);
109-
if (command == APPEND_TODO_HELP && argc == 1)
110-
return !!append_todo_help_to_file(0, keep_empty);
11194
if (command == EDIT_TODO && argc == 1)
11295
return !!edit_todo_list(flags);
11396
if (command == PREPARE_BRANCH && argc == 2)
11497
return !!prepare_branch_to_be_rebased(&opts, argv[1]);
115-
if (command == CHECKOUT_ONTO && argc == 4)
116-
return !!checkout_onto(&opts, argv[1], argv[2], argv[3]);
11798
if (command == COMPLETE_ACTION && argc == 6)
11899
return !!complete_action(&opts, flags, argv[1], argv[2], argv[3],
119100
argv[4], argv[5], autosquash);

git-rebase--interactive.sh

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -16,56 +16,6 @@ todo="$state_dir"/git-rebase-todo
1616
GIT_CHERRY_PICK_HELP="$resolvemsg"
1717
export GIT_CHERRY_PICK_HELP
1818

19-
comment_char=$(git config --get core.commentchar 2>/dev/null)
20-
case "$comment_char" in
21-
'' | auto)
22-
comment_char="#"
23-
;;
24-
?)
25-
;;
26-
*)
27-
comment_char=$(echo "$comment_char" | cut -c1)
28-
;;
29-
esac
30-
31-
die_abort () {
32-
apply_autostash
33-
rm -rf "$state_dir"
34-
die "$1"
35-
}
36-
37-
has_action () {
38-
test -n "$(git stripspace --strip-comments <"$1")"
39-
}
40-
41-
git_sequence_editor () {
42-
if test -z "$GIT_SEQUENCE_EDITOR"
43-
then
44-
GIT_SEQUENCE_EDITOR="$(git config sequence.editor)"
45-
if [ -z "$GIT_SEQUENCE_EDITOR" ]
46-
then
47-
GIT_SEQUENCE_EDITOR="$(git var GIT_EDITOR)" || return $?
48-
fi
49-
fi
50-
51-
eval "$GIT_SEQUENCE_EDITOR" '"$@"'
52-
}
53-
54-
expand_todo_ids() {
55-
git rebase--helper --expand-ids
56-
}
57-
58-
collapse_todo_ids() {
59-
git rebase--helper --shorten-ids
60-
}
61-
62-
get_missing_commit_check_level () {
63-
check_level=$(git config --get rebase.missingCommitsCheck)
64-
check_level=${check_level:-ignore}
65-
# Don't be case sensitive
66-
printf '%s' "$check_level" | tr 'A-Z' 'a-z'
67-
}
68-
6919
# Initiate an action. If the cannot be any
7020
# further action it may exec a command
7121
# or exit and not return.

rebase-interactive.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,6 @@ void append_todo_help(unsigned edit_todo, unsigned keep_empty,
5252
}
5353
}
5454

55-
int append_todo_help_to_file(unsigned edit_todo, unsigned keep_empty)
56-
{
57-
struct strbuf buf = STRBUF_INIT;
58-
FILE *todo;
59-
int ret;
60-
61-
todo = fopen_or_warn(rebase_path_todo(), "a");
62-
if (!todo)
63-
return 1;
64-
65-
append_todo_help(edit_todo, keep_empty, &buf);
66-
67-
ret = fputs(buf.buf, todo);
68-
if (ret < 0)
69-
error_errno(_("could not append help text to '%s'"), rebase_path_todo());
70-
71-
fclose(todo);
72-
strbuf_release(&buf);
73-
74-
return ret;
75-
}
76-
7755
int edit_todo_list(unsigned flags)
7856
{
7957
struct strbuf buf = STRBUF_INIT;

rebase-interactive.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
void append_todo_help(unsigned edit_todo, unsigned keep_empty,
55
struct strbuf *buf);
6-
int append_todo_help_to_file(unsigned edit_todo, unsigned keep_empty);
76
int edit_todo_list(unsigned flags);
87

98
#endif

sequencer.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3173,9 +3173,9 @@ int prepare_branch_to_be_rebased(struct replay_opts *opts, const char *commit)
31733173
return 0;
31743174
}
31753175

3176-
int checkout_onto(struct replay_opts *opts,
3177-
const char *onto_name, const char *onto,
3178-
const char *orig_head)
3176+
static int checkout_onto(struct replay_opts *opts,
3177+
const char *onto_name, const char *onto,
3178+
const char *orig_head)
31793179
{
31803180
struct object_id oid;
31813181
const char *action = reflog_message(opts, "start", "checkout %s", onto_name);
@@ -4420,7 +4420,7 @@ static int rewrite_file(const char *path, const char *buf, size_t len)
44204420
}
44214421

44224422
/* skip picking commits whose parents are unchanged */
4423-
int skip_unnecessary_picks(struct object_id *output_oid)
4423+
static int skip_unnecessary_picks(struct object_id *output_oid)
44244424
{
44254425
const char *todo_file = rebase_path_todo();
44264426
struct strbuf buf = STRBUF_INIT;

sequencer.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ int sequencer_add_exec_commands(const char *command);
8888
int transform_todos(unsigned flags);
8989
enum missing_commit_check_level get_missing_commit_check_level(void);
9090
int check_todo_list(void);
91-
int skip_unnecessary_picks(struct object_id *output_oid);
9291
int complete_action(struct replay_opts *opts, unsigned flags,
9392
const char *shortrevisions, const char *onto_name,
9493
const char *onto, const char *orig_head, const char *cmd,
@@ -111,9 +110,6 @@ void commit_post_rewrite(const struct commit *current_head,
111110
const struct object_id *new_head);
112111

113112
int prepare_branch_to_be_rebased(struct replay_opts *opts, const char *commit);
114-
int checkout_onto(struct replay_opts *opts,
115-
const char *onto_name, const char *onto,
116-
const char *orig_head);
117113

118114
#define SUMMARY_INITIAL_COMMIT (1 << 0)
119115
#define SUMMARY_SHOW_AUTHOR_DATE (1 << 1)

0 commit comments

Comments
 (0)