2 * Copyright (c) 2011, Google Inc.
13 SAFE_CRLF_RENORMALIZE = 3,
14 SAFE_CRLF_KEEP_CRLF = 4
17 extern enum safe_crlf safe_crlf;
25 extern enum auto_crlf auto_crlf;
38 extern enum eol core_eol;
39 extern const char *get_cached_convert_stats_ascii(const struct index_state *istate,
41 extern const char *get_wt_convert_stats_ascii(const char *path);
42 extern const char *get_convert_attr_ascii(const char *path);
44 /* returns 1 if *dst was used */
45 extern int convert_to_git(const struct index_state *istate,
46 const char *path, const char *src, size_t len,
47 struct strbuf *dst, enum safe_crlf checksafe);
48 extern int convert_to_working_tree(const char *path, const char *src,
49 size_t len, struct strbuf *dst);
50 extern int renormalize_buffer(const struct index_state *istate,
51 const char *path, const char *src, size_t len,
53 static inline int would_convert_to_git(const struct index_state *istate,
56 return convert_to_git(istate, path, NULL, 0, NULL, 0);
58 /* Precondition: would_convert_to_git_filter_fd(path) == true */
59 extern void convert_to_git_filter_fd(const struct index_state *istate,
60 const char *path, int fd,
62 enum safe_crlf checksafe);
63 extern int would_convert_to_git_filter_fd(const char *path);
65 /*****************************************************************
67 * Streaming conversion support
69 *****************************************************************/
71 struct stream_filter; /* opaque */
73 extern struct stream_filter *get_stream_filter(const char *path, const unsigned char *);
74 extern void free_stream_filter(struct stream_filter *);
75 extern int is_null_stream_filter(struct stream_filter *);
78 * Use as much input up to *isize_p and fill output up to *osize_p;
79 * update isize_p and osize_p to indicate how much buffer space was
80 * consumed and filled. Return 0 on success, non-zero on error.
82 * Some filters may need to buffer the input and look-ahead inside it
83 * to decide what to output, and they may consume more than zero bytes
84 * of input and still not produce any output. After feeding all the
85 * input, pass NULL as input and keep calling this function, to let
86 * such filters know there is no more input coming and it is time for
87 * them to produce the remaining output based on the buffered input.
89 extern int stream_filter(struct stream_filter *,
90 const char *input, size_t *isize_p,
91 char *output, size_t *osize_p);
93 #endif /* CONVERT_H */