Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14005784
D9165.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9165.id.diff
View Options
diff --git a/src/workflow/ArcanistBaseWorkflow.php b/src/workflow/ArcanistBaseWorkflow.php
--- a/src/workflow/ArcanistBaseWorkflow.php
+++ b/src/workflow/ArcanistBaseWorkflow.php
@@ -760,6 +760,14 @@
return $this;
}
+ public function hasRepositoryAPI() {
+ try {
+ return (bool)$this->getRepositoryAPI();
+ } catch (Exception $ex) {
+ return false;
+ }
+ }
+
public function getRepositoryAPI() {
if (!$this->repositoryAPI) {
$workflow = get_class($this);
diff --git a/src/workflow/ArcanistDiffWorkflow.php b/src/workflow/ArcanistDiffWorkflow.php
--- a/src/workflow/ArcanistDiffWorkflow.php
+++ b/src/workflow/ArcanistDiffWorkflow.php
@@ -1169,11 +1169,11 @@
}
private function shouldAmend() {
- if ($this->haveUncommittedChanges) {
+ if ($this->isRawDiffSource()) {
return false;
}
- if ($this->isHistoryImmutable()) {
+ if ($this->haveUncommittedChanges) {
return false;
}
@@ -1181,7 +1181,9 @@
return false;
}
- if ($this->isRawDiffSource()) {
+ // Run this last: with --raw or --raw-command, we won't have a repository
+ // API.
+ if ($this->isHistoryImmutable()) {
return false;
}
@@ -1638,13 +1640,19 @@
$template = ArcanistCommentRemover::removeComments($new_template);
- $repository_api = $this->getRepositoryAPI();
- // special check for whether to amend here. optimizes a common git
- // workflow. we can't do this for mercurial because the mq extension
- // is popular and incompatible with hg commit --amend ; see T2011.
- $should_amend = (count($included_commits) == 1 &&
- $repository_api instanceof ArcanistGitAPI &&
- $this->shouldAmend());
+ // With --raw-command, we may not have a repository API.
+ if ($this->hasRepositoryAPI()) {
+ $repository_api = $this->getRepositoryAPI();
+ // special check for whether to amend here. optimizes a common git
+ // workflow. we can't do this for mercurial because the mq extension
+ // is popular and incompatible with hg commit --amend ; see T2011.
+ $should_amend = (count($included_commits) == 1 &&
+ $repository_api instanceof ArcanistGitAPI &&
+ $this->shouldAmend());
+ } else {
+ $should_amend = false;
+ }
+
if ($should_amend) {
$wrote = (rtrim($old_message) != rtrim($template));
if ($wrote) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Oct 28, 7:44 PM (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6714597
Default Alt Text
D9165.id.diff (2 KB)
Attached To
Mode
D9165: Fix "arc diff --raw-command --create"
Attached
Detach File
Event Timeline
Log In to Comment