From 2188fadd9d96bda5c4030856b988127d14661388 Mon Sep 17 00:00:00 2001
From: Boming Zhang <bomingzh@sjtu.edu.cn>
Date: Tue, 3 Jun 2025 21:57:15 -0400
Subject: [PATCH] feat: set git user name & email

---
 bin/joj3-forge-convert | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/bin/joj3-forge-convert b/bin/joj3-forge-convert
index f5376b7..39e164f 100755
--- a/bin/joj3-forge-convert
+++ b/bin/joj3-forge-convert
@@ -1,10 +1,16 @@
 #!/usr/bin/bash
 set -e
 COURSE=$1
-git -C /home/tt/.cache/$COURSE-config pull
-rsync -r --delete /home/tt/.cache/$COURSE-config/home/tt/.config/ /home/tt/.config
+REPO_PATH=/home/tt/.cache/$COURSE-config
+GIT_USER=$(whoami)
+GIT_HOSTNAME=$(hostname -s)
+GIT_EMAIL="${GIT_USER}@${GIT_HOSTNAME}"
+git -C $REPO_PATH pull
+rsync -r --delete $REPO_PATH/home/tt/.config/ /home/tt/.config
 joj3-forge convert /home/tt/.config/joj
-rsync -r --delete /home/tt/.config/joj/ /home/tt/.cache/$COURSE-config/home/tt/.config/joj
-git -C /home/tt/.cache/$COURSE-config add home/tt/.config/joj
-git -C /home/tt/.cache/$COURSE-config commit -m "chore: joj3-forge convert"
-git -C /home/tt/.cache/$COURSE-config push
+rsync -r --delete /home/tt/.config/joj/ $REPO_PATH/home/tt/.config/joj
+git -C $REPO_PATH config user.name $GIT_USER
+git -C $REPO_PATH config user.email $GIT_EMAIL
+git -C $REPO_PATH add home/tt/.config/joj
+git -C $REPO_PATH commit -m "chore: joj3-forge convert"
+git -C $REPO_PATH push