• 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

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

3
function GitRebase(repo::GitRepo, branch::GitAnnotated, upstream::GitAnnotated;
×
4
                   onto::Union{GitAnnotated, Nothing}=nothing,
5
                   opts::RebaseOptions = RebaseOptions())
6
    ensure_initialized()
×
7
    rebase_ptr_ptr = Ref{Ptr{Cvoid}}(C_NULL)
×
8
    @check ccall((:git_rebase_init, libgit2), Cint,
×
9
                  (Ptr{Ptr{Cvoid}}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid},
10
                   Ptr{Cvoid}, Ptr{RebaseOptions}),
11
                   rebase_ptr_ptr, repo, branch, upstream,
12
                   onto === nothing ? C_NULL : onto, Ref(opts))
13
    return GitRebase(repo, rebase_ptr_ptr[])
×
14
end
15

16
function count(rb::GitRebase)
×
17
    ensure_initialized()
×
18
    return ccall((:git_rebase_operation_entrycount, libgit2), Csize_t, (Ptr{Cvoid},), rb)
×
19
end
20

21
"""
22
    current(rb::GitRebase)::Csize_t
23

24
Return the index of the current [`RebaseOperation`](@ref). If no operation has
25
yet been applied (because the [`GitRebase`](@ref) has been constructed but `next`
26
has not yet been called or iteration over `rb` has not yet begun), return
27
`GIT_REBASE_NO_OPERATION`, which is equal to `typemax(Csize_t)`.
28
"""
29
function current(rb::GitRebase)
×
30
    ensure_initialized()
×
31
    return ccall((:git_rebase_operation_current, libgit2), Csize_t, (Ptr{Cvoid},), rb)
×
32
end
33

34
function Base.getindex(rb::GitRebase, i::Integer)
×
35
    if !(1 <= i <= count(rb))
×
36
        throw(BoundsError(rb, (i,)))
×
37
    end
38
    ensure_initialized()
×
39
    GC.@preserve rb begin
×
40
        rb_op_ptr = ccall((:git_rebase_operation_byindex, libgit2),
×
41
                          Ptr{RebaseOperation},
42
                          (Ptr{Cvoid}, Csize_t), rb.ptr, i-1)
43
        rb_op = unsafe_load(rb_op_ptr)
×
44
    end
45
    return rb_op
×
46
end
47

48
function Base.iterate(rb::GitRebase, state=nothing)
49
    ensure_initialized()
×
50
    rb_op_ptr_ptr = Ref{Ptr{RebaseOperation}}(C_NULL)
×
51
    GC.@preserve rb begin
×
52
        err = ccall((:git_rebase_next, libgit2), Cint,
×
53
                    (Ptr{Ptr{RebaseOperation}}, Ptr{Cvoid}),
54
                    rb_op_ptr_ptr, rb.ptr)
55
        if err == Cint(Error.GIT_OK)
×
56
            return unsafe_load(rb_op_ptr_ptr[]), nothing
×
57
        elseif err == Cint(Error.ITEROVER)
×
58
            return nothing
×
59
        else
60
            throw(GitError(err))
×
61
        end
62
    end
63
end
64

65
function Base.show(io::IO, rb::GitRebase)
×
66
    println(io, "GitRebase:")
×
67
    println(io, "Number: ", count(rb))
×
68
    println(io, "Currently performing operation: ", current(rb)+1)
×
69
end
70

71
"""
72
    LibGit2.commit(rb::GitRebase, sig::GitSignature)
73

74
Commit the current patch to the rebase `rb`, using `sig` as the committer. Is silent if
75
the commit has already been applied.
76
"""
77
function commit(rb::GitRebase, sig::GitSignature)
×
78
    ensure_initialized()
×
79
    oid_ptr = Ref(GitHash())
×
80
    try
×
81
        @check ccall((:git_rebase_commit, libgit2), Error.Code,
×
82
                     (Ptr{GitHash}, Ptr{Cvoid}, Ptr{SignatureStruct}, Ptr{SignatureStruct}, Ptr{UInt8}, Ptr{UInt8}),
83
                      oid_ptr, rb, C_NULL, sig, C_NULL, C_NULL)
84
    catch err
85
        # TODO: return current HEAD instead
86
        err isa GitError && err.code === Error.EAPPLIED && return nothing
×
87
        rethrow()
×
88
    end
89
    return oid_ptr[]
×
90
end
91

92
"""
93
    abort(rb::GitRebase)::Csize_t
94

95
Cancel the in-progress rebase, undoing all changes made so far and returning
96
the parent repository of `rb` and its working directory to their state before
97
the rebase was initiated. Return `0` if the abort is successful,
98
`LibGit2.Error.ENOTFOUND` if no rebase is in progress (for example, if the
99
rebase had completed), and `-1` for other errors.
100
"""
101
function abort(rb::GitRebase)
102
    ensure_initialized()
×
103
    return ccall((:git_rebase_abort, libgit2), Csize_t,
×
104
                      (Ptr{Cvoid},), rb)
105
end
106

107
"""
108
    finish(rb::GitRebase, sig::GitSignature)::Csize_t
109

110
Complete the rebase described by `rb`. `sig` is a [`GitSignature`](@ref)
111
to specify the identity of the user finishing the rebase. Return `0` if the
112
rebase finishes successfully, `-1` if there is an error.
113
"""
114
function finish(rb::GitRebase, sig::GitSignature)
115
    ensure_initialized()
×
116
    return ccall((:git_rebase_finish, libgit2), Csize_t,
×
117
                  (Ptr{Cvoid}, Ptr{SignatureStruct}),
118
                   rb, sig)
119
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