-
-
Notifications
You must be signed in to change notification settings - Fork 933
Repo: handle worktrees better #638
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #638 +/- ##
=========================================
+ Coverage 92.76% 94.2% +1.43%
=========================================
Files 61 61
Lines 9910 9968 +58
=========================================
+ Hits 9193 9390 +197
+ Misses 717 578 -139
Continue to review full report at Codecov.
|
I'm really not sure what's going on in the AppVeyor test cases here. It's not obvious to me that these are related to this change set, and locally on a Linux machine all tests with tox pass except all py34 ones, in which pip fails to install the test prerequisites correctly. That's clearly just py34 not working, rather than being this patch. The test_git_submodules_and_add_sm_with_new_commit() test is failing from what appears to be an AppVeyor bug: 534 git.exc.GitCommandError: Cmd('git') failed due to: exit code(128) Clearly '(none)' is None being formatted as a TLD, which is not valid. (Trying to work around this in 9667b7a, not sure if it'll work.) I have no idea test_diff_with_staged_file() failures would be caused by this, and they do seem to be present in AppVeyor runs on the PRs before this one. Staring at the code and the backtrace, my best guess is that polish_url() should be returning a backslash-version instead of slashes, and so the filesystem paths aren't working? But I don't know how that all works in cygwin/windows, and I don't have a windows machine to reproduce locally. |
This makes Repo("foo") work when foo/.git is a file of the form created by "git worktree add", i.e. it's a text file that says: gitdir: /home/me/project/.git/worktrees/bar and where /home/me/project/.git/ is the nominal gitdir, but /home/me/project/.git/worktrees/bar has this worktree's HEAD etc and a "gitdir" file that contains the path of foo/.git . Signed-off-by: Peter Jones <[email protected]>
One of the submodule tests says: Traceback (most recent call last): File "C:\projects\gitpython\git\test\lib\helper.py", line 92, in wrapper return func(self, path) File "C:\projects\gitpython\git\test\test_submodule.py", line 706, in test_git_submodules_and_add_sm_with_new_commit smm.git.commit(m="new file added") File "C:\projects\gitpython\git\cmd.py", line 425, in <lambda> return lambda *args, **kwargs: self._call_process(name, *args, **kwargs) File "C:\projects\gitpython\git\cmd.py", line 877, in _call_process return self.execute(call, **exec_kwargs) File "C:\projects\gitpython\git\cmd.py", line 688, in execute raise GitCommandError(command, status, stderr_value, stdout_value) git.exc.GitCommandError: Cmd('git') failed due to: exit code(128) cmdline: git commit -m new file added stderr: ' *** Please tell me who you are. Run git config --global user.email "[email protected]" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: unable to auto-detect email address (got 'appveyor@APPVYR-WIN.(none)')' Clearly this is failing because (none) isn't a valid TLD, but I figure I'll try to set a fake value and see if that works around it.
Here is the error log we see: ====================================================================== ERROR: test_git_submodules_and_add_sm_with_new_commit (git.test.test_submodule.TestSubmodule) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\projects\gitpython\git\test\lib\helper.py", line 92, in wrapper return func(self, path) File "C:\projects\gitpython\git\test\test_submodule.py", line 709, in test_git_submodules_and_add_sm_with_new_commit smm.git.commit(m="new file added") File "C:\projects\gitpython\git\cmd.py", line 425, in <lambda> return lambda *args, **kwargs: self._call_process(name, *args, **kwargs) File "C:\projects\gitpython\git\cmd.py", line 877, in _call_process return self.execute(call, **exec_kwargs) File "C:\projects\gitpython\git\cmd.py", line 688, in execute raise GitCommandError(command, status, stderr_value, stdout_value) GitCommandError: Cmd('git') failed due to: exit code(128) cmdline: git commit -m new file added stderr: ' *** Please tell me who you are.
Hi @vathpela , thanks a lot for your contribution, and for making it such a gorgeous one! I can feel the pain that appveyor can cause, which is why I chose to go down the easy path and try to skip the test there, just to save time to be spent more productively :). Also it looks like Appveyor was breaking for a while, as you noted, which shouldn't have happened in the first place. Once the CI's are happy, this one will be merged. |
This makes Repo("foo") work when foo/.git is a file of the form created
by "git worktree add", i.e. it's a text file that says:
gitdir: /home/me/project/.git/worktrees/bar
and where /home/me/project/.git/ is the nominal gitdir, but
/home/me/project/.git/worktrees/bar has this worktree's HEAD etc and a
"gitdir" file that contains the path of foo/.git .
Signed-off-by: Peter Jones [email protected]