On Thu, Jan 18, 2018 at 10:35 AM, Johannes Schindelin <johannes.schindelin@xxxxxx> wrote: > [...] > This commit implements the commands to label, and to reset to, given > revisions. The syntax is: > > label <name> > reset <name> > [...] > > Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> > --- > diff --git a/sequencer.c b/sequencer.c > @@ -1919,6 +1936,139 @@ static int do_exec(const char *command_line) > +static int safe_append(const char *filename, const char *fmt, ...) > +{ > + [...] > + if (commit_lock_file(&lock) < 0) { > + rollback_lock_file(&lock); > + return error(_("failed to finalize '%s'."), filename); s/\.// > + } > + > + return 0; > +} > + > +static int do_reset(const char *name, int len) > +{ > + [...] > + if (hold_locked_index(&lock, LOCK_REPORT_ON_ERROR) < 0) > + return -1; > + > + for (i = 0; i < len; i++) > + if (isspace(name[i])) > + len = i; What is the purpose of this loop? I could imagine that it's trying to strip all whitespace from the end of 'name', however, to do that it would iterate backward, not forward. (Or perhaps it's trying to truncate at the first space, but then it would need to invert the condition or use 'break'.) Am I missing something obvious? > + read_cache_unmerged(); > + if (!fill_tree_descriptor(&desc, &oid)) { > + error(_("Failed to find tree of %s."), oid_to_hex(&oid)); s/Failed/failed/ s/\.// > + rollback_lock_file(&lock); > + free((void *)desc.buffer); > + strbuf_release(&ref_name); > + return -1; > + }