Skip to content

Commit 2b5ba0b

Browse files
author
Bruno Moreira De Barros
committed
Adds better error handling for repos that don't contain the commit that's being deployed (or compared to).
1 parent 20371dd commit 2b5ba0b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

git-deploy

391 Bytes
Binary file not shown.

tools/src/Git.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,11 @@ public function get_changes($target_commit, $current_commit) {
7575
$details = preg_split("/\\s+/", $line);
7676
$return['delete'][] = $details[1];
7777
$return['upload'][] = $details[2];
78+
} elseif (stristr($line, "fatal: bad object") !== false) {
79+
$commit = trim(str_ireplace("fatal: bad object", "", $line));
80+
Helpers::error("The commit '$commit' does not exist in this clone of the repo.\nFor more information, check out: https://help.github.com/articles/commit-exists-on-github-but-not-in-my-local-clone/");
7881
} else {
79-
Helpers::error("Unknown git-diff status: {$line[0]}");
82+
Helpers::error("Unknown git-diff status: {$line[0]} (LINE: $line)");
8083
}
8184
}
8285
} else {

0 commit comments

Comments
 (0)