blob: 1ce9adbb2c1b663f166d02a2c7a25a2d13ca0a3c (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package files
import (
"os"
"path"
)
func (executor *refUpdateExecutor) createUpdateLock(name refPath) error {
root := executor.store.rootFor(name.root)
dir := path.Dir(name.path)
if dir != "." {
err := root.MkdirAll(dir, 0o755)
if err != nil {
return err
}
}
file, err := root.OpenFile(name.path+".lock", os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0o644)
if err != nil {
return err
}
return file.Close()
}
|