Matthias Urlichs <[EMAIL PROTECTED]> writes:
> Exactly the same thing as vice versa.
> Or, even more exactly, my patch *makes* that happen. ;-)
Ah, I was not being careful enough. Sorry.
That said, I have been hating that diff options parsing for
quite a while, and I've been thinking about cleaning it up along
the lines I'll outline here, but have not done anything about
it. Care to help me out?
- In diff.h introduce these new stuff:
struct diff_opts {
int output_format;
int detect_rename;
...
};
void diff_opts_init(struct diff_opts *);
int diff_opts_parse(const char *, struct diff_opts *);
int diff_opts_final(struct diff_opts *);
- In diff-* brothers:
- replace individual diff option variables with a single
"static struct diff_opts diff_opts";
- change the argument parsing code to do the following:
diff_opts_init(&diff_opts);
for each arg {
/* common options to diff brothers are handled by
* diff_opts_parse()
*/
switch (diff_opts_parse(arg, &diff_opts)) {
case 1: /* was a diff option and was parsed successfully */
continue;
case -1: /* error */
usage(diff_*_usage);
}
if (!strcmp())
... parsing of other options
}
if (diff_opts_final(&diff_opts))
/* defaulting to HUMAN format when nothing specified,
* complaining if find-copies-harder is specified but
* -C was not, etc. is done in diff_opts_final().
*
* The complex if() chains that checks if we are in
* name or in raw mode and switch output_format around
* properly is what I missed in your patch, but I think
* you can lose that by recording z-ness of the output
* independently from the output format in diff_opts_parse()
* and combining diff-raw vs diff-name and z vs non-z
* in diff_opts_final(). That would make the code much
* simpler.
*/
usage(diff_*_usage);
- In diff.h and diff.c, replace individual option parameters
for the following functions to a single pointer to struct
diff_opts:
diff_setup(), diffcore_std(), diffcore_std_no_resolve(), diff_flush().
We probably can make diff_scoreopt_parse() function static to
diff.c once this is done.
We may want to rip out the independeant pickaxe, orderfile and
filter support for diff-helper while we are at it, making it
truly just a "diff-raw to diff-patch" converter.
Hmm?
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html