Split the production flags (literal, space-separated arguments) so this * exercises the same pins without a shell or a second copy of their values. */
| 904 | /* Split the production flags (literal, space-separated arguments) so this |
| 905 | * exercises the same pins without a shell or a second copy of their values. */ |
| 906 | static bool diff_git_run(const char *root, const char *config, diff_git_output_t *output) { |
| 907 | char pins[] = CBM_TEST_IMPACT_GIT_PINS; |
| 908 | char flags[] = CBM_TEST_IMPACT_DIFF_FLAGS; |
| 909 | const char *git = "git"; |
| 910 | #ifdef _WIN32 |
| 911 | git = cbm_find_cli("git", cbm_get_home_dir()); |
| 912 | if (!git) { |
| 913 | return false; |
| 914 | } |
| 915 | #endif |
| 916 | const char *argv[48] = {git, "-C", root, "-c", config}; |
| 917 | size_t count = 5; |
| 918 | char *groups[] = {pins, flags}; |
| 919 | for (size_t group = 0; group < 2; group++) { |
| 920 | if (group == 1) { |
| 921 | argv[count++] = "diff"; |
| 922 | } |
| 923 | char *part = groups[group]; |
| 924 | while (*part) { |
| 925 | while (*part == ' ') { |
| 926 | part++; |
| 927 | } |
| 928 | if (!*part) { |
| 929 | break; |
| 930 | } |
| 931 | if (count + 6 >= sizeof(argv) / sizeof(argv[0])) { |
| 932 | return false; |
| 933 | } |
| 934 | argv[count++] = part; |
| 935 | while (*part && *part != ' ') { |
| 936 | part++; |
| 937 | } |
| 938 | if (*part) { |
| 939 | *part++ = '\0'; |
| 940 | } |
| 941 | } |
| 942 | } |
| 943 | argv[count++] = "--no-index"; |
| 944 | argv[count++] = "--"; |
| 945 | argv[count++] = "before.c"; |
| 946 | argv[count++] = "after.c"; |
| 947 | argv[count] = NULL; |
| 948 | cbm_proc_opts_t options = { |
| 949 | .bin = git, |
| 950 | .argv = argv, |
| 951 | .log_file = TH_PATH(root, "diff.log"), |
| 952 | .on_log_line = diff_git_capture, |
| 953 | .log_ud = output, |
| 954 | .quiet_timeout_ms = 10000, |
| 955 | .delete_log_on_exit = true, |
| 956 | .strip_git_repo_env = true, |
| 957 | }; |
| 958 | cbm_proc_result_t result = {0}; |
| 959 | return cbm_subprocess_run(&options, &result) == 0 && result.outcome == CBM_PROC_EXIT_NONZERO && |
| 960 | result.exit_code == 1 && !output->overflow; |
| 961 | } |
| 962 | |
| 963 | TEST(test_diff_git_flags_ignore_inter_hunk_config) { |
no test coverage detected