Commit 8964147
revert: Separate cmdline parsing from functional code
Currently, revert_or_cherry_pick sets up a default git config, parses
command-line arguments, before preparing to pick commits. This makes
for a bad API as the central worry of callers is to assert whether or
not a conflict occured while cherry picking. The current API is like:
if (revert_or_cherry_pick(argc, argv, opts) < 0)
print "Something failed, we're not sure what"
Simplify and rename revert_or_cherry_pick to pick_commits so that it
only has the responsibility of setting up the revision walker and
picking commits in a loop. Transfer the remaining work to its
callers. Now, the API is simplified as:
if (parse_args(argc, argv, opts) < 0)
print "Can't parse arguments"
if (pick_commits(opts) < 0)
print "Error encountered in picking machinery"
Later in the series, pick_commits will also serve as the starting
point for continuing a cherry-pick or revert.
Inspired-by: Christian Couder <chriscool@tuxfamily.org>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent 80e1f79 commit 8964147
1 file changed
Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
563 | 563 | | |
564 | 564 | | |
565 | 565 | | |
566 | | - | |
567 | | - | |
| 566 | + | |
568 | 567 | | |
569 | 568 | | |
570 | 569 | | |
571 | 570 | | |
572 | | - | |
573 | 571 | | |
574 | | - | |
575 | | - | |
576 | 572 | | |
577 | 573 | | |
578 | 574 | | |
| |||
605 | 601 | | |
606 | 602 | | |
607 | 603 | | |
608 | | - | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
609 | 607 | | |
610 | 608 | | |
611 | 609 | | |
| |||
614 | 612 | | |
615 | 613 | | |
616 | 614 | | |
617 | | - | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
618 | 618 | | |
0 commit comments