| 732 | #endif |
| 733 | |
| 734 | static bool gf_rev_metadata(cbm_git_facts_t *facts, const char *option, bool absolute, |
| 735 | const char **out, cbm_git_facts_error_t *error) { |
| 736 | const char *args[] = {"rev-parse", "--path-format=absolute", option}; |
| 737 | gf_result_t result; |
| 738 | if (!gf_run(facts, args, 3, false, &result, error) || |
| 739 | !gf_owned_line(facts, &result.out, out, error)) |
| 740 | return false; |
| 741 | #ifdef _WIN32 |
| 742 | if (absolute && !(*out = gf_native_metadata_path(facts, *out))) |
| 743 | return gf_error(error, CBM_GIT_FACTS_OOM, "Cannot retain Git metadata path"); |
| 744 | #endif |
| 745 | if (absolute && !gf_absolute(*out)) |
| 746 | return gf_error(error, CBM_GIT_FACTS_COMMAND, "Git metadata path is not absolute"); |
| 747 | return true; |
| 748 | } |
| 749 | |
| 750 | /* Metadata queries call gf_run directly; the executor must not call this guard. |
| 751 | * This checks persistent topology consistency, not an atomic filesystem snapshot. |
no test coverage detected