Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"unknown revision or path not in the working tree" from 1.6.15 onwards #803

Closed
alecthomas opened this issue Aug 9, 2024 · 4 comments Β· Fixed by #804
Closed

"unknown revision or path not in the working tree" from 1.6.15 onwards #803

alecthomas opened this issue Aug 9, 2024 · 4 comments Β· Fixed by #804
Labels
bug Something isn't working

Comments

@alecthomas
Copy link

πŸ”§ 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
@alecthomas alecthomas added the bug Something isn't working label Aug 9, 2024
@mrexox
Copy link
Member

mrexox commented Aug 9, 2024

Hey @alecthomas! Is the issue only related to odd error messages in STDOUT or lefthook fails to run the pre-push hook too?

@alecthomas
Copy link
Author

It seems to run to completion fine I think, though it's very disconcerting :)

@mrexox
Copy link
Member

mrexox commented Aug 9, 2024

Ok, I could reproduce this and I made a fix for this. Will release it ASAP πŸ‘

@alecthomas
Copy link
Author

πŸ™

We love Lefthook BTW, thanks for all the hard work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants