尝试使用pre-commit-msg挂接时使用sh.exe.stackdump [英] sh.exe.stackdump when trying to use a pre-commit-msg hook

查看:145
本文介绍了尝试使用pre-commit-msg挂接时使用sh.exe.stackdump的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我尝试使用预提交挂钩在当前分支名称之前添加前缀时,都会生成sh.exe.stackdump文件,并且该挂钩不起作用。我尝试了许多其他已验证可在其他PC上运行的文件,这使我相信这与钩子本身无关。

Whenever I try to use a pre commit hook to prepend the current branch name, a sh.exe.stackdump file is generated and the hook doesn't work. I've tried a number of other files which have been verified to work on other PC's leading me to believe it's not an issue with the hook itself.

我正在使用Windows 10上的git 2.18。我已经验证了我的PATH是正确的,已经重新安装了git,并且除了Windows Defender之外没有其他正在运行的AV。

I'm using git 2.18 on Windows 10. I've verified my PATH is correct, reinstalled git already and have no AV running other than Windows Defender.

Stackdump:

Stackdump:

Exception: STATUS_STACK_OVERFLOW at rip=7FFE4951EC07
rax=0000000000000010 rbx=0000000000000000 rcx=0000000000000010
rdx=000000000000000C rsi=00000000FFFFAA50 rdi=00007FFE3CA8B600
r8 =00000000FFFFA988 r9 =00000000FFFFA9C0 r10=00000000FFFFA000
r11=00000000FFE03EA0 r12=FFFFFFFFFFFFFFFF r13=00000000FFFFADC0
r14=000000000000014C r15=0000000000000000
rbp=00000000FFFFA9C0 rsp=00000000FFFFA978
program=C:\Program Files\Git\usr\bin\sh.exe, pid 17444, thread 
cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B
Stack trace:
Frame        Function    Args
000FFFFA9C0  7FFE4951EC07 (00000000104, 000FFFFAA38, 7FFE494FFE58, 00000000000)
000FFFFA9C0  7FFE494FD827 (7FFE3CA8B600, 7FFE3CA8B600, 00000000001, 00000230022)
000FFFFAA38  7FFE45B48A24 (7FFE49480000, 7FFE494FD7A0, 7FFE494E7AC0, 7FFFFFFEFFFF)
000FFFFAC00  7FFE45B488A1 (5E03000600010000, 5A4E5B7BB435, 000FFFFAAC0, 000FFFFADC0)
000FFFFAC00  7FFE45B48704 (7FFE3CA8B810, FFFFFFFFFFFFFFFF, 0000084E840, 7FFE3CA8B810)
000FFFFAC00  7FFE3C9F11A0 (000FFFFAC00, 0000084E840, 00000000190, 00000000000)
000FFFFAC00  7FFE3C9C4DCC (7FFE00000005, 7FFE3C9C4C10, 00000160000, 000007E4D80)
000FFFFB3D0  7FFE3C99F83E (4F004E004F0043, 02400540055, 00000000000, 00180010018)
000007E4D80  7FFE3C99EA38 (000000001D4, 000FFFFBA00, 000FFFFB760, 000FFFFB7F8)
000FFFFB760  7FFE3C9973EC (000FFFFB8D0, 000000001DC, 00000000000, 0018028E980)
000000001D4  7FFE45B58966 (00000000001, 00000000000, 0018022F490, 00000000001)
000000001D4  7FFE4882A103 (00000000020, 00000000000, 000FFFFBB20, 00000000001)
000000001D4  001800AB2B5 (000FFFFBAC0, 0018028E980, 00000000001, 00000000001)
000FFFFBD30  001800ABFF5 (00100410FBB, 001803213B0, 0060004E980, 001004E9740)
000FFFFBD30  0018011DE4B (00100410FBB, 001803213B0, 0060004E980, 001004E9740)
000FFFFBD30  00000FAE458 (00100410FBB, 001803213B0, 0060004E980, 001004E9740)
End of stack trace (more stack frames may be present)

我尝试过的prepare-commit-msg文件之一:

One of the prepare-commit-msg files I've tried:

#!/bin/sh

if [ -z "$BRANCHES_TO_SKIP" ]; then
  BRANCHES_TO_SKIP=(master develop)
fi

BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"
BRANCH_NAME=$(echo "$BRANCH_NAME" | sed -E 's/([0-9]+-[0-9]+)-.*/\1/')

echo Prepending branch name $BRANCH_NAME

BRANCH_EXCLUDED=$(printf "%s\n" "${BRANCHES_TO_SKIP[@]}" | grep -c "^$BRANCH_NAME$")
BRANCH_IN_COMMIT=$(grep -c "$BRANCH_NAME" $1)

if [ -n "$BRANCH_NAME" ] && ! [[ $BRANCH_EXCLUDED -eq 1 ]] && ! [[ $BRANCH_IN_COMMIT -ge 1 ]]; then
  sed -i.bak -e "1s/^/$BRANCH_NAME /" $1
fi


推荐答案


我已经验证了我的PATH是正确的

I've verified my PATH is correct

仍然:用于测试,请解压缩 PortableGit-2.18.0-64-bit.7z.exe ,并使用简化的PATH(在CMD中,仅用于测试)

Still: for testing, unzip PortableGit-2.18.0-64-bit.7z.exe in C:\Git, and use a simplified PATH (in a CMD, just for testing)

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\Git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%MAVEN_HOME%\bin;%PATH%

然后,在该CMD中,使用该钩子再次尝试在回购中提交。

Then, in that CMD, try again your commit in your repo with that hook.

这篇关于尝试使用pre-commit-msg挂接时使用sh.exe.stackdump的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆