haxelib icon indicating copy to clipboard operation
haxelib copied to clipboard

std@sys_remove_dir when trying to install git library with specific branch

Open T1mL3arn opened this issue 2 years ago • 8 comments

This

haxelib git flixel-text-input https://github.com/Starmapo/flixel-text-input.git master

ends with

Error: std@sys_remove_dir

and empty git directory.

Not using branch name

haxelib git flixel-text-input https://github.com/Starmapo/flixel-text-input.git

works though.

T1mL3arn avatar Jan 25 '24 03:01 T1mL3arn

If you run with the --debug flag it should hopefully give more information. It looks like the repository doesn't have a master branch, so maybe it failed to checkout, and so it tried to get rid of the git folder to revert the installation but failed for some reason.

tobil4sk avatar Jan 25 '24 11:01 tobil4sk

repository doesn't have a master

Indeed I totally missed that :cry: Without --debug the error is cut, but with this flag there is error: pathspec 'master' did not match any file(s) known to git which is more clear.

T1mL3arn avatar Jan 25 '24 13:01 T1mL3arn

Reopening because the current error hides the real issue.

tobil4sk avatar Jun 27 '24 06:06 tobil4sk

One thing we can do is a bit of a check with the git command git ls-remote --symref <url> which will spit out this giant list of refs (without needing to do a repo clone at all)

> git ls-remote --symref https://github.com/Starmapo/flixel-text-input.git
ref: refs/heads/main    HEAD
951a0103a17bfa55eed86703ce50b4fb0d7590bc        HEAD
951a0103a17bfa55eed86703ce50b4fb0d7590bc        refs/heads/main
8869e6b1b8e939a64de7611265e042c4596bee82        refs/pull/1/head
320d882f86cdc4ab0b5613d156a586238253ecf0        refs/pull/3/head
7fcdb8bcf6c5a2d2d6f49d5081989e049595baec        refs/tags/v1.0.0
526eebf40935910224f982abc577e427cab14d13        refs/tags/v1.1.0
f0e616de478501acd650b98ab4e28ef323386a8a        refs/tags/v2.0.0
2c0a4f4f45285b631368b174b9c9cd7b3148fcf6        refs/tags/v2.0.1
abc1c1b3bde15b0f480c763969679da335f3a1e3        refs/tags/v2.0.2

and do some regex/parsing to return a list of remote branches. Also in this command in the first line of the output is ref: refs/heads/main HEAD which is the repo's default branch, which I've found helpful in certain cases.

ninjamuffin99 avatar Aug 31 '24 21:08 ninjamuffin99

Just hit this also on Haxe 4.3.6. The useful line of error info is just before the std@sys_remove_dir output - not sure if there is a way you can just capture the last couple of lines:

...
From https://github.com/icculus/mojoAL
 * branch            e08dbf39828afbdaf0bf0b6e2a8bb861b7b86b10 -> FETCH_HEAD
From https://github.com/libsdl-org/SDL
 * branch              22d6e09a8ded9a0a6880ed02ed069d637f987540 -> FETCH_HEAD
From https://github.com/openfl/libtinyfiledialogs
 * branch            2681e426ddaebc8e2764a7823b4b9d69564d1684 -> FETCH_HEAD
error: pathspec 'ThreadPool_Deque' did not match any file(s) known to git
std@sys_remove_dir

47rooks avatar Jun 28 '25 15:06 47rooks

Just hit this also on Haxe 4.3.6.

@47rooks Could you share more details? What system is this on and what's the exact command you are using?

tobil4sk avatar Jun 29 '25 10:06 tobil4sk

I was trying to install a git update on a PR branch where someone was fixing lime threadpool Deque support. I screwed up the first doing this:

haxelib git lime https://github.com/openfl/lime.git ThreadPool_Deque

The problem here is that the ThreadPool_Deque branch does not exist in the lime repo. The error info I got without -debug was "std@sys_remove_dir"

Once I added the -debug flag I was able to get the additional info:

error: pathspec 'ThreadPool_Deque' did not match any file(s) known to git
std@sys_remove_dir

The problem was that I was not using the fork repo. Once I did that it found the branch and it was fine. So the issue here is that the error reporting made it hard to figure out my mistake.

47rooks avatar Jun 30 '25 13:06 47rooks

Ok, I think this may be a windows specific issue (I can't reproduce it on Linux at least). When the checkout command fails, we throw an exception, but forget to restore the old cwd, so we are still inside the checkout directory and I guess it's not possible to delete the cwd on windows. See: https://github.com/HaxeFoundation/haxelib/blob/4b0f81454ebf5d81c3542a1644951e21286c892b/src/haxelib/client/Vcs.hx#L295-L308

If this is the issue, then it should have been fixed in: 127baf0a05c448209497c8593e9a2c9e3cb6ec69. It is included in the 4.2.0 release of haxelib, so you can try that to see if the issue is solved now.

tobil4sk avatar Jul 05 '25 14:07 tobil4sk