You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using recently released worktrees git feature, and having issues with applying patches.
Also I use Vagrant, and it renders gitdir path within worktree invalid.
Here is an example.
mkdir/tmp/git_apply_issuecd/tmp/git_apply_issue# Simulate worktree with invalid pathecho'gitdir: /nonexistent' > .gitecho"source 'https://rubygems.org'\n\ngem 'nokogiri'" > Gemfilebundleinstall --path./.bundle# Extracting libxml2-2.9.2.tar.gz into tmp/x86_64-apple-darwin15.2.0/ports/libxml2/2.9.2... OK# Running git apply with /tmp/git_apply_issue/.bundle/ruby/2.3.0/gems/nokogiri-1.6.7.2/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch... ERROR, review '/tmp/git_apply_issue/.bundle/ruby/2.3.0/gems/nokogiri-1.6.7.2/ext/nokogiri/tmp/x86_64-apple-darwin15.2.0/ports/libxml2/2.9.2/patch.log' to see what happened. Last lines are:# ========================================================================# fatal: Not a git repository: /nonexistent# ========================================================================
...
I believe it is caused by behavior of git apply itself. Apparently --work-tree=. does not prevent git from traversing up and looking for git repo files.
git apply command is being executed within /tmp/git_apply_issue/.bundle/ruby/2.3.0/gems/nokogiri-1.6.7.2/ext/nokogiri.
Is there a way to avoid this error?
The text was updated successfully, but these errors were encountered:
I don't totally understand what you're demonstrating above ... that git apply blows up if you have gitdir set to a nonexistent directory? This seems a little contrived. Can you help me understand a real use case?
You are correct, git apply just blows up. Actually, patch works just fine.
Here is what I'm doing.
I have rails project (cloned from git repo) in /Users/eisenhorn/work/project.
I create another branch to play with vagrant. Switching branches during daily work leads me to bunch of issues like removed .vagrant folder, overwritten project configs, etc.
To avoid it I create worktree with vagrant branch in /Users/eisenhorn/work/project-vagrant (via git worktree add ../project-vagrant vagrant).
Everything looks very smooth, I just change dir and keep working (start vm, provision, run app, etc).
In Vagrantfile I'm mapping /Users/eisenhorn/work/project-vagrant into VM as /home/vagrant/app. That is why .git file has completely broken gitdir specification within VM.
Finally, in VM I execute bundle install --path /home/vagrant/app/.bundle, and nokogiri installation fails because of bundled libxml/libxslt and mini_portile applying patches via git apply. Git traverses up, encounters invalid gitdir, and fails.
I'm using recently released worktrees git feature, and having issues with applying patches.
Also I use Vagrant, and it renders gitdir path within worktree invalid.
Here is an example.
I believe it is caused by behavior of
git apply
itself. Apparently--work-tree=.
does not prevent git from traversing up and looking for git repo files.git apply
command is being executed within/tmp/git_apply_issue/.bundle/ruby/2.3.0/gems/nokogiri-1.6.7.2/ext/nokogiri
.Is there a way to avoid this error?
The text was updated successfully, but these errors were encountered: