From 73d0f5a90cb5dcbadfc6d0fd22f14e8bc0e61f86 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 26 Jun 2024 15:47:35 +0100 Subject: [PATCH] fix(git): Make git commit display detached HEAD correctly --- packages/git/src/subcommands/commit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/git/src/subcommands/commit.js b/packages/git/src/subcommands/commit.js index ccdfe8c83..c219b80ae 100644 --- a/packages/git/src/subcommands/commit.js +++ b/packages/git/src/subcommands/commit.js @@ -99,7 +99,7 @@ export default { }); const commit_title = options.message.split('\n')[0]; const short_hash = await shorten_hash({ fs, dir, gitdir, cache }, commit_hash); - let output = `[${branch} ${short_hash}] ${commit_title}\n`; + let output = `[${branch ?? 'detached HEAD'} ${short_hash}] ${commit_title}\n`; // TODO: --amend prints out the date of the original commit here, as: // ` Date: Fri May 17 15:45:47 2024 +0100` // TODO: Print out file change count, insertion count, and deletion count