Coverage Report

Created: 2024-09-08 06:24

/src/git/builtin/apply.c
Line
Count
Source (jump to first uncovered line)
1
#include "builtin.h"
2
#include "gettext.h"
3
#include "repository.h"
4
#include "hash.h"
5
#include "apply.h"
6
7
static const char * const apply_usage[] = {
8
  N_("git apply [<options>] [<patch>...]"),
9
  NULL
10
};
11
12
int cmd_apply(int argc, const char **argv, const char *prefix)
13
0
{
14
0
  int force_apply = 0;
15
0
  int options = 0;
16
0
  int ret;
17
0
  struct apply_state state;
18
19
0
  if (init_apply_state(&state, the_repository, prefix))
20
0
    exit(128);
21
22
  /*
23
   * We could to redo the "apply.c" machinery to make this
24
   * arbitrary fallback unnecessary, but it is dubious that it
25
   * is worth the effort.
26
   * cf. https://lore.kernel.org/git/xmqqcypfcmn4.fsf@gitster.g/
27
   */
28
0
  if (!the_hash_algo)
29
0
    repo_set_hash_algo(the_repository, GIT_HASH_SHA1);
30
31
0
  argc = apply_parse_options(argc, argv,
32
0
           &state, &force_apply, &options,
33
0
           apply_usage);
34
35
0
  if (check_apply_state(&state, force_apply))
36
0
    exit(128);
37
38
0
  ret = apply_all_patches(&state, argc, argv, options);
39
40
0
  clear_apply_state(&state);
41
42
0
  return ret;
43
0
}