Closed stephanweissenberger closed 2 years ago
please run with logging gitui -l
and share the logs
06:28:38 [TRACE] (1) gitui::app: [src\app.rs:358] update
06:28:38 [TRACE] (1) asyncgit::status: [asyncgit\src\status.rs:95] request: [hash: 8093369622771005831] (type: WorkingDir)
06:28:38 [TRACE] (1) asyncgit::status: [asyncgit\src\status.rs:95] request: [hash: 27492516042608446] (type: Stage)
06:28:38 [TRACE] (3) asyncgit::status: [asyncgit\src\status.rs:151] status fetched: 27492516042608446 (type: Stage)
06:28:38 [TRACE] (2) asyncgit::status: [asyncgit\src\status.rs:151] status fetched: 8093369622771005831 (type: WorkingDir)
06:28:38 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Resize(187, 54))
06:28:38 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Status)
06:28:39 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Status)
06:28:40 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Down, modifiers: NONE }))
06:28:40 [TRACE] (1) asyncgit::diff: [asyncgit\src\diff.rs:93] request DiffParams { path: "xxx.cs", diff_type: WorkDir, options: DiffOptions { ignore_whitespace: false, context: 3, interhunk_lines: 0 } }
06:28:40 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Diff)
06:28:40 [TRACE] (1) asyncgit::diff: [asyncgit\src\diff.rs:93] request DiffParams { path: "xxx.cs", diff_type: WorkDir, options: DiffOptions { ignore_whitespace: false, context: 3, interhunk_lines: 0 } }
06:28:41 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Enter, modifiers: NONE }))
06:28:41 [TRACE] (1) gitui::app: [src\app.rs:358] update
06:28:41 [TRACE] (1) asyncgit::diff: [asyncgit\src\diff.rs:93] request DiffParams { path: "xxx.cs", diff_type: WorkDir, options: DiffOptions { ignore_whitespace: false, context: 3, interhunk_lines: 0 } }
06:28:41 [TRACE] (1) asyncgit::status: [asyncgit\src\status.rs:95] request: [hash: 17467022224256997398] (type: WorkingDir)
06:28:41 [TRACE] (1) asyncgit::status: [asyncgit\src\status.rs:95] request: [hash: 13870839505501950219] (type: Stage)
06:28:41 [TRACE] (4) asyncgit::status: [asyncgit\src\status.rs:151] status fetched: 13870839505501950219 (type: Stage)
06:28:41 [TRACE] (3) asyncgit::status: [asyncgit\src\status.rs:151] status fetched: 17467022224256997398 (type: WorkingDir)
06:28:41 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Diff)
06:28:41 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Status)
06:28:41 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Status)
06:28:42 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Down, modifiers: NONE }))
06:28:42 [TRACE] (1) asyncgit::diff: [asyncgit\src\diff.rs:93] request DiffParams { path: "xxx.cs", diff_type: Stage, options: DiffOptions { ignore_whitespace: false, context: 3, interhunk_lines: 0 } }
06:28:42 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Diff)
06:28:42 [TRACE] (1) asyncgit::diff: [asyncgit\src\diff.rs:93] request DiffParams { path: "xxx.cs", diff_type: Stage, options: DiffOptions { ignore_whitespace: false, context: 3, interhunk_lines: 0 } }
06:28:43 [TRACE] (1) gitui::app: [src\app.rs:358] update
06:28:43 [TRACE] (1) asyncgit::diff: [asyncgit\src\diff.rs:93] request DiffParams { path: "xxx.cs", diff_type: Stage, options: DiffOptions { ignore_whitespace: false, context: 3, interhunk_lines: 0 } }
06:28:43 [TRACE] (1) asyncgit::status: [asyncgit\src\status.rs:95] request: [hash: 11325537580545616272] (type: WorkingDir)
06:28:43 [TRACE] (1) asyncgit::status: [asyncgit\src\status.rs:95] request: [hash: 5125050458315069150] (type: Stage)
06:28:43 [TRACE] (4) asyncgit::status: [asyncgit\src\status.rs:151] status fetched: 5125050458315069150 (type: Stage)
06:28:43 [TRACE] (3) asyncgit::status: [asyncgit\src\status.rs:151] status fetched: 11325537580545616272 (type: WorkingDir)
06:28:43 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Status)
06:28:44 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Diff)
06:28:44 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Status)
06:28:44 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Char('c'), modifiers: NONE }))
06:28:46 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Char('a'), modifiers: NONE }))
06:28:47 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Char('n'), modifiers: NONE }))
06:28:47 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Char('o'), modifiers: NONE }))
06:28:47 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Char('t'), modifiers: NONE }))
06:28:47 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Char('h'), modifiers: NONE }))
06:28:47 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Char('e'), modifiers: NONE }))
06:28:48 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Char('r'), modifiers: NONE }))
06:28:48 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Char(' '), modifiers: NONE }))
06:28:48 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Char('c'), modifiers: NONE }))
06:28:48 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Char('h'), modifiers: NONE }))
06:28:48 [TRACE] (1) gitui::app: [src\app.rs:358] update
06:28:48 [TRACE] (1) asyncgit::diff: [asyncgit\src\diff.rs:93] request DiffParams { path: "xxx.cs", diff_type: Stage, options: DiffOptions { ignore_whitespace: false, context: 3, interhunk_lines: 0 } }
06:28:48 [TRACE] (1) asyncgit::status: [asyncgit\src\status.rs:95] request: [hash: 13076846175333652500] (type: WorkingDir)
06:28:48 [TRACE] (1) asyncgit::status: [asyncgit\src\status.rs:95] request: [hash: 6728392064951034947] (type: Stage)
06:28:48 [TRACE] (4) asyncgit::status: [asyncgit\src\status.rs:151] status fetched: 6728392064951034947 (type: Stage)
06:28:48 [TRACE] (3) asyncgit::status: [asyncgit\src\status.rs:151] status fetched: 13076846175333652500 (type: WorkingDir)
06:28:48 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Status)
06:28:49 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Char('a'), modifiers: NONE }))
06:28:49 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Diff)
06:28:49 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Status)
06:28:49 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Char('n'), modifiers: NONE }))
06:28:49 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Char('g'), modifiers: NONE }))
06:28:49 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Char('e'), modifiers: NONE }))
06:28:50 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Enter, modifiers: NONE }))
06:28:50 [TRACE] (1) gitui::app: [src\app.rs:358] update
06:28:50 [TRACE] (1) asyncgit::diff: [asyncgit\src\diff.rs:93] request DiffParams { path: "xxx.cs", diff_type: Stage, options: DiffOptions { ignore_whitespace: false, context: 3, interhunk_lines: 0 } }
06:28:50 [TRACE] (1) asyncgit::status: [asyncgit\src\status.rs:95] request: [hash: 17759465892022646311] (type: WorkingDir)
06:28:50 [TRACE] (1) asyncgit::status: [asyncgit\src\status.rs:95] request: [hash: 1268490788371977227] (type: Stage)
06:28:50 [TRACE] (4) asyncgit::status: [asyncgit\src\status.rs:151] status fetched: 1268490788371977227 (type: Stage)
06:28:50 [TRACE] (3) asyncgit::status: [asyncgit\src\status.rs:151] status fetched: 17759465892022646311 (type: WorkingDir)
06:28:51 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Diff)
06:28:51 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Status)
06:28:51 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Status)
06:28:53 [TRACE] (1) gitui::app: [src\app.rs:358] update
06:28:53 [TRACE] (1) asyncgit::diff: [asyncgit\src\diff.rs:93] request DiffParams { path: "xxx.cs", diff_type: Stage, options: DiffOptions { ignore_whitespace: false, context: 3, interhunk_lines: 0 } }
06:28:53 [TRACE] (1) asyncgit::status: [asyncgit\src\status.rs:95] request: [hash: 10245235635540339689] (type: WorkingDir)
06:28:53 [TRACE] (1) asyncgit::status: [asyncgit\src\status.rs:95] request: [hash: 8734810998434222429] (type: Stage)
06:28:53 [TRACE] (4) asyncgit::status: [asyncgit\src\status.rs:151] status fetched: 8734810998434222429 (type: Stage)
06:28:53 [TRACE] (3) asyncgit::status: [asyncgit\src\status.rs:151] status fetched: 10245235635540339689 (type: WorkingDir)
06:28:54 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Diff)
06:28:54 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Status)
06:28:54 [TRACE] (1) gitui::app: [src\app.rs:377] update_async: Git(Status)
06:28:54 [TRACE] (1) gitui::app: [src\app.rs:286] event: Input(Key(KeyEvent { code: Char('c'), modifiers: CONTROL }))
06:28:54 [ERROR] input thread error: sending on a disconnected channel
Can you share the precommit?
I adopted my pre-commit hook to be more universal and always return an error. Given that you use husky. This will always return errorcode 1.
npx husky add .husky/pre-commit "exit 1" git add .husky/pre-commit
Looks like git2 doesnt support that, at least i found nothing documented, telling me otherwise...
Line 63: https://github.com/extrawurst/gitui/blob/master/asyncgit/src/sync/commit.rs
no libgit2/git2-rs are not of help here anyway. we implement them in here ourselves.
so we only support commit-msg
and post-commit
for now
edit: we actually support it, stupid me
@stephanweissenberger I am not using husky, never have. I need to know what kind of .git/hooks/pre-commit
file it generates to be able to look into this
i dug a bit. a "normal" pre-commit hook works pretty fine.
but husky does not generate one.
husky changes the value of git config core.hooksPath
to .husky
in a non-husky repo this value is empty.
Good find, that’s why it’s not working then. We do not respect that config yet
Adding support for hookspath should be fairly easy to add though
@stephanweissenberger can you please run from https://github.com/extrawurst/gitui/pull/1054 and see if that fixes it for you?
@extrawurst sorry for the late reply as my rust skills are very bad :)
it works :D
i dont see any output, but that could be an issue of mine...
thats good news 🥳 weird I thought I saw an email that said it does not work. I guess you updated that.
so regarding the output: what should it print? can you share the hook, so I can try to reproduce it?
yeah, the previous comment was me being very stupid and i dont want to talk about it.. 😆
my first test was without any code and just
echo "executing pre-commit hook" exit 1
second was trying some frontend linting
echo "executing pre-commit hook" npm run lint --prefix frontend
last test was backend c# linting
echo "executing pre-commit hook" dotnet format --verify-no-changes backend
every single one returns a non zero exitcode, but i dont see any output...
@stephanweissenberger hm it works for me if I create a pre-commit
hook:
#!/bin/sh
echo 'rejected'
exit 1
in ~/.githooks/pre-commit
and setting: git config --local core.hooksPath "~/.githooks"
I wonder what is different in your case? feel free to also join our discord to get this over the finish line
@extrawurst I double checked twice and you totally lost me...
The githook you described does neither in .git\hook
, or ~\.githooks
nor husky
an output...
I tried on windows powershell and commandline to no avail.
At this point im super confused...
I will repeat what I responded on discord: I am not on windows it might very well be a windows specific issue now
Describe the bug With husky I added a precommit hook to build my project before commiting it.
git commit
does respect this and builds my project prior to commit. gitui commit does not.To Reproduce Steps to reproduce the behavior:
Expected behavior A precommit hook should be respected by gitui
Context (please complete the following information):
Windows 21H1
]0.18.0
]