| 1 | package lockingscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/ |
| 2 | |
| 3 | import ( |
| 4 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 5 | "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/" |
| 6 | "timescip-go gomod github.com/golang/go/src go1.25.0 time/" |
| 7 | |
| 8 | "github.com/git-lfs/git-lfs/v3/errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/" |
| 9 | "github.com/git-lfs/git-lfs/v3/gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/" |
| 10 | "github.com/git-lfs/git-lfs/v3/lfsapiscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/" |
| 11 | "github.com/git-lfs/git-lfs/v3/sshscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/" |
| 12 | "github.com/git-lfs/git-lfs/v3/trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/" |
| 13 | ) |
| 14 | |
| 15 | type sshLockClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient# struct { |
| 16 | transferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#transfer. *sshscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/.SSHTransferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHTransfer# |
| 17 | *lfsapiscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/.Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#Client. |
| 18 | } |
| 19 | |
| 20 | func (c *sshLockClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#) connectionscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#connection().() (*sshscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/.PktlineConnectionscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/PktlineConnection#, error) { |
| 21 | return c.transferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#transfer..Connectionscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHTransfer#Connection().(0) |
| 22 | } |
| 23 | |
| 24 | func (c *sshLockClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#) parseLockResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#parseLockResponse().(status int, args []string, lines []string) (*Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#, string, error) { |
| 25 | var lock *Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock# |
| 26 | var message string |
| 27 | var err error |
| 28 | seen := make(map[string]struct{}) |
| 29 | if status >= 200 && status <= 299 || status == 409 { |
| 30 | lock = &Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#{} |
| 31 | for _, entry := range args { |
| 32 | if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(entry, "id=") { |
| 33 | lock.Idscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Id. = entry[3:] |
| 34 | seen["id"] = struct{}{} |
| 35 | } else if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(entry, "path=") { |
| 36 | lock.Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Path. = entry[5:] |
| 37 | seen["path"] = struct{}{} |
| 38 | } else if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(entry, "ownername=") { |
| 39 | lock.Ownerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Owner. = &Userscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/User#{} |
| 40 | lock.Ownerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Owner..Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/User#Name. = entry[10:] |
| 41 | seen["ownername"] = struct{}{} |
| 42 | } else if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(entry, "locked-at=") { |
| 43 | lock.LockedAtscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#LockedAt., err = timescip-go gomod github.com/golang/go/src go1.25.0 time/.Parsescip-go gomod github.com/golang/go/src go1.25.0 time/Parse().(timescip-go gomod github.com/golang/go/src go1.25.0 time/.RFC3339scip-go gomod github.com/golang/go/src go1.25.0 time/RFC3339., entry[10:]) |
| 44 | if err != nil { |
| 45 | return lock, "", errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("lock response: invalid locked-at: %s", entry)) |
| 46 | } |
| 47 | seen["locked-at"] = struct{}{} |
| 48 | } |
| 49 | } |
| 50 | if len(seen) != 4 { |
| 51 | return nil, "", errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("incomplete fields for lock")) |
| 52 | } |
| 53 | } |
| 54 | if status > 299 && len(lines) > 0 { |
| 55 | message = lines[0] |
| 56 | } |
| 57 | return lock, message, nil |
| 58 | } |
| 59 | |
| 60 | type ownerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/owner# string |
| 61 | |
| 62 | const ( |
| 63 | ownerOursscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/ownerOurs. = ownerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/owner#("ours") |
| 64 | ownerTheirsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/ownerTheirs. = ownerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/owner#("theirs") |
| 65 | ownerUnknownscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/ownerUnknown. = ownerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/owner#("") |
| 66 | ) |
| 67 | |
| 68 | type lockDatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData# struct { |
| 69 | lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#lock. Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock# |
| 70 | whoscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#who. ownerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/owner# |
| 71 | } |
| 72 | |
| 73 | func (c *sshLockClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#) lockDataIsIncompletescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#lockDataIsIncomplete().(data *lockDatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#) bool { |
| 74 | return data.lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#lock..Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Path. == "" || data.lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#lock..Ownerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Owner. == nil || data.lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#lock..LockedAtscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#LockedAt..IsZeroscip-go gomod github.com/golang/go/src go1.25.0 time/Time#IsZero().() |
| 75 | } |
| 76 | |
| 77 | func (c *sshLockClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#) parseListLockResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#parseListLockResponse().(status int, args []string, lines []string) (all []Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#, ours []Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#, theirs []Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#, nextCursor string, message string, err error) { |
| 78 | locks := make(map[string]*lockDatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#) |
| 79 | var last *lockDatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData# |
| 80 | if status >= 200 && status <= 299 { |
| 81 | for _, entry := range args { |
| 82 | if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(entry, "next-cursor=") { |
| 83 | if len(nextCursor) > 0 { |
| 84 | return nil, nil, nil, "", "", errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("lock response: multiple next-cursor responses")) |
| 85 | } |
| 86 | nextCursor = entry[12:] |
| 87 | } |
| 88 | } |
| 89 | for _, entry := range lines { |
| 90 | values := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.SplitNscip-go gomod github.com/golang/go/src go1.25.0 strings/SplitN().(entry, " ", 3) |
| 91 | var cmd string |
| 92 | if len(values) > 0 { |
| 93 | cmd = values[0] |
| 94 | } |
| 95 | if cmd == "lock" { |
| 96 | if len(values) != 2 { |
| 97 | return nil, nil, nil, "", "", errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("lock response: invalid response: %q", entry)) |
| 98 | } else if last != nil && c.lockDataIsIncompletescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#lockDataIsIncomplete().(last) { |
| 99 | return nil, nil, nil, "", "", errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("lock response: incomplete lock data")) |
| 100 | } |
| 101 | id := values[1] |
| 102 | last = &lockDatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#{whoscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#who.: ownerUnknownscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/ownerUnknown.} |
| 103 | last.lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#lock..Idscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Id. = id |
| 104 | locks[id] = last |
| 105 | } else if len(values) != 3 { |
| 106 | return nil, nil, nil, "", "", errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("lock response: invalid response: %q", entry)) |
| 107 | } else if last == nil || last.lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#lock..Idscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Id. != values[1] { |
| 108 | return nil, nil, nil, "", "", errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("lock response: interspersed response: %q", entry)) |
| 109 | } else { |
| 110 | switch cmd { |
| 111 | case "path": |
| 112 | last.lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#lock..Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Path. = values[2] |
| 113 | case "owner": |
| 114 | last.whoscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#who. = ownerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/owner#(values[2]) |
| 115 | case "ownername": |
| 116 | last.lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#lock..Ownerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Owner. = &Userscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/User#{} |
| 117 | last.lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#lock..Ownerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Owner..Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/User#Name. = values[2] |
| 118 | case "locked-at": |
| 119 | last.lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#lock..LockedAtscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#LockedAt., err = timescip-go gomod github.com/golang/go/src go1.25.0 time/.Parsescip-go gomod github.com/golang/go/src go1.25.0 time/Parse().(timescip-go gomod github.com/golang/go/src go1.25.0 time/.RFC3339scip-go gomod github.com/golang/go/src go1.25.0 time/RFC3339., values[2]) |
| 120 | if err != nil { |
| 121 | return nil, nil, nil, "", "", errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("lock response: invalid locked-at: %s", entry)) |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | } |
| 126 | if last != nil && c.lockDataIsIncompletescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#lockDataIsIncomplete().(last) { |
| 127 | return nil, nil, nil, "", "", errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("lock response: incomplete lock data")) |
| 128 | } |
| 129 | for _, lock := range locks { |
| 130 | all = append(all, lock.lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#lock.) |
| 131 | if lock.whoscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#who. == ownerOursscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/ownerOurs. { |
| 132 | ours = append(ours, lock.lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#lock.) |
| 133 | } else if lock.whoscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#who. == ownerTheirsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/ownerTheirs. { |
| 134 | theirs = append(theirs, lock.lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockData#lock.) |
| 135 | } |
| 136 | } |
| 137 | } else if status > 299 && len(lines) > 0 { |
| 138 | message = lines[0] |
| 139 | } |
| 140 | return all, ours, theirs, nextCursor, message, nil |
| 141 | } |
| 142 | |
| 143 | func (c *sshLockClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#) Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#Lock().(remote string, lockReq *lockRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockRequest#) (*lockResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockResponse#, int, error) { |
| 144 | args := make([]string, 0, 3) |
| 145 | args = append(args, 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().("path=%s", lockReq.Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockRequest#Path.)) |
| 146 | if lockReq.Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockRequest#Ref. != nil { |
| 147 | args = append(args, 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().("refname=%s", lockReq.Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockRequest#Ref..Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockRef#Name.)) |
| 148 | } |
| 149 | conn, err := c.connectionscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#connection().() |
| 150 | if err != nil { |
| 151 | return nil, 0, err |
| 152 | } |
| 153 | conn.Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/PktlineConnection#Lock().() |
| 154 | defer conn.Unlockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/PktlineConnection#Unlock().() |
| 155 | err = conn.SendMessagescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/PktlineConnection#SendMessage().("lock", args) |
| 156 | if err != nil { |
| 157 | return nil, 0, err |
| 158 | } |
| 159 | status, args, lines, err := conn.ReadStatusWithLinesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/PktlineConnection#ReadStatusWithLines().() |
| 160 | if err != nil { |
| 161 | return nil, status, err |
| 162 | |
| 163 | } |
| 164 | var lock lockResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockResponse# |
| 165 | lock.Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockResponse#Lock., lock.Messagescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockResponse#Message., err = c.parseLockResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#parseLockResponse().(status, args, lines) |
| 166 | return &lock, status, err |
| 167 | } |
| 168 | |
| 169 | func (c *sshLockClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#) Unlockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#Unlock().(ref *gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#, remote, id string, force bool) (*unlockResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/unlockResponse#, int, error) { |
| 170 | args := make([]string, 0, 3) |
| 171 | if ref != nil { |
| 172 | args = append(args, 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().("refname=%s", ref.Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name.)) |
| 173 | } |
| 174 | conn, err := c.connectionscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#connection().() |
| 175 | if err != nil { |
| 176 | return nil, 0, err |
| 177 | } |
| 178 | conn.Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/PktlineConnection#Lock().() |
| 179 | defer conn.Unlockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/PktlineConnection#Unlock().() |
| 180 | err = conn.SendMessagescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/PktlineConnection#SendMessage().(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().("unlock %s", id), args) |
| 181 | if err != nil { |
| 182 | return nil, 0, err |
| 183 | } |
| 184 | status, args, lines, err := conn.ReadStatusWithLinesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/PktlineConnection#ReadStatusWithLines().() |
| 185 | if err != nil { |
| 186 | return nil, status, err |
| 187 | |
| 188 | } |
| 189 | var lock unlockResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/unlockResponse# |
| 190 | lock.Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/unlockResponse#Lock., lock.Messagescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/unlockResponse#Message., err = c.parseLockResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#parseLockResponse().(status, args, lines) |
| 191 | return &lock, status, err |
| 192 | } |
| 193 | |
| 194 | func (c *sshLockClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#) Searchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#Search().(remote string, searchReq *lockSearchRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockSearchRequest#) (*lockListscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockList#, int, error) { |
| 195 | values := searchReq.QueryValuesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockSearchRequest#QueryValues().() |
| 196 | args := make([]string, 0, len(values)) |
| 197 | for key, value := range values { |
| 198 | args = append(args, 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=%s", key, value)) |
| 199 | } |
| 200 | conn, err := c.connectionscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#connection().() |
| 201 | if err != nil { |
| 202 | return nil, 0, err |
| 203 | } |
| 204 | conn.Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/PktlineConnection#Lock().() |
| 205 | defer conn.Unlockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/PktlineConnection#Unlock().() |
| 206 | err = conn.SendMessagescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/PktlineConnection#SendMessage().("list-lock", args) |
| 207 | if err != nil { |
| 208 | return nil, 0, err |
| 209 | } |
| 210 | status, args, lines, err := conn.ReadStatusWithLinesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/PktlineConnection#ReadStatusWithLines().() |
| 211 | if err != nil { |
| 212 | return nil, status, err |
| 213 | } |
| 214 | locks, _, _, nextCursor, message, err := c.parseListLockResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#parseListLockResponse().(status, args, lines) |
| 215 | if err != nil { |
| 216 | return nil, status, err |
| 217 | } |
| 218 | list := &lockListscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockList#{ |
| 219 | Locksscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockList#Locks.: locks, |
| 220 | NextCursorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockList#NextCursor.: nextCursor, |
| 221 | Messagescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockList#Message.: message, |
| 222 | } |
| 223 | return list, status, nil |
| 224 | } |
| 225 | |
| 226 | func (c *sshLockClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#) SearchVerifiablescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#SearchVerifiable().(remote string, vreq *lockVerifiableRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableRequest#) (*lockVerifiableListscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableList#, int, error) { |
| 227 | args := make([]string, 0, 3) |
| 228 | if vreq.Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableRequest#Ref. != nil { |
| 229 | args = append(args, 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().("refname=%s", vreq.Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableRequest#Ref..Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockRef#Name.)) |
| 230 | } |
| 231 | if len(vreq.Cursorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableRequest#Cursor.) > 0 { |
| 232 | args = append(args, 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().("cursor=%s", vreq.Cursorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableRequest#Cursor.)) |
| 233 | } |
| 234 | if vreq.Limitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableRequest#Limit. > 0 { |
| 235 | args = append(args, 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().("limit=%d", vreq.Limitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableRequest#Limit.)) |
| 236 | } |
| 237 | conn, err := c.connectionscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#connection().() |
| 238 | if err != nil { |
| 239 | return nil, 0, err |
| 240 | } |
| 241 | conn.Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/PktlineConnection#Lock().() |
| 242 | defer conn.Unlockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/PktlineConnection#Unlock().() |
| 243 | err = conn.SendMessagescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/PktlineConnection#SendMessage().("list-lock", args) |
| 244 | if err != nil { |
| 245 | return nil, 0, err |
| 246 | } |
| 247 | status, args, lines, err := conn.ReadStatusWithLinesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/PktlineConnection#ReadStatusWithLines().() |
| 248 | if err != nil { |
| 249 | return nil, status, err |
| 250 | } |
| 251 | _, ours, theirs, nextCursor, message, err := c.parseListLockResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sshLockClient#parseListLockResponse().(status, args, lines) |
| 252 | if err != nil { |
| 253 | return nil, status, err |
| 254 | } |
| 255 | list := &lockVerifiableListscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableList#{ |
| 256 | Oursscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableList#Ours.: ours, |
| 257 | Theirsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableList#Theirs.: theirs, |
| 258 | NextCursorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableList#NextCursor.: nextCursor, |
| 259 | Messagescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableList#Message.: message, |
| 260 | } |
| 261 | return list, status, nil |
| 262 | } |