Skip to content

Commit

Permalink
do checkout before changing HEAD (#20916)
Browse files Browse the repository at this point in the history
* do checkout before changing HEAD
541d94b

* add test for change to file permissions
42493ae

* add test for symlinks
a3fab6b

* add issue numbers to comments
1b7d47a

change close(repo) to finalize(repo) for release-0.5
  • Loading branch information
simonbyrne authored and tkelman committed May 2, 2017
1 parent 468974c commit 8619307
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
6 changes: 3 additions & 3 deletions base/libgit2/libgit2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,14 @@ function checkout!(repo::GitRepo, commit::AbstractString = "";
opts = force ? CheckoutOptions(checkout_strategy = Consts.CHECKOUT_FORCE) :
CheckoutOptions()
try
# checkout commit
checkout_tree(repo, peeled, options = opts)

# detach commit
obj_oid = Oid(peeled)
ref = GitReference(repo, obj_oid, force=force,
msg="libgit2.checkout: moving from $head_name to $(string(obj_oid))")
finalize(ref)

# checkout commit
checkout_tree(repo, peeled, options = opts)
finally
finalize(peeled)
end
Expand Down
27 changes: 27 additions & 0 deletions test/libgit2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,33 @@ mktempdir() do dir
end
#end


if is_unix()
#@testset "checkout/proptest" begin
repo = LibGit2.GitRepo(test_repo)
try
cp(joinpath(test_repo, test_file), joinpath(test_repo, "proptest"))
LibGit2.add!(repo, "proptest")
id1 = LibGit2.commit(repo, "test property change 1")
# change in file permissions (#17610)
chmod(joinpath(test_repo, "proptest"),0o744)
LibGit2.add!(repo, "proptest")
id2 = LibGit2.commit(repo, "test property change 2")
LibGit2.checkout!(repo, string(id1))
@test !LibGit2.isdirty(repo)
# change file to symlink (#18420)
mv(joinpath(test_repo, "proptest"), joinpath(test_repo, "proptest2"))
symlink(joinpath(test_repo, "proptest2"), joinpath(test_repo, "proptest"))
LibGit2.add!(repo, "proptest", "proptest2")
id3 = LibGit2.commit(repo, "test symlink change")
LibGit2.checkout!(repo, string(id1))
@test !LibGit2.isdirty(repo)
finally
finalize(repo)
end
#end
end

#@testset "Credentials" begin
creds_user = "USER"
creds_pass = "PASS"
Expand Down

3 comments on commit 8619307

@tkelman
Copy link
Contributor

@tkelman tkelman commented on 8619307 May 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking for cause of array growth regression, 8619307 vs 0.5.1
@nanosoldier runbenchmarks("array", vs = "@6445c82d0060dbe82b88436f0f4371a4ee64d918")

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels

@martinholters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, some of these regressions look familiar...

Please sign in to comment.