Skip to content

Commit f045831

Browse files
committed
Merge pull request #13953 from JuliaLang/tk/nogit
Fix url(::Method) for no-git builds
2 parents 8866b4e + 0f2f451 commit f045831

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

base/methodshow.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@ function url(m::Method)
100100
line = m.func.code.line
101101
line <= 0 || ismatch(r"In\[[0-9]+\]", file) && return ""
102102
if inbase(M)
103-
return "https://github.com/JuliaLang/julia/tree/$(Base.GIT_VERSION_INFO.commit)/base/$file#L$line"
103+
if isempty(Base.GIT_VERSION_INFO.commit)
104+
# this url will only work if we're on a tagged release
105+
return "https://github.com/JuliaLang/julia/tree/v$VERSION/base/$file#L$line"
106+
else
107+
return "https://github.com/JuliaLang/julia/tree/$(Base.GIT_VERSION_INFO.commit)/base/$file#L$line"
108+
end
104109
else
105110
try
106111
d = dirname(file)

test/show.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,11 @@ end
317317
@test contains(sprint(io -> writemime(io,"text/plain",methods(Base.inbase))),"inbase(m::Module)")
318318
@test contains(sprint(io -> writemime(io,"text/html",methods(Base.inbase))),"inbase(m::<b>Module</b>)")
319319

320-
@test contains(Base.url(methods(eigs).defs),"https://github.com/JuliaLang/julia/tree/$(Base.GIT_VERSION_INFO.commit)/base/linalg/arnoldi.jl#L")
320+
if isempty(Base.GIT_VERSION_INFO.commit)
321+
@test contains(Base.url(methods(eigs).defs),"https://github.com/JuliaLang/julia/tree/v$VERSION/base/linalg/arnoldi.jl#L")
322+
else
323+
@test contains(Base.url(methods(eigs).defs),"https://github.com/JuliaLang/julia/tree/$(Base.GIT_VERSION_INFO.commit)/base/linalg/arnoldi.jl#L")
324+
end
321325

322326
# print_matrix should be able to handle small and large objects easily, test by
323327
# calling writemime. This also indirectly tests print_matrix_row, which

0 commit comments

Comments
 (0)