From 87e9c936ad1c98c232dd1632ca649f2d6a227c4d Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Thu, 9 Nov 2023 20:23:03 +0100 Subject: [PATCH] Make "git cat-file" exception messages include repository monogram/slug Summary: When throwing an exception related to output provided by `git cat-file`, include the repository monogram to allow potentially debugging in Git. Closes T15661 Test Plan: Unclear. Basically: "have a broken Git repository in Diffusion". (However this patch changes a message only shown in case of an exception, so in the worst case we'd break the exception via an exception.) Reviewers: O1 Blessed Committers, speck Reviewed By: O1 Blessed Committers, speck Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15661 Differential Revision: https://we.phorge.it/D25460 --- .../lowlevel/DiffusionLowLevelResolveRefsQuery.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php index 0bbba1dc18..899e69d49b 100644 --- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php +++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php @@ -140,8 +140,9 @@ final class DiffusionLowLevelResolveRefsQuery if (count($lines) !== count($unresolved)) { throw new Exception( pht( - 'Unexpected line count from `%s`!', - 'git cat-file')); + 'Unexpected line count from `%s` in %s!', + 'git cat-file', + $repository->getMonogram())); } $hits = array(); @@ -153,8 +154,9 @@ final class DiffusionLowLevelResolveRefsQuery if (count($parts) < 2) { throw new Exception( pht( - 'Failed to parse `%s` output: %s', + 'Failed to parse `%s` output in %s: %s', 'git cat-file', + $repository->getMonogram(), $line)); } list($identifier, $type) = $parts; @@ -177,8 +179,9 @@ final class DiffusionLowLevelResolveRefsQuery default: throw new Exception( pht( - 'Unexpected object type from `%s`: %s', + 'Unexpected object type from `%s` in %s: %s', 'git cat-file', + $repository->getMonogram(), $line)); } -- 2.51.2