Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9ac84288
authored
Jun 24, 2026
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix(ci): add post-commit fix-git-refs script for Windows branch ref bug
1 parent
e8015024
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
9 deletions
lefthook.yml
scripts/fix-git-refs.sh
server/ai-direct-server/public/index.html
lefthook.yml
View file @
9ac8428
...
...
@@ -9,15 +9,7 @@ pre-commit:
post-commit
:
commands
:
fix-refs
:
run
:
|
BRANCH=$(git symbolic-ref HEAD 2>/dev/null | sed 's|refs/heads/||');
if [ -n "$BRANCH" ]; then
NEW_HASH=$(tail -1 .git/logs/refs/heads/$BRANCH 2>/dev/null | cut -d' ' -f2);
if [ -n "$NEW_HASH" ]; then
mkdir -p .git/refs/heads/$(dirname $BRANCH) 2>/dev/null;
printf '%s\n' "$NEW_HASH" > .git/refs/heads/$BRANCH;
fi
fi
run
:
sh scripts/fix-git-refs.sh
post-merge
:
commands
:
...
...
scripts/fix-git-refs.sh
0 → 100644
View file @
9ac8428
#!/bin/sh
# Fix Windows/Git branch ref sync bug
# On Windows, git commit may fail to update loose refs properly,
# causing branch refs to fall back to stale packed-refs values.
# This script reads the correct hash from the reflog and writes it
# to the loose ref file, ensuring branch refs stay in sync.
GIT_DIR
=
"
$(
git rev-parse --git-dir 2>/dev/null
)
"
if
[
-z
"
$GIT_DIR
"
]
;
then
exit
0
fi
BRANCH
=
"
$(
git symbolic-ref HEAD 2>/dev/null | sed
's|refs/heads/||'
)
"
if
[
-z
"
$BRANCH
"
]
;
then
exit
0
fi
REFLOG
=
"
$GIT_DIR
/logs/refs/heads/
$BRANCH
"
if
[
-f
"
$REFLOG
"
]
;
then
NEW_HASH
=
"
$(
tail -1
"
$REFLOG
"
| cut -d
' '
-f2
)
"
else
NEW_HASH
=
"
$(
tail -1
"
$GIT_DIR
/logs/HEAD"
| cut -d
' '
-f2
)
"
fi
if
[
-z
"
$NEW_HASH
"
]
;
then
exit
0
fi
REF_FILE
=
"
$GIT_DIR
/refs/heads/
$BRANCH
"
REF_DIR
=
"
$(
dirname
"
$REF_FILE
"
)
"
mkdir -p
"
$REF_DIR
"
2>/dev/null
printf
'%s\n'
"
$NEW_HASH
"
>
"
$REF_FILE
"
server/ai-direct-server/public/index.html
View file @
9ac8428
...
...
@@ -204,3 +204,4 @@
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment