Skip to content

Commit 8581349

Browse files
committed
wip: fix broken phabricator submit test
1 parent 3e4cb3d commit 8581349

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

git-branchless-submit/src/phabricator.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ impl Forge for PhabricatorForge<'_> {
241241
fn query_status(
242242
&mut self,
243243
commit_set: CommitSet,
244-
) -> eyre::Result<std::result::Result<HashMap<NonZeroOid, CommitStatus>, ExitCode>> {
244+
) -> EyreExitOr<HashMap<NonZeroOid, CommitStatus>> {
245245
let commit_oids = self.dag.commit_set_to_vec(&commit_set)?;
246246
let commit_oid_to_revision: HashMap<NonZeroOid, Option<Id>> = commit_oids
247247
.into_iter()
@@ -319,7 +319,7 @@ impl Forge for PhabricatorForge<'_> {
319319
&mut self,
320320
commits: HashMap<NonZeroOid, CommitStatus>,
321321
options: &SubmitOptions,
322-
) -> eyre::Result<std::result::Result<HashMap<NonZeroOid, CreateStatus>, ExitCode>> {
322+
) -> EyreExitOr<HashMap<NonZeroOid, CreateStatus>> {
323323
let SubmitOptions {
324324
create: _,
325325
draft,
@@ -371,7 +371,9 @@ impl Forge for PhabricatorForge<'_> {
371371
TestCommand::Args(args.into_iter().map(ToString::to_string).collect())
372372
} else {
373373
TestCommand::String(
374-
r#"(git show | grep 'BROKEN') && exit 1 || git commit --amend --message "$(git show --no-patch --format=%B HEAD)
374+
// Convoluted way to check if the commit message contains the
375+
// given string without a dependency on `grep`, etc.
376+
r#"[ "$(git log --max-count=1 HEAD^..HEAD --grep='BROKEN')" != '' ] && exit 1 || git commit --amend --message "$(git show --no-patch --format=%B HEAD)
375377
376378
Differential Revision: https://phabricator.example.com/D000$(git rev-list --count HEAD)
377379
"

git-branchless-submit/tests/test_phabricator_forge.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ fn test_submit_phabricator_failure_commit() -> eyre::Result<()> {
265265
Stopped at d5bb8b5 (create test3.txt)
266266
branchless: processing 1 update: ref HEAD
267267
"###);
268-
insta::assert_snapshot!(stdout, @r###"
268+
insta::assert_snapshot!(stdout, @r"
269269
branchless: running command: <git-executable> diff --quiet
270270
Calling Git for on-disk rebase...
271271
branchless: running command: <git-executable> rebase --continue
@@ -274,7 +274,6 @@ fn test_submit_phabricator_failure_commit() -> eyre::Result<()> {
274274
branchless: running command: <git-executable> rebase --abort
275275
Failed (exit code 1): 5b9de4b BROKEN: test2.txt
276276
Stdout:
277-
BROKEN: test2.txt
278277
Stderr:
279278
Attempting rebase in-memory...
280279
[1/3] Committed as: 55af3db create test1.txt
@@ -293,7 +292,7 @@ fn test_submit_phabricator_failure_commit() -> eyre::Result<()> {
293292
Failed to create 2 commits:
294293
5b9de4b BROKEN: test2.txt
295294
e9d3664 create test3.txt
296-
"###);
295+
");
297296
}
298297

299298
{

0 commit comments

Comments
 (0)