@@ -3,7 +3,6 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "builtin.h"
@@ -34,28 +33,6 @@ static int mark_query;
static int skip_object_info;
static const char *rest;
-static int filter_object(const char *path, unsigned mode,
- const struct object_id *oid,
- char **buf, unsigned long *size)
-{
- enum object_type type;
-
- *buf = read_object_file(oid, &type, size);
- if (!*buf)
- return error(_("cannot read object %s '%s'"),
- oid_to_hex(oid), path);
- if ((type == OBJ_BLOB) && S_ISREG(mode)) {
- struct strbuf strbuf = STRBUF_INIT;
- if (convert_to_working_tree(&the_index, path, *buf, *size, &strbuf)) {
- free(*buf);
- *size = strbuf.len;
- *buf = strbuf_detach(&strbuf, NULL);
- }
- }
-
- return 0;
-}
-
static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
int unknown_type)
{
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2005 Junio C Hamano
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "tempfile.h"
@@ -6524,6 +6525,28 @@ int textconv_object(struct repository *r,
return 1;
}
+int filter_object(const char *path, unsigned mode,
+ const struct object_id *oid,
+ char **buf, unsigned long *size)
+{
+ enum object_type type;
+
+ *buf = read_object_file(oid, &type, size);
+ if (!*buf)
+ return error(_("cannot read object %s '%s'"),
+ oid_to_hex(oid), path);
+ if ((type == OBJ_BLOB) && S_ISREG(mode)) {
+ struct strbuf strbuf = STRBUF_INIT;
+ if (convert_to_working_tree(&the_index, path, *buf, *size, &strbuf)) {
+ free(*buf);
+ *size = strbuf.len;
+ *buf = strbuf_detach(&strbuf, NULL);
+ }
+ }
+
+ return 0;
+}
+
void setup_diff_pager(struct diff_options *opt)
{
/*
@@ -476,6 +476,10 @@ int textconv_object(struct repository *repo,
const struct object_id *oid, int oid_valid,
char **buf, unsigned long *buf_size);
+int filter_object(const char *path, unsigned mode,
+ const struct object_id *oid,
+ char **buf, unsigned long *size);
+
int parse_rename_score(const char **cp_p);
long parse_algorithm_value(const char *value);
Move function filter_object to diff.c, like it is done with function textconv_object. Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com> --- builtin/cat-file.c | 23 ----------------------- diff.c | 23 +++++++++++++++++++++++ diff.h | 4 ++++ 3 files changed, 27 insertions(+), 23 deletions(-) -- https://github.com/git/git/pull/568