From: "Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Harald Nordgren <haraldnordgren@gmail.com>,
Harald Nordgren <haraldnordgren@gmail.com>
Subject: [PATCH 1/2] commit: extract commit_index_files_or_die() helper
Date: Sat, 13 Jun 2026 09:16:28 +0000 [thread overview]
Message-ID: <ddb720a8bded60b6efa35e571dff0e23ffb7b1a6.1781342189.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2334.git.git.1781342189.gitgitgadget@gmail.com>
From: Harald Nordgren <haraldnordgren@gmail.com>
A later change adds a second caller that commits the index lock and dies
on failure, so wrap that into a helper to avoid duplicating its message.
No functional change intended.
Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
---
builtin/commit.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index 28f6174503..1a51450660 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -248,6 +248,14 @@ static int commit_index_files(void)
return err;
}
+static void commit_index_files_or_die(void)
+{
+ if (commit_index_files())
+ die(_("repository has been updated, but unable to write\n"
+ "new index file. Check that disk is not full and quota is\n"
+ "not exceeded, and then \"git restore --staged :/\" to recover."));
+}
+
/*
* Take a union of paths in the index and the named tree (typically, "HEAD"),
* and return the paths that match the given pattern in list.
@@ -1954,10 +1962,7 @@ int cmd_commit(int argc,
unlink(git_path_merge_mode(the_repository));
unlink(git_path_squash_msg(the_repository));
- if (commit_index_files())
- die(_("repository has been updated, but unable to write\n"
- "new index file. Check that disk is not full and quota is\n"
- "not exceeded, and then \"git restore --staged :/\" to recover."));
+ commit_index_files_or_die();
git_test_write_commit_graph_or_die(the_repository->objects->sources);
--
gitgitgadget
next prev parent reply other threads:[~2026-06-13 9:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-13 9:16 [PATCH 0/2] commit: preserve commit hash on a no-op amend Harald Nordgren via GitGitGadget
2026-06-13 9:16 ` Harald Nordgren via GitGitGadget [this message]
2026-06-13 9:16 ` [PATCH 2/2] commit: keep the commit " Harald Nordgren via GitGitGadget
2026-06-13 9:59 ` [PATCH 0/2] commit: preserve commit hash " Johannes Sixt
2026-06-13 14:07 ` Ben Knoble
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ddb720a8bded60b6efa35e571dff0e23ffb7b1a6.1781342189.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=haraldnordgren@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox