From 1bab2573d0f87755a57d2cc36a3c2995308439e5 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Mon, 28 Sep 2026 10:40:35 +0200 Subject: [PATCH] topdir.mk: Make target git-import idempotent Target git-import adds everything it finds in the current directory. If it's already a Git project, that fails over git commit -m "First commit". Since it's a prerequisite of target git-init-remote, it breaks that target, too for non-empty git repos, which isn't helpful when trying to run make git-init-remote to publish an an already existing project. So only do something meaningful in git-import if the project it's run in doesn't already contain files. Signed-off-by: Jan Lindemann --- make/topdir.mk | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/make/topdir.mk b/make/topdir.mk index 564af8a3..f1bd44c4 100644 --- a/make/topdir.mk +++ b/make/topdir.mk @@ -224,9 +224,12 @@ git-clone-to-remote: make git-update-project-description git-import: git-init git-config - git add -A - git status - git commit -am "First commit" + if ! git ls-files | grep -q .; then \ + set -ex ;\ + git add -A ;\ + git status ;\ + git commit -am "First commit" ;\ + fi git-init-remote: git-import git-clone-to-remote