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
git unadd changes lost if hook fails on windows #570
Comments
Strange, that patch doesn't look like a patch at all! I recently fixed something in this code section (during I think 0.14.2), can you include your version information (both for Other information that may be useful:
I have a sneaking suspicion that one or more of the configuration changes caused one of the following to happen:
|
fwiw, with the default installation of I'm curious to see what settings cause this to happen (I'll be trying some combinations myself) |
Also the output of the following commands would be useful for debugging
|
this pr may help with this issue as it switches to the more-lower-level commands |
local git config[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
autocrlf = true
whitespace = fix
[branch "master"]
[branch "devops_cubead_dev"]
[remote "origin"]
url = git@github.com:CubeADGroup/devops.git
fetch = +refs/heads/*:refs/remotes/origin/*
[user]
name = RunningToTheEdgeOfTheWorld
[branch "master"]
remote = origin
merge = refs/heads/master global git config[filter "lfs"]
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
[user]
name = ZJ
[user]
email = 569290339@qq.com
[gui]
recentrepo = D:/CubeadProjects/omms
[alias]
s = status
cm = commit -m
co = checkout
a = add
b = branch
p = push
d = diff
dt = difftool
[core]
autocrlf = true
[diff]
tool = gvimdiff
[difftool]
prompt = No
[apply]
whitespace = nowarn |
|
That's super helpful! I should be able to reproduce this now and get a fix for you :) |
hint: |
Interesting, I can trigger a fatal error by configuring as follows: [apply]
whitespace = error So there's something to fix at least, I'll make a patch for that and see if it fixes your error (crosses fingers) |
thank you , and I found I can not apply anypatch( use --ignore-submodules --binary --exit-code --no-color - |
If you're using powershell it might be because of this -- though that shouldn't affect pre-commit since there aren't any shells anywhere. Here's the patch I've written for |
Can you try the latest master and see if that patch helped? |
i am tyring |
it doesn't work. but I found the problem. |
Hmm, there has to be some commandline option to make that happen correctly -- I'll look at this in the morning (I still can't get it to reproduce under test!) |
OK! I can finally reproduce this. Here's my minimal reproduction (also reproducing on linux, but I don't think anyone uses Script#!/bin/bash
set -ex
rm -rf foo
git init foo
cd foo
# Commit crlf into repository
git config --local core.autocrlf false
python3 -c 'open("foo", "wb").write(b"1\r\n2\r\n")'
git add foo
git commit -m "Initial commit with crlf"
# Change whitespace mode to autocrlf, "commit lf, checkout crlf"
git config --local core.autocrlf true
python3 -c 'open("foo", "wb").write(b"1\r\n2\r\n\r\n\r\n\r\n")'
# Run pre-commit
head -4 ~/workspace/pre-commit/.pre-commit-config.yaml > .pre-commit-config.yaml
~/workspace/pre-commit/venv*/bin/pre-commit Output
|
The best approach I can come up with is to temporarily set I'll try and make a patch for this -- I also think this is probably a bug in git (a patch generated by |
Good news! #575 should solve this issue -- thanks for the patience :) |
success, thank you very much! |
~/.pre-commit/pre-commit.log
Then, I open the patch file. (C:\Users\56929\.pre-commit\patch1501483011),it looks like
The text was updated successfully, but these errors were encountered: