`commit` is also not required here when reseting index, so it should be like
args = [];
if (type) args.push
if (commit) args.push