forked from git-for-windows/git
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
send-pack: do not check for sha1 file when GVFS_MISSING_OK set
- Loading branch information
Showing
1 changed file
with
2 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c9ceb5a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am trying to figure out what is causing microsoft/VFSForGit#830 and this particular change seems to be breaking one of the assumptions made by git.
The flow usually is:
In this case if a remote has a branch that has never existed locally - instead of skipping it, it gets added in with ^ in front of it, which is not what would have happened. @kewillford could you elaborate on what the semantics of this particular change are as I find it difficult to understand what issue you were working around by introducing it.
c9ceb5a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kewillford do you remember what this change was about?
@Ignas I don't think that VFSforGit currently supports multiple remotes...
c9ceb5a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #68 for the PR as well as this VFSForGit issue for some additional information. Basically on Mac this was causing git to hang because the read-object hook would be spawned here and because of how handles are inherited on Mac, stdin and stdout would not be correct when it came back to wait on pack-objects stdout because it was really waiting on the read-object's stdout.
c9ceb5a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, found the PR. So it seems that assumptions that this would not break git were not correct. I will look into fixing the hang so this could be reverted. The case only surfaces if you are pushing to a remote that you don't have access to via VFS protocol (upstream for example).
c9ceb5a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are a couple other PRs that I put up that would fix the issue.
#79 - fixes it by closing all the file descriptors when a process is launched. Not sure if this is a safe change though.
#69 - fixes it by loading the list of objects before passing the objects to the pack-object process. Probably our best option at this point.
We went with the smallest code change to begin with but if that is causing issues we can revert that and switch to one of these others.
c9ceb5a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#69 looks way better as far as I am concerned as #68 changes git semantics and while I understand that multiple remote support is not there, #69 would at least make them work when pushing. And the less changes to git semantics the better :)
c9ceb5a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there anything I can do to help move this forward? Should I open a pull request that replaces #68 with #69 to fix microsoft/VFSForGit#830 or will you do that instead as you are the author of both? Though I still think it's kind of weird that git code can't handle running 2 sub-processes in parallel, and feel that it might be something fixable. Have not managed to figure it out yet though.
c9ceb5a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so I looked really hard, and I think I figured it out #128 is I think the correct way to fix it. It might make sense to contribute changes to run-command.c to Git upstream, but I wanted to make this available so we could continue the discussion on how to fix my issue with some actual code present.
c9ceb5a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened a new PR #127 that reverts the old code and replaces it. Have you tried to push with GVFS on Mac with #128? I can see if I will have some time to test it because you have to push and during the push GVFS will need to download some objects so that the read-object hook will start after the pack-objects process was started.
c9ceb5a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that was my test case during debugging of the issue on my macbook for the microsoft/VFSForGit#830 bug. And both the hang and the crash are gone.
As my remote is ahead, read-object is invoked to check if it exists (has_object) which triggers read-object concurrently with pack-objects call.
Basically to figure this out I reverted your workaround and did inspecting with "lsof -p" on all 3 objects, to notice that the pipe used for pack-objects stdin was closed on git side, but still open on read-objects side. Which is expected, read-objects inherits all fds, but has no idea about "fd20" and should not know about it.
The solution to this is to basically set the bit closeonexec on the fd before you start read-objects (or do any other fork + exec for that matter).