Thread (30 messages) flat view 30 messages, 3 authors, 2016-06-15

Re: [PATCH 08/10] revert: Introduce HEAD, TODO files to persist state, plan

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:51:21

Hi Jonathan and others,

Jonathan Nieder writes:
Ramkumar Ramachandra wrote:
Almost there.  To comfort overly-worried people like me that think we
have not finished converted all die() calls yet, wouldn't this need to
look like

       persist_head(head);
       while ((commit = ...)) {
               int status_or_error;

               /*
                * Checkpoint.  If do_pick_commit exits, make sure the user
                * can still use "git cherry-pick --continue" to recover.
                */
               persist_todo(revs.commits, opts);

               status_or_error = do_pick_commit(...);
               if (status_or_error)
                       return status_or_error;
       }

       /* Success! */
       remove_todo(opts);
       remove_head();
       return 0;
It's a little embarrassing, but I'm not able to figure out how to
persist the TODO early. prepare_revs() sets up the revision walker and
populates the rev_info struct: it contains a commit_list * in its
commits member, but I apparently can't access those directly -- I went
through some literature about revision walking and inspected how
get_revision must be used to iterate over all the individual commits.
Now, to persist the TODO, I need a commit_list to use: is there some
API I can use to avoid iterating over all the commits twice? Once to
populate the commit_list to persist the TODO, and the second time to
actually pick them?

Thanks.

-- Ram
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help