|
6 | 6 | # By: dlesieur <dlesieur@student.42.fr> +#+ +:+ +#+ # |
7 | 7 | # +#+#+#+#+#+ +#+ # |
8 | 8 | # 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 # |
10 | 10 | # # |
11 | 11 | # **************************************************************************** # |
12 | 12 |
|
@@ -214,25 +214,28 @@ rm_branch: |
214 | 214 | git push origin --delete $(BRANCH) |
215 | 215 |
|
216 | 216 | publish: |
217 | | - @set -e; \ |
218 | | - export GIT_PUBLISH=1; \ |
| 217 | + @export GIT_PUBLISH=1; \ |
219 | 218 | BR=$$(git branch --show-current); \ |
| 219 | + MSG_VAL='$(subst ','\'',$(MSG))'; \ |
220 | 220 | 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; \ |
222 | 222 | echo "[publish] current branch: $$BR"; \ |
223 | 223 | 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"; \ |
226 | 230 | echo "[publish] switching to develop"; \ |
227 | 231 | git checkout develop; \ |
228 | 232 | git pull --ff-only; \ |
229 | 233 | 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"; \ |
232 | 235 | git push origin develop; \ |
233 | 236 | 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; \ |
236 | 239 | echo "[publish] done (on branch: develop)" |
237 | 240 |
|
238 | 241 | # Auto-run set-hooks on first use (after clone) |
|
0 commit comments