From b67ce7e53444d31faff0cb6e107b7abc8dd40ce8 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 26 Mar 2012 09:43:37 -0700 Subject: [PATCH] Raise a better error message when "arc patch" fails because of filename case changes Summary: Git can't apply filename case change patches on case-insensitive filesystems. Some day we could manually do this ourselves, but it's fairly rare and complicated -- just raise a useful warning. Test Plan: Tried to apply a case-changing patch, got a good error. Reviewers: btrahan Reviewed By: btrahan CC: aran, epriestley Maniphest Tasks: T618 Differential Revision: https://secure.phabricator.com/D2015 --- src/workflow/patch/ArcanistPatchWorkflow.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/workflow/patch/ArcanistPatchWorkflow.php b/src/workflow/patch/ArcanistPatchWorkflow.php index f5b97579..49d87512 100644 --- a/src/workflow/patch/ArcanistPatchWorkflow.php +++ b/src/workflow/patch/ArcanistPatchWorkflow.php @@ -581,7 +581,24 @@ EOTEXT $future = $repository_api->execFutureLocal( 'apply --index --reject'); $future->write($bundle->toGitPatch()); - $future->resolvex(); + + try { + $future->resolvex(); + } catch (CommandException $ex) { + echo phutil_console_format( + "\n** Patch Failed! **\n"); + $stderr = $ex->getStdErr(); + if (preg_match('/already exists in working directory/', $stderr)) { + echo phutil_console_wrap( + phutil_console_format( + "\n** WARNING ** This patch may have failed ". + "because it attempts to change the case of a filename (for ". + "instance, from 'example.c' to 'Example.c'). Git can not apply ". + "patches like this on case-insensitive filesystems. You must ". + "apply this patch manually.\n")); + } + throw $ex; + } if ($this->shouldCommit()) { $commit_message = $this->getCommitMessage($bundle); -- 2.43.0