{"thread":{"id":"20459","subject":"[PATCH 2/4] sequencer: add \"--fast-forward\" option to \"git sequencer--helper\"","startedAt":"2009-08-07T20:40:51Z","lastAt":"2009-08-07T20:40:51Z","messageCount":1,"participants":["Christian Couder"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"119932","messageId":"20090807204054.6280.60062.chriscool@tuxfamily.org","threadId":"20459","inReplyTo":null,"subject":"[PATCH 2/4] sequencer: add \"--fast-forward\" option to \"git sequencer--helper\"","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2009-08-07T20:40:51Z","receivedAt":"2009-08-07T20:40:51Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"This new option uses the \"do_fast_forward()\" function to perform\na fast forward.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n builtin-sequencer--helper.c |   16 ++++++++++++----\n 1 files changed, 12 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin-sequencer--helper.c b/builtin-sequencer--helper.c\nindex 0cd7e98..bd72f65 100644\n--- a/builtin-sequencer--helper.c\n+++ b/builtin-sequencer--helper.c\n@@ -19,6 +19,7 @@ static unsigned char head_sha1[20];\n static const char * const git_sequencer_helper_usage[] = {\n \t\"git sequencer--helper --make-patch <commit>\",\n \t\"git sequencer--helper --reset-hard <commit> <reflog-msg> <verbosity>\",\n+\t\"git sequencer--helper --fast-forward <commit> <reflog-msg> <verbosity>\",\n \tNULL\n };\n \n@@ -218,11 +219,14 @@ int cmd_sequencer__helper(int argc, const char **argv, const char *prefix)\n {\n \tchar *patch_commit = NULL;\n \tchar *reset_commit = NULL;\n+\tchar *ff_commit = NULL;\n \tstruct option options[] = {\n \t\tOPT_STRING(0, \"make-patch\", &patch_commit, \"commit\",\n \t\t\t   \"create a patch from commit\"),\n \t\tOPT_STRING(0, \"reset-hard\", &reset_commit, \"commit\",\n \t\t\t   \"reset to commit\"),\n+\t\tOPT_STRING(0, \"fast-forward\", &ff_commit, \"commit\",\n+\t\t\t   \"fast forward to commit\"),\n \t\tOPT_END()\n \t};\n \n@@ -239,15 +243,16 @@ int cmd_sequencer__helper(int argc, const char **argv, const char *prefix)\n \t\treturn 0;\n \t}\n \n-\tif (reset_commit) {\n+\tif (ff_commit || reset_commit) {\n \t\tunsigned char sha1[20];\n+\t\tchar *commit = ff_commit ? ff_commit : reset_commit;\n \n \t\tif (argc != 2)\n \t\t\tusage_with_options(git_sequencer_helper_usage,\n \t\t\t\t\t   options);\n \n-\t\tif (get_sha1(reset_commit, sha1)) {\n-\t\t\terror(\"Could not find '%s'\", reset_commit);\n+\t\tif (get_sha1(commit, sha1)) {\n+\t\t\terror(\"Could not find '%s'\", commit);\n \t\t\treturn 1;\n \t\t}\n \n@@ -258,7 +263,10 @@ int cmd_sequencer__helper(int argc, const char **argv, const char *prefix)\n \t\t\treturn 1;\n \t\t}\n \n-\t\treturn reset_almost_hard(sha1);\n+\t\tif (ff_commit)\n+\t\t\treturn do_fast_forward(sha1);\n+\t\telse\n+\t\t\treturn reset_almost_hard(sha1);\n \t}\n \n \tusage_with_options(git_sequencer_helper_usage, options);\n-- \n1.6.4.209.g16b77\n"}]}