Skip to content

Commit

Permalink
Comment out the failure in find_objects_added_in
Browse files Browse the repository at this point in the history
  • Loading branch information
adamziel committed Jan 7, 2025
1 parent 2d5da28 commit d4afa36
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ static private function get_fs() {
if(!is_dir(WP_STATIC_PAGES_DIR)) {
mkdir(WP_STATIC_PAGES_DIR, 0777, true);
}
// $local_fs = new WP_Local_Filesystem(WP_STATIC_PAGES_DIR);
$local_fs = new WP_Local_Filesystem(WP_STATIC_PAGES_DIR);
$repo = new WP_Git_Repository($local_fs);
$repo->add_remote('origin', GIT_REPO_URL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public function force_pull($branch_name=null, $path = '/') {
$path = '/' . ltrim($path, '/');
$remote_refs = $this->fetchRefs('refs/heads/' . $branch_name);
$remote_head = $remote_refs['refs/heads/' . $branch_name];
// @TODO: Support "want" and "have" here
$remote_index = $this->list_objects($remote_head);

$remote_branch_ref = 'refs/heads/' . $branch_name;
Expand All @@ -179,7 +180,6 @@ public function force_pull($branch_name=null, $path = '/') {
$all_path_related_oids[] = $remote_head;
$all_path_related_oids = array_flip($all_path_related_oids);

// @TODO: Support "want" and "have" here
$new_oids = $remote_index->find_objects_added_in($remote_head, $local_ref ?: null, [
'old_commit_repository' => $local_index,
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,12 @@ public function find_objects_added_in($new_commit_hash, $old_commit_hash=WP_Git_

while($new_commit_hash !== $old_commit_hash && !wp_git_is_null_oid($new_commit_hash)) {
if(false === $this->read_object($new_commit_hash)) {
throw new Exception('Failed to read new commit object: ' . $new_commit_hash);
// @TODO: This is a fatal failure since we're not able to
// establish a path between the old and new commit,
// but it's commented out for now to record a demo.
// Let's restore the failure here.
// throw new Exception('Failed to read new commit object: ' . $new_commit_hash);
break;
}
$new_objects_oids[$new_commit_hash] = true;
$parsed_commit = $this->get_parsed_commit();
Expand Down

0 comments on commit d4afa36

Please sign in to comment.