"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.deleteCachedBranchParentShaResult = exports.getCachedBranchParentShaResult = void 0;
const repository_1 = require("../cache/repository");
function getCachedBranchParentShaResult(branchName, branchSha) {
    const { branches } = (0, repository_1.getCache)();
    const branch = branches?.find((branch) => branch.branchName === branchName);
    if (branch?.parentSha && branchSha === branch?.sha) {
        return branch.parentSha;
    }
    return null;
}
exports.getCachedBranchParentShaResult = getCachedBranchParentShaResult;
function deleteCachedBranchParentShaResult(branchName) {
    const { branches } = (0, repository_1.getCache)();
    const branch = branches?.find((branch) => branch.branchName === branchName);
    if (branch?.parentSha) {
        delete branch.parentSha;
    }
}
exports.deleteCachedBranchParentShaResult = deleteCachedBranchParentShaResult;
//# sourceMappingURL=parent-sha-cache.js.map