Coverage Report

Created: 2026-10-17 07:15

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/git/read-cache.h
Line
Count
Source
1
#ifndef READ_CACHE_H
2
#define READ_CACHE_H
3
4
#include "read-cache-ll.h"
5
#include "object.h"
6
#include "pathspec.h"
7
#include "environment.h"
8
9
/*
10
 * Determine the appropriate index mode for a file based on its stat()
11
 * information and the existing cache entry (if any).
12
 *
13
 * This function handles degradation for filesystems that lack
14
 * symlink support or reliable executable bits.
15
 */
16
static inline unsigned int ce_mode_from_stat(struct repository *repo,
17
               const struct cache_entry *ce,
18
               unsigned int mode)
19
0
{
20
0
  if (S_ISREG(mode) && !repo_has_symlinks(repo) &&
21
0
      ce && S_ISLNK(ce->ce_mode))
22
0
    return ce->ce_mode;
23
0
  if (S_ISREG(mode) && !repo_trust_executable_bit(repo)) {
24
0
    if (ce && S_ISREG(ce->ce_mode))
25
0
      return ce->ce_mode;
26
0
    return create_ce_mode(0666);
27
0
  }
28
0
  return create_ce_mode(mode);
29
0
}
Unexecuted instantiation: revision.c:ce_mode_from_stat
Unexecuted instantiation: wt-status.c:ce_mode_from_stat
Unexecuted instantiation: diff-lib.c:ce_mode_from_stat
Unexecuted instantiation: pathspec.c:ce_mode_from_stat
Unexecuted instantiation: read-cache.c:ce_mode_from_stat
Unexecuted instantiation: resolve-undo.c:ce_mode_from_stat
Unexecuted instantiation: unpack-trees.c:ce_mode_from_stat
Unexecuted instantiation: apply.c:ce_mode_from_stat
Unexecuted instantiation: preload-index.c:ce_mode_from_stat
30
31
static inline int ce_to_dtype(const struct cache_entry *ce)
32
0
{
33
0
  unsigned ce_mode = ntohl(ce->ce_mode);
34
0
  if (S_ISREG(ce_mode))
35
0
    return DT_REG;
36
0
  else if (S_ISDIR(ce_mode) || S_ISGITLINK(ce_mode))
37
0
    return DT_DIR;
38
0
  else if (S_ISLNK(ce_mode))
39
0
    return DT_LNK;
40
0
  else
41
0
    return DT_UNKNOWN;
42
0
}
Unexecuted instantiation: revision.c:ce_to_dtype
Unexecuted instantiation: wt-status.c:ce_to_dtype
Unexecuted instantiation: diff-lib.c:ce_to_dtype
Unexecuted instantiation: pathspec.c:ce_to_dtype
Unexecuted instantiation: read-cache.c:ce_to_dtype
Unexecuted instantiation: resolve-undo.c:ce_to_dtype
Unexecuted instantiation: unpack-trees.c:ce_to_dtype
Unexecuted instantiation: apply.c:ce_to_dtype
Unexecuted instantiation: preload-index.c:ce_to_dtype
43
44
static inline int ce_path_match(struct index_state *istate,
45
        const struct cache_entry *ce,
46
        const struct pathspec *pathspec,
47
        char *seen)
48
0
{
49
0
  return match_pathspec(istate, pathspec, ce->name, ce_namelen(ce), 0, seen,
50
0
            S_ISDIR(ce->ce_mode) || S_ISGITLINK(ce->ce_mode));
51
0
}
Unexecuted instantiation: revision.c:ce_path_match
Unexecuted instantiation: wt-status.c:ce_path_match
Unexecuted instantiation: diff-lib.c:ce_path_match
Unexecuted instantiation: pathspec.c:ce_path_match
Unexecuted instantiation: read-cache.c:ce_path_match
Unexecuted instantiation: resolve-undo.c:ce_path_match
Unexecuted instantiation: unpack-trees.c:ce_path_match
Unexecuted instantiation: apply.c:ce_path_match
Unexecuted instantiation: preload-index.c:ce_path_match
52
53
#endif /* READ_CACHE_H */