Skip to content

Commit

Permalink
textconv: make the API public
Browse files Browse the repository at this point in the history
The textconv functionality allows one to convert a file into text before
running diff. But this functionality can be useful to other features
such as blame.

Signed-off-by: Axel Bonnet <axel.bonnet@ensimag.imag.fr>
Signed-off-by: Clément Poulain <clement.poulain@ensimag.imag.fr>
Signed-off-by: Diane Gasselin <diane.gasselin@ensimag.imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Axel Bonnet authored and Junio C Hamano committed Jun 11, 2010
1 parent 92a75a3 commit a788d7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 4 additions & 8 deletions diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ static char diff_colors[][COLOR_MAXLEN] = {
GIT_COLOR_NORMAL, /* FUNCINFO */
};

static void diff_filespec_load_driver(struct diff_filespec *one);
static size_t fill_textconv(struct userdiff_driver *driver,
struct diff_filespec *df, char **outbuf);

static int parse_diff_color_slot(const char *var, int ofs)
{
if (!strcasecmp(var+ofs, "plain"))
Expand Down Expand Up @@ -1629,7 +1625,7 @@ void diff_set_mnemonic_prefix(struct diff_options *options, const char *a, const
options->b_prefix = b;
}

static struct userdiff_driver *get_textconv(struct diff_filespec *one)
struct userdiff_driver *get_textconv(struct diff_filespec *one)
{
if (!DIFF_FILE_VALID(one))
return NULL;
Expand Down Expand Up @@ -4002,9 +3998,9 @@ static char *run_textconv(const char *pgm, struct diff_filespec *spec,
return strbuf_detach(&buf, outsize);
}

static size_t fill_textconv(struct userdiff_driver *driver,
struct diff_filespec *df,
char **outbuf)
size_t fill_textconv(struct userdiff_driver *driver,
struct diff_filespec *df,
char **outbuf)
{
size_t size;

Expand Down
8 changes: 8 additions & 0 deletions diff.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
struct rev_info;
struct diff_options;
struct diff_queue_struct;
struct diff_filespec;
struct userdiff_driver;

typedef void (*change_fn_t)(struct diff_options *options,
unsigned old_mode, unsigned new_mode,
Expand Down Expand Up @@ -287,4 +289,10 @@ extern void diff_no_index(struct rev_info *, int, const char **, int, const char

extern int index_differs_from(const char *def, int diff_flags);

extern size_t fill_textconv(struct userdiff_driver *driver,
struct diff_filespec *df,
char **outbuf);

extern struct userdiff_driver *get_textconv(struct diff_filespec *one);

#endif /* DIFF_H */

0 comments on commit a788d7d

Please sign in to comment.