wbond / package_control

The Sublime Text package manager
https://packagecontrol.io
4.79k stars 816 forks source link

Why ignore VCS-based packages accordingly to this message? #1233

Closed evandrocoan closed 7 years ago

evandrocoan commented 7 years ago

This error pops up some times I open Sublime Text.

I just enabled debug mode, when find the log I post it here.

Package Control

Error executing: "C:\Program Files (x86)\Git\cmd\git.exe" symbolic-ref -q HEAD

Working directory:
D:\SublimeText\Data\Packages\PowerCursors

VCS-based packages can be ignored by changing the "ignore_vcs_packages" setting to true.
Sublime Text will need to be restarted once the setting is changed.
evandrocoan commented 7 years ago

I recorded the log with debug on:

  1. [LOG] Why ignore VCS-based packages accordingly to this message?
Package Control: Looking for git at: "C:\Program Files\Windows Defender\git.exe", ...
Package Control: Found git at "C:\Program Files (x86)\Git\cmd\git.exe"
Package Control: Executing "C:\Program Files (x86)\Git\cmd\git.exe" symbolic-ref -q HEAD [D:\SublimeText\Data\Packages\PowerCursors]
error: Package Control

Error executing: "C:\Program Files (x86)\Git\cmd\git.exe" symbolic-ref -q HEAD

Working directory: D:\SublimeText\Data\Packages\PowerCursors

VCS-based packages can be ignored by changing the "ignore_vcs_packages" setting to true.

Sublime Text will need to be restarted once the setting is changed.
Exception in thread Thread-28:
Traceback (most recent call last):
  File "./python3.3/threading.py", line 901, in _bootstrap_inner
  File "D:\SublimeText\Data\Packages\Package Control\package_control\automatic_upgrader.py", line 117, in run
    self.upgrade_packages()
  File "D:\SublimeText\Data\Packages\Package Control\package_control\automatic_upgrader.py", line 257, in upgrade_packages
    ignore_packages=self.auto_upgrade_ignore
  File "D:\SublimeText\Data\Packages\Package Control\package_control\package_installer.py", line 99, in make_package_list
    incoming = upgrader.incoming()
  File "D:\SublimeText\Data\Packages\Package Control\package_control\upgraders\git_upgrader.py", line 107, in incoming
    info = self.get_working_copy_info()
  File "D:\SublimeText\Data\Packages\Package Control\package_control\upgraders\git_upgrader.py", line 59, in get_working_copy_info
    branch = res.replace('refs/heads/', '')
AttributeError: 'bool' object has no attribute 'replace'
wbond commented 7 years ago

Did you try executing that command in that directory?

evandrocoan commented 7 years ago

Yes, does not output any error or anything:

User@User-pc$ git.exe symbolic-ref -q HEAD
User@User-pc$ git.exe symbolic-ref -q HEAD
User@User-pc$
wbond commented 7 years ago

I believe that means you don't have a remote set up, so PC cant properly manage it

evandrocoan commented 7 years ago

I do not understand why I wound need to have a remote setup. What should be remote?

Also, even after I put this on the settings file:

    "ignore_vcs_packagess":
    [
        "PowerCursors"
    ],

That error keeps popping up with the same package. How can it be fixed?

wbond commented 7 years ago

The reason a remote needs to be set up is because Package Control is designed to install and update packages. In this case it can't update it, but it appears there is a bug in handling the situation where there is no remote.

I don't know why it is still showing you an error. It sounds like a little debugging is in order.

FichteFoll commented 7 years ago

ignore_vcs_packagess

You have an extra s there. Not sure if that's the issue.

evandrocoan commented 7 years ago

Thanks. This was the issue for why package control was not ignoring that package. However, the why package control is getting trouble with that package I am not sure now, but I have a theory.

  1. That package "PowerCursors" is not installed by package control. It is a fork on my github count.
  2. For all packages which I did not installed by package control, i.e., the packages I forked and cloned, I put them on the list "auto_upgrade_ignore":[...].

But that pacakge "PowerCursors" I had forgot to put on the auto_upgrade_ignore list, so my guess is the original package on Package control was updated and now package control is trying to update it with the original autor. However the version installed is from my fork.

If it is this, then is nice for package control to put a nice alert on Sublime Text console, stating what happened, instead of throwing that pop up annoying window when I open Sublime Text.

evandrocoan commented 7 years ago

After adding the "PowerCursors" package to the auto_upgrade_ignore list, Sublime Text stopped showing that window when sublime text start.

Now I find out Package control cannot install any new packages. Every time I try to that message comes back. Then I disabled that package, and now package control is show the same message, but for another package.

Now I set "ignore_vcs_packages": true, instead of only "ignore_vcs_packages": "PowerCursors",. And it worked. The install packages window opened, and I could install new packages.

evandrocoan commented 7 years ago

I recorded a log within the error when I perform the command Install Package. Now it is troubling with package Preferences Editor. Which is another package I manually installed by git clone and had put on the "auto_upgrade_ignore" list.

  1. Package Control: Fetching list of available packages and dependencies

Worked

Now I put all the packages from the "auto_upgrade_ignore" list, also on the "ignore_vcs_packages" and it worked. Now I can install new packages.

evandrocoan commented 7 years ago

I find out what causes this error. I had the package All Autocomplete triggering it. Then I gone to the folder Packages/All Autocomplete and noticed it is a git repo synlinked. Then I deleted the .git file which points to gitdir: ../.git/modules/All Autocomplete and recloned the repository, so its files are within the repo. Then the package control stopped throwing the error for the package All Autocomplete and started doing the same error for the next package which also a git submodule and had the .git synlinking to the parent git folder.

It is because the All Autocomplete is a submodule, therefore its gits files are in:

  1. gitdir: ../.git/modules/All Autocomplete

Now you can reproduce it, but you need:

  1. To make your Packages folder a git repository, and add the All Autocomplete as a submodule.
  2. Delete it, and install clone your Package folder repo with git clone --recursive

This will create the All Autocomplete as a git submodule and store its files on the parent git folder at:

  1. gitdir: ../.git/modules/All Autocomplete

Related issues:

  1. https://github.com/mojombo/grit/pull/145 Make refs support submodule

Update

I did some testing using the python interpreter, and it is a problem with the proc = subprocess.Popen():

>>> import os
>>> import subprocess
>>> startupinfo = subprocess.STARTUPINFO();startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW;
>>> proc = subprocess.Popen( ['C:/Program Files (x86)/Git/bin/git.exe', 'symbolic-ref', '-q', 'HEAD'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, startupinfo=startupinfo, cwd='D:/SublimeText/Data/Packages/amxmodx', env=os.environ )
>>> proc.communicate()
(b'', None)
>>> proc = subprocess.Popen( ['C:/Program Files (x86)/Git/bin/git.exe', 'symbolic-ref', '-q', 'HEAD'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, startupinfo=startupinfo, cwd='D:/SublimeText/Data/Packages/All Autocomplete', env=os.environ )
>>> proc.communicate()
(b'refs/heads/master\n', None)
>>>

On the first command, I do with the package amxmodx which has the .git file symlinking to gitdir: ../.git/modules/amxmodx. And we got the output (b'', None).

On the second command, I do with the package All Autocomplete which has the .git folder inside it. And we got the output (b'refs/heads/master\n', None), which works correctly and make the package control not throw the error.

evandrocoan commented 7 years ago

I just figured out the problem. When I do git clone --recursive the submodules are not checkout on their branches, therefore the command git.exe symbolic-ref -q HEAD returns empty.

The solution is just go to each submodule and do git checkout master or the main default branch.

wbond commented 7 years ago

This was fixed by 790bcd6