| 1 | package tasklogscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/ |
| 2 | |
| 3 | import ( |
| 4 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 5 | "ioscip-go gomod github.com/golang/go/src go1.25.0 io/" |
| 6 | "osscip-go gomod github.com/golang/go/src go1.25.0 os/" |
| 7 | "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/" |
| 8 | "syncscip-go gomod github.com/golang/go/src go1.25.0 sync/" |
| 9 | "timescip-go gomod github.com/golang/go/src go1.25.0 time/" |
| 10 | |
| 11 | isattyscip-go gomod github.com/mattn/go-isatty v0.0.24 `github.com/mattn/go-isatty`/ "github.com/mattn/go-isattyscip-go gomod github.com/mattn/go-isatty v0.0.24 `github.com/mattn/go-isatty`/" |
| 12 | "github.com/olekukonko/tsscip-go gomod github.com/olekukonko/ts 78ecb04241c0 `github.com/olekukonko/ts`/" |
| 13 | ) |
| 14 | |
| 15 | const ( |
| 16 | DefaultLoggingThrottlescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/DefaultLoggingThrottle. = 200 * timescip-go gomod github.com/golang/go/src go1.25.0 time/.Millisecondscip-go gomod github.com/golang/go/src go1.25.0 time/Millisecond. |
| 17 | ) |
| 18 | |
| 19 | // Logger logs a series of tasks to an io.Writer, processing each task in order |
| 20 | // until completion . |
| 21 | type Loggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger# struct { |
| 22 | // sink is the writer to write to. |
| 23 | sinkscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#sink. ioscip-go gomod github.com/golang/go/src go1.25.0 io/.Writerscip-go gomod github.com/golang/go/src go1.25.0 io/Writer# |
| 24 | |
| 25 | // widthFn is a function that returns the width of the terminal that |
| 26 | // this logger is running within. |
| 27 | widthFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#widthFn. func() int |
| 28 | |
| 29 | // tty is true if sink is connected to a terminal |
| 30 | ttyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#tty. bool |
| 31 | |
| 32 | // forceProgress forces progress status even when stdout is not a tty |
| 33 | forceProgressscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#forceProgress. bool |
| 34 | |
| 35 | // throttle is the minimum amount of time that must pass between each |
| 36 | // instant data is logged. |
| 37 | throttlescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#throttle. timescip-go gomod github.com/golang/go/src go1.25.0 time/.Durationscip-go gomod github.com/golang/go/src go1.25.0 time/Duration# |
| 38 | |
| 39 | // queue is the incoming, unbuffered queue of tasks to enqueue. |
| 40 | queuescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#queue. chan Taskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Task# |
| 41 | // tasks is the set of tasks to process. |
| 42 | tasksscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#tasks. chan Taskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Task# |
| 43 | // wg is a WaitGroup that is incremented when new tasks are enqueued, |
| 44 | // and decremented when tasks finish. |
| 45 | wgscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#wg. *syncscip-go gomod github.com/golang/go/src go1.25.0 sync/.WaitGroupscip-go gomod github.com/golang/go/src go1.25.0 sync/WaitGroup# |
| 46 | } |
| 47 | |
| 48 | // Option is the type for |
| 49 | type Optionscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Option# func(*Loggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#) |
| 50 | |
| 51 | // ForceProgress returns an options function that configures forced progress status |
| 52 | // on the logger. |
| 53 | func ForceProgressscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/ForceProgress().(v bool) Optionscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Option# { |
| 54 | return func(l *Loggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#) { |
| 55 | l.forceProgressscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#forceProgress. = v |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | // NewLogger returns a new *Logger instance that logs to "sink" and uses the |
| 60 | // current terminal width as the width of the line. Will log progress status if |
| 61 | // stdout is a terminal or if forceProgress is true |
| 62 | func NewLoggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/NewLogger().(sink ioscip-go gomod github.com/golang/go/src go1.25.0 io/.Writerscip-go gomod github.com/golang/go/src go1.25.0 io/Writer#, options ...Optionscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Option#) *Loggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger# { |
| 63 | if sink == nil { |
| 64 | sink = ioscip-go gomod github.com/golang/go/src go1.25.0 io/.Discardscip-go gomod github.com/golang/go/src go1.25.0 io/Discard. |
| 65 | } |
| 66 | |
| 67 | l := &Loggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#{ |
| 68 | sinkscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#sink.: sink, |
| 69 | throttlescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#throttle.: DefaultLoggingThrottlescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/DefaultLoggingThrottle., |
| 70 | widthFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#widthFn.: func() int { |
| 71 | size, err := tsscip-go gomod github.com/olekukonko/ts 78ecb04241c0 `github.com/olekukonko/ts`/.GetSizescip-go gomod github.com/olekukonko/ts 78ecb04241c0 `github.com/olekukonko/ts`/GetSize().() |
| 72 | if err != nil { |
| 73 | return 80 |
| 74 | } |
| 75 | return size.Colscip-go gomod github.com/olekukonko/ts 78ecb04241c0 `github.com/olekukonko/ts`/Size#Col().() |
| 76 | }, |
| 77 | queuescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#queue.: make(chan Taskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Task#), |
| 78 | tasksscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#tasks.: make(chan Taskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Task#), |
| 79 | wgscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#wg.: new(syncscip-go gomod github.com/golang/go/src go1.25.0 sync/.WaitGroupscip-go gomod github.com/golang/go/src go1.25.0 sync/WaitGroup#), |
| 80 | } |
| 81 | |
| 82 | for _, option := range options { |
| 83 | option(l) |
| 84 | } |
| 85 | |
| 86 | l.ttyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#tty. = ttyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/tty().(sink) |
| 87 | |
| 88 | go l.consumescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#consume().() |
| 89 | |
| 90 | return l |
| 91 | } |
| 92 | |
| 93 | type hasFdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/hasFd# interface { |
| 94 | Fdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/hasFd#Fd.() uintptr |
| 95 | } |
| 96 | |
| 97 | // tty returns true if the writer is connected to a tty |
| 98 | func ttyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/tty().(writer ioscip-go gomod github.com/golang/go/src go1.25.0 io/.Writerscip-go gomod github.com/golang/go/src go1.25.0 io/Writer#) bool { |
| 99 | if v, ok := writer.(hasFdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/hasFd#); ok { |
| 100 | return isattyscip-go gomod github.com/mattn/go-isatty v0.0.24 `github.com/mattn/go-isatty`/.IsTerminalscip-go gomod github.com/mattn/go-isatty v0.0.24 `github.com/mattn/go-isatty`/IsTerminal().(v.Fdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/hasFd#Fd.()) || isattyscip-go gomod github.com/mattn/go-isatty v0.0.24 `github.com/mattn/go-isatty`/.IsCygwinTerminalscip-go gomod github.com/mattn/go-isatty v0.0.24 `github.com/mattn/go-isatty`/IsCygwinTerminal().(v.Fdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/hasFd#Fd.()) |
| 101 | } |
| 102 | return false |
| 103 | } |
| 104 | |
| 105 | // Close closes the queue and does not allow new Tasks to be `enqueue()`'d. It |
| 106 | // waits until the currently running Task has completed. |
| 107 | func (l *Loggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#) Closescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#Close().() { |
| 108 | if l == nil { |
| 109 | return |
| 110 | } |
| 111 | |
| 112 | close(l.queuescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#queue.) |
| 113 | |
| 114 | l.wgscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#wg..Waitscip-go gomod github.com/golang/go/src go1.25.0 sync/WaitGroup#Wait().() |
| 115 | } |
| 116 | |
| 117 | // Waiter creates and enqueues a new *WaitingTask. |
| 118 | func (l *Loggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#) Waiterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#Waiter().(msg string) *WaitingTaskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/WaitingTask# { |
| 119 | t := NewWaitingTaskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/NewWaitingTask().(msg) |
| 120 | l.Enqueuescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#Enqueue().(t) |
| 121 | |
| 122 | return t |
| 123 | } |
| 124 | |
| 125 | // Percentage creates and enqueues a new *PercentageTask. |
| 126 | func (l *Loggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#) Percentagescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#Percentage().(msg string, total uint64) *PercentageTaskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/PercentageTask# { |
| 127 | t := NewPercentageTaskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/NewPercentageTask().(msg, total) |
| 128 | l.Enqueuescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#Enqueue().(t) |
| 129 | |
| 130 | return t |
| 131 | } |
| 132 | |
| 133 | // List creates and enqueues a new *ListTask. |
| 134 | func (l *Loggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#) Listscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#List().(msg string) *ListTaskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/ListTask# { |
| 135 | t := NewListTaskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/NewListTask().(msg) |
| 136 | l.Enqueuescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#Enqueue().(t) |
| 137 | |
| 138 | return t |
| 139 | } |
| 140 | |
| 141 | // Simple creates and enqueues a new *SimpleTask. |
| 142 | func (l *Loggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#) Simplescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#Simple().() *SimpleTaskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/SimpleTask# { |
| 143 | t := NewSimpleTaskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/NewSimpleTask().() |
| 144 | l.Enqueuescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#Enqueue().(t) |
| 145 | |
| 146 | return t |
| 147 | } |
| 148 | |
| 149 | // Enqueue enqueues the given Tasks "ts". |
| 150 | func (l *Loggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#) Enqueuescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#Enqueue().(ts ...Taskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Task#) { |
| 151 | if l == nil { |
| 152 | for _, t := range ts { |
| 153 | if t == nil { |
| 154 | // NOTE: Do not allow nil tasks which are unable |
| 155 | // to be completed. |
| 156 | continue |
| 157 | } |
| 158 | go func(t Taskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Task#) { |
| 159 | for range t.Updatesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Task#Updates.() { |
| 160 | // Discard all updates. |
| 161 | } |
| 162 | }(t) |
| 163 | } |
| 164 | return |
| 165 | } |
| 166 | |
| 167 | l.wgscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#wg..Addscip-go gomod github.com/golang/go/src go1.25.0 sync/WaitGroup#Add().(len(ts)) |
| 168 | for _, t := range ts { |
| 169 | if t == nil { |
| 170 | // NOTE: See above. |
| 171 | continue |
| 172 | } |
| 173 | l.queuescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#queue. <- t |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | // consume creates a pseudo-infinte buffer between the incoming set of tasks and |
| 178 | // the queue of tasks to work on. |
| 179 | func (l *Loggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#) consumescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#consume().() { |
| 180 | go func() { |
| 181 | // Process the single next task in sequence until completion, |
| 182 | // then consume the next task. |
| 183 | for task := range l.tasksscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#tasks. { |
| 184 | l.logTaskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#logTask().(task) |
| 185 | } |
| 186 | }() |
| 187 | |
| 188 | defer close(l.tasksscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#tasks.) |
| 189 | |
| 190 | for { |
| 191 | // Wait for either a) l.queue to close, or b) a new task |
| 192 | // to be submitted. |
| 193 | task, ok := <-l.queuescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#queue. |
| 194 | if !ok { |
| 195 | // If the queue is closed, no more new tasks may |
| 196 | // be added. |
| 197 | return |
| 198 | } |
| 199 | |
| 200 | // Otherwise, add a new task to the set of tasks to |
| 201 | // process immediately. |
| 202 | l.tasksscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#tasks. <- task |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | // logTask logs the set of updates from a given task to the sink, then logs a |
| 207 | // "done." message, and then marks the task as done. |
| 208 | // |
| 209 | // By default, the *Logger throttles log entry updates to once per the duration |
| 210 | // of time specified by `l.throttle time.Duration`. |
| 211 | // |
| 212 | // If the duration if 0, or the task is "durable" (by implementing |
| 213 | // github.com/git-lfs/git-lfs/tasklog#DurableTask), then all entries will be |
| 214 | // logged. |
| 215 | func (l *Loggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#) logTaskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#logTask().(task Taskscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Task#) { |
| 216 | defer l.wgscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#wg..Donescip-go gomod github.com/golang/go/src go1.25.0 sync/WaitGroup#Done().() |
| 217 | |
| 218 | logAll := !task.Throttledscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Task#Throttled.() |
| 219 | var last timescip-go gomod github.com/golang/go/src go1.25.0 time/.Timescip-go gomod github.com/golang/go/src go1.25.0 time/Time# |
| 220 | |
| 221 | var update *Updatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Update# |
| 222 | for update = range task.Updatesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Task#Updates.() { |
| 223 | if !ttyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/tty().(osscip-go gomod github.com/golang/go/src go1.25.0 os/.Stdoutscip-go gomod github.com/golang/go/src go1.25.0 os/Stdout.) && !l.forceProgressscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#forceProgress. { |
| 224 | continue |
| 225 | } |
| 226 | if logAll || l.throttlescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#throttle. == 0 || !update.Throttledscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Update#Throttled().(last.Addscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Add().(l.throttlescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#throttle.)) { |
| 227 | l.logLinescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#logLine().(update.Sscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Update#S.) |
| 228 | last = update.Atscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Update#At. |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | if update != nil { |
| 233 | // If a task sent no updates, the last recorded update will be |
| 234 | // nil. Given this, only log a message when there was at least |
| 235 | // (1) update. |
| 236 | l.logscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#log().(fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%s, done.\n", update.Sscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Update#S.)) |
| 237 | } |
| 238 | |
| 239 | if v, ok := task.(interface { |
| 240 | // OnComplete is called after the Task "task" is closed, but |
| 241 | // before new tasks are accepted. |
| 242 | OnComplete() |
| 243 | }); ok { |
| 244 | // If the Task implements this interface, call it and block |
| 245 | // before accepting new tasks. |
| 246 | v.OnComplete() |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | // logLine writes a complete line and moves the cursor to the beginning of the |
| 251 | // line. |
| 252 | // |
| 253 | // It returns the number of bytes "n" written to the sink and the error "err", |
| 254 | // if one was encountered. |
| 255 | func (l *Loggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#) logLinescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#logLine().(str string) (n int, err error) { |
| 256 | padding := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Repeatscip-go gomod github.com/golang/go/src go1.25.0 strings/Repeat().(" ", max(0, l.widthFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#widthFn.()-len(str))) |
| 257 | |
| 258 | return l.logscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#log().(str + padding + "\r") |
| 259 | } |
| 260 | |
| 261 | // log writes a string verbatim to the sink. |
| 262 | // |
| 263 | // It returns the number of bytes "n" written to the sink and the error "err", |
| 264 | // if one was encountered. |
| 265 | func (l *Loggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#) logscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#log().(str string) (n int, err error) { |
| 266 | return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Fprintscip-go gomod github.com/golang/go/src go1.25.0 fmt/Fprint().(l.sinkscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#sink., str) |
| 267 | } |