]> git.ipfire.org Git - thirdparty/git.git/blame - entry.h
coverity: allow running on macOS
[thirdparty/git.git] / entry.h
CommitLineData
d052cc03
MT
1#ifndef ENTRY_H
2#define ENTRY_H
3
d052cc03
MT
4#include "convert.h"
5
ba3d1c73
EN
6struct cache_entry;
7struct index_state;
8
d052cc03
MT
9struct checkout {
10 struct index_state *istate;
11 const char *base_dir;
12 int base_dir_len;
4002ec3d 13 const char *super_prefix;
d052cc03
MT
14 struct delayed_checkout *delayed_checkout;
15 struct checkout_metadata meta;
16 unsigned force:1,
17 quiet:1,
18 not_new:1,
19 clone:1,
20 refresh_cache:1;
21};
f69a6e4f 22#define CHECKOUT_INIT { .base_dir = "" }
d052cc03
MT
23
24#define TEMPORARY_FILENAME_LENGTH 25
25/*
26 * Write the contents from ce out to the working tree.
27 *
28 * When topath[] is not NULL, instead of writing to the working tree
29 * file named by ce, a temporary file is created by this function and
30 * its name is returned in topath[], which must be able to hold at
31 * least TEMPORARY_FILENAME_LENGTH bytes long.
ae22751f
MT
32 *
33 * With checkout_entry_ca(), callers can optionally pass a preloaded
34 * conv_attrs struct (to avoid reloading it), when ce refers to a
35 * regular file. If ca is NULL, the attributes will be loaded
36 * internally when (and if) needed.
d052cc03 37 */
ae22751f
MT
38int checkout_entry_ca(struct cache_entry *ce, struct conv_attrs *ca,
39 const struct checkout *state, char *topath,
40 int *nr_checkouts);
41static inline int checkout_entry(struct cache_entry *ce,
42 const struct checkout *state, char *topath,
43 int *nr_checkouts)
44{
45 return checkout_entry_ca(ce, NULL, state, topath, nr_checkouts);
46}
d052cc03
MT
47
48void enable_delayed_checkout(struct checkout *state);
611c7785 49int finish_delayed_checkout(struct checkout *state, int show_progress);
d052cc03
MT
50
51/*
52 * Unlink the last component and schedule the leading directories for
53 * removal, such that empty directories get removed.
4002ec3d
ÆAB
54 *
55 * The "super_prefix" is either NULL, or the "--super-prefix" passed
56 * down from "read-tree" et al.
d052cc03 57 */
4002ec3d 58void unlink_entry(const struct cache_entry *ce, const char *super_prefix);
d052cc03 59
e9aa762c 60void *read_blob_entry(const struct cache_entry *ce, size_t *size);
49cfd903 61int fstat_checkout_output(int fd, const struct checkout *state, struct stat *st);
584a0d13
MT
62void update_ce_after_write(const struct checkout *state, struct cache_entry *ce,
63 struct stat *st);
49cfd903 64
d052cc03 65#endif /* ENTRY_H */