From 41360e04de1715d1fbdf3ff5a9163eb8ee0584aa Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Sat, 27 Jun 2026 15:49:04 +0200 Subject: [PATCH] Run `git add` multiple times when too many files to add When there are more than 1000 files to pass into the `git add` command, run that command multiple times, with up to 1000 files at a time, to avoid problems with too long command line. Fixes #334 --- src/ablog/commands.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ablog/commands.py b/src/ablog/commands.py index 3823ac92..7706a0f5 100644 --- a/src/ablog/commands.py +++ b/src/ablog/commands.py @@ -430,7 +430,9 @@ def ablog_deploy( git_add.append(fnnew) print(f"Moved {len(git_add)} files to {github_pages}.github.io") os.chdir(repodir) - run("git add -f " + " ".join(['"{}"'.format(os.path.relpath(p)) for p in git_add]), echo=True) + for i in range(0, len(git_add), 1000): + chunk = git_add[i:i+1000] + run("git add -f " + " ".join(['"{}"'.format(os.path.relpath(p)) for p in chunk]), echo=True) if not os.path.isfile(".nojekyll"): open(".nojekyll", "w") run("git add -f .nojekyll")