diff options
author | Ramkumar Ramachandra <artagnon@gmail.com> | 2011-08-04 16:09:06 +0530 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-08-04 15:40:43 -0700 |
commit | 89641472aafc28469448688a4ba610cf082921fa (patch) | |
tree | d9f984e4ad39d50dec482a46a813247fdee1f7d1 /builtin/diff-files.c | |
parent | revert: Introduce struct to keep command-line options (diff) | |
download | tgif-89641472aafc28469448688a4ba610cf082921fa.tar.xz |
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>
Diffstat (limited to 'builtin/diff-files.c')
0 files changed, 0 insertions, 0 deletions