[PATCH v2 16/18] ref_format: add split_on_whitespace flag
- Date: Wed, 10 Jan 2018 09:36:41 +0000
- From: Olga Telezhnaya <olyatelezhnaya@xxxxxxxxx>
- Subject: [PATCH v2 16/18] ref_format: add split_on_whitespace flag
Add flag to ref_format struct so that we could pass needed info
to cat-file.
Signed-off-by: Olga Telezhnaia <olyatelezhnaya@xxxxxxxxx>
Mentored-by: Christian Couder <christian.couder@xxxxxxxxx>
Mentored by: Jeff King <peff@xxxxxxxx>
---
builtin/cat-file.c | 1 +
ref-filter.c | 4 ++--
ref-filter.h | 1 +
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 289912ab1f858..5aac10b9808ff 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -394,6 +394,7 @@ static int batch_objects(struct batch_options *opt)
memset(&data, 0, sizeof(data));
opt->format->cat_file_data = &data;
opt->format->is_cat = 1;
+ opt->format->split_on_whitespace = &data.split_on_whitespace;
verify_ref_format(opt->format);
if (opt->cmdmode)
data.split_on_whitespace = 1;
diff --git a/ref-filter.c b/ref-filter.c
index 2c955e90bb4c9..0fb33198fb450 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -494,8 +494,8 @@ static int parse_ref_filter_atom(const struct ref_format *format,
need_tagged = 1;
if (!strcmp(valid_atom[i].name, "symref"))
need_symref = 1;
- if (is_cat && !strcmp(valid_atoms[i].name, "rest"))
- cat_file_info->split_on_whitespace = 1;
+ if (!strcmp(valid_atom[i].name, "rest"))
+ *format->split_on_whitespace = 1;
return at;
}
diff --git a/ref-filter.h b/ref-filter.h
index 12a938b0aa6a3..aaf1790e43e62 100644
--- a/ref-filter.h
+++ b/ref-filter.h
@@ -127,6 +127,7 @@ struct ref_format {
*/
struct expand_data *cat_file_data;
int is_cat;
+ int *split_on_whitespace;
};
#define REF_FORMAT_INIT { NULL, 0, -1 }
--
https://github.com/git/git/pull/450