-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Cannot do git checkout -- . or git reset --hard when affected files' mode changed from 100755 to 100644 #1924
Comments
$ git diff 1.txt i guess this is the problem: Git for windows cannot do reset, when the git modification is only file mode from 755 to 644 (on Linux it's ok) |
I just did this in a clone of Git for Windows' own git.git fork: $ git add --chmod=+x README.md
$ git commit -m "Test: mark README as executable"
[master 04d4b5e43b24] Test: mark README as executable
1 file changed, 0 insertions(+), 0 deletions(-)
mode change 100644 => 100755 README.md
$ git reset --hard HEAD^
HEAD is now at 2c704875d008 Merge pull request #1915 from dscho/open-in-gdb
$ git reset --hard HEAD@{1}
HEAD is now at 04d4b5e43b24 Test: mark README as executable
$ git show
commit 04d4b5e43b2411644cfdd3a99af7631c196a8dbb (HEAD -> master)
Author: Johannes Schindelin <[email protected]>
Date: Mon Nov 12 16:00:29 2018 +0100
Test: mark README as executable
diff --git a/README.md b/README.md
old mode 100644
new mode 100755 As you can see, your "Minimal, Complete, Verifiable Example" is not verifiable here. |
Can i ask: $ git add --chmod=+x README.md Where does this command execute? Linux or Windows? Our git env is hybrid: the remote git repo is on Linux, and i use 2 client clones: one is on Windows, for code edit, and one is on another linux, for cross-compiling... The file mode change is done on Linux env. |
The file mode change is not done by me, but by another team guy, who use ubuntu os client, and maybe trigger these changes by chown -R ... commands, which i'm not very clear. |
It does not matter. This is the way to tell Git that this file is executable when you do not know whether And it does not matter how your colleague makes their changes as long as you can produce an MCVE. So far, there is no way for me to verify your claim. My only chance is to go on a wild goose chase (which is an incredible time waster on my side) trying to recreate what may have happened on your side, and even if I would manage to see the same symptoms (I did not manage that, as I demonstrated earlier), then I still would not know that it is actually the same underlying problem. So you see, there is really no alternative to you producing a public repository with which you can reproduce the symptom reliably on your side, them make that available to others so that they can verify, and then fix. |
someone has met with the same problem and gives a fix: git config core.filemode false That's it, problem fixed. |
Could that setting be set by default on Git for Windows? That stackoverflow question above was viewed 174k times, so it's fair to say that it's a common problem on Windows. |
Changing the In mixed environments, you do need a bit more social cohesion to ensure that everyone works cooperatively in our multi-cultural diverse community. Do have a read through the |
The problem is that neither So adding this probing to |
Hmm, maybe it's not the Git way. Which (other) XY problems does this solve?
It probably ought to be a separate command (see XY above), or command option, e.g. |
The problem is that neither `git clone` nor `git init` are run when a
user downloads an archive of a tree and extracts it, which is is the
fastest way to download a tree.
That is the problem all right. Git is not designed to work in such a way, that's why the `git init` command exists and does more than just copying around a couple of files.
So adding this probing to `git reset` would probably be a good idea.
No, it would not be a good idea: who says that the state would be consistent if `git reset` randomly changes fundamental values that are expected not to change over the life-time of a worktree?
|
@tbertels The question (given dscho's comment) becomes "why do you have a tree with one set of embedded modes, supposedly for the same repo, such that when it's extracted to the worktree, you have the mode conflict?" It implies that the team isn't working together for mutual benefit, and may have wider issues, e.g. not being able to fetch and having to use archives, or not mutually understanding how/when the executable bit is set and stored within git (as distinct from the FS), no policy on how/when the executable bit should be set, etc. |
In this case, it was for LibreOffice (https://www.libreoffice.org/about-us/source-code/), the full list of tarballs is on https://dev-www.libreoffice.org/bundles/ |
@tbertels are you saying that they tarred up Git worktrees, including Git configs? |
Yes, they have. |
Well, that is the bug, then. What they should probably consider instead is to create a Git bundle via In other words, the root cause of this problem really is incorrect Git usage, as Git was not designed to work in the way LibreOffice apparently expects it to work. |
Setup
defaults?
to the issue you're seeing?
** insert your response here **
Details
** Bash **
Minimal, Complete, and Verifiable example
this will help us understand the issue.
** All the files in git status output list should be reset **
** cannot reset these files' status **
URL to that repository to help us with testing?
** no **
The text was updated successfully, but these errors were encountered: