mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-10 00:42:40 +01:00
In "arc patch", use "cat-file -t" instead of "rev-parse --verify" to check for commits.
Summary: - `git rev-parse --verify` "verifies" very valid-looking commit name, not just valid commit names. - Currently, if we can't find the base rev we'll incorrectly "verify" it and then fail on "git checkout -b <branch> <some bogus commit>". - Instead, use `git cat-file -t`. - See similar fix in D1590. Example: $ git rev-parse --verify aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Test Plan: Ran "arc patch" in a mismatched local, hit "Y" to branch, got a branch off HEAD instead of an error. Reviewers: btrahan Reviewed By: btrahan CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1947
This commit is contained in:
parent
718b8b6d4f
commit
4e888458d7
1 changed files with 8 additions and 5 deletions
|
@ -269,11 +269,14 @@ EOTEXT
|
|||
// verify the base revision is valid
|
||||
// in a working copy that uses the git-svn bridge, the base revision might
|
||||
// be a svn uri instead of a git ref
|
||||
|
||||
// NOTE: Use 'cat-file', not 'rev-parse --verify', because 'rev-parse'
|
||||
// always "verifies" any properly-formatted commit even if it does not
|
||||
// exist.
|
||||
list($err) = exec_manual(
|
||||
'(cd %s; git rev-parse --verify %s)',
|
||||
'(cd %s; git cat-file -t %s)',
|
||||
$repository_api->getPath(),
|
||||
$base_revision
|
||||
);
|
||||
$base_revision);
|
||||
|
||||
if ($base_revision && !$err) {
|
||||
execx(
|
||||
|
@ -289,8 +292,8 @@ EOTEXT
|
|||
}
|
||||
|
||||
echo phutil_console_format(
|
||||
"Created and checked out branch {$branch_name}.\n"
|
||||
);
|
||||
"Created and checked out branch %s.\n",
|
||||
$branch_name);
|
||||
}
|
||||
|
||||
private function shouldUpdateWorkingCopy() {
|
||||
|
|
Loading…
Reference in a new issue