Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
sequencer (rebase -i): differentiate between comments and 'noop'
author
Johannes Schindelin
<johannes.schindelin@gmx.de>
Mon, 2 Jan 2017 15:34:39 +0000
(16:34 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 9 Jan 2017 22:57:30 +0000
(14:57 -0800)
In the upcoming patch, we will support rebase -i's progress
reporting. The progress skips comments but counts 'noop's.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (from parent 1:
b3fdd58
)
diff --git
a/sequencer.c
b/sequencer.c
index 6e92f186ae3a44516f255ba45ab2bdb8d82c7f2b..41f80ea2c42095684978854daa061be087d6d1bb 100644
(file)
--- a/
sequencer.c
+++ b/
sequencer.c
@@
-737,7
+737,9
@@
enum todo_command {
TODO_EXEC,
/* commands that do nothing but are counted for reporting progress */
TODO_NOOP,
TODO_EXEC,
/* commands that do nothing but are counted for reporting progress */
TODO_NOOP,
- TODO_DROP
+ TODO_DROP,
+ /* comments (not counted for reporting progress) */
+ TODO_COMMENT
};
static struct {
};
static struct {
@@
-752,12
+754,13
@@
static struct {
{ 's', "squash" },
{ 'x', "exec" },
{ 0, "noop" },
{ 's', "squash" },
{ 'x', "exec" },
{ 0, "noop" },
- { 'd', "drop" }
+ { 'd', "drop" },
+ { 0, NULL }
};
static const char *command_to_string(const enum todo_command command)
{
};
static const char *command_to_string(const enum todo_command command)
{
- if (
(size_t)command < ARRAY_SIZE(todo_command_info)
)
+ if (
command < TODO_COMMENT
)
return todo_command_info[command].str;
die("Unknown command: %d", command);
}
return todo_command_info[command].str;
die("Unknown command: %d", command);
}
@@
-1198,14
+1201,14
@@
static int parse_insn_line(struct todo_item *item, const char *bol, char *eol)
bol += strspn(bol, " \t");
if (bol == eol || *bol == '\r' || *bol == comment_line_char) {
bol += strspn(bol, " \t");
if (bol == eol || *bol == '\r' || *bol == comment_line_char) {
- item->command = TODO_
NOOP
;
+ item->command = TODO_
COMMENT
;
item->commit = NULL;
item->arg = bol;
item->arg_len = eol - bol;
return 0;
}
item->commit = NULL;
item->arg = bol;
item->arg_len = eol - bol;
return 0;
}
- for (i = 0; i <
ARRAY_SIZE(todo_command_info)
; i++)
+ for (i = 0; i <
TODO_COMMENT
; i++)
if (skip_prefix(bol, todo_command_info[i].str, &bol)) {
item->command = i;
break;
if (skip_prefix(bol, todo_command_info[i].str, &bol)) {
item->command = i;
break;
@@
-1214,7
+1217,7
@@
static int parse_insn_line(struct todo_item *item, const char *bol, char *eol)
item->command = i;
break;
}
item->command = i;
break;
}
- if (i >=
ARRAY_SIZE(todo_command_info)
)
+ if (i >=
TODO_COMMENT
)
return -1;
if (item->command == TODO_NOOP) {
return -1;
if (item->command == TODO_NOOP) {