-
Notifications
You must be signed in to change notification settings - Fork 34
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
write_tag_metadata does not add files on Windows #28
Comments
Message "No METADATA changes to commit" displayed when you try to register or tag repo which is dirty. This is expected behavior. |
|
That really needs a more descriptive error message for that condition then. |
To be clear, |
Yes, that was the bug. |
Sorry, I made a mistake this message displayed when METADATA is dirty while you try to register or tag any package. So, probably, you had something uncommitted before tagging. This is an exceptional situation, usually METADATA mustn't have any uncommitted changes. |
|
Cannot reproduce on linux box. And it's |
Aha, I managed to get the same problem. I cannot stage changes anymore. |
Might have a file-system race condition somewhere, which is likely to be slower and more apparent on Windows. |
This is still a bug on latest master of everything. A very nasty one if
|
At least
|
@wildart could you please respond to direct requests for assistance? |
Just wanted to report that I've been running into this as well when trying to It seems like julia> mkdir("git_test")
julia> cd("git_test")
julia> LibGit2.init(pwd())
Base.LibGit2.GitRepo(Ptr{Void} @0x00000000088990d0)
julia> r = LibGit2.GitRepo(pwd())
Base.LibGit2.GitRepo(Ptr{Void} @0x00000000088993d0)
julia> (f, _) = mktemp(pwd());
julia> LibGit2.add!(r, f)
shell> git status
On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
jl_85BE.tmp
nothing added to commit but untracked files present (use "git add" to track)
julia> LibGit2.add!(r, splitdir(f)[2])
shell> git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: jl_85BE.tmp I won't pretend to understand what's going on in |
That is a very useful piece of information, thanks @pfitzseb! |
Hm. Throwing in some |
function write_tag_metadata(repo::GitRepo, pkg::AbstractString, ver::VersionNumber, commit::AbstractString, force::Bool=false)
pkgdir = PkgDev.dir(pkg)
content = with(GitRepo, pkgdir) do pkg_repo
LibGit2.cat(pkg_repo, LibGit2.GitBlob, "$commit:REQUIRE")
end
reqs = content !== nothing ? Reqs.read(split(content, '\n', keep=false)) : Reqs.Line[]
cd(Pkg.dir("METADATA")) do
d = joinpath(pkg,"versions",string(ver))
mkpath(d)
cd(d) do
sha1file = "sha1"
if !force && ispath(sha1file)
current = readchomp(sha1file)
current == commit ||
throw(PkgError("$pkg v$ver is already registered as $current, bailing"))
end
open(io->println(io,commit), sha1file, "w")
LibGit2.add!(repo, sha1file)
reqsfile = "requires"
if isempty(reqs)
ispath(reqsfile) && LibGit2.remove!(repo, reqsfile)
else
Reqs.write(reqsfile,reqs)
LibGit2.add!(repo, reqsfile)
end
end
end
return nothing
end
Nevermind, I'm an idiot: The path must of course be relative to the git dir's cwd. Unix style path seperators work then. The libgit2 docs even say as much: |
we should probably do normalization here for 0.5.0's sake even if Base.LibGit2 gets fixed for this |
Should be sufficient to replace |
That isn't exactly what I tested, but should be a more direct way to get the same result. should have a comment to these issues explaining why it isn't calling joinpath |
and the PkgDev.tag tests aren't detailed enough if they were missing this on appveyor |
Should probably add a |
* change git paths to always be / separated fixes #28. * fix tests?
This might be a bug in base's
LibGit2.add!
, not sure. Will have to come back and look into it in more detail later. I end up getting "No METADATA changes to commit" at the end of aPkg.tag
because no sha1 or requires files have been added (they've been created, but not added to the metadata git repo).The text was updated successfully, but these errors were encountered: