From 66d0ce915b197edab512bb7ad2b06727603ce47a Mon Sep 17 00:00:00 2001 From: tracer-ysyx Date: Sat, 6 Jan 2024 00:43:00 +0800 Subject: [PATCH] =?UTF-8?q?>=20configure=20=20ysyx=5F22040000=20=E6=9D=8E?= =?UTF-8?q?=E5=BF=83=E6=9D=A8=20=20Linux=20calcite=206.1.69=20#1-NixOS=20S?= =?UTF-8?q?MP=20PREEMPT=5FDYNAMIC=20Wed=20Dec=2020=2016:00:29=20UTC=202023?= =?UTF-8?q?=20x86=5F64=20GNU/Linux=20=20=2000:43:00=20=20up=201=20day=20?= =?UTF-8?q?=209:29,=20=202=20users,=20=20load=20average:=200.45,=200.46,?= =?UTF-8?q?=200.41?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- git_commit.sh | 40 ++++++++++++++++++++++++++++++++++++++++ npc/CMakeLists.txt | 4 ++-- 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100755 git_commit.sh diff --git a/git_commit.sh b/git_commit.sh new file mode 100755 index 0000000..17378e7 --- /dev/null +++ b/git_commit.sh @@ -0,0 +1,40 @@ +#/usr/bin/env bash +# +# Environment Variables: +# NEMU_HOME +set -x + +STUID=ysyx_22040000 +STUNAME=李心杨 + +TRACER=tracer-ysyx +GITFLAGS="-q --author=$TRACER --no-verify --allow-empty" + +YSYX_HOME=$NEMU_HOME/.. +WORK_BRANCH=$(git rev-parse --abbrev-ref HEAD) +WORK_INDEX=$YSYX_HOME/.git/index.${WORK_BRANCH} +TRACER_BRANCH=$TRACER + +LOCK_DIR=$YSYX_HOME/.git/ + +git_soft_checkout () { + git checkout --detach -q && git reset --soft $1 -q -- && git checkout $1 -q -- ; +} + +git_commit () { + # create tracer branch if not existent + git branch $TRACER_BRANCH -q 2>/dev/null || true + # backup git index + cp -a .git/index $WORK_INDEX + # switch to tracer branch + git_soft_checkout "$TRACER_BRANCH" + # add files to commit + git add . -A --ignore-errors + # generate commit msg, commit changes in tracer branch + printf "> $1 \n $STUID $STUNAME \n $(uname -a) \n $(uptime)\n" | git commit -F - $GITFLAGS + git_soft_checkout "$WORK_BRANCH" + mv $WORK_INDEX .git/index +} + +git_commit $1 + diff --git a/npc/CMakeLists.txt b/npc/CMakeLists.txt index 8d3e4dd..d5ca275 100644 --- a/npc/CMakeLists.txt +++ b/npc/CMakeLists.txt @@ -5,8 +5,8 @@ set (CMAKE_CXX_STANDARD 11) cmake_policy(SET CMP0144 NEW) execute_process( - COMMAND ${CMAKE_SOURCE_DIR}/../git_commit.sh "configure\ npc" - WORKING_DIRECTORY ../ + COMMAND ${CMAKE_SOURCE_DIR}/../git_commit.sh "configure npc" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/.. ) find_package(SDL2 REQUIRED)