Coverage Report

Created: 2024-09-08 06:23

/src/git/entry.h
Line
Count
Source (jump to first uncovered line)
1
#ifndef ENTRY_H
2
#define ENTRY_H
3
4
#include "convert.h"
5
6
struct cache_entry;
7
struct index_state;
8
9
struct checkout {
10
  struct index_state *istate;
11
  const char *base_dir;
12
  int base_dir_len;
13
  const char *super_prefix;
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
};
22
0
#define CHECKOUT_INIT { .base_dir = "" }
23
24
0
#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.
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.
37
 */
38
int checkout_entry_ca(struct cache_entry *ce, struct conv_attrs *ca,
39
          const struct checkout *state, char *topath,
40
          int *nr_checkouts);
41
static inline int checkout_entry(struct cache_entry *ce,
42
         const struct checkout *state, char *topath,
43
         int *nr_checkouts)
44
0
{
45
0
  return checkout_entry_ca(ce, NULL, state, topath, nr_checkouts);
46
0
}
Unexecuted instantiation: checkout--worker.c:checkout_entry
Unexecuted instantiation: checkout-index.c:checkout_entry
Unexecuted instantiation: checkout.c:checkout_entry
Unexecuted instantiation: difftool.c:checkout_entry
Unexecuted instantiation: mv.c:checkout_entry
Unexecuted instantiation: stash.c:checkout_entry
Unexecuted instantiation: apply.c:checkout_entry
Unexecuted instantiation: entry.c:checkout_entry
Unexecuted instantiation: merge-ort.c:checkout_entry
Unexecuted instantiation: parallel-checkout.c:checkout_entry
Unexecuted instantiation: unpack-trees.c:checkout_entry
47
48
void enable_delayed_checkout(struct checkout *state);
49
int finish_delayed_checkout(struct checkout *state, int show_progress);
50
51
/*
52
 * Unlink the last component and schedule the leading directories for
53
 * removal, such that empty directories get removed.
54
 *
55
 * The "super_prefix" is either NULL, or the "--super-prefix" passed
56
 * down from "read-tree" et al.
57
 */
58
void unlink_entry(const struct cache_entry *ce, const char *super_prefix);
59
60
void *read_blob_entry(const struct cache_entry *ce, size_t *size);
61
int fstat_checkout_output(int fd, const struct checkout *state, struct stat *st);
62
void update_ce_after_write(const struct checkout *state, struct cache_entry *ce,
63
         struct stat *st);
64
65
/*
66
 * Calls the correct function out of {unlink,rmdir}_or_warn based on
67
 * the supplied file mode.
68
 */
69
int remove_or_warn(unsigned int mode, const char *path);
70
71
#endif /* ENTRY_H */