Re: [PATCH 17/18] revert: Introduce --continue to continue the operation
From: Christian Couder <hidden>
Date: 2016-06-15 22:51:42
On Thursday 28 July 2011 18:52:30 Ramkumar Ramachandra wrote:
quoted hunk ↗ jump to hunk
+static void read_populate_todo(struct commit_list **todo_list, + struct replay_opts *opts) +{ + const char *todo_file = git_path(SEQ_TODO_FILE); + struct strbuf buf = STRBUF_INIT; + struct commit_list **next; + struct commit *commit; + char *p; + int fd; + + fd = open(todo_file, O_RDONLY); + if (fd < 0) { + strbuf_release(&buf);
We don't need to release buf here.
quoted hunk ↗ jump to hunk
+ die_errno(_("Could not open %s."), todo_file); + } + if (strbuf_read(&buf, fd, 0) < buf.len) {
The other places in the code are using "strbuf_read(...) < 0" to detect an error.
quoted hunk ↗ jump to hunk
+ close(fd); + strbuf_release(&buf); + die(_("Could not read %s."), todo_file); + } + close(fd); + + next = todo_list; + for (p = buf.buf; *p; p = strchr(p, '\n') + 1) {
This relies on a "\n" at the end of the last line...
quoted hunk ↗ jump to hunk
+ commit = parse_insn_line(p, opts); + if (!commit) + goto error; + next = commit_list_append(commit, next); + } + if (!*todo_list) + goto error; + strbuf_release(&buf); + return; +error: + strbuf_release(&buf); + die(_("Unusable instruction sheet: %s"), todo_file); +}
Thanks, Christian.