Skip to content
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

[BUG] Cannot export if using version control to manage releases #11

Closed
SorraTheOrc opened this issue Jan 4, 2021 · 6 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@SorraTheOrc
Copy link
Contributor

Describe the bug
My release process involves a release/stable branch maintained in Git. In order to create a release I checkout this branch into a separate location and have package-tools export the source into this directory. But this throws the error below. This error is because it is trying to delete the .git directory - which is not desired.

System.UnauthorizedAccessException: Access to the path "F:\Unity Projects\WizardsCode\DevLogger-Release\.git\objects\pack\pack-cd2674ec3c25d4b3d28b5a9fc15b955db020c6bd.idx" is denied.
  at System.IO.File.Delete (System.String path) [0x00073] in <9577ac7a62ef43179789031239ba8798>:0 
  at System.IO.Directory.RecursiveDelete (System.String path) [0x0003f] in <9577ac7a62ef43179789031239ba8798>:0 
  at System.IO.Directory.RecursiveDelete (System.String path) [0x00024] in <9577ac7a62ef43179789031239ba8798>:0 
  at System.IO.Directory.RecursiveDelete (System.String path) [0x00024] in <9577ac7a62ef43179789031239ba8798>:0 
  at System.IO.Directory.Delete (System.String path, System.Boolean recursive) [0x00009] in <9577ac7a62ef43179789031239ba8798>:0 
  at System.IO.DirectoryInfo.Delete (System.Boolean recursive) [0x00000] in <9577ac7a62ef43179789031239ba8798>:0 
  at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.Delete(bool)
  at JCMG.PackageTools.Editor.FileTools.RecursivelyDeleteDirectoryContents (System.IO.DirectoryInfo directoryInfo) [0x00030] in F:\Unity Projects\WizardsCode\DevLogger\Library\PackageCache\com.jeffcampbellmakesgames.packagetools@7bd34d8b47\PackageTools\Scripts\Editor\Tools\FileTools.cs:242 
  at JCMG.PackageTools.Editor.FileTools.CreateOrUpdatePackageSource (JCMG.PackageTools.Editor.PackageManifestConfig packageManifest) [0x000ed] in F:\Unity Projects\WizardsCode\DevLogger\Library\PackageCache\com.jeffcampbellmakesgames.packagetools@7bd34d8b47\PackageTools\Scripts\Editor\Tools\FileTools.cs:96 
UnityEngine.Debug:LogErrorFormat(Object, String, Object[])
JCMG.PackageTools.Editor.FileTools:CreateOrUpdatePackageSource(PackageManifestConfig) (at Library/PackageCache/com.jeffcampbellmakesgames.packagetools@7bd34d8b47/PackageTools/Scripts/Editor/Tools/FileTools.cs:161)
JCMG.PackageTools.Editor.PackageManifestConfigInspector:OnInspectorGUI() (at Library/PackageCache/com.jeffcampbellmakesgames.packagetools@7bd34d8b47/PackageTools/Scripts/Editor/Inspectors/PackageManifestConfigInspector.cs:189)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Unity Version:
Unity 2019.4.15f1

To Reproduce
I have an open source project which makes it easy to reproduce step by step instructions at
https://github.com/TheWizardsCode/DevLogger#release-process

Expected behavior
The DevLogger-Release folder contains the correct package and I can git add ., git commit -m "release v 0.2.5", git push

Additional context
I think I can probably work around this by force pushing to the repo. I will test this out and post a workaround if it works. However, it may be simpler if .git files were not deleted. What do you think?

Should I work on a patch?

@SorraTheOrc SorraTheOrc added the bug Something isn't working label Jan 4, 2021
@SorraTheOrc
Copy link
Contributor Author

SorraTheOrc commented Jan 4, 2021

Workaround:

  1. Delete the existing package directory
  2. Export the package source
  3. cd into the package directory
  4. git init
  5. git remote add origin git@...
  6. git fetch
  7. git add .
  8. git commit -m "Release v0.2.5
  9. git branch -m master release/stable
  10. git push -f -u origin release/stable

@jeffcampbellmakesgames
Copy link
Owner

Is your .git folder hidden? I also use this tool to export to a separate orphan branch on a different clone of the same repository, but have not seen this issue. One reason I think it may be this is that the delete process ignores hidden folders for exactly this kind of scenario.

if ((sdi.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden)

@jeffcampbellmakesgames jeffcampbellmakesgames self-assigned this Jan 4, 2021
@SorraTheOrc
Copy link
Contributor Author

It is hidden in the sense that Windows has it marked as hidden, assuming you mean is it the hidden property checked:

image

I've checked and the line you are referring to above returns true. I'm not a Windows guy so I'm not 100% sure what it means for a folder to be hidden in Windows.

@SorraTheOrc
Copy link
Contributor Author

SorraTheOrc commented Jan 20, 2021

[EDIT: this comment is not relevant, see next comment]

A little more info on this. The .git folder was a red herring. It is also happening in a devtest publication folder in which I am not version controlled. Here the error is System.IO.IOException: F:\Unity Projects\WizardsCode\Character-DevTest\package.json already exists at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x0012c] in <9577ac7a62ef43179789031239ba8798>:0

Looks like .git just happened to be the first file it tried to delete.

Are you using Windows Subsystem for Linux? I'm wondering if this is some kind of wierd permissions problem based on that (I am using it, so knowing if you are using it or not will help in debugging).

I'm on a deadline right now, but I'll try to debug this soon. The workaround of manually deleting is OK for now.

@SorraTheOrc
Copy link
Contributor Author

The second issue is unrelated. This happens if you put the package manifest descriptor in the directory containing the project being packaged, moving them back to the Asset folder root fixed it.

The first problem, with .git folder still exists, I've not had time to debug yet, I'm still using the above workaround

@SorraTheOrc
Copy link
Contributor Author

In a new project this issue is not occurring. I believe it may be an oddity with that specific project and windows file locks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants