Skip to content

Commit 47b9ac3

Browse files
committed
feat(Makefile): I've just implemented two new targets into the makefile, publish and rm_branch that flush all the branch and merge with develop when we're sre we're done
1 parent 9e2e3de commit 47b9ac3

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

.init.stamp

Whitespace-only changes.

Makefile

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# By: dlesieur <dlesieur@student.42.fr> +#+ +:+ +#+ #
77
# +#+#+#+#+#+ +#+ #
88
# Created: 2025/10/23 19:03:21 by dlesieur #+# #+# #
9-
# Updated: 2025/11/06 21:19:06 by dlesieur ### ########.fr #
9+
# Updated: 2025/11/06 21:25:31 by dlesieur ### ########.fr #
1010
# #
1111
# **************************************************************************** #
1212

@@ -214,25 +214,28 @@ rm_branch:
214214
git push origin --delete $(BRANCH)
215215

216216
publish:
217-
@set -e; \
218-
export GIT_PUBLISH=1; \
217+
@export GIT_PUBLISH=1; \
219218
BR=$$(git branch --show-current); \
219+
MSG_VAL='$(subst ','\'',$(MSG))'; \
220220
if [ -z "$$BR" ]; then echo "fatal: branch name required"; exit 128; fi; \
221-
if [ -z "$(MSG)" ]; then echo "fatal: provide commit message via MSG=\"...\""; exit 2; fi; \
221+
if [ -z "$$MSG_VAL" ]; then echo "fatal: provide commit message via MSG=\"...\""; exit 2; fi; \
222222
echo "[publish] current branch: $$BR"; \
223223
git add .; \
224-
if ! git diff --cached --quiet; then git commit -m "$(MSG)"; else echo "[publish] nothing to commit"; fi; \
225-
git push origin $$BR; \
224+
if ! git diff --cached --quiet; then \
225+
git commit -m "$$MSG_VAL"; \
226+
else \
227+
echo "[publish] nothing to commit"; \
228+
fi; \
229+
git push origin "$$BR"; \
226230
echo "[publish] switching to develop"; \
227231
git checkout develop; \
228232
git pull --ff-only; \
229233
echo "[publish] merging $$BR -> develop"; \
230-
# Merge commit will be allowed in publish mode without 250-word requirement
231-
git merge --no-ff $$BR; \
234+
git merge --no-ff "$$BR"; \
232235
git push origin develop; \
233236
echo "[publish] deleting branch $$BR locally and on origin"; \
234-
git branch -D $$BR; \
235-
git push origin --delete $$BR || true; \
237+
git branch -D "$$BR"; \
238+
git push origin --delete "$$BR" || true; \
236239
echo "[publish] done (on branch: develop)"
237240

238241
# Auto-run set-hooks on first use (after clone)

out.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

scripts/hooks/commit-msg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if [ -z "$MSG_FILE" ]; then
1111
exit 0
1212
fi
1313

14-
# PUBLISH MODE: only enforce length >= 250 words, nothing else.
14+
# PUBLISH MODE: only enforce length >= 25 words, nothing else.
1515
if [ "${GIT_PUBLISH:-}" = "1" ]; then
1616
# Skip checks for merge commits to avoid blocking automated merge messages
1717
if git rev-parse -q --verify MERGE_HEAD >/dev/null 2>&1; then
@@ -21,7 +21,7 @@ if [ "${GIT_PUBLISH:-}" = "1" ]; then
2121
# Count words excluding commented/empty lines
2222
word_count=$(awk '!/^[[:space:]]*($|#)/{print}' "$MSG_FILE" | wc -w | tr -d '[:space:]')
2323
if [ "$word_count" -lt 25 ]; then
24-
log_error "publish mode: commit message must contain at least 250 words (got $word_count)."
24+
log_error "publish mode: commit message must contain at least 25 words (got $word_count)."
2525
log_info "Tip: provide a detailed description via: MSG=\"your long message ...\""
2626
exit 1
2727
fi

0 commit comments

Comments
 (0)