Skip to content

Commit c2676cd

Browse files
pyokagangitster
authored andcommitted
builtin-am: implement legacy -b/--binary option
The -b/--binary option was initially implemented in 087b674 (git-am: --binary; document --resume and --binary., 2005-11-16). The option will pass the --binary flag to git-apply to allow it to apply binary patches. However, in 2b6eef9 (Make apply --binary a no-op., 2006-09-06), --binary was been made a no-op in git-apply. Following that, since cb3a160 (git-am: ignore --binary option, 2008-08-09), the --binary option in git-am is ignored as well. In 6c15a1c (am: officially deprecate -b/--binary option, 2012-03-13), the --binary option was tweaked to its present behavior: when set, the message: The -b/--binary option has been a no-op for long time, and it will be removed. Please do not use it anymore. will be printed. Re-implement this in builtin/am.c. Signed-off-by: Paul Tan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7ff2683 commit c2676cd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

builtin/am.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,6 +2126,7 @@ enum resume_mode {
21262126
int cmd_am(int argc, const char **argv, const char *prefix)
21272127
{
21282128
struct am_state state;
2129+
int binary = -1;
21292130
int keep_cr = -1;
21302131
int patch_format = PATCH_FORMAT_UNKNOWN;
21312132
enum resume_mode resume = RESUME_FALSE;
@@ -2139,6 +2140,8 @@ int cmd_am(int argc, const char **argv, const char *prefix)
21392140
struct option options[] = {
21402141
OPT_BOOL('i', "interactive", &state.interactive,
21412142
N_("run interactively")),
2143+
OPT_HIDDEN_BOOL('b', "binary", &binary,
2144+
N_("(historical option -- no-op")),
21422145
OPT_BOOL('3', "3way", &state.threeway,
21432146
N_("allow fall back on 3way merging if needed")),
21442147
OPT__QUIET(&state.quiet, N_("be quiet")),
@@ -2239,6 +2242,10 @@ int cmd_am(int argc, const char **argv, const char *prefix)
22392242

22402243
argc = parse_options(argc, argv, prefix, options, usage, 0);
22412244

2245+
if (binary >= 0)
2246+
fprintf_ln(stderr, _("The -b/--binary option has been a no-op for long time, and\n"
2247+
"it will be removed. Please do not use it anymore."));
2248+
22422249
if (read_index_preload(&the_index, NULL) < 0)
22432250
die(_("failed to read the index"));
22442251

0 commit comments

Comments
 (0)