* [PATCH] diff: allow unstuck arguments with --diff-algorithm
@ 2013-04-05 11:15 John Keeping
2013-04-05 11:43 ` Thomas Rast
0 siblings, 1 reply; 3+ messages in thread
From: John Keeping @ 2013-04-05 11:15 UTC (permalink / raw)
To: git; +Cc: Michal Privoznik, John Keeping
The argument to --diff-algorithm is mandatory, so there is no reason to
require the argument to be stuck to the option with '='. Change this
for consistency with other Git commands.
Note that this doesi not change the handling of diff-algorithm in
merge-recursive.c since the primary interface to that is via the -X
option to 'git merge' where the unstuck form does not make sense.
Signed-off-by: John Keeping <john@keeping.me.uk>
---
diff.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/diff.c b/diff.c
index db952a5..e0152f8 100644
--- a/diff.c
+++ b/diff.c
@@ -3596,8 +3596,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
options->xdl_opts = DIFF_WITH_ALG(options, PATIENCE_DIFF);
else if (!strcmp(arg, "--histogram"))
options->xdl_opts = DIFF_WITH_ALG(options, HISTOGRAM_DIFF);
- else if (!prefixcmp(arg, "--diff-algorithm=")) {
- long value = parse_algorithm_value(arg+17);
+ else if ((argcount = parse_long_opt("diff-algorithm", av, &optarg))) {
+ long value = parse_algorithm_value(optarg);
if (value < 0)
return error("option diff-algorithm accepts \"myers\", "
"\"minimal\", \"patience\" and \"histogram\"");
@@ -3605,6 +3605,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
DIFF_XDL_CLR(options, NEED_MINIMAL);
options->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
options->xdl_opts |= value;
+ return argcount;
}
/* flags options */
--
1.8.2.540.gf023cfe
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] diff: allow unstuck arguments with --diff-algorithm
2013-04-05 11:15 [PATCH] diff: allow unstuck arguments with --diff-algorithm John Keeping
@ 2013-04-05 11:43 ` Thomas Rast
2013-04-05 12:19 ` [PATCH v2] " John Keeping
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Rast @ 2013-04-05 11:43 UTC (permalink / raw)
To: John Keeping; +Cc: git, Michal Privoznik
John Keeping <john@keeping.me.uk> writes:
> The argument to --diff-algorithm is mandatory, so there is no reason to
> require the argument to be stuck to the option with '='. Change this
> for consistency with other Git commands.
>
> Note that this doesi not change the handling of diff-algorithm in
^
strayi ;-)
> merge-recursive.c since the primary interface to that is via the -X
> option to 'git merge' where the unstuck form does not make sense.
>
> Signed-off-by: John Keeping <john@keeping.me.uk>
> ---
> diff.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/diff.c b/diff.c
> index db952a5..e0152f8 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -3596,8 +3596,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
> options->xdl_opts = DIFF_WITH_ALG(options, PATIENCE_DIFF);
> else if (!strcmp(arg, "--histogram"))
> options->xdl_opts = DIFF_WITH_ALG(options, HISTOGRAM_DIFF);
> - else if (!prefixcmp(arg, "--diff-algorithm=")) {
> - long value = parse_algorithm_value(arg+17);
> + else if ((argcount = parse_long_opt("diff-algorithm", av, &optarg))) {
> + long value = parse_algorithm_value(optarg);
> if (value < 0)
> return error("option diff-algorithm accepts \"myers\", "
> "\"minimal\", \"patience\" and \"histogram\"");
> @@ -3605,6 +3605,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
> DIFF_XDL_CLR(options, NEED_MINIMAL);
> options->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
> options->xdl_opts |= value;
> + return argcount;
> }
>
> /* flags options */
--
Thomas Rast
trast@{inf,student}.ethz.ch
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] diff: allow unstuck arguments with --diff-algorithm
2013-04-05 11:43 ` Thomas Rast
@ 2013-04-05 12:19 ` John Keeping
0 siblings, 0 replies; 3+ messages in thread
From: John Keeping @ 2013-04-05 12:19 UTC (permalink / raw)
To: Thomas Rast; +Cc: git, Michal Privoznik
The argument to --diff-algorithm is mandatory, so there is no reason to
require the argument to be stuck to the option with '='. Change this
for consistency with other Git commands.
Note that this does not change the handling of diff-algorithm in
merge-recursive.c since the primary interface to that is via the -X
option to 'git merge' where the unstuck form does not make sense.
Signed-off-by: John Keeping <john@keeping.me.uk>
---
On Fri, Apr 05, 2013 at 01:43:16PM +0200, Thomas Rast wrote:
> John Keeping <john@keeping.me.uk> writes:
>
> > The argument to --diff-algorithm is mandatory, so there is no reason to
> > require the argument to be stuck to the option with '='. Change this
> > for consistency with other Git commands.
> >
> > Note that this doesi not change the handling of diff-algorithm in
> ^
> strayi ;-)
Thanks.
diff.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/diff.c b/diff.c
index db952a5..e0152f8 100644
--- a/diff.c
+++ b/diff.c
@@ -3596,8 +3596,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
options->xdl_opts = DIFF_WITH_ALG(options, PATIENCE_DIFF);
else if (!strcmp(arg, "--histogram"))
options->xdl_opts = DIFF_WITH_ALG(options, HISTOGRAM_DIFF);
- else if (!prefixcmp(arg, "--diff-algorithm=")) {
- long value = parse_algorithm_value(arg+17);
+ else if ((argcount = parse_long_opt("diff-algorithm", av, &optarg))) {
+ long value = parse_algorithm_value(optarg);
if (value < 0)
return error("option diff-algorithm accepts \"myers\", "
"\"minimal\", \"patience\" and \"histogram\"");
@@ -3605,6 +3605,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
DIFF_XDL_CLR(options, NEED_MINIMAL);
options->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
options->xdl_opts |= value;
+ return argcount;
}
/* flags options */
--
1.8.2.540.gf023cfe
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-06 16:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-05 11:15 [PATCH] diff: allow unstuck arguments with --diff-algorithm John Keeping
2013-04-05 11:43 ` Thomas Rast
2013-04-05 12:19 ` [PATCH v2] " John Keeping
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).