Skip to content

Instantly share code, notes, and snippets.

@abiriadev
Created March 25, 2025 13:06
Show Gist options
  • Save abiriadev/894430c11782098ab560ccb17d8d715b to your computer and use it in GitHub Desktop.
Save abiriadev/894430c11782098ab560ccb17d8d715b to your computer and use it in GitHub Desktop.
force git to allow empty commit message. it's just a hacky joke with experiment. use it on your own risk in production
diff --git a/builtin/commit.c b/builtin/commit.c
index 2f45968222..25e26a2f70 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -125,7 +125,7 @@ static int all, also, interactive, patch_interactive, only, amend, signoff;
static int edit_flag = -1; /* unspecified */
static int quiet, verbose, no_verify, allow_empty, dry_run, renew_authorship;
static int config_commit_verbose = -1; /* unspecified */
-static int no_post_rewrite, allow_empty_message, pathspec_file_nul;
+static int no_post_rewrite, allow_empty_message = 1, pathspec_file_nul;
static const char *untracked_files_arg, *force_date, *ignore_submodule_arg, *ignored_arg;
static const char *sign_commit, *pathspec_from_file;
static struct strvec trailer_args = STRVEC_INIT;
{
programs.git = {
enable = true;
package = pkgs.git.overrideAttrs (p: {
patches = p.patches ++ [ ./allow-empty-message.patch ];
preInstallCheck =
p.preInstallCheck
+ ''
disable_test t3404-rebase-interactive
disable_test t3405-rebase-malformed
disable_test t6429-merge-sequence-rename-caching
disable_test t7500-commit-template-squash-signoff
disable_test t7501-commit-basic-functionality
disable_test t7502-commit-porcelain
disable_test t7507-commit-verbose
disable_test t7508-status
'';
});
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment