"unknown revision or path not in the working tree" from 1.6.15 onwards
alecthomas opened this issue ยท 4 comments
๐ง Summary
After upgrading from lefthook 1.6.14 to 1.6.15 (or higher), every push results in the following output:
๐ ~/dev/ftl $ git push aat/bump-lefthook-2
โ waitingfatal: ambiguous argument '@{push}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument '@{push}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument '@{push}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument '@{push}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument '@{push}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
This only occurs if the remote branch doesn't already exist. Once it exists everything works fine.
On 1.6.14 this works in either case.
Lefthook version
1.6.15 a58c11d
Steps to reproduce
I'm not sure, it happens 100% of the time for me. Let me know if there's any further information you'd need to reproduce it.
Possible Solution
Logs / Screenshots
๐ ~/dev/ftl $ LEFTHOOK_VERBOSE=true git push aat/bump-lefthook-2
+ '[' '' = 0 ']'
+ call_lefthook run pre-push origin git@github.com:TBD54566975/ftl.git
+ test -n ''
+ lefthook -h
+ lefthook run pre-push origin git@github.com:TBD54566975/ftl.git
โ [lefthook] cmd: [git rev-parse --show-toplevel]
โ [lefthook] err: <nil>
โ [lefthook] out: /Users/alec/dev/ftl
โ [lefthook] cmd: [git rev-parse --git-path hooks]
โ [lefthook] err: <nil>
โ [lefthook] out: .git/hooks
โ [lefthook] cmd: [git rev-parse --git-path info]
โ [lefthook] err: <nil>
โ [lefthook] out: .git/info
โ [lefthook] cmd: [git rev-parse --git-dir]
โ [lefthook] err: <nil>
โ [lefthook] out: .git
โ [lefthook] cmd: [git hash-object -t tree /dev/null]
โ [lefthook] err: <nil>
โ [lefthook] out: 4b825dc642cb6eb9a060e54bf8d69288fbee4904
โ [lefthook] cmd: [git diff --name-only HEAD @{push}]
โ [lefthook] cmd: [git diff --name-only HEAD @{push}]
โ [lefthook] dir: /Users/alec/dev/ftl
โ [lefthook] cmd: [git diff --name-only HEAD @{push}]
โ [lefthook] dir: /Users/alec/dev/ftl
โ [lefthook] cmd: [git diff --name-only HEAD @{push}]
โ [lefthook] dir: /Users/alec/dev/ftl
โ [lefthook] dir: /Users/alec/dev/ftl
โ [lefthook] cmd: [git diff --name-only HEAD @{push}]
โ [lefthook] dir: /Users/alec/dev/ftl
fatal: ambiguous argument '@{push}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument '@{push}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
โ [lefthook] err: exit status 128
โ [lefthook] out:
โ [lefthook] cmd: [git branch --remotes]
โ [lefthook] dir: /Users/alec/dev/ftl
โ [lefthook] err: exit status 128
โ [lefthook] out:
โ [lefthook] cmd: [git branch --remotes]
โ [lefthook] dir: /Users/alec/dev/ftl
Hey @alecthomas! Is the issue only related to odd error messages in STDOUT or lefthook fails to run the pre-push
hook too?
It seems to run to completion fine I think, though it's very disconcerting :)
Ok, I could reproduce this and I made a fix for this. Will release it ASAP ๐
๐
We love Lefthook BTW, thanks for all the hard work.