Skip to content

Commit aa3e8e3

Browse files
authored
fix return value of gittreesha (#452)
* fix return value of gittreesha `gittreesha` should return a tuple of the sha and error message. A bug introduced in #449 returned only the sha when there was no error. This fixes the bug and also updates the tests * bump patch version
1 parent 89fe769 commit aa3e8e3

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Registrator"
22
uuid = "4418983a-e44d-11e8-3aec-9789530b3b3e"
33
authors = ["Stefan Karpinski <[email protected]>"]
4-
version = "1.9.5"
4+
version = "1.9.6"
55

66
[deps]
77
AutoHashEquals = "15f4f7f2-30c1-5605-9d31-71845cf9641f"

src/webui/gitutils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ function gettreesha(
262262
run(Cmd(Cmd(String["git", "clone", "--bare", string(url), dest]); env))
263263
end
264264
# let Cmd interpolate strings safely
265-
readchomp(Cmd(String["git", "-C", dest, "rev-parse", "$ref:$subdir"]))
265+
readchomp(Cmd(String["git", "-C", dest, "rev-parse", "$ref:$subdir"])), ""
266266
end
267267
catch ex
268268
@error "Exception while getting tree SHA" exception=(ex, catch_backtrace())

test/webui/gitutils.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ restoreconfig!()
1717
org = GitHub.User(login="JuliaLang")
1818

1919
public_repo_of_org = GitHub.Repo(name="Example.jl", private=false, owner=org, organization=org, permissions = GitHub.Permissions(admin = true, push = false, pull = true), clone_url="https://github.com/JuliaLang/Example.jl.git")
20-
example_master_treesha = Base.redirect_stderr(devnull) do
20+
example_master_treesha, err = Base.redirect_stderr(devnull) do
2121
Registrator.WebUI.gettreesha(public_repo_of_org, "master", "")
2222
end
2323
@test length(example_master_treesha) == 40
24+
@test err == ""
2425

2526
ret, err = Base.redirect_stderr(devnull) do
2627
Registrator.WebUI.gettreesha(public_repo_of_org, "mas ter", "")

0 commit comments

Comments
 (0)