You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@mrexox - Any suggestions? Seems like a very critical issue as unable to push any code from local to origin. See multiple places online. https://gitlab.com/gitlab-org/gitlab/-/issues/448387 Happy to help but our team is brand new to using lefthook.
Lefthook gets the diff with the previously pushed commit to the upstream. If there's no upstream, then lefthook fails. But maybe the better option would be to get the whole diff from the empty tree?
git diff --name-only HEAD $(git hash-object -t tree /dev/null)
Unfortunately, this diff will be very-very huge (depending on a number of commits since the first commit). However this looks correct if you are pushing new changes you haven't ever pushed. Otherwise there's no way to know what changes you have already pushed and what changes are new.
Does it feel convenient to get the diff from the very first commit (it can be very huge), or should lefthook throw an error to STDOUT? Or maybe it should skip the hook? I feel like using the huge diff is a better option but my vision is not accurate since I always have an upstream in my local repos and never face this error. I'd be glad to hear your thoughts.
🔧 Summary
Exiting with error code:128 on running any hook from left hook. verbose logs shows that this is because of no upstream
Lefthook version
v1.5.2
Steps to reproduce
Expected results
Hooks should run without any problem
Actual results
error calling replace command for {files}: exit status 128
error replacing {files}: exit status 128
Logs / Screenshots
lefthook run pre-commit -v
│ [lefthook] cmd: [git rev-parse --show-toplevel]
│ [lefthook] dir:
│ [lefthook] err:
│ [lefthook] out: /Users/tilakpur/projects/mosip/ovp-ble
│ [lefthook] cmd: [git rev-parse --git-path hooks]
│ [lefthook] dir:
│ [lefthook] err:
│ [lefthook] out: .git/hooks
│ [lefthook] cmd: [git rev-parse --git-path info]
│ [lefthook] dir:
│ [lefthook] err:
│ [lefthook] out: .git/info
│ [lefthook] cmd: [git rev-parse --git-dir]
│ [lefthook] dir:
│ [lefthook] err:
│ [lefthook] out: .git
╭──────────────────────────────────────╮
│ 🥊 lefthook v1.5.2 hook: pre-commit │
╰──────────────────────────────────────╯
│ [lefthook] cmd: [sh -c git status --short]
│ [lefthook] dir: /Users/tilakpur/projects/mosip/ovp-ble
│ [lefthook] err:
│ [lefthook] out:
│ [lefthook] cmd: [sh -c git diff --name-only @{push}]
│ [lefthook] cmd: [sh -c git diff --name-only @{push}]
│ [lefthook] dir: /Users/tilakpur/projects/mosip/ovp-ble
│ [lefthook] dir: /Users/tilakpur/projects/mosip/ovp-ble
│ [lefthook] err: exit status 128
│ [lefthook] err: exit status 128
│ [lefthook] out: fatal: no upstream configured for branch 'main'
│ [lefthook] out: fatal: no upstream configured for branch 'main'
error calling replace command for {files}: exit status 128
error replacing {files}: exit status 128
│ types (skip) error
│ lint (skip) error
│ [lefthook] cmd: [sh -c git stash list]
│ [lefthook] dir: /Users/tilakpur/projects/mosip/ovp-ble
│ [lefthook] err:
│ [lefthook] out:
The text was updated successfully, but these errors were encountered: