Skip to content

Commit a2c7552

Browse files
john-caigitster
authored andcommitted
cat-file: rename cmdmode to transform_mode
In the next patch, we will add an enum on the batch_options struct that indicates which type of batch operation will be used: --batch, --batch-check and the soon to be --batch-command that will read commands from stdin. --batch-command mode might get confused with the cmdmode flag. There is value in renaming cmdmode in any case. cmdmode refers to how the result output of the blob will be transformed, either according to --filter or --textconv. So transform_mode is a more descriptive name for the flag. Rename cmdmode to transform_mode in cat-file.c Signed-off-by: John Cai <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 38062e7 commit a2c7552

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

builtin/cat-file.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct batch_options {
2424
int buffer_output;
2525
int all_objects;
2626
int unordered;
27-
int cmdmode; /* may be 'w' or 'c' for --filters or --textconv */
27+
int transform_mode; /* may be 'w' or 'c' for --filters or --textconv */
2828
const char *format;
2929
};
3030

@@ -302,19 +302,19 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
302302
if (data->type == OBJ_BLOB) {
303303
if (opt->buffer_output)
304304
fflush(stdout);
305-
if (opt->cmdmode) {
305+
if (opt->transform_mode) {
306306
char *contents;
307307
unsigned long size;
308308

309309
if (!data->rest)
310310
die("missing path for '%s'", oid_to_hex(oid));
311311

312-
if (opt->cmdmode == 'w') {
312+
if (opt->transform_mode == 'w') {
313313
if (filter_object(data->rest, 0100644, oid,
314314
&contents, &size))
315315
die("could not convert '%s' %s",
316316
oid_to_hex(oid), data->rest);
317-
} else if (opt->cmdmode == 'c') {
317+
} else if (opt->transform_mode == 'c') {
318318
enum object_type type;
319319
if (!textconv_object(the_repository,
320320
data->rest, 0100644, oid,
@@ -326,7 +326,7 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
326326
die("could not convert '%s' %s",
327327
oid_to_hex(oid), data->rest);
328328
} else
329-
BUG("invalid cmdmode: %c", opt->cmdmode);
329+
BUG("invalid transform_mode: %c", opt->transform_mode);
330330
batch_write(opt, contents, size);
331331
free(contents);
332332
} else {
@@ -529,7 +529,7 @@ static int batch_objects(struct batch_options *opt)
529529
strbuf_expand(&output, opt->format, expand_format, &data);
530530
data.mark_query = 0;
531531
strbuf_release(&output);
532-
if (opt->cmdmode)
532+
if (opt->transform_mode)
533533
data.split_on_whitespace = 1;
534534

535535
/*
@@ -742,7 +742,7 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)
742742
/* Return early if we're in batch mode? */
743743
if (batch.enabled) {
744744
if (opt_cw)
745-
batch.cmdmode = opt;
745+
batch.transform_mode = opt;
746746
else if (opt && opt != 'b')
747747
usage_msg_optf(_("'-%c' is incompatible with batch mode"),
748748
usage, options, opt);

0 commit comments

Comments
 (0)