• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

JuliaLang / julia / #38162

06 Aug 2025 08:25PM UTC coverage: 25.688% (-43.6%) from 69.336%
#38162

push

local

web-flow
fix runtime cglobal builtin function implementation (#59210)

This had failed to be updated for the LazyLibrary changes to codegen.

12976 of 50513 relevant lines covered (25.69%)

676965.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

5.26
/stdlib/LibGit2/src/error.jl
1
# This file is a part of Julia. License is MIT: https://julialang.org/license
2

3
module Error
4

5
import ..LibGit2: ensure_initialized
6
using LibGit2_jll
7

8
export GitError
9

10
@enum(Code, GIT_OK          = Cint(0),   # no error
11
            ERROR           = Cint(-01), # generic error
12
            ENOTFOUND       = Cint(-03), # requested object could not be found
13
            EEXISTS         = Cint(-04), # object exits preventing op
14
            EAMBIGUOUS      = Cint(-05), # more than one object matches
15
            EBUFS           = Cint(-06), # output buffer too small to hold data
16
            EUSER           = Cint(-07), # user callback generated error
17
            EBAREREPO       = Cint(-08), # operation not allowed on bare repo
18
            EUNBORNBRANCH   = Cint(-09), # HEAD refers to branch with 0 commits
19
            EUNMERGED       = Cint(-10), # merge in progress prevented op
20
            ENONFASTFORWARD = Cint(-11), # ref not fast-forwardable
21
            EINVALIDSPEC    = Cint(-12), # name / ref not in valid format
22
            ECONFLICT       = Cint(-13), # Checkout conflicts prevented operation
23
            ELOCKED         = Cint(-14), # lock file prevented op
24
            EMODIFIED       = Cint(-15), # ref value does not match expected
25
            EAUTH           = Cint(-16), # authentication error
26
            ECERTIFICATE    = Cint(-17), # server certificate is invalid
27
            EAPPLIED        = Cint(-18), # patch/merge has already been applied
28
            EPEEL           = Cint(-19), # the requested peel operation is not possible
29
            EEOF            = Cint(-20), # unexpected EOF
30
            EINVALID        = Cint(-21), # Invalid operation or input
31
            EUNCOMMITTED    = Cint(-22), # Uncommitted changes in index prevented operation
32
            EDIRECTORY      = Cint(-23), # The operation is not valid for a directory
33
            EMERGECONFLICT  = Cint(-24), # A merge conflict exists and cannot continue
34

35
            PASSTHROUGH     = Cint(-30), # internal only
36
            ITEROVER        = Cint(-31), # signals end of iteration
37
            RETRY           = Cint(-32), # internal only
38
            EMISMATCH       = Cint(-33), # hashsum mismatch in object
39
            EINDEXDIRTY     = Cint(-34), # unsaved changes in the index would be overwritten
40
            EAPPLYFAIL      = Cint(-35), # patch application failed
41
            EOWNER          = Cint(-36), # the object is not owned by the current user
42
            TIMEOUT         = Cint(-37), # The operation timed out
43
            EUNCHANGED      = Cint(-38), # There were no changes
44
            ENOTSUPPORTED   = Cint(-39), # An option is not supported
45
            EREADONLY       = Cint(-40), # The subject is read-only
46
)
47

48
@enum(Class, None,
49
             NoMemory,
50
             OS,
51
             Invalid,
52
             Reference,
53
             Zlib,
54
             Repository,
55
             Config,
56
             Regex,
57
             Odb,
58
             Index,
59
             Object,
60
             Net,
61
             Tag,
62
             Tree,
63
             Indexer,
64
             SSL,
65
             Submodule,
66
             Thread,
67
             Stash,
68
             Checkout,
69
             FetchHead,
70
             Merge,
71
             SSH,
72
             Filter,
73
             Revert,
74
             Callback,
75
             CherryPick,
76
             Describe,
77
             Rebase,
78
             Filesystem,
79
             Patch,
80
             WorkTree,
81
             SHA1,
82
             HTTP,
83
             Internal,
84
             Grafts)
85

86
struct ErrorStruct
87
    message::Ptr{UInt8}
88
    class::Cint
89
end
90

91
struct GitError <: Exception
92
    class::Class
10✔
93
    code::Code
94
    msg::String
95
end
96
Base.show(io::IO, err::GitError) = print(io, "GitError(Code:$(err.code), Class:$(err.class), $(err.msg))")
×
97

98
function last_error()
×
99
    ensure_initialized()
×
100
    err = ccall((:git_error_last, libgit2), Ptr{ErrorStruct}, ())
×
101
    if err != C_NULL
×
102
        err_obj   = unsafe_load(err)
×
103
        err_class = Class(err_obj.class)
×
104
        err_msg   = unsafe_string(err_obj.message)
×
105
    else
106
        err_class = Class(0)
×
107
        err_msg = "No errors"
×
108
    end
109
    return (err_class, err_msg)
×
110
end
111

112
GitError(err_code::Integer) = GitError(Code(err_code))
×
113
function GitError(err_code::Code)
114
    err_class, err_msg = last_error()
×
115
    return GitError(err_class, err_code, err_msg)
×
116
end
117

118
end # Error module
119

120
macro check(git_func)
121
    quote
122
        err = Cint($(esc(git_func::Expr)))
×
123
        if err < 0
×
124
            throw(Error.GitError(err))
×
125
        end
126
        err
×
127
    end
128
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc