id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
sequencelengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
sequencelengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
151,100
paulmach/orb
maptile/tilecover/helpers.go
Point
func Point(ll orb.Point, z maptile.Zoom) maptile.Set { return maptile.Set{ maptile.At(ll, z): true, } }
go
func Point(ll orb.Point, z maptile.Zoom) maptile.Set { return maptile.Set{ maptile.At(ll, z): true, } }
[ "func", "Point", "(", "ll", "orb", ".", "Point", ",", "z", "maptile", ".", "Zoom", ")", "maptile", ".", "Set", "{", "return", "maptile", ".", "Set", "{", "maptile", ".", "At", "(", "ll", ",", "z", ")", ":", "true", ",", "}", "\n", "}" ]
// Point creates a tile cover for the point, i.e. just the tile // containing the point.
[ "Point", "creates", "a", "tile", "cover", "for", "the", "point", "i", ".", "e", ".", "just", "the", "tile", "containing", "the", "point", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tilecover/helpers.go#L43-L47
151,101
paulmach/orb
maptile/tilecover/helpers.go
MultiPoint
func MultiPoint(mp orb.MultiPoint, z maptile.Zoom) maptile.Set { set := make(maptile.Set) for _, p := range mp { set[maptile.At(p, z)] = true } return set }
go
func MultiPoint(mp orb.MultiPoint, z maptile.Zoom) maptile.Set { set := make(maptile.Set) for _, p := range mp { set[maptile.At(p, z)] = true } return set }
[ "func", "MultiPoint", "(", "mp", "orb", ".", "MultiPoint", ",", "z", "maptile", ".", "Zoom", ")", "maptile", ".", "Set", "{", "set", ":=", "make", "(", "maptile", ".", "Set", ")", "\n", "for", "_", ",", "p", ":=", "range", "mp", "{", "set", "[", "maptile", ".", "At", "(", "p", ",", "z", ")", "]", "=", "true", "\n", "}", "\n\n", "return", "set", "\n", "}" ]
// MultiPoint creates a tile cover for the set of points,
[ "MultiPoint", "creates", "a", "tile", "cover", "for", "the", "set", "of", "points" ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tilecover/helpers.go#L50-L57
151,102
paulmach/orb
maptile/tilecover/helpers.go
Bound
func Bound(b orb.Bound, z maptile.Zoom) maptile.Set { lo := maptile.At(b.Min, z) hi := maptile.At(b.Max, z) result := make(maptile.Set, (hi.X-lo.X+1)*(lo.Y-hi.Y+1)) for x := lo.X; x <= hi.X; x++ { for y := hi.Y; y <= lo.Y; y++ { result[maptile.Tile{X: x, Y: y, Z: z}] = true } } return result }
go
func Bound(b orb.Bound, z maptile.Zoom) maptile.Set { lo := maptile.At(b.Min, z) hi := maptile.At(b.Max, z) result := make(maptile.Set, (hi.X-lo.X+1)*(lo.Y-hi.Y+1)) for x := lo.X; x <= hi.X; x++ { for y := hi.Y; y <= lo.Y; y++ { result[maptile.Tile{X: x, Y: y, Z: z}] = true } } return result }
[ "func", "Bound", "(", "b", "orb", ".", "Bound", ",", "z", "maptile", ".", "Zoom", ")", "maptile", ".", "Set", "{", "lo", ":=", "maptile", ".", "At", "(", "b", ".", "Min", ",", "z", ")", "\n", "hi", ":=", "maptile", ".", "At", "(", "b", ".", "Max", ",", "z", ")", "\n\n", "result", ":=", "make", "(", "maptile", ".", "Set", ",", "(", "hi", ".", "X", "-", "lo", ".", "X", "+", "1", ")", "*", "(", "lo", ".", "Y", "-", "hi", ".", "Y", "+", "1", ")", ")", "\n\n", "for", "x", ":=", "lo", ".", "X", ";", "x", "<=", "hi", ".", "X", ";", "x", "++", "{", "for", "y", ":=", "hi", ".", "Y", ";", "y", "<=", "lo", ".", "Y", ";", "y", "++", "{", "result", "[", "maptile", ".", "Tile", "{", "X", ":", "x", ",", "Y", ":", "y", ",", "Z", ":", "z", "}", "]", "=", "true", "\n", "}", "\n", "}", "\n\n", "return", "result", "\n", "}" ]
// Bound creates a tile cover for the bound. i.e. all the tiles // that intersect the bound.
[ "Bound", "creates", "a", "tile", "cover", "for", "the", "bound", ".", "i", ".", "e", ".", "all", "the", "tiles", "that", "intersect", "the", "bound", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tilecover/helpers.go#L61-L74
151,103
paulmach/orb
maptile/tilecover/helpers.go
Collection
func Collection(c orb.Collection, z maptile.Zoom) maptile.Set { set := make(maptile.Set) for _, g := range c { set.Merge(Geometry(g, z)) } return set }
go
func Collection(c orb.Collection, z maptile.Zoom) maptile.Set { set := make(maptile.Set) for _, g := range c { set.Merge(Geometry(g, z)) } return set }
[ "func", "Collection", "(", "c", "orb", ".", "Collection", ",", "z", "maptile", ".", "Zoom", ")", "maptile", ".", "Set", "{", "set", ":=", "make", "(", "maptile", ".", "Set", ")", "\n", "for", "_", ",", "g", ":=", "range", "c", "{", "set", ".", "Merge", "(", "Geometry", "(", "g", ",", "z", ")", ")", "\n", "}", "\n\n", "return", "set", "\n", "}" ]
// Collection returns the covering set of tiles for the // geoemtry collection.
[ "Collection", "returns", "the", "covering", "set", "of", "tiles", "for", "the", "geoemtry", "collection", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/maptile/tilecover/helpers.go#L78-L85
151,104
paulmach/orb
polygon.go
Equal
func (p Polygon) Equal(polygon Polygon) bool { if len(p) != len(polygon) { return false } for i := range p { if !p[i].Equal(polygon[i]) { return false } } return true }
go
func (p Polygon) Equal(polygon Polygon) bool { if len(p) != len(polygon) { return false } for i := range p { if !p[i].Equal(polygon[i]) { return false } } return true }
[ "func", "(", "p", "Polygon", ")", "Equal", "(", "polygon", "Polygon", ")", "bool", "{", "if", "len", "(", "p", ")", "!=", "len", "(", "polygon", ")", "{", "return", "false", "\n", "}", "\n\n", "for", "i", ":=", "range", "p", "{", "if", "!", "p", "[", "i", "]", ".", "Equal", "(", "polygon", "[", "i", "]", ")", "{", "return", "false", "\n", "}", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
// Equal compares two polygons. Returns true if lengths are the same // and all points are Equal.
[ "Equal", "compares", "two", "polygons", ".", "Returns", "true", "if", "lengths", "are", "the", "same", "and", "all", "points", "are", "Equal", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/polygon.go#L28-L40
151,105
paulmach/orb
polygon.go
Clone
func (p Polygon) Clone() Polygon { if p == nil { return p } np := make(Polygon, 0, len(p)) for _, r := range p { np = append(np, r.Clone()) } return np }
go
func (p Polygon) Clone() Polygon { if p == nil { return p } np := make(Polygon, 0, len(p)) for _, r := range p { np = append(np, r.Clone()) } return np }
[ "func", "(", "p", "Polygon", ")", "Clone", "(", ")", "Polygon", "{", "if", "p", "==", "nil", "{", "return", "p", "\n", "}", "\n\n", "np", ":=", "make", "(", "Polygon", ",", "0", ",", "len", "(", "p", ")", ")", "\n", "for", "_", ",", "r", ":=", "range", "p", "{", "np", "=", "append", "(", "np", ",", "r", ".", "Clone", "(", ")", ")", "\n", "}", "\n\n", "return", "np", "\n", "}" ]
// Clone returns a new deep copy of the polygon. // All of the rings are also cloned.
[ "Clone", "returns", "a", "new", "deep", "copy", "of", "the", "polygon", ".", "All", "of", "the", "rings", "are", "also", "cloned", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/polygon.go#L44-L55
151,106
paulmach/orb
multi_polygon.go
Bound
func (mp MultiPolygon) Bound() Bound { if len(mp) == 0 { return emptyBound } bound := mp[0].Bound() for i := 1; i < len(mp); i++ { bound = bound.Union(mp[i].Bound()) } return bound }
go
func (mp MultiPolygon) Bound() Bound { if len(mp) == 0 { return emptyBound } bound := mp[0].Bound() for i := 1; i < len(mp); i++ { bound = bound.Union(mp[i].Bound()) } return bound }
[ "func", "(", "mp", "MultiPolygon", ")", "Bound", "(", ")", "Bound", "{", "if", "len", "(", "mp", ")", "==", "0", "{", "return", "emptyBound", "\n", "}", "\n", "bound", ":=", "mp", "[", "0", "]", ".", "Bound", "(", ")", "\n", "for", "i", ":=", "1", ";", "i", "<", "len", "(", "mp", ")", ";", "i", "++", "{", "bound", "=", "bound", ".", "Union", "(", "mp", "[", "i", "]", ".", "Bound", "(", ")", ")", "\n", "}", "\n\n", "return", "bound", "\n", "}" ]
// Bound returns a bound around the multi-polygon.
[ "Bound", "returns", "a", "bound", "around", "the", "multi", "-", "polygon", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/multi_polygon.go#L17-L27
151,107
paulmach/orb
multi_polygon.go
Equal
func (mp MultiPolygon) Equal(multiPolygon MultiPolygon) bool { if len(mp) != len(multiPolygon) { return false } for i, p := range mp { if !p.Equal(multiPolygon[i]) { return false } } return true }
go
func (mp MultiPolygon) Equal(multiPolygon MultiPolygon) bool { if len(mp) != len(multiPolygon) { return false } for i, p := range mp { if !p.Equal(multiPolygon[i]) { return false } } return true }
[ "func", "(", "mp", "MultiPolygon", ")", "Equal", "(", "multiPolygon", "MultiPolygon", ")", "bool", "{", "if", "len", "(", "mp", ")", "!=", "len", "(", "multiPolygon", ")", "{", "return", "false", "\n", "}", "\n\n", "for", "i", ",", "p", ":=", "range", "mp", "{", "if", "!", "p", ".", "Equal", "(", "multiPolygon", "[", "i", "]", ")", "{", "return", "false", "\n", "}", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
// Equal compares two multi-polygons.
[ "Equal", "compares", "two", "multi", "-", "polygons", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/multi_polygon.go#L30-L42
151,108
paulmach/orb
multi_polygon.go
Clone
func (mp MultiPolygon) Clone() MultiPolygon { if mp == nil { return nil } nmp := make(MultiPolygon, 0, len(mp)) for _, p := range mp { nmp = append(nmp, p.Clone()) } return nmp }
go
func (mp MultiPolygon) Clone() MultiPolygon { if mp == nil { return nil } nmp := make(MultiPolygon, 0, len(mp)) for _, p := range mp { nmp = append(nmp, p.Clone()) } return nmp }
[ "func", "(", "mp", "MultiPolygon", ")", "Clone", "(", ")", "MultiPolygon", "{", "if", "mp", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "nmp", ":=", "make", "(", "MultiPolygon", ",", "0", ",", "len", "(", "mp", ")", ")", "\n", "for", "_", ",", "p", ":=", "range", "mp", "{", "nmp", "=", "append", "(", "nmp", ",", "p", ".", "Clone", "(", ")", ")", "\n", "}", "\n\n", "return", "nmp", "\n", "}" ]
// Clone returns a new deep copy of the multi-polygon.
[ "Clone", "returns", "a", "new", "deep", "copy", "of", "the", "multi", "-", "polygon", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/multi_polygon.go#L45-L56
151,109
paulmach/orb
internal/length/length.go
Length
func Length(g orb.Geometry, df orb.DistanceFunc) float64 { if g == nil { return 0 } switch g := g.(type) { case orb.Point: return 0 case orb.MultiPoint: return 0 case orb.LineString: return lineStringLength(g, df) case orb.MultiLineString: sum := 0.0 for _, ls := range g { sum += lineStringLength(ls, df) } return sum case orb.Ring: return lineStringLength(orb.LineString(g), df) case orb.Polygon: return polygonLength(g, df) case orb.MultiPolygon: sum := 0.0 for _, p := range g { sum += polygonLength(p, df) } return sum case orb.Collection: sum := 0.0 for _, c := range g { sum += Length(c, df) } return sum case orb.Bound: return Length(g.ToRing(), df) } panic(fmt.Sprintf("geometry type not supported: %T", g)) }
go
func Length(g orb.Geometry, df orb.DistanceFunc) float64 { if g == nil { return 0 } switch g := g.(type) { case orb.Point: return 0 case orb.MultiPoint: return 0 case orb.LineString: return lineStringLength(g, df) case orb.MultiLineString: sum := 0.0 for _, ls := range g { sum += lineStringLength(ls, df) } return sum case orb.Ring: return lineStringLength(orb.LineString(g), df) case orb.Polygon: return polygonLength(g, df) case orb.MultiPolygon: sum := 0.0 for _, p := range g { sum += polygonLength(p, df) } return sum case orb.Collection: sum := 0.0 for _, c := range g { sum += Length(c, df) } return sum case orb.Bound: return Length(g.ToRing(), df) } panic(fmt.Sprintf("geometry type not supported: %T", g)) }
[ "func", "Length", "(", "g", "orb", ".", "Geometry", ",", "df", "orb", ".", "DistanceFunc", ")", "float64", "{", "if", "g", "==", "nil", "{", "return", "0", "\n", "}", "\n\n", "switch", "g", ":=", "g", ".", "(", "type", ")", "{", "case", "orb", ".", "Point", ":", "return", "0", "\n", "case", "orb", ".", "MultiPoint", ":", "return", "0", "\n", "case", "orb", ".", "LineString", ":", "return", "lineStringLength", "(", "g", ",", "df", ")", "\n", "case", "orb", ".", "MultiLineString", ":", "sum", ":=", "0.0", "\n", "for", "_", ",", "ls", ":=", "range", "g", "{", "sum", "+=", "lineStringLength", "(", "ls", ",", "df", ")", "\n", "}", "\n\n", "return", "sum", "\n", "case", "orb", ".", "Ring", ":", "return", "lineStringLength", "(", "orb", ".", "LineString", "(", "g", ")", ",", "df", ")", "\n", "case", "orb", ".", "Polygon", ":", "return", "polygonLength", "(", "g", ",", "df", ")", "\n", "case", "orb", ".", "MultiPolygon", ":", "sum", ":=", "0.0", "\n", "for", "_", ",", "p", ":=", "range", "g", "{", "sum", "+=", "polygonLength", "(", "p", ",", "df", ")", "\n", "}", "\n\n", "return", "sum", "\n", "case", "orb", ".", "Collection", ":", "sum", ":=", "0.0", "\n", "for", "_", ",", "c", ":=", "range", "g", "{", "sum", "+=", "Length", "(", "c", ",", "df", ")", "\n", "}", "\n\n", "return", "sum", "\n", "case", "orb", ".", "Bound", ":", "return", "Length", "(", "g", ".", "ToRing", "(", ")", ",", "df", ")", "\n", "}", "\n\n", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "g", ")", ")", "\n", "}" ]
// Length returns the length of the boundary of the geometry // using 2d euclidean geometry.
[ "Length", "returns", "the", "length", "of", "the", "boundary", "of", "the", "geometry", "using", "2d", "euclidean", "geometry", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/internal/length/length.go#L11-L53
151,110
paulmach/orb
encoding/mvt/layer.go
NewLayer
func NewLayer(name string, fc *geojson.FeatureCollection) *Layer { return &Layer{ Name: name, Version: 1, Extent: DefaultExtent, Features: fc.Features, } }
go
func NewLayer(name string, fc *geojson.FeatureCollection) *Layer { return &Layer{ Name: name, Version: 1, Extent: DefaultExtent, Features: fc.Features, } }
[ "func", "NewLayer", "(", "name", "string", ",", "fc", "*", "geojson", ".", "FeatureCollection", ")", "*", "Layer", "{", "return", "&", "Layer", "{", "Name", ":", "name", ",", "Version", ":", "1", ",", "Extent", ":", "DefaultExtent", ",", "Features", ":", "fc", ".", "Features", ",", "}", "\n", "}" ]
// NewLayer is a helper to create a Layer from a feature collection // and a name, it sets the default extent and version to 1.
[ "NewLayer", "is", "a", "helper", "to", "create", "a", "Layer", "from", "a", "feature", "collection", "and", "a", "name", "it", "sets", "the", "default", "extent", "and", "version", "to", "1", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/layer.go#L24-L31
151,111
paulmach/orb
encoding/mvt/layer.go
ProjectToTile
func (l *Layer) ProjectToTile(tile maptile.Tile) { p := newProjection(tile, l.Extent) for _, f := range l.Features { f.Geometry = project.Geometry(f.Geometry, p.ToTile) } }
go
func (l *Layer) ProjectToTile(tile maptile.Tile) { p := newProjection(tile, l.Extent) for _, f := range l.Features { f.Geometry = project.Geometry(f.Geometry, p.ToTile) } }
[ "func", "(", "l", "*", "Layer", ")", "ProjectToTile", "(", "tile", "maptile", ".", "Tile", ")", "{", "p", ":=", "newProjection", "(", "tile", ",", "l", ".", "Extent", ")", "\n", "for", "_", ",", "f", ":=", "range", "l", ".", "Features", "{", "f", ".", "Geometry", "=", "project", ".", "Geometry", "(", "f", ".", "Geometry", ",", "p", ".", "ToTile", ")", "\n", "}", "\n", "}" ]
// ProjectToTile will project all the geometries in the layer // to tile coordinates based on the extent and the mercator projection.
[ "ProjectToTile", "will", "project", "all", "the", "geometries", "in", "the", "layer", "to", "tile", "coordinates", "based", "on", "the", "extent", "and", "the", "mercator", "projection", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/layer.go#L35-L40
151,112
paulmach/orb
encoding/mvt/layer.go
ProjectToWGS84
func (l *Layer) ProjectToWGS84(tile maptile.Tile) { p := newProjection(tile, l.Extent) for _, f := range l.Features { f.Geometry = project.Geometry(f.Geometry, p.ToWGS84) } }
go
func (l *Layer) ProjectToWGS84(tile maptile.Tile) { p := newProjection(tile, l.Extent) for _, f := range l.Features { f.Geometry = project.Geometry(f.Geometry, p.ToWGS84) } }
[ "func", "(", "l", "*", "Layer", ")", "ProjectToWGS84", "(", "tile", "maptile", ".", "Tile", ")", "{", "p", ":=", "newProjection", "(", "tile", ",", "l", ".", "Extent", ")", "\n", "for", "_", ",", "f", ":=", "range", "l", ".", "Features", "{", "f", ".", "Geometry", "=", "project", ".", "Geometry", "(", "f", ".", "Geometry", ",", "p", ".", "ToWGS84", ")", "\n", "}", "\n", "}" ]
// ProjectToWGS84 will project all the geometries backed to WGS84 from // the extent and mercator projection.
[ "ProjectToWGS84", "will", "project", "all", "the", "geometries", "backed", "to", "WGS84", "from", "the", "extent", "and", "mercator", "projection", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/layer.go#L44-L49
151,113
paulmach/orb
encoding/mvt/layer.go
NewLayers
func NewLayers(layers map[string]*geojson.FeatureCollection) Layers { result := make(Layers, 0, len(layers)) for name, fc := range layers { result = append(result, NewLayer(name, fc)) } return result }
go
func NewLayers(layers map[string]*geojson.FeatureCollection) Layers { result := make(Layers, 0, len(layers)) for name, fc := range layers { result = append(result, NewLayer(name, fc)) } return result }
[ "func", "NewLayers", "(", "layers", "map", "[", "string", "]", "*", "geojson", ".", "FeatureCollection", ")", "Layers", "{", "result", ":=", "make", "(", "Layers", ",", "0", ",", "len", "(", "layers", ")", ")", "\n", "for", "name", ",", "fc", ":=", "range", "layers", "{", "result", "=", "append", "(", "result", ",", "NewLayer", "(", "name", ",", "fc", ")", ")", "\n", "}", "\n\n", "return", "result", "\n", "}" ]
// NewLayers creates a set of layers given a set of feature collections.
[ "NewLayers", "creates", "a", "set", "of", "layers", "given", "a", "set", "of", "feature", "collections", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/layer.go#L55-L62
151,114
paulmach/orb
encoding/mvt/layer.go
ToFeatureCollections
func (ls Layers) ToFeatureCollections() map[string]*geojson.FeatureCollection { result := make(map[string]*geojson.FeatureCollection, len(ls)) for _, l := range ls { result[l.Name] = &geojson.FeatureCollection{ Features: l.Features, } } return result }
go
func (ls Layers) ToFeatureCollections() map[string]*geojson.FeatureCollection { result := make(map[string]*geojson.FeatureCollection, len(ls)) for _, l := range ls { result[l.Name] = &geojson.FeatureCollection{ Features: l.Features, } } return result }
[ "func", "(", "ls", "Layers", ")", "ToFeatureCollections", "(", ")", "map", "[", "string", "]", "*", "geojson", ".", "FeatureCollection", "{", "result", ":=", "make", "(", "map", "[", "string", "]", "*", "geojson", ".", "FeatureCollection", ",", "len", "(", "ls", ")", ")", "\n", "for", "_", ",", "l", ":=", "range", "ls", "{", "result", "[", "l", ".", "Name", "]", "=", "&", "geojson", ".", "FeatureCollection", "{", "Features", ":", "l", ".", "Features", ",", "}", "\n", "}", "\n\n", "return", "result", "\n", "}" ]
// ToFeatureCollections converts the layers to sets of geojson // feature collections.
[ "ToFeatureCollections", "converts", "the", "layers", "to", "sets", "of", "geojson", "feature", "collections", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/layer.go#L66-L75
151,115
paulmach/orb
encoding/mvt/layer.go
ProjectToTile
func (ls Layers) ProjectToTile(tile maptile.Tile) { for _, l := range ls { l.ProjectToTile(tile) } }
go
func (ls Layers) ProjectToTile(tile maptile.Tile) { for _, l := range ls { l.ProjectToTile(tile) } }
[ "func", "(", "ls", "Layers", ")", "ProjectToTile", "(", "tile", "maptile", ".", "Tile", ")", "{", "for", "_", ",", "l", ":=", "range", "ls", "{", "l", ".", "ProjectToTile", "(", "tile", ")", "\n", "}", "\n", "}" ]
// ProjectToTile will project all the geometries in all layers // to tile coordinates based on the extent and the mercator projection.
[ "ProjectToTile", "will", "project", "all", "the", "geometries", "in", "all", "layers", "to", "tile", "coordinates", "based", "on", "the", "extent", "and", "the", "mercator", "projection", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/layer.go#L79-L83
151,116
paulmach/orb
encoding/mvt/layer.go
ProjectToWGS84
func (ls Layers) ProjectToWGS84(tile maptile.Tile) { for _, l := range ls { l.ProjectToWGS84(tile) } }
go
func (ls Layers) ProjectToWGS84(tile maptile.Tile) { for _, l := range ls { l.ProjectToWGS84(tile) } }
[ "func", "(", "ls", "Layers", ")", "ProjectToWGS84", "(", "tile", "maptile", ".", "Tile", ")", "{", "for", "_", ",", "l", ":=", "range", "ls", "{", "l", ".", "ProjectToWGS84", "(", "tile", ")", "\n", "}", "\n", "}" ]
// ProjectToWGS84 will project all the geometries in all the layers backed // to WGS84 from the extent and mercator projection.
[ "ProjectToWGS84", "will", "project", "all", "the", "geometries", "in", "all", "the", "layers", "backed", "to", "WGS84", "from", "the", "extent", "and", "mercator", "projection", "." ]
c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29
https://github.com/paulmach/orb/blob/c6e407b203494d3b1edb9fd5cae4cf34a4ae0f29/encoding/mvt/layer.go#L87-L91
151,117
libgit2/git2go
config.go
NewConfig
func NewConfig() (*Config, error) { config := new(Config) runtime.LockOSThread() defer runtime.UnlockOSThread() if ret := C.git_config_new(&config.ptr); ret < 0 { return nil, MakeGitError(ret) } return config, nil }
go
func NewConfig() (*Config, error) { config := new(Config) runtime.LockOSThread() defer runtime.UnlockOSThread() if ret := C.git_config_new(&config.ptr); ret < 0 { return nil, MakeGitError(ret) } return config, nil }
[ "func", "NewConfig", "(", ")", "(", "*", "Config", ",", "error", ")", "{", "config", ":=", "new", "(", "Config", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "if", "ret", ":=", "C", ".", "git_config_new", "(", "&", "config", ".", "ptr", ")", ";", "ret", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "config", ",", "nil", "\n", "}" ]
// NewConfig creates a new empty configuration object
[ "NewConfig", "creates", "a", "new", "empty", "configuration", "object" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/config.go#L59-L70
151,118
libgit2/git2go
config.go
AddFile
func (c *Config) AddFile(path string, level ConfigLevel, force bool) error { cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_config_add_file_ondisk(c.ptr, cpath, C.git_config_level_t(level), nil, cbool(force)) runtime.KeepAlive(c) if ret < 0 { return MakeGitError(ret) } return nil }
go
func (c *Config) AddFile(path string, level ConfigLevel, force bool) error { cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_config_add_file_ondisk(c.ptr, cpath, C.git_config_level_t(level), nil, cbool(force)) runtime.KeepAlive(c) if ret < 0 { return MakeGitError(ret) } return nil }
[ "func", "(", "c", "*", "Config", ")", "AddFile", "(", "path", "string", ",", "level", "ConfigLevel", ",", "force", "bool", ")", "error", "{", "cpath", ":=", "C", ".", "CString", "(", "path", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cpath", ")", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_config_add_file_ondisk", "(", "c", ".", "ptr", ",", "cpath", ",", "C", ".", "git_config_level_t", "(", "level", ")", ",", "nil", ",", "cbool", "(", "force", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "c", ")", "\n", "if", "ret", "<", "0", "{", "return", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// AddFile adds a file-backed backend to the config object at the specified level.
[ "AddFile", "adds", "a", "file", "-", "backed", "backend", "to", "the", "config", "object", "at", "the", "specified", "level", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/config.go#L73-L87
151,119
libgit2/git2go
config.go
NewIterator
func (c *Config) NewIterator() (*ConfigIterator, error) { iter := &ConfigIterator{cfg: c} runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_config_iterator_new(&iter.ptr, c.ptr) if ret < 0 { return nil, MakeGitError(ret) } return iter, nil }
go
func (c *Config) NewIterator() (*ConfigIterator, error) { iter := &ConfigIterator{cfg: c} runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_config_iterator_new(&iter.ptr, c.ptr) if ret < 0 { return nil, MakeGitError(ret) } return iter, nil }
[ "func", "(", "c", "*", "Config", ")", "NewIterator", "(", ")", "(", "*", "ConfigIterator", ",", "error", ")", "{", "iter", ":=", "&", "ConfigIterator", "{", "cfg", ":", "c", "}", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_config_iterator_new", "(", "&", "iter", ".", "ptr", ",", "c", ".", "ptr", ")", "\n", "if", "ret", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "iter", ",", "nil", "\n", "}" ]
// NewIterator creates an iterator over each entry in the // configuration
[ "NewIterator", "creates", "an", "iterator", "over", "each", "entry", "in", "the", "configuration" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/config.go#L187-L199
151,120
libgit2/git2go
config.go
NewIteratorGlob
func (c *Config) NewIteratorGlob(regexp string) (*ConfigIterator, error) { iter := &ConfigIterator{cfg: c} cregexp := C.CString(regexp) defer C.free(unsafe.Pointer(cregexp)) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_config_iterator_glob_new(&iter.ptr, c.ptr, cregexp) if ret < 0 { return nil, MakeGitError(ret) } return iter, nil }
go
func (c *Config) NewIteratorGlob(regexp string) (*ConfigIterator, error) { iter := &ConfigIterator{cfg: c} cregexp := C.CString(regexp) defer C.free(unsafe.Pointer(cregexp)) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_config_iterator_glob_new(&iter.ptr, c.ptr, cregexp) if ret < 0 { return nil, MakeGitError(ret) } return iter, nil }
[ "func", "(", "c", "*", "Config", ")", "NewIteratorGlob", "(", "regexp", "string", ")", "(", "*", "ConfigIterator", ",", "error", ")", "{", "iter", ":=", "&", "ConfigIterator", "{", "cfg", ":", "c", "}", "\n", "cregexp", ":=", "C", ".", "CString", "(", "regexp", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cregexp", ")", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_config_iterator_glob_new", "(", "&", "iter", ".", "ptr", ",", "c", ".", "ptr", ",", "cregexp", ")", "\n", "if", "ret", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "iter", ",", "nil", "\n", "}" ]
// NewIteratorGlob creates an iterator over each entry in the // configuration whose name matches the given regular expression
[ "NewIteratorGlob", "creates", "an", "iterator", "over", "each", "entry", "in", "the", "configuration", "whose", "name", "matches", "the", "given", "regular", "expression" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/config.go#L203-L217
151,121
libgit2/git2go
config.go
OpenLevel
func (c *Config) OpenLevel(parent *Config, level ConfigLevel) (*Config, error) { config := new(Config) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_config_open_level(&config.ptr, parent.ptr, C.git_config_level_t(level)) runtime.KeepAlive(c) runtime.KeepAlive(parent) if ret < 0 { return nil, MakeGitError(ret) } return config, nil }
go
func (c *Config) OpenLevel(parent *Config, level ConfigLevel) (*Config, error) { config := new(Config) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_config_open_level(&config.ptr, parent.ptr, C.git_config_level_t(level)) runtime.KeepAlive(c) runtime.KeepAlive(parent) if ret < 0 { return nil, MakeGitError(ret) } return config, nil }
[ "func", "(", "c", "*", "Config", ")", "OpenLevel", "(", "parent", "*", "Config", ",", "level", "ConfigLevel", ")", "(", "*", "Config", ",", "error", ")", "{", "config", ":=", "new", "(", "Config", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_config_open_level", "(", "&", "config", ".", "ptr", ",", "parent", ".", "ptr", ",", "C", ".", "git_config_level_t", "(", "level", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "c", ")", "\n", "runtime", ".", "KeepAlive", "(", "parent", ")", "\n", "if", "ret", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "config", ",", "nil", "\n", "}" ]
// OpenLevel creates a single-level focused config object from a multi-level one
[ "OpenLevel", "creates", "a", "single", "-", "level", "focused", "config", "object", "from", "a", "multi", "-", "level", "one" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/config.go#L330-L344
151,122
libgit2/git2go
config.go
OpenOndisk
func OpenOndisk(path string) (*Config, error) { cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) config := new(Config) runtime.LockOSThread() defer runtime.UnlockOSThread() if ret := C.git_config_open_ondisk(&config.ptr, cpath); ret < 0 { return nil, MakeGitError(ret) } return config, nil }
go
func OpenOndisk(path string) (*Config, error) { cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) config := new(Config) runtime.LockOSThread() defer runtime.UnlockOSThread() if ret := C.git_config_open_ondisk(&config.ptr, cpath); ret < 0 { return nil, MakeGitError(ret) } return config, nil }
[ "func", "OpenOndisk", "(", "path", "string", ")", "(", "*", "Config", ",", "error", ")", "{", "cpath", ":=", "C", ".", "CString", "(", "path", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cpath", ")", ")", "\n\n", "config", ":=", "new", "(", "Config", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "if", "ret", ":=", "C", ".", "git_config_open_ondisk", "(", "&", "config", ".", "ptr", ",", "cpath", ")", ";", "ret", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "config", ",", "nil", "\n", "}" ]
// OpenOndisk creates a new config instance containing a single on-disk file
[ "OpenOndisk", "creates", "a", "new", "config", "instance", "containing", "a", "single", "on", "-", "disk", "file" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/config.go#L347-L361
151,123
libgit2/git2go
config.go
Next
func (iter *ConfigIterator) Next() (*ConfigEntry, error) { var centry *C.git_config_entry runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_config_next(&centry, iter.ptr) if ret < 0 { return nil, MakeGitError(ret) } entry := newConfigEntryFromC(centry) runtime.KeepAlive(iter) return entry, nil }
go
func (iter *ConfigIterator) Next() (*ConfigEntry, error) { var centry *C.git_config_entry runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_config_next(&centry, iter.ptr) if ret < 0 { return nil, MakeGitError(ret) } entry := newConfigEntryFromC(centry) runtime.KeepAlive(iter) return entry, nil }
[ "func", "(", "iter", "*", "ConfigIterator", ")", "Next", "(", ")", "(", "*", "ConfigEntry", ",", "error", ")", "{", "var", "centry", "*", "C", ".", "git_config_entry", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_config_next", "(", "&", "centry", ",", "iter", ".", "ptr", ")", "\n", "if", "ret", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "entry", ":=", "newConfigEntryFromC", "(", "centry", ")", "\n", "runtime", ".", "KeepAlive", "(", "iter", ")", "\n\n", "return", "entry", ",", "nil", "\n", "}" ]
// Next returns the next entry for this iterator
[ "Next", "returns", "the", "next", "entry", "for", "this", "iterator" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/config.go#L369-L384
151,124
libgit2/git2go
config.go
ConfigFindProgramdata
func ConfigFindProgramdata() (string, error) { var buf C.git_buf defer C.git_buf_dispose(&buf) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_config_find_programdata(&buf) if ret < 0 { return "", MakeGitError(ret) } return C.GoString(buf.ptr), nil }
go
func ConfigFindProgramdata() (string, error) { var buf C.git_buf defer C.git_buf_dispose(&buf) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_config_find_programdata(&buf) if ret < 0 { return "", MakeGitError(ret) } return C.GoString(buf.ptr), nil }
[ "func", "ConfigFindProgramdata", "(", ")", "(", "string", ",", "error", ")", "{", "var", "buf", "C", ".", "git_buf", "\n", "defer", "C", ".", "git_buf_dispose", "(", "&", "buf", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_config_find_programdata", "(", "&", "buf", ")", "\n", "if", "ret", "<", "0", "{", "return", "\"", "\"", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "C", ".", "GoString", "(", "buf", ".", "ptr", ")", ",", "nil", "\n", "}" ]
// ConfigFindProgramdata locate the path to the configuration file in ProgramData. // // Look for the file in %PROGRAMDATA%\Git\config used by portable git.
[ "ConfigFindProgramdata", "locate", "the", "path", "to", "the", "configuration", "file", "in", "ProgramData", ".", "Look", "for", "the", "file", "in", "%PROGRAMDATA%", "\\", "Git", "\\", "config", "used", "by", "portable", "git", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/config.go#L439-L452
151,125
libgit2/git2go
merge.go
MergeAnalysis
func (r *Repository) MergeAnalysis(theirHeads []*AnnotatedCommit) (MergeAnalysis, MergePreference, error) { runtime.LockOSThread() defer runtime.UnlockOSThread() gmerge_head_array := make([]*C.git_annotated_commit, len(theirHeads)) for i := 0; i < len(theirHeads); i++ { gmerge_head_array[i] = theirHeads[i].ptr } ptr := unsafe.Pointer(&gmerge_head_array[0]) var analysis C.git_merge_analysis_t var preference C.git_merge_preference_t err := C.git_merge_analysis(&analysis, &preference, r.ptr, (**C.git_annotated_commit)(ptr), C.size_t(len(theirHeads))) runtime.KeepAlive(theirHeads) if err < 0 { return MergeAnalysisNone, MergePreferenceNone, MakeGitError(err) } return MergeAnalysis(analysis), MergePreference(preference), nil }
go
func (r *Repository) MergeAnalysis(theirHeads []*AnnotatedCommit) (MergeAnalysis, MergePreference, error) { runtime.LockOSThread() defer runtime.UnlockOSThread() gmerge_head_array := make([]*C.git_annotated_commit, len(theirHeads)) for i := 0; i < len(theirHeads); i++ { gmerge_head_array[i] = theirHeads[i].ptr } ptr := unsafe.Pointer(&gmerge_head_array[0]) var analysis C.git_merge_analysis_t var preference C.git_merge_preference_t err := C.git_merge_analysis(&analysis, &preference, r.ptr, (**C.git_annotated_commit)(ptr), C.size_t(len(theirHeads))) runtime.KeepAlive(theirHeads) if err < 0 { return MergeAnalysisNone, MergePreferenceNone, MakeGitError(err) } return MergeAnalysis(analysis), MergePreference(preference), nil }
[ "func", "(", "r", "*", "Repository", ")", "MergeAnalysis", "(", "theirHeads", "[", "]", "*", "AnnotatedCommit", ")", "(", "MergeAnalysis", ",", "MergePreference", ",", "error", ")", "{", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "gmerge_head_array", ":=", "make", "(", "[", "]", "*", "C", ".", "git_annotated_commit", ",", "len", "(", "theirHeads", ")", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "theirHeads", ")", ";", "i", "++", "{", "gmerge_head_array", "[", "i", "]", "=", "theirHeads", "[", "i", "]", ".", "ptr", "\n", "}", "\n", "ptr", ":=", "unsafe", ".", "Pointer", "(", "&", "gmerge_head_array", "[", "0", "]", ")", "\n", "var", "analysis", "C", ".", "git_merge_analysis_t", "\n", "var", "preference", "C", ".", "git_merge_preference_t", "\n", "err", ":=", "C", ".", "git_merge_analysis", "(", "&", "analysis", ",", "&", "preference", ",", "r", ".", "ptr", ",", "(", "*", "*", "C", ".", "git_annotated_commit", ")", "(", "ptr", ")", ",", "C", ".", "size_t", "(", "len", "(", "theirHeads", ")", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "theirHeads", ")", "\n", "if", "err", "<", "0", "{", "return", "MergeAnalysisNone", ",", "MergePreferenceNone", ",", "MakeGitError", "(", "err", ")", "\n", "}", "\n", "return", "MergeAnalysis", "(", "analysis", ")", ",", "MergePreference", "(", "preference", ")", ",", "nil", "\n\n", "}" ]
// MergeAnalysis returns the possible actions which could be taken by // a 'git-merge' command. There may be multiple answers, so the first // return value is a bitmask of MergeAnalysis values.
[ "MergeAnalysis", "returns", "the", "possible", "actions", "which", "could", "be", "taken", "by", "a", "git", "-", "merge", "command", ".", "There", "may", "be", "multiple", "answers", "so", "the", "first", "return", "value", "is", "a", "bitmask", "of", "MergeAnalysis", "values", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/merge.go#L193-L211
151,126
libgit2/git2go
merge.go
MergeBases
func (r *Repository) MergeBases(one, two *Oid) ([]*Oid, error) { runtime.LockOSThread() defer runtime.UnlockOSThread() var coids C.git_oidarray ret := C.git_merge_bases(&coids, r.ptr, one.toC(), two.toC()) runtime.KeepAlive(one) runtime.KeepAlive(two) if ret < 0 { return make([]*Oid, 0), MakeGitError(ret) } oids := make([]*Oid, coids.count) hdr := reflect.SliceHeader{ Data: uintptr(unsafe.Pointer(coids.ids)), Len: int(coids.count), Cap: int(coids.count), } goSlice := *(*[]C.git_oid)(unsafe.Pointer(&hdr)) for i, cid := range goSlice { oids[i] = newOidFromC(&cid) } return oids, nil }
go
func (r *Repository) MergeBases(one, two *Oid) ([]*Oid, error) { runtime.LockOSThread() defer runtime.UnlockOSThread() var coids C.git_oidarray ret := C.git_merge_bases(&coids, r.ptr, one.toC(), two.toC()) runtime.KeepAlive(one) runtime.KeepAlive(two) if ret < 0 { return make([]*Oid, 0), MakeGitError(ret) } oids := make([]*Oid, coids.count) hdr := reflect.SliceHeader{ Data: uintptr(unsafe.Pointer(coids.ids)), Len: int(coids.count), Cap: int(coids.count), } goSlice := *(*[]C.git_oid)(unsafe.Pointer(&hdr)) for i, cid := range goSlice { oids[i] = newOidFromC(&cid) } return oids, nil }
[ "func", "(", "r", "*", "Repository", ")", "MergeBases", "(", "one", ",", "two", "*", "Oid", ")", "(", "[", "]", "*", "Oid", ",", "error", ")", "{", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "var", "coids", "C", ".", "git_oidarray", "\n", "ret", ":=", "C", ".", "git_merge_bases", "(", "&", "coids", ",", "r", ".", "ptr", ",", "one", ".", "toC", "(", ")", ",", "two", ".", "toC", "(", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "one", ")", "\n", "runtime", ".", "KeepAlive", "(", "two", ")", "\n", "if", "ret", "<", "0", "{", "return", "make", "(", "[", "]", "*", "Oid", ",", "0", ")", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "oids", ":=", "make", "(", "[", "]", "*", "Oid", ",", "coids", ".", "count", ")", "\n", "hdr", ":=", "reflect", ".", "SliceHeader", "{", "Data", ":", "uintptr", "(", "unsafe", ".", "Pointer", "(", "coids", ".", "ids", ")", ")", ",", "Len", ":", "int", "(", "coids", ".", "count", ")", ",", "Cap", ":", "int", "(", "coids", ".", "count", ")", ",", "}", "\n\n", "goSlice", ":=", "*", "(", "*", "[", "]", "C", ".", "git_oid", ")", "(", "unsafe", ".", "Pointer", "(", "&", "hdr", ")", ")", "\n\n", "for", "i", ",", "cid", ":=", "range", "goSlice", "{", "oids", "[", "i", "]", "=", "newOidFromC", "(", "&", "cid", ")", "\n", "}", "\n\n", "return", "oids", ",", "nil", "\n", "}" ]
// MergeBases retrieves the list of merge bases between two commits. // // If none are found, an empty slice is returned and the error is set // approprately
[ "MergeBases", "retrieves", "the", "list", "of", "merge", "bases", "between", "two", "commits", ".", "If", "none", "are", "found", "an", "empty", "slice", "is", "returned", "and", "the", "error", "is", "set", "approprately" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/merge.go#L271-L297
151,127
libgit2/git2go
note.go
Create
func (c *NoteCollection) Create( ref string, author, committer *Signature, id *Oid, note string, force bool) (*Oid, error) { oid := new(Oid) var cref *C.char if ref == "" { cref = nil } else { cref = C.CString(ref) defer C.free(unsafe.Pointer(cref)) } authorSig, err := author.toC() if err != nil { return nil, err } defer C.git_signature_free(authorSig) committerSig, err := committer.toC() if err != nil { return nil, err } defer C.git_signature_free(committerSig) cnote := C.CString(note) defer C.free(unsafe.Pointer(cnote)) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_note_create( oid.toC(), c.repo.ptr, cref, authorSig, committerSig, id.toC(), cnote, cbool(force)) runtime.KeepAlive(c) runtime.KeepAlive(id) if ret < 0 { return nil, MakeGitError(ret) } return oid, nil }
go
func (c *NoteCollection) Create( ref string, author, committer *Signature, id *Oid, note string, force bool) (*Oid, error) { oid := new(Oid) var cref *C.char if ref == "" { cref = nil } else { cref = C.CString(ref) defer C.free(unsafe.Pointer(cref)) } authorSig, err := author.toC() if err != nil { return nil, err } defer C.git_signature_free(authorSig) committerSig, err := committer.toC() if err != nil { return nil, err } defer C.git_signature_free(committerSig) cnote := C.CString(note) defer C.free(unsafe.Pointer(cnote)) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_note_create( oid.toC(), c.repo.ptr, cref, authorSig, committerSig, id.toC(), cnote, cbool(force)) runtime.KeepAlive(c) runtime.KeepAlive(id) if ret < 0 { return nil, MakeGitError(ret) } return oid, nil }
[ "func", "(", "c", "*", "NoteCollection", ")", "Create", "(", "ref", "string", ",", "author", ",", "committer", "*", "Signature", ",", "id", "*", "Oid", ",", "note", "string", ",", "force", "bool", ")", "(", "*", "Oid", ",", "error", ")", "{", "oid", ":=", "new", "(", "Oid", ")", "\n\n", "var", "cref", "*", "C", ".", "char", "\n", "if", "ref", "==", "\"", "\"", "{", "cref", "=", "nil", "\n", "}", "else", "{", "cref", "=", "C", ".", "CString", "(", "ref", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cref", ")", ")", "\n", "}", "\n\n", "authorSig", ",", "err", ":=", "author", ".", "toC", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "C", ".", "git_signature_free", "(", "authorSig", ")", "\n\n", "committerSig", ",", "err", ":=", "committer", ".", "toC", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "C", ".", "git_signature_free", "(", "committerSig", ")", "\n\n", "cnote", ":=", "C", ".", "CString", "(", "note", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cnote", ")", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_note_create", "(", "oid", ".", "toC", "(", ")", ",", "c", ".", "repo", ".", "ptr", ",", "cref", ",", "authorSig", ",", "committerSig", ",", "id", ".", "toC", "(", ")", ",", "cnote", ",", "cbool", "(", "force", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "c", ")", "\n", "runtime", ".", "KeepAlive", "(", "id", ")", "\n", "if", "ret", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n", "return", "oid", ",", "nil", "\n", "}" ]
// Create adds a note for an object
[ "Create", "adds", "a", "note", "for", "an", "object" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/note.go#L20-L61
151,128
libgit2/git2go
note.go
Read
func (c *NoteCollection) Read(ref string, id *Oid) (*Note, error) { var cref *C.char if ref == "" { cref = nil } else { cref = C.CString(ref) defer C.free(unsafe.Pointer(cref)) } runtime.LockOSThread() defer runtime.UnlockOSThread() var ptr *C.git_note ret := C.git_note_read(&ptr, c.repo.ptr, cref, id.toC()) runtime.KeepAlive(c) runtime.KeepAlive(id) if ret < 0 { return nil, MakeGitError(ret) } return newNoteFromC(ptr, c.repo), nil }
go
func (c *NoteCollection) Read(ref string, id *Oid) (*Note, error) { var cref *C.char if ref == "" { cref = nil } else { cref = C.CString(ref) defer C.free(unsafe.Pointer(cref)) } runtime.LockOSThread() defer runtime.UnlockOSThread() var ptr *C.git_note ret := C.git_note_read(&ptr, c.repo.ptr, cref, id.toC()) runtime.KeepAlive(c) runtime.KeepAlive(id) if ret < 0 { return nil, MakeGitError(ret) } return newNoteFromC(ptr, c.repo), nil }
[ "func", "(", "c", "*", "NoteCollection", ")", "Read", "(", "ref", "string", ",", "id", "*", "Oid", ")", "(", "*", "Note", ",", "error", ")", "{", "var", "cref", "*", "C", ".", "char", "\n", "if", "ref", "==", "\"", "\"", "{", "cref", "=", "nil", "\n", "}", "else", "{", "cref", "=", "C", ".", "CString", "(", "ref", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cref", ")", ")", "\n", "}", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "var", "ptr", "*", "C", ".", "git_note", "\n", "ret", ":=", "C", ".", "git_note_read", "(", "&", "ptr", ",", "c", ".", "repo", ".", "ptr", ",", "cref", ",", "id", ".", "toC", "(", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "c", ")", "\n", "runtime", ".", "KeepAlive", "(", "id", ")", "\n", "if", "ret", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "newNoteFromC", "(", "ptr", ",", "c", ".", "repo", ")", ",", "nil", "\n", "}" ]
// Read reads the note for an object
[ "Read", "reads", "the", "note", "for", "an", "object" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/note.go#L64-L85
151,129
libgit2/git2go
note.go
Remove
func (c *NoteCollection) Remove(ref string, author, committer *Signature, id *Oid) error { var cref *C.char if ref == "" { cref = nil } else { cref = C.CString(ref) defer C.free(unsafe.Pointer(cref)) } authorSig, err := author.toC() if err != nil { return err } defer C.git_signature_free(authorSig) committerSig, err := committer.toC() if err != nil { return err } defer C.git_signature_free(committerSig) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_note_remove(c.repo.ptr, cref, authorSig, committerSig, id.toC()) runtime.KeepAlive(c) runtime.KeepAlive(id) if ret < 0 { return MakeGitError(ret) } return nil }
go
func (c *NoteCollection) Remove(ref string, author, committer *Signature, id *Oid) error { var cref *C.char if ref == "" { cref = nil } else { cref = C.CString(ref) defer C.free(unsafe.Pointer(cref)) } authorSig, err := author.toC() if err != nil { return err } defer C.git_signature_free(authorSig) committerSig, err := committer.toC() if err != nil { return err } defer C.git_signature_free(committerSig) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_note_remove(c.repo.ptr, cref, authorSig, committerSig, id.toC()) runtime.KeepAlive(c) runtime.KeepAlive(id) if ret < 0 { return MakeGitError(ret) } return nil }
[ "func", "(", "c", "*", "NoteCollection", ")", "Remove", "(", "ref", "string", ",", "author", ",", "committer", "*", "Signature", ",", "id", "*", "Oid", ")", "error", "{", "var", "cref", "*", "C", ".", "char", "\n", "if", "ref", "==", "\"", "\"", "{", "cref", "=", "nil", "\n", "}", "else", "{", "cref", "=", "C", ".", "CString", "(", "ref", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cref", ")", ")", "\n", "}", "\n\n", "authorSig", ",", "err", ":=", "author", ".", "toC", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "C", ".", "git_signature_free", "(", "authorSig", ")", "\n\n", "committerSig", ",", "err", ":=", "committer", ".", "toC", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "C", ".", "git_signature_free", "(", "committerSig", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_note_remove", "(", "c", ".", "repo", ".", "ptr", ",", "cref", ",", "authorSig", ",", "committerSig", ",", "id", ".", "toC", "(", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "c", ")", "\n", "runtime", ".", "KeepAlive", "(", "id", ")", "\n", "if", "ret", "<", "0", "{", "return", "MakeGitError", "(", "ret", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Remove removes the note for an object
[ "Remove", "removes", "the", "note", "for", "an", "object" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/note.go#L88-L119
151,130
libgit2/git2go
note.go
DefaultRef
func (c *NoteCollection) DefaultRef() (string, error) { buf := C.git_buf{} runtime.LockOSThread() defer runtime.UnlockOSThread() ecode := C.git_note_default_ref(&buf, c.repo.ptr) runtime.KeepAlive(c) if ecode < 0 { return "", MakeGitError(ecode) } ret := C.GoString(buf.ptr) C.git_buf_dispose(&buf) return ret, nil }
go
func (c *NoteCollection) DefaultRef() (string, error) { buf := C.git_buf{} runtime.LockOSThread() defer runtime.UnlockOSThread() ecode := C.git_note_default_ref(&buf, c.repo.ptr) runtime.KeepAlive(c) if ecode < 0 { return "", MakeGitError(ecode) } ret := C.GoString(buf.ptr) C.git_buf_dispose(&buf) return ret, nil }
[ "func", "(", "c", "*", "NoteCollection", ")", "DefaultRef", "(", ")", "(", "string", ",", "error", ")", "{", "buf", ":=", "C", ".", "git_buf", "{", "}", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ecode", ":=", "C", ".", "git_note_default_ref", "(", "&", "buf", ",", "c", ".", "repo", ".", "ptr", ")", "\n", "runtime", ".", "KeepAlive", "(", "c", ")", "\n", "if", "ecode", "<", "0", "{", "return", "\"", "\"", ",", "MakeGitError", "(", "ecode", ")", "\n", "}", "\n\n", "ret", ":=", "C", ".", "GoString", "(", "buf", ".", "ptr", ")", "\n", "C", ".", "git_buf_dispose", "(", "&", "buf", ")", "\n\n", "return", "ret", ",", "nil", "\n", "}" ]
// DefaultRef returns the default notes reference for a repository
[ "DefaultRef", "returns", "the", "default", "notes", "reference", "for", "a", "repository" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/note.go#L122-L138
151,131
libgit2/git2go
note.go
Free
func (n *Note) Free() error { if n.ptr == nil { return ErrInvalid } runtime.SetFinalizer(n, nil) C.git_note_free(n.ptr) n.ptr = nil return nil }
go
func (n *Note) Free() error { if n.ptr == nil { return ErrInvalid } runtime.SetFinalizer(n, nil) C.git_note_free(n.ptr) n.ptr = nil return nil }
[ "func", "(", "n", "*", "Note", ")", "Free", "(", ")", "error", "{", "if", "n", ".", "ptr", "==", "nil", "{", "return", "ErrInvalid", "\n", "}", "\n", "runtime", ".", "SetFinalizer", "(", "n", ",", "nil", ")", "\n", "C", ".", "git_note_free", "(", "n", ".", "ptr", ")", "\n", "n", ".", "ptr", "=", "nil", "\n", "return", "nil", "\n", "}" ]
// Free frees a git_note object
[ "Free", "frees", "a", "git_note", "object" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/note.go#L153-L161
151,132
libgit2/git2go
note.go
Author
func (n *Note) Author() *Signature { ptr := C.git_note_author(n.ptr) return newSignatureFromC(ptr) }
go
func (n *Note) Author() *Signature { ptr := C.git_note_author(n.ptr) return newSignatureFromC(ptr) }
[ "func", "(", "n", "*", "Note", ")", "Author", "(", ")", "*", "Signature", "{", "ptr", ":=", "C", ".", "git_note_author", "(", "n", ".", "ptr", ")", "\n", "return", "newSignatureFromC", "(", "ptr", ")", "\n", "}" ]
// Author returns the signature of the note author
[ "Author", "returns", "the", "signature", "of", "the", "note", "author" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/note.go#L164-L167
151,133
libgit2/git2go
note.go
Id
func (n *Note) Id() *Oid { ptr := C.git_note_id(n.ptr) runtime.KeepAlive(n) return newOidFromC(ptr) }
go
func (n *Note) Id() *Oid { ptr := C.git_note_id(n.ptr) runtime.KeepAlive(n) return newOidFromC(ptr) }
[ "func", "(", "n", "*", "Note", ")", "Id", "(", ")", "*", "Oid", "{", "ptr", ":=", "C", ".", "git_note_id", "(", "n", ".", "ptr", ")", "\n", "runtime", ".", "KeepAlive", "(", "n", ")", "\n", "return", "newOidFromC", "(", "ptr", ")", "\n", "}" ]
// Id returns the note object's id
[ "Id", "returns", "the", "note", "object", "s", "id" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/note.go#L170-L174
151,134
libgit2/git2go
note.go
Committer
func (n *Note) Committer() *Signature { ptr := C.git_note_committer(n.ptr) runtime.KeepAlive(n) return newSignatureFromC(ptr) }
go
func (n *Note) Committer() *Signature { ptr := C.git_note_committer(n.ptr) runtime.KeepAlive(n) return newSignatureFromC(ptr) }
[ "func", "(", "n", "*", "Note", ")", "Committer", "(", ")", "*", "Signature", "{", "ptr", ":=", "C", ".", "git_note_committer", "(", "n", ".", "ptr", ")", "\n", "runtime", ".", "KeepAlive", "(", "n", ")", "\n", "return", "newSignatureFromC", "(", "ptr", ")", "\n", "}" ]
// Committer returns the signature of the note committer
[ "Committer", "returns", "the", "signature", "of", "the", "note", "committer" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/note.go#L177-L181
151,135
libgit2/git2go
note.go
Message
func (n *Note) Message() string { ret := C.GoString(C.git_note_message(n.ptr)) runtime.KeepAlive(n) return ret }
go
func (n *Note) Message() string { ret := C.GoString(C.git_note_message(n.ptr)) runtime.KeepAlive(n) return ret }
[ "func", "(", "n", "*", "Note", ")", "Message", "(", ")", "string", "{", "ret", ":=", "C", ".", "GoString", "(", "C", ".", "git_note_message", "(", "n", ".", "ptr", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "n", ")", "\n", "return", "ret", "\n", "}" ]
// Message returns the note message
[ "Message", "returns", "the", "note", "message" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/note.go#L184-L188
151,136
libgit2/git2go
note.go
NewNoteIterator
func (repo *Repository) NewNoteIterator(ref string) (*NoteIterator, error) { var cref *C.char if ref == "" { cref = nil } else { cref = C.CString(ref) defer C.free(unsafe.Pointer(cref)) } var ptr *C.git_note_iterator runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_note_iterator_new(&ptr, repo.ptr, cref) runtime.KeepAlive(repo) if ret < 0 { return nil, MakeGitError(ret) } iter := &NoteIterator{ptr: ptr, r: repo} runtime.SetFinalizer(iter, (*NoteIterator).Free) return iter, nil }
go
func (repo *Repository) NewNoteIterator(ref string) (*NoteIterator, error) { var cref *C.char if ref == "" { cref = nil } else { cref = C.CString(ref) defer C.free(unsafe.Pointer(cref)) } var ptr *C.git_note_iterator runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_note_iterator_new(&ptr, repo.ptr, cref) runtime.KeepAlive(repo) if ret < 0 { return nil, MakeGitError(ret) } iter := &NoteIterator{ptr: ptr, r: repo} runtime.SetFinalizer(iter, (*NoteIterator).Free) return iter, nil }
[ "func", "(", "repo", "*", "Repository", ")", "NewNoteIterator", "(", "ref", "string", ")", "(", "*", "NoteIterator", ",", "error", ")", "{", "var", "cref", "*", "C", ".", "char", "\n", "if", "ref", "==", "\"", "\"", "{", "cref", "=", "nil", "\n", "}", "else", "{", "cref", "=", "C", ".", "CString", "(", "ref", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cref", ")", ")", "\n", "}", "\n\n", "var", "ptr", "*", "C", ".", "git_note_iterator", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_note_iterator_new", "(", "&", "ptr", ",", "repo", ".", "ptr", ",", "cref", ")", "\n", "runtime", ".", "KeepAlive", "(", "repo", ")", "\n", "if", "ret", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "iter", ":=", "&", "NoteIterator", "{", "ptr", ":", "ptr", ",", "r", ":", "repo", "}", "\n", "runtime", ".", "SetFinalizer", "(", "iter", ",", "(", "*", "NoteIterator", ")", ".", "Free", ")", "\n", "return", "iter", ",", "nil", "\n", "}" ]
// NewNoteIterator creates a new iterator for notes
[ "NewNoteIterator", "creates", "a", "new", "iterator", "for", "notes" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/note.go#L197-L220
151,137
libgit2/git2go
note.go
Free
func (v *NoteIterator) Free() { runtime.SetFinalizer(v, nil) C.git_note_iterator_free(v.ptr) }
go
func (v *NoteIterator) Free() { runtime.SetFinalizer(v, nil) C.git_note_iterator_free(v.ptr) }
[ "func", "(", "v", "*", "NoteIterator", ")", "Free", "(", ")", "{", "runtime", ".", "SetFinalizer", "(", "v", ",", "nil", ")", "\n", "C", ".", "git_note_iterator_free", "(", "v", ".", "ptr", ")", "\n", "}" ]
// Free frees the note interator
[ "Free", "frees", "the", "note", "interator" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/note.go#L223-L226
151,138
libgit2/git2go
blob.go
Write
func (stream *BlobWriteStream) Write(p []byte) (int, error) { header := (*reflect.SliceHeader)(unsafe.Pointer(&p)) ptr := (*C.char)(unsafe.Pointer(header.Data)) size := C.size_t(header.Len) runtime.LockOSThread() defer runtime.UnlockOSThread() ecode := C._go_git_writestream_write(stream.ptr, ptr, size) runtime.KeepAlive(stream) if ecode < 0 { return 0, MakeGitError(ecode) } return len(p), nil }
go
func (stream *BlobWriteStream) Write(p []byte) (int, error) { header := (*reflect.SliceHeader)(unsafe.Pointer(&p)) ptr := (*C.char)(unsafe.Pointer(header.Data)) size := C.size_t(header.Len) runtime.LockOSThread() defer runtime.UnlockOSThread() ecode := C._go_git_writestream_write(stream.ptr, ptr, size) runtime.KeepAlive(stream) if ecode < 0 { return 0, MakeGitError(ecode) } return len(p), nil }
[ "func", "(", "stream", "*", "BlobWriteStream", ")", "Write", "(", "p", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "header", ":=", "(", "*", "reflect", ".", "SliceHeader", ")", "(", "unsafe", ".", "Pointer", "(", "&", "p", ")", ")", "\n", "ptr", ":=", "(", "*", "C", ".", "char", ")", "(", "unsafe", ".", "Pointer", "(", "header", ".", "Data", ")", ")", "\n", "size", ":=", "C", ".", "size_t", "(", "header", ".", "Len", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ecode", ":=", "C", ".", "_go_git_writestream_write", "(", "stream", ".", "ptr", ",", "ptr", ",", "size", ")", "\n", "runtime", ".", "KeepAlive", "(", "stream", ")", "\n", "if", "ecode", "<", "0", "{", "return", "0", ",", "MakeGitError", "(", "ecode", ")", "\n", "}", "\n\n", "return", "len", "(", "p", ")", ",", "nil", "\n", "}" ]
// Implement io.Writer
[ "Implement", "io", ".", "Writer" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/blob.go#L135-L150
151,139
libgit2/git2go
diff.go
DiffBlobs
func DiffBlobs(oldBlob *Blob, oldAsPath string, newBlob *Blob, newAsPath string, opts *DiffOptions, fileCallback DiffForEachFileCallback, detail DiffDetail) error { data := &diffForEachData{ FileCallback: fileCallback, } intHunks := C.int(0) if detail >= DiffDetailHunks { intHunks = C.int(1) } intLines := C.int(0) if detail >= DiffDetailLines { intLines = C.int(1) } handle := pointerHandles.Track(data) defer pointerHandles.Untrack(handle) var oldBlobPtr, newBlobPtr *C.git_blob if oldBlob != nil { oldBlobPtr = oldBlob.cast_ptr } if newBlob != nil { newBlobPtr = newBlob.cast_ptr } oldBlobPath := C.CString(oldAsPath) defer C.free(unsafe.Pointer(oldBlobPath)) newBlobPath := C.CString(newAsPath) defer C.free(unsafe.Pointer(newBlobPath)) copts, _ := diffOptionsToC(opts) defer freeDiffOptions(copts) runtime.LockOSThread() defer runtime.UnlockOSThread() ecode := C._go_git_diff_blobs(oldBlobPtr, oldBlobPath, newBlobPtr, newBlobPath, copts, 1, intHunks, intLines, handle) runtime.KeepAlive(oldBlob) runtime.KeepAlive(newBlob) if ecode < 0 { return MakeGitError(ecode) } return nil }
go
func DiffBlobs(oldBlob *Blob, oldAsPath string, newBlob *Blob, newAsPath string, opts *DiffOptions, fileCallback DiffForEachFileCallback, detail DiffDetail) error { data := &diffForEachData{ FileCallback: fileCallback, } intHunks := C.int(0) if detail >= DiffDetailHunks { intHunks = C.int(1) } intLines := C.int(0) if detail >= DiffDetailLines { intLines = C.int(1) } handle := pointerHandles.Track(data) defer pointerHandles.Untrack(handle) var oldBlobPtr, newBlobPtr *C.git_blob if oldBlob != nil { oldBlobPtr = oldBlob.cast_ptr } if newBlob != nil { newBlobPtr = newBlob.cast_ptr } oldBlobPath := C.CString(oldAsPath) defer C.free(unsafe.Pointer(oldBlobPath)) newBlobPath := C.CString(newAsPath) defer C.free(unsafe.Pointer(newBlobPath)) copts, _ := diffOptionsToC(opts) defer freeDiffOptions(copts) runtime.LockOSThread() defer runtime.UnlockOSThread() ecode := C._go_git_diff_blobs(oldBlobPtr, oldBlobPath, newBlobPtr, newBlobPath, copts, 1, intHunks, intLines, handle) runtime.KeepAlive(oldBlob) runtime.KeepAlive(newBlob) if ecode < 0 { return MakeGitError(ecode) } return nil }
[ "func", "DiffBlobs", "(", "oldBlob", "*", "Blob", ",", "oldAsPath", "string", ",", "newBlob", "*", "Blob", ",", "newAsPath", "string", ",", "opts", "*", "DiffOptions", ",", "fileCallback", "DiffForEachFileCallback", ",", "detail", "DiffDetail", ")", "error", "{", "data", ":=", "&", "diffForEachData", "{", "FileCallback", ":", "fileCallback", ",", "}", "\n\n", "intHunks", ":=", "C", ".", "int", "(", "0", ")", "\n", "if", "detail", ">=", "DiffDetailHunks", "{", "intHunks", "=", "C", ".", "int", "(", "1", ")", "\n", "}", "\n\n", "intLines", ":=", "C", ".", "int", "(", "0", ")", "\n", "if", "detail", ">=", "DiffDetailLines", "{", "intLines", "=", "C", ".", "int", "(", "1", ")", "\n", "}", "\n\n", "handle", ":=", "pointerHandles", ".", "Track", "(", "data", ")", "\n", "defer", "pointerHandles", ".", "Untrack", "(", "handle", ")", "\n\n", "var", "oldBlobPtr", ",", "newBlobPtr", "*", "C", ".", "git_blob", "\n", "if", "oldBlob", "!=", "nil", "{", "oldBlobPtr", "=", "oldBlob", ".", "cast_ptr", "\n", "}", "\n", "if", "newBlob", "!=", "nil", "{", "newBlobPtr", "=", "newBlob", ".", "cast_ptr", "\n", "}", "\n\n", "oldBlobPath", ":=", "C", ".", "CString", "(", "oldAsPath", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "oldBlobPath", ")", ")", "\n", "newBlobPath", ":=", "C", ".", "CString", "(", "newAsPath", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "newBlobPath", ")", ")", "\n\n", "copts", ",", "_", ":=", "diffOptionsToC", "(", "opts", ")", "\n", "defer", "freeDiffOptions", "(", "copts", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ecode", ":=", "C", ".", "_go_git_diff_blobs", "(", "oldBlobPtr", ",", "oldBlobPath", ",", "newBlobPtr", ",", "newBlobPath", ",", "copts", ",", "1", ",", "intHunks", ",", "intLines", ",", "handle", ")", "\n", "runtime", ".", "KeepAlive", "(", "oldBlob", ")", "\n", "runtime", ".", "KeepAlive", "(", "newBlob", ")", "\n", "if", "ecode", "<", "0", "{", "return", "MakeGitError", "(", "ecode", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// DiffBlobs performs a diff between two arbitrary blobs. You can pass // whatever file names you'd like for them to appear as in the diff.
[ "DiffBlobs", "performs", "a", "diff", "between", "two", "arbitrary", "blobs", ".", "You", "can", "pass", "whatever", "file", "names", "you", "d", "like", "for", "them", "to", "appear", "as", "in", "the", "diff", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/diff.go#L765-L810
151,140
libgit2/git2go
rebase.go
DefaultRebaseOptions
func DefaultRebaseOptions() (RebaseOptions, error) { opts := C.git_rebase_options{} runtime.LockOSThread() defer runtime.UnlockOSThread() ecode := C.git_rebase_init_options(&opts, C.GIT_REBASE_OPTIONS_VERSION) if ecode < 0 { return RebaseOptions{}, MakeGitError(ecode) } return rebaseOptionsFromC(&opts), nil }
go
func DefaultRebaseOptions() (RebaseOptions, error) { opts := C.git_rebase_options{} runtime.LockOSThread() defer runtime.UnlockOSThread() ecode := C.git_rebase_init_options(&opts, C.GIT_REBASE_OPTIONS_VERSION) if ecode < 0 { return RebaseOptions{}, MakeGitError(ecode) } return rebaseOptionsFromC(&opts), nil }
[ "func", "DefaultRebaseOptions", "(", ")", "(", "RebaseOptions", ",", "error", ")", "{", "opts", ":=", "C", ".", "git_rebase_options", "{", "}", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ecode", ":=", "C", ".", "git_rebase_init_options", "(", "&", "opts", ",", "C", ".", "GIT_REBASE_OPTIONS_VERSION", ")", "\n", "if", "ecode", "<", "0", "{", "return", "RebaseOptions", "{", "}", ",", "MakeGitError", "(", "ecode", ")", "\n", "}", "\n", "return", "rebaseOptionsFromC", "(", "&", "opts", ")", ",", "nil", "\n", "}" ]
// DefaultRebaseOptions returns a RebaseOptions with default values.
[ "DefaultRebaseOptions", "returns", "a", "RebaseOptions", "with", "default", "values", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/rebase.go#L83-L94
151,141
libgit2/git2go
rebase.go
InitRebase
func (r *Repository) InitRebase(branch *AnnotatedCommit, upstream *AnnotatedCommit, onto *AnnotatedCommit, opts *RebaseOptions) (*Rebase, error) { runtime.LockOSThread() defer runtime.UnlockOSThread() if branch == nil { branch = &AnnotatedCommit{ptr: nil} } if upstream == nil { upstream = &AnnotatedCommit{ptr: nil} } if onto == nil { onto = &AnnotatedCommit{ptr: nil} } var ptr *C.git_rebase err := C.git_rebase_init(&ptr, r.ptr, branch.ptr, upstream.ptr, onto.ptr, opts.toC()) runtime.KeepAlive(branch) runtime.KeepAlive(upstream) runtime.KeepAlive(onto) if err < 0 { return nil, MakeGitError(err) } return newRebaseFromC(ptr), nil }
go
func (r *Repository) InitRebase(branch *AnnotatedCommit, upstream *AnnotatedCommit, onto *AnnotatedCommit, opts *RebaseOptions) (*Rebase, error) { runtime.LockOSThread() defer runtime.UnlockOSThread() if branch == nil { branch = &AnnotatedCommit{ptr: nil} } if upstream == nil { upstream = &AnnotatedCommit{ptr: nil} } if onto == nil { onto = &AnnotatedCommit{ptr: nil} } var ptr *C.git_rebase err := C.git_rebase_init(&ptr, r.ptr, branch.ptr, upstream.ptr, onto.ptr, opts.toC()) runtime.KeepAlive(branch) runtime.KeepAlive(upstream) runtime.KeepAlive(onto) if err < 0 { return nil, MakeGitError(err) } return newRebaseFromC(ptr), nil }
[ "func", "(", "r", "*", "Repository", ")", "InitRebase", "(", "branch", "*", "AnnotatedCommit", ",", "upstream", "*", "AnnotatedCommit", ",", "onto", "*", "AnnotatedCommit", ",", "opts", "*", "RebaseOptions", ")", "(", "*", "Rebase", ",", "error", ")", "{", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "if", "branch", "==", "nil", "{", "branch", "=", "&", "AnnotatedCommit", "{", "ptr", ":", "nil", "}", "\n", "}", "\n\n", "if", "upstream", "==", "nil", "{", "upstream", "=", "&", "AnnotatedCommit", "{", "ptr", ":", "nil", "}", "\n", "}", "\n\n", "if", "onto", "==", "nil", "{", "onto", "=", "&", "AnnotatedCommit", "{", "ptr", ":", "nil", "}", "\n", "}", "\n\n", "var", "ptr", "*", "C", ".", "git_rebase", "\n", "err", ":=", "C", ".", "git_rebase_init", "(", "&", "ptr", ",", "r", ".", "ptr", ",", "branch", ".", "ptr", ",", "upstream", ".", "ptr", ",", "onto", ".", "ptr", ",", "opts", ".", "toC", "(", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "branch", ")", "\n", "runtime", ".", "KeepAlive", "(", "upstream", ")", "\n", "runtime", ".", "KeepAlive", "(", "onto", ")", "\n", "if", "err", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "err", ")", "\n", "}", "\n\n", "return", "newRebaseFromC", "(", "ptr", ")", ",", "nil", "\n", "}" ]
// InitRebase initializes a rebase operation to rebase the changes in branch relative to upstream onto another branch.
[ "InitRebase", "initializes", "a", "rebase", "operation", "to", "rebase", "the", "changes", "in", "branch", "relative", "to", "upstream", "onto", "another", "branch", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/rebase.go#L135-L161
151,142
libgit2/git2go
rebase.go
OpenRebase
func (r *Repository) OpenRebase(opts *RebaseOptions) (*Rebase, error) { runtime.LockOSThread() defer runtime.UnlockOSThread() var ptr *C.git_rebase err := C.git_rebase_open(&ptr, r.ptr, opts.toC()) runtime.KeepAlive(r) if err < 0 { return nil, MakeGitError(err) } return newRebaseFromC(ptr), nil }
go
func (r *Repository) OpenRebase(opts *RebaseOptions) (*Rebase, error) { runtime.LockOSThread() defer runtime.UnlockOSThread() var ptr *C.git_rebase err := C.git_rebase_open(&ptr, r.ptr, opts.toC()) runtime.KeepAlive(r) if err < 0 { return nil, MakeGitError(err) } return newRebaseFromC(ptr), nil }
[ "func", "(", "r", "*", "Repository", ")", "OpenRebase", "(", "opts", "*", "RebaseOptions", ")", "(", "*", "Rebase", ",", "error", ")", "{", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "var", "ptr", "*", "C", ".", "git_rebase", "\n", "err", ":=", "C", ".", "git_rebase_open", "(", "&", "ptr", ",", "r", ".", "ptr", ",", "opts", ".", "toC", "(", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "r", ")", "\n", "if", "err", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "err", ")", "\n", "}", "\n\n", "return", "newRebaseFromC", "(", "ptr", ")", ",", "nil", "\n", "}" ]
// OpenRebase opens an existing rebase that was previously started by either an invocation of InitRebase or by another client.
[ "OpenRebase", "opens", "an", "existing", "rebase", "that", "was", "previously", "started", "by", "either", "an", "invocation", "of", "InitRebase", "or", "by", "another", "client", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/rebase.go#L164-L176
151,143
libgit2/git2go
rebase.go
OperationAt
func (rebase *Rebase) OperationAt(index uint) *RebaseOperation { operation := C.git_rebase_operation_byindex(rebase.ptr, C.size_t(index)) return newRebaseOperationFromC(operation) }
go
func (rebase *Rebase) OperationAt(index uint) *RebaseOperation { operation := C.git_rebase_operation_byindex(rebase.ptr, C.size_t(index)) return newRebaseOperationFromC(operation) }
[ "func", "(", "rebase", "*", "Rebase", ")", "OperationAt", "(", "index", "uint", ")", "*", "RebaseOperation", "{", "operation", ":=", "C", ".", "git_rebase_operation_byindex", "(", "rebase", ".", "ptr", ",", "C", ".", "size_t", "(", "index", ")", ")", "\n\n", "return", "newRebaseOperationFromC", "(", "operation", ")", "\n", "}" ]
// OperationAt gets the rebase operation specified by the given index.
[ "OperationAt", "gets", "the", "rebase", "operation", "specified", "by", "the", "given", "index", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/rebase.go#L179-L183
151,144
libgit2/git2go
rebase.go
CurrentOperationIndex
func (rebase *Rebase) CurrentOperationIndex() (uint, error) { runtime.LockOSThread() defer runtime.UnlockOSThread() var err error operationIndex := uint(C.git_rebase_operation_current(rebase.ptr)) runtime.KeepAlive(rebase) if operationIndex == RebaseNoOperation { err = ErrRebaseNoOperation } return uint(operationIndex), err }
go
func (rebase *Rebase) CurrentOperationIndex() (uint, error) { runtime.LockOSThread() defer runtime.UnlockOSThread() var err error operationIndex := uint(C.git_rebase_operation_current(rebase.ptr)) runtime.KeepAlive(rebase) if operationIndex == RebaseNoOperation { err = ErrRebaseNoOperation } return uint(operationIndex), err }
[ "func", "(", "rebase", "*", "Rebase", ")", "CurrentOperationIndex", "(", ")", "(", "uint", ",", "error", ")", "{", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "var", "err", "error", "\n", "operationIndex", ":=", "uint", "(", "C", ".", "git_rebase_operation_current", "(", "rebase", ".", "ptr", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "rebase", ")", "\n", "if", "operationIndex", "==", "RebaseNoOperation", "{", "err", "=", "ErrRebaseNoOperation", "\n", "}", "\n\n", "return", "uint", "(", "operationIndex", ")", ",", "err", "\n", "}" ]
// CurrentOperationIndex gets the index of the rebase operation that is // currently being applied. There is also an error returned for API // compatibility.
[ "CurrentOperationIndex", "gets", "the", "index", "of", "the", "rebase", "operation", "that", "is", "currently", "being", "applied", ".", "There", "is", "also", "an", "error", "returned", "for", "API", "compatibility", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/rebase.go#L188-L200
151,145
libgit2/git2go
rebase.go
OperationCount
func (rebase *Rebase) OperationCount() uint { ret := uint(C.git_rebase_operation_entrycount(rebase.ptr)) runtime.KeepAlive(rebase) return ret }
go
func (rebase *Rebase) OperationCount() uint { ret := uint(C.git_rebase_operation_entrycount(rebase.ptr)) runtime.KeepAlive(rebase) return ret }
[ "func", "(", "rebase", "*", "Rebase", ")", "OperationCount", "(", ")", "uint", "{", "ret", ":=", "uint", "(", "C", ".", "git_rebase_operation_entrycount", "(", "rebase", ".", "ptr", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "rebase", ")", "\n", "return", "ret", "\n", "}" ]
// OperationCount gets the count of rebase operations that are to be applied.
[ "OperationCount", "gets", "the", "count", "of", "rebase", "operations", "that", "are", "to", "be", "applied", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/rebase.go#L203-L207
151,146
libgit2/git2go
rebase.go
Finish
func (rebase *Rebase) Finish() error { runtime.LockOSThread() defer runtime.UnlockOSThread() err := C.git_rebase_finish(rebase.ptr, nil) runtime.KeepAlive(rebase) if err < 0 { return MakeGitError(err) } return nil }
go
func (rebase *Rebase) Finish() error { runtime.LockOSThread() defer runtime.UnlockOSThread() err := C.git_rebase_finish(rebase.ptr, nil) runtime.KeepAlive(rebase) if err < 0 { return MakeGitError(err) } return nil }
[ "func", "(", "rebase", "*", "Rebase", ")", "Finish", "(", ")", "error", "{", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "err", ":=", "C", ".", "git_rebase_finish", "(", "rebase", ".", "ptr", ",", "nil", ")", "\n", "runtime", ".", "KeepAlive", "(", "rebase", ")", "\n", "if", "err", "<", "0", "{", "return", "MakeGitError", "(", "err", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// Finish finishes a rebase that is currently in progress once all patches have been applied.
[ "Finish", "finishes", "a", "rebase", "that", "is", "currently", "in", "progress", "once", "all", "patches", "have", "been", "applied", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/rebase.go#L259-L270
151,147
libgit2/git2go
rebase.go
Abort
func (rebase *Rebase) Abort() error { runtime.LockOSThread() defer runtime.UnlockOSThread() err := C.git_rebase_abort(rebase.ptr) runtime.KeepAlive(rebase) if err < 0 { return MakeGitError(err) } return nil }
go
func (rebase *Rebase) Abort() error { runtime.LockOSThread() defer runtime.UnlockOSThread() err := C.git_rebase_abort(rebase.ptr) runtime.KeepAlive(rebase) if err < 0 { return MakeGitError(err) } return nil }
[ "func", "(", "rebase", "*", "Rebase", ")", "Abort", "(", ")", "error", "{", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "err", ":=", "C", ".", "git_rebase_abort", "(", "rebase", ".", "ptr", ")", "\n", "runtime", ".", "KeepAlive", "(", "rebase", ")", "\n", "if", "err", "<", "0", "{", "return", "MakeGitError", "(", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Abort aborts a rebase that is currently in progress, resetting the repository and working directory to their state before rebase began.
[ "Abort", "aborts", "a", "rebase", "that", "is", "currently", "in", "progress", "resetting", "the", "repository", "and", "working", "directory", "to", "their", "state", "before", "rebase", "began", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/rebase.go#L273-L283
151,148
libgit2/git2go
rebase.go
Free
func (rebase *Rebase) Free() { runtime.SetFinalizer(rebase, nil) C.git_rebase_free(rebase.ptr) }
go
func (rebase *Rebase) Free() { runtime.SetFinalizer(rebase, nil) C.git_rebase_free(rebase.ptr) }
[ "func", "(", "rebase", "*", "Rebase", ")", "Free", "(", ")", "{", "runtime", ".", "SetFinalizer", "(", "rebase", ",", "nil", ")", "\n", "C", ".", "git_rebase_free", "(", "rebase", ".", "ptr", ")", "\n", "}" ]
// Free frees the Rebase object.
[ "Free", "frees", "the", "Rebase", "object", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/rebase.go#L286-L289
151,149
libgit2/git2go
mempack.go
NewMempack
func NewMempack(odb *Odb) (mempack *Mempack, err error) { mempack = new(Mempack) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_mempack_new(&mempack.ptr) if ret < 0 { return nil, MakeGitError(ret) } ret = C.git_odb_add_backend(odb.ptr, mempack.ptr, C.int(999)) runtime.KeepAlive(odb) if ret < 0 { // Since git_odb_add_alternate() takes ownership of the ODB backend, the // only case in which we free the mempack's memory is if it fails to be // added to the ODB. C._go_git_odb_backend_free(mempack.ptr) return nil, MakeGitError(ret) } return mempack, nil }
go
func NewMempack(odb *Odb) (mempack *Mempack, err error) { mempack = new(Mempack) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_mempack_new(&mempack.ptr) if ret < 0 { return nil, MakeGitError(ret) } ret = C.git_odb_add_backend(odb.ptr, mempack.ptr, C.int(999)) runtime.KeepAlive(odb) if ret < 0 { // Since git_odb_add_alternate() takes ownership of the ODB backend, the // only case in which we free the mempack's memory is if it fails to be // added to the ODB. C._go_git_odb_backend_free(mempack.ptr) return nil, MakeGitError(ret) } return mempack, nil }
[ "func", "NewMempack", "(", "odb", "*", "Odb", ")", "(", "mempack", "*", "Mempack", ",", "err", "error", ")", "{", "mempack", "=", "new", "(", "Mempack", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_mempack_new", "(", "&", "mempack", ".", "ptr", ")", "\n", "if", "ret", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "ret", "=", "C", ".", "git_odb_add_backend", "(", "odb", ".", "ptr", ",", "mempack", ".", "ptr", ",", "C", ".", "int", "(", "999", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "odb", ")", "\n", "if", "ret", "<", "0", "{", "// Since git_odb_add_alternate() takes ownership of the ODB backend, the", "// only case in which we free the mempack's memory is if it fails to be", "// added to the ODB.", "C", ".", "_go_git_odb_backend_free", "(", "mempack", ".", "ptr", ")", "\n", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "mempack", ",", "nil", "\n", "}" ]
// NewMempack creates a new mempack instance and registers it to the ODB.
[ "NewMempack", "creates", "a", "new", "mempack", "instance", "and", "registers", "it", "to", "the", "ODB", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/mempack.go#L25-L47
151,150
libgit2/git2go
remote.go
Fetch
func (o *Remote) Fetch(refspecs []string, opts *FetchOptions, msg string) error { var cmsg *C.char = nil if msg != "" { cmsg = C.CString(msg) defer C.free(unsafe.Pointer(cmsg)) } crefspecs := C.git_strarray{} crefspecs.count = C.size_t(len(refspecs)) crefspecs.strings = makeCStringsFromStrings(refspecs) defer freeStrarray(&crefspecs) coptions := (*C.git_fetch_options)(C.calloc(1, C.size_t(unsafe.Sizeof(C.git_fetch_options{})))) defer C.free(unsafe.Pointer(coptions)) populateFetchOptions(coptions, opts) defer untrackCalbacksPayload(&coptions.callbacks) defer freeStrarray(&coptions.custom_headers) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_remote_fetch(o.ptr, &crefspecs, coptions, cmsg) runtime.KeepAlive(o) if ret < 0 { return MakeGitError(ret) } return nil }
go
func (o *Remote) Fetch(refspecs []string, opts *FetchOptions, msg string) error { var cmsg *C.char = nil if msg != "" { cmsg = C.CString(msg) defer C.free(unsafe.Pointer(cmsg)) } crefspecs := C.git_strarray{} crefspecs.count = C.size_t(len(refspecs)) crefspecs.strings = makeCStringsFromStrings(refspecs) defer freeStrarray(&crefspecs) coptions := (*C.git_fetch_options)(C.calloc(1, C.size_t(unsafe.Sizeof(C.git_fetch_options{})))) defer C.free(unsafe.Pointer(coptions)) populateFetchOptions(coptions, opts) defer untrackCalbacksPayload(&coptions.callbacks) defer freeStrarray(&coptions.custom_headers) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_remote_fetch(o.ptr, &crefspecs, coptions, cmsg) runtime.KeepAlive(o) if ret < 0 { return MakeGitError(ret) } return nil }
[ "func", "(", "o", "*", "Remote", ")", "Fetch", "(", "refspecs", "[", "]", "string", ",", "opts", "*", "FetchOptions", ",", "msg", "string", ")", "error", "{", "var", "cmsg", "*", "C", ".", "char", "=", "nil", "\n", "if", "msg", "!=", "\"", "\"", "{", "cmsg", "=", "C", ".", "CString", "(", "msg", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cmsg", ")", ")", "\n", "}", "\n\n", "crefspecs", ":=", "C", ".", "git_strarray", "{", "}", "\n", "crefspecs", ".", "count", "=", "C", ".", "size_t", "(", "len", "(", "refspecs", ")", ")", "\n", "crefspecs", ".", "strings", "=", "makeCStringsFromStrings", "(", "refspecs", ")", "\n", "defer", "freeStrarray", "(", "&", "crefspecs", ")", "\n\n", "coptions", ":=", "(", "*", "C", ".", "git_fetch_options", ")", "(", "C", ".", "calloc", "(", "1", ",", "C", ".", "size_t", "(", "unsafe", ".", "Sizeof", "(", "C", ".", "git_fetch_options", "{", "}", ")", ")", ")", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "coptions", ")", ")", "\n\n", "populateFetchOptions", "(", "coptions", ",", "opts", ")", "\n", "defer", "untrackCalbacksPayload", "(", "&", "coptions", ".", "callbacks", ")", "\n", "defer", "freeStrarray", "(", "&", "coptions", ".", "custom_headers", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_remote_fetch", "(", "o", ".", "ptr", ",", "&", "crefspecs", ",", "coptions", ",", "cmsg", ")", "\n", "runtime", ".", "KeepAlive", "(", "o", ")", "\n", "if", "ret", "<", "0", "{", "return", "MakeGitError", "(", "ret", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Fetch performs a fetch operation. refspecs specifies which refspecs // to use for this fetch, use an empty list to use the refspecs from // the configuration; msg specifies what to use for the reflog // entries. Leave "" to use defaults.
[ "Fetch", "performs", "a", "fetch", "operation", ".", "refspecs", "specifies", "which", "refspecs", "to", "use", "for", "this", "fetch", "use", "an", "empty", "list", "to", "use", "the", "refspecs", "from", "the", "configuration", ";", "msg", "specifies", "what", "to", "use", "for", "the", "reflog", "entries", ".", "Leave", "to", "use", "defaults", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/remote.go#L706-L734
151,151
libgit2/git2go
signature.go
Offset
func (v *Signature) Offset() int { _, offset := v.When.Zone() return offset / 60 }
go
func (v *Signature) Offset() int { _, offset := v.When.Zone() return offset / 60 }
[ "func", "(", "v", "*", "Signature", ")", "Offset", "(", ")", "int", "{", "_", ",", "offset", ":=", "v", ".", "When", ".", "Zone", "(", ")", "\n", "return", "offset", "/", "60", "\n", "}" ]
// Offset returns the time zone offset of v.When in minutes, which is what git wants.
[ "Offset", "returns", "the", "time", "zone", "offset", "of", "v", ".", "When", "in", "minutes", "which", "is", "what", "git", "wants", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/signature.go#L30-L33
151,152
libgit2/git2go
stash.go
Save
func (c *StashCollection) Save( stasher *Signature, message string, flags StashFlag) (*Oid, error) { oid := new(Oid) stasherC, err := stasher.toC() if err != nil { return nil, err } defer C.git_signature_free(stasherC) messageC := C.CString(message) defer C.free(unsafe.Pointer(messageC)) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_stash_save( oid.toC(), c.repo.ptr, stasherC, messageC, C.uint32_t(flags)) runtime.KeepAlive(c) if ret < 0 { return nil, MakeGitError(ret) } return oid, nil }
go
func (c *StashCollection) Save( stasher *Signature, message string, flags StashFlag) (*Oid, error) { oid := new(Oid) stasherC, err := stasher.toC() if err != nil { return nil, err } defer C.git_signature_free(stasherC) messageC := C.CString(message) defer C.free(unsafe.Pointer(messageC)) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_stash_save( oid.toC(), c.repo.ptr, stasherC, messageC, C.uint32_t(flags)) runtime.KeepAlive(c) if ret < 0 { return nil, MakeGitError(ret) } return oid, nil }
[ "func", "(", "c", "*", "StashCollection", ")", "Save", "(", "stasher", "*", "Signature", ",", "message", "string", ",", "flags", "StashFlag", ")", "(", "*", "Oid", ",", "error", ")", "{", "oid", ":=", "new", "(", "Oid", ")", "\n\n", "stasherC", ",", "err", ":=", "stasher", ".", "toC", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "C", ".", "git_signature_free", "(", "stasherC", ")", "\n\n", "messageC", ":=", "C", ".", "CString", "(", "message", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "messageC", ")", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_stash_save", "(", "oid", ".", "toC", "(", ")", ",", "c", ".", "repo", ".", "ptr", ",", "stasherC", ",", "messageC", ",", "C", ".", "uint32_t", "(", "flags", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "c", ")", "\n", "if", "ret", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n", "return", "oid", ",", "nil", "\n", "}" ]
// Save saves the local modifications to a new stash. // // Stasher is the identity of the person performing the stashing. // Message is the optional description along with the stashed state. // Flags control the stashing process and are given as bitwise OR.
[ "Save", "saves", "the", "local", "modifications", "to", "a", "new", "stash", ".", "Stasher", "is", "the", "identity", "of", "the", "person", "performing", "the", "stashing", ".", "Message", "is", "the", "optional", "description", "along", "with", "the", "stashed", "state", ".", "Flags", "control", "the", "stashing", "process", "and", "are", "given", "as", "bitwise", "OR", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/stash.go#L46-L71
151,153
libgit2/git2go
stash.go
DefaultStashApplyOptions
func DefaultStashApplyOptions() (StashApplyOptions, error) { optsC := C.git_stash_apply_options{} runtime.LockOSThread() defer runtime.UnlockOSThread() ecode := C.git_stash_apply_init_options(&optsC, C.GIT_STASH_APPLY_OPTIONS_VERSION) if ecode < 0 { return StashApplyOptions{}, MakeGitError(ecode) } return StashApplyOptions{ Flags: StashApplyFlag(optsC.flags), CheckoutOptions: checkoutOptionsFromC(&optsC.checkout_options), }, nil }
go
func DefaultStashApplyOptions() (StashApplyOptions, error) { optsC := C.git_stash_apply_options{} runtime.LockOSThread() defer runtime.UnlockOSThread() ecode := C.git_stash_apply_init_options(&optsC, C.GIT_STASH_APPLY_OPTIONS_VERSION) if ecode < 0 { return StashApplyOptions{}, MakeGitError(ecode) } return StashApplyOptions{ Flags: StashApplyFlag(optsC.flags), CheckoutOptions: checkoutOptionsFromC(&optsC.checkout_options), }, nil }
[ "func", "DefaultStashApplyOptions", "(", ")", "(", "StashApplyOptions", ",", "error", ")", "{", "optsC", ":=", "C", ".", "git_stash_apply_options", "{", "}", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ecode", ":=", "C", ".", "git_stash_apply_init_options", "(", "&", "optsC", ",", "C", ".", "GIT_STASH_APPLY_OPTIONS_VERSION", ")", "\n", "if", "ecode", "<", "0", "{", "return", "StashApplyOptions", "{", "}", ",", "MakeGitError", "(", "ecode", ")", "\n", "}", "\n", "return", "StashApplyOptions", "{", "Flags", ":", "StashApplyFlag", "(", "optsC", ".", "flags", ")", ",", "CheckoutOptions", ":", "checkoutOptionsFromC", "(", "&", "optsC", ".", "checkout_options", ")", ",", "}", ",", "nil", "\n", "}" ]
// DefaultStashApplyOptions initializes the structure with default values.
[ "DefaultStashApplyOptions", "initializes", "the", "structure", "with", "default", "values", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/stash.go#L148-L162
151,154
libgit2/git2go
stash.go
Foreach
func (c *StashCollection) Foreach(callback StashCallback) error { data := stashCallbackData{ Callback: callback, } handle := pointerHandles.Track(&data) defer pointerHandles.Untrack(handle) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C._go_git_stash_foreach(c.repo.ptr, handle) runtime.KeepAlive(c) if ret == C.GIT_EUSER { return data.Error } if ret < 0 { return MakeGitError(ret) } return nil }
go
func (c *StashCollection) Foreach(callback StashCallback) error { data := stashCallbackData{ Callback: callback, } handle := pointerHandles.Track(&data) defer pointerHandles.Untrack(handle) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C._go_git_stash_foreach(c.repo.ptr, handle) runtime.KeepAlive(c) if ret == C.GIT_EUSER { return data.Error } if ret < 0 { return MakeGitError(ret) } return nil }
[ "func", "(", "c", "*", "StashCollection", ")", "Foreach", "(", "callback", "StashCallback", ")", "error", "{", "data", ":=", "stashCallbackData", "{", "Callback", ":", "callback", ",", "}", "\n\n", "handle", ":=", "pointerHandles", ".", "Track", "(", "&", "data", ")", "\n", "defer", "pointerHandles", ".", "Untrack", "(", "handle", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "_go_git_stash_foreach", "(", "c", ".", "repo", ".", "ptr", ",", "handle", ")", "\n", "runtime", ".", "KeepAlive", "(", "c", ")", "\n", "if", "ret", "==", "C", ".", "GIT_EUSER", "{", "return", "data", ".", "Error", "\n", "}", "\n", "if", "ret", "<", "0", "{", "return", "MakeGitError", "(", "ret", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Foreach loops over all the stashed states and calls the callback // for each one. // // If callback returns an error, this will stop looping.
[ "Foreach", "loops", "over", "all", "the", "stashed", "states", "and", "calls", "the", "callback", "for", "each", "one", ".", "If", "callback", "returns", "an", "error", "this", "will", "stop", "looping", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/stash.go#L274-L294
151,155
libgit2/git2go
stash.go
Drop
func (c *StashCollection) Drop(index int) error { runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_stash_drop(c.repo.ptr, C.size_t(index)) runtime.KeepAlive(c) if ret < 0 { return MakeGitError(ret) } return nil }
go
func (c *StashCollection) Drop(index int) error { runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_stash_drop(c.repo.ptr, C.size_t(index)) runtime.KeepAlive(c) if ret < 0 { return MakeGitError(ret) } return nil }
[ "func", "(", "c", "*", "StashCollection", ")", "Drop", "(", "index", "int", ")", "error", "{", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_stash_drop", "(", "c", ".", "repo", ".", "ptr", ",", "C", ".", "size_t", "(", "index", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "c", ")", "\n", "if", "ret", "<", "0", "{", "return", "MakeGitError", "(", "ret", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Drop removes a single stashed state from the stash list. // // 'index' is the position within the stash list. 0 points // to the most recent stashed state. // // Returns error code ErrNotFound if there's no stashed // state for the given index.
[ "Drop", "removes", "a", "single", "stashed", "state", "from", "the", "stash", "list", ".", "index", "is", "the", "position", "within", "the", "stash", "list", ".", "0", "points", "to", "the", "most", "recent", "stashed", "state", ".", "Returns", "error", "code", "ErrNotFound", "if", "there", "s", "no", "stashed", "state", "for", "the", "given", "index", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/stash.go#L303-L313
151,156
libgit2/git2go
handles.go
Track
func (v *HandleList) Track(pointer interface{}) unsafe.Pointer { handle := C.malloc(1) v.Lock() v.handles[handle] = pointer v.Unlock() return handle }
go
func (v *HandleList) Track(pointer interface{}) unsafe.Pointer { handle := C.malloc(1) v.Lock() v.handles[handle] = pointer v.Unlock() return handle }
[ "func", "(", "v", "*", "HandleList", ")", "Track", "(", "pointer", "interface", "{", "}", ")", "unsafe", ".", "Pointer", "{", "handle", ":=", "C", ".", "malloc", "(", "1", ")", "\n\n", "v", ".", "Lock", "(", ")", "\n", "v", ".", "handles", "[", "handle", "]", "=", "pointer", "\n", "v", ".", "Unlock", "(", ")", "\n\n", "return", "handle", "\n", "}" ]
// Track adds the given pointer to the list of pointers to track and // returns a pointer value which can be passed to C as an opaque // pointer.
[ "Track", "adds", "the", "given", "pointer", "to", "the", "list", "of", "pointers", "to", "track", "and", "returns", "a", "pointer", "value", "which", "can", "be", "passed", "to", "C", "as", "an", "opaque", "pointer", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/handles.go#L28-L36
151,157
libgit2/git2go
handles.go
Untrack
func (v *HandleList) Untrack(handle unsafe.Pointer) { v.Lock() delete(v.handles, handle) C.free(handle) v.Unlock() }
go
func (v *HandleList) Untrack(handle unsafe.Pointer) { v.Lock() delete(v.handles, handle) C.free(handle) v.Unlock() }
[ "func", "(", "v", "*", "HandleList", ")", "Untrack", "(", "handle", "unsafe", ".", "Pointer", ")", "{", "v", ".", "Lock", "(", ")", "\n", "delete", "(", "v", ".", "handles", ",", "handle", ")", "\n", "C", ".", "free", "(", "handle", ")", "\n", "v", ".", "Unlock", "(", ")", "\n", "}" ]
// Untrack stops tracking the pointer given by the handle
[ "Untrack", "stops", "tracking", "the", "pointer", "given", "by", "the", "handle" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/handles.go#L39-L44
151,158
libgit2/git2go
handles.go
Get
func (v *HandleList) Get(handle unsafe.Pointer) interface{} { v.RLock() defer v.RUnlock() ptr, ok := v.handles[handle] if !ok { panic(fmt.Sprintf("invalid pointer handle: %p", handle)) } return ptr }
go
func (v *HandleList) Get(handle unsafe.Pointer) interface{} { v.RLock() defer v.RUnlock() ptr, ok := v.handles[handle] if !ok { panic(fmt.Sprintf("invalid pointer handle: %p", handle)) } return ptr }
[ "func", "(", "v", "*", "HandleList", ")", "Get", "(", "handle", "unsafe", ".", "Pointer", ")", "interface", "{", "}", "{", "v", ".", "RLock", "(", ")", "\n", "defer", "v", ".", "RUnlock", "(", ")", "\n\n", "ptr", ",", "ok", ":=", "v", ".", "handles", "[", "handle", "]", "\n", "if", "!", "ok", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "handle", ")", ")", "\n", "}", "\n\n", "return", "ptr", "\n", "}" ]
// Get retrieves the pointer from the given handle
[ "Get", "retrieves", "the", "pointer", "from", "the", "given", "handle" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/handles.go#L47-L57
151,159
libgit2/git2go
index.go
NewIndex
func NewIndex() (*Index, error) { var ptr *C.git_index runtime.LockOSThread() defer runtime.UnlockOSThread() if err := C.git_index_new(&ptr); err < 0 { return nil, MakeGitError(err) } return newIndexFromC(ptr, nil), nil }
go
func NewIndex() (*Index, error) { var ptr *C.git_index runtime.LockOSThread() defer runtime.UnlockOSThread() if err := C.git_index_new(&ptr); err < 0 { return nil, MakeGitError(err) } return newIndexFromC(ptr, nil), nil }
[ "func", "NewIndex", "(", ")", "(", "*", "Index", ",", "error", ")", "{", "var", "ptr", "*", "C", ".", "git_index", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "if", "err", ":=", "C", ".", "git_index_new", "(", "&", "ptr", ")", ";", "err", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "err", ")", "\n", "}", "\n\n", "return", "newIndexFromC", "(", "ptr", ",", "nil", ")", ",", "nil", "\n", "}" ]
// NewIndex allocates a new index. It won't be associated with any // file on the filesystem or repository
[ "NewIndex", "allocates", "a", "new", "index", ".", "It", "won", "t", "be", "associated", "with", "any", "file", "on", "the", "filesystem", "or", "repository" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/index.go#L109-L120
151,160
libgit2/git2go
index.go
Path
func (v *Index) Path() string { ret := C.GoString(C.git_index_path(v.ptr)) runtime.KeepAlive(v) return ret }
go
func (v *Index) Path() string { ret := C.GoString(C.git_index_path(v.ptr)) runtime.KeepAlive(v) return ret }
[ "func", "(", "v", "*", "Index", ")", "Path", "(", ")", "string", "{", "ret", ":=", "C", ".", "GoString", "(", "C", ".", "git_index_path", "(", "v", ".", "ptr", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "v", ")", "\n", "return", "ret", "\n", "}" ]
// Path returns the index' path on disk or an empty string if it // exists only in memory.
[ "Path", "returns", "the", "index", "path", "on", "disk", "or", "an", "empty", "string", "if", "it", "exists", "only", "in", "memory", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/index.go#L142-L146
151,161
libgit2/git2go
index.go
Clear
func (v *Index) Clear() error { runtime.LockOSThread() defer runtime.UnlockOSThread() err := C.git_index_clear(v.ptr) runtime.KeepAlive(v) if err < 0 { return MakeGitError(err) } return nil }
go
func (v *Index) Clear() error { runtime.LockOSThread() defer runtime.UnlockOSThread() err := C.git_index_clear(v.ptr) runtime.KeepAlive(v) if err < 0 { return MakeGitError(err) } return nil }
[ "func", "(", "v", "*", "Index", ")", "Clear", "(", ")", "error", "{", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "err", ":=", "C", ".", "git_index_clear", "(", "v", ".", "ptr", ")", "\n", "runtime", ".", "KeepAlive", "(", "v", ")", "\n", "if", "err", "<", "0", "{", "return", "MakeGitError", "(", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Clear clears the index object in memory; changes must be explicitly // written to disk for them to take effect persistently
[ "Clear", "clears", "the", "index", "object", "in", "memory", ";", "changes", "must", "be", "explicitly", "written", "to", "disk", "for", "them", "to", "take", "effect", "persistently" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/index.go#L150-L160
151,162
libgit2/git2go
index.go
Add
func (v *Index) Add(entry *IndexEntry) error { var centry C.git_index_entry populateCIndexEntry(entry, &centry) defer freeCIndexEntry(&centry) runtime.LockOSThread() defer runtime.UnlockOSThread() err := C.git_index_add(v.ptr, &centry) runtime.KeepAlive(v) if err < 0 { return MakeGitError(err) } return nil }
go
func (v *Index) Add(entry *IndexEntry) error { var centry C.git_index_entry populateCIndexEntry(entry, &centry) defer freeCIndexEntry(&centry) runtime.LockOSThread() defer runtime.UnlockOSThread() err := C.git_index_add(v.ptr, &centry) runtime.KeepAlive(v) if err < 0 { return MakeGitError(err) } return nil }
[ "func", "(", "v", "*", "Index", ")", "Add", "(", "entry", "*", "IndexEntry", ")", "error", "{", "var", "centry", "C", ".", "git_index_entry", "\n\n", "populateCIndexEntry", "(", "entry", ",", "&", "centry", ")", "\n", "defer", "freeCIndexEntry", "(", "&", "centry", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "err", ":=", "C", ".", "git_index_add", "(", "v", ".", "ptr", ",", "&", "centry", ")", "\n", "runtime", ".", "KeepAlive", "(", "v", ")", "\n", "if", "err", "<", "0", "{", "return", "MakeGitError", "(", "err", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// Add adds or replaces the given entry to the index, making a copy of // the data
[ "Add", "adds", "or", "replaces", "the", "given", "entry", "to", "the", "index", "making", "a", "copy", "of", "the", "data" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/index.go#L164-L180
151,163
libgit2/git2go
index.go
RemoveDirectory
func (v *Index) RemoveDirectory(dir string, stage int) error { cstr := C.CString(dir) defer C.free(unsafe.Pointer(cstr)) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_index_remove_directory(v.ptr, cstr, C.int(stage)) runtime.KeepAlive(v) if ret < 0 { return MakeGitError(ret) } return nil }
go
func (v *Index) RemoveDirectory(dir string, stage int) error { cstr := C.CString(dir) defer C.free(unsafe.Pointer(cstr)) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_index_remove_directory(v.ptr, cstr, C.int(stage)) runtime.KeepAlive(v) if ret < 0 { return MakeGitError(ret) } return nil }
[ "func", "(", "v", "*", "Index", ")", "RemoveDirectory", "(", "dir", "string", ",", "stage", "int", ")", "error", "{", "cstr", ":=", "C", ".", "CString", "(", "dir", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_index_remove_directory", "(", "v", ".", "ptr", ",", "cstr", ",", "C", ".", "int", "(", "stage", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "v", ")", "\n", "if", "ret", "<", "0", "{", "return", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// RemoveDirectory removes all entries from the index under a given directory.
[ "RemoveDirectory", "removes", "all", "entries", "from", "the", "index", "under", "a", "given", "directory", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/index.go#L306-L320
151,164
libgit2/git2go
index.go
ReadTree
func (v *Index) ReadTree(tree *Tree) error { runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_index_read_tree(v.ptr, tree.cast_ptr) runtime.KeepAlive(v) runtime.KeepAlive(tree) if ret < 0 { return MakeGitError(ret) } return nil }
go
func (v *Index) ReadTree(tree *Tree) error { runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_index_read_tree(v.ptr, tree.cast_ptr) runtime.KeepAlive(v) runtime.KeepAlive(tree) if ret < 0 { return MakeGitError(ret) } return nil }
[ "func", "(", "v", "*", "Index", ")", "ReadTree", "(", "tree", "*", "Tree", ")", "error", "{", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_index_read_tree", "(", "v", ".", "ptr", ",", "tree", ".", "cast_ptr", ")", "\n", "runtime", ".", "KeepAlive", "(", "v", ")", "\n", "runtime", ".", "KeepAlive", "(", "tree", ")", "\n", "if", "ret", "<", "0", "{", "return", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// ReadTree replaces the contents of the index with those of the given // tree
[ "ReadTree", "replaces", "the", "contents", "of", "the", "index", "with", "those", "of", "the", "given", "tree" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/index.go#L340-L352
151,165
libgit2/git2go
describe.go
DefaultDescribeOptions
func DefaultDescribeOptions() (DescribeOptions, error) { runtime.LockOSThread() defer runtime.UnlockOSThread() opts := C.git_describe_options{} ecode := C.git_describe_init_options(&opts, C.GIT_DESCRIBE_OPTIONS_VERSION) if ecode < 0 { return DescribeOptions{}, MakeGitError(ecode) } return DescribeOptions{ MaxCandidatesTags: uint(opts.max_candidates_tags), Strategy: DescribeOptionsStrategy(opts.describe_strategy), }, nil }
go
func DefaultDescribeOptions() (DescribeOptions, error) { runtime.LockOSThread() defer runtime.UnlockOSThread() opts := C.git_describe_options{} ecode := C.git_describe_init_options(&opts, C.GIT_DESCRIBE_OPTIONS_VERSION) if ecode < 0 { return DescribeOptions{}, MakeGitError(ecode) } return DescribeOptions{ MaxCandidatesTags: uint(opts.max_candidates_tags), Strategy: DescribeOptionsStrategy(opts.describe_strategy), }, nil }
[ "func", "DefaultDescribeOptions", "(", ")", "(", "DescribeOptions", ",", "error", ")", "{", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "opts", ":=", "C", ".", "git_describe_options", "{", "}", "\n", "ecode", ":=", "C", ".", "git_describe_init_options", "(", "&", "opts", ",", "C", ".", "GIT_DESCRIBE_OPTIONS_VERSION", ")", "\n", "if", "ecode", "<", "0", "{", "return", "DescribeOptions", "{", "}", ",", "MakeGitError", "(", "ecode", ")", "\n", "}", "\n\n", "return", "DescribeOptions", "{", "MaxCandidatesTags", ":", "uint", "(", "opts", ".", "max_candidates_tags", ")", ",", "Strategy", ":", "DescribeOptionsStrategy", "(", "opts", ".", "describe_strategy", ")", ",", "}", ",", "nil", "\n", "}" ]
// DefaultDescribeOptions returns default options for the describe operation.
[ "DefaultDescribeOptions", "returns", "default", "options", "for", "the", "describe", "operation", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/describe.go#L41-L55
151,166
libgit2/git2go
describe.go
DefaultDescribeFormatOptions
func DefaultDescribeFormatOptions() (DescribeFormatOptions, error) { runtime.LockOSThread() defer runtime.UnlockOSThread() opts := C.git_describe_format_options{} ecode := C.git_describe_init_format_options(&opts, C.GIT_DESCRIBE_FORMAT_OPTIONS_VERSION) if ecode < 0 { return DescribeFormatOptions{}, MakeGitError(ecode) } return DescribeFormatOptions{ AbbreviatedSize: uint(opts.abbreviated_size), AlwaysUseLongFormat: opts.always_use_long_format == 1, }, nil }
go
func DefaultDescribeFormatOptions() (DescribeFormatOptions, error) { runtime.LockOSThread() defer runtime.UnlockOSThread() opts := C.git_describe_format_options{} ecode := C.git_describe_init_format_options(&opts, C.GIT_DESCRIBE_FORMAT_OPTIONS_VERSION) if ecode < 0 { return DescribeFormatOptions{}, MakeGitError(ecode) } return DescribeFormatOptions{ AbbreviatedSize: uint(opts.abbreviated_size), AlwaysUseLongFormat: opts.always_use_long_format == 1, }, nil }
[ "func", "DefaultDescribeFormatOptions", "(", ")", "(", "DescribeFormatOptions", ",", "error", ")", "{", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "opts", ":=", "C", ".", "git_describe_format_options", "{", "}", "\n", "ecode", ":=", "C", ".", "git_describe_init_format_options", "(", "&", "opts", ",", "C", ".", "GIT_DESCRIBE_FORMAT_OPTIONS_VERSION", ")", "\n", "if", "ecode", "<", "0", "{", "return", "DescribeFormatOptions", "{", "}", ",", "MakeGitError", "(", "ecode", ")", "\n", "}", "\n\n", "return", "DescribeFormatOptions", "{", "AbbreviatedSize", ":", "uint", "(", "opts", ".", "abbreviated_size", ")", ",", "AlwaysUseLongFormat", ":", "opts", ".", "always_use_long_format", "==", "1", ",", "}", ",", "nil", "\n", "}" ]
// DefaultDescribeFormatOptions returns default options for formatting // the output.
[ "DefaultDescribeFormatOptions", "returns", "default", "options", "for", "formatting", "the", "output", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/describe.go#L75-L89
151,167
libgit2/git2go
describe.go
Format
func (result *DescribeResult) Format(opts *DescribeFormatOptions) (string, error) { resultBuf := C.git_buf{} var cFormatOpts *C.git_describe_format_options if opts != nil { cDirtySuffix := C.CString(opts.DirtySuffix) defer C.free(unsafe.Pointer(cDirtySuffix)) cFormatOpts = &C.git_describe_format_options{ version: C.GIT_DESCRIBE_FORMAT_OPTIONS_VERSION, abbreviated_size: C.uint(opts.AbbreviatedSize), always_use_long_format: cbool(opts.AlwaysUseLongFormat), dirty_suffix: cDirtySuffix, } } runtime.LockOSThread() defer runtime.UnlockOSThread() ecode := C.git_describe_format(&resultBuf, result.ptr, cFormatOpts) runtime.KeepAlive(result) if ecode < 0 { return "", MakeGitError(ecode) } defer C.git_buf_dispose(&resultBuf) return C.GoString(resultBuf.ptr), nil }
go
func (result *DescribeResult) Format(opts *DescribeFormatOptions) (string, error) { resultBuf := C.git_buf{} var cFormatOpts *C.git_describe_format_options if opts != nil { cDirtySuffix := C.CString(opts.DirtySuffix) defer C.free(unsafe.Pointer(cDirtySuffix)) cFormatOpts = &C.git_describe_format_options{ version: C.GIT_DESCRIBE_FORMAT_OPTIONS_VERSION, abbreviated_size: C.uint(opts.AbbreviatedSize), always_use_long_format: cbool(opts.AlwaysUseLongFormat), dirty_suffix: cDirtySuffix, } } runtime.LockOSThread() defer runtime.UnlockOSThread() ecode := C.git_describe_format(&resultBuf, result.ptr, cFormatOpts) runtime.KeepAlive(result) if ecode < 0 { return "", MakeGitError(ecode) } defer C.git_buf_dispose(&resultBuf) return C.GoString(resultBuf.ptr), nil }
[ "func", "(", "result", "*", "DescribeResult", ")", "Format", "(", "opts", "*", "DescribeFormatOptions", ")", "(", "string", ",", "error", ")", "{", "resultBuf", ":=", "C", ".", "git_buf", "{", "}", "\n\n", "var", "cFormatOpts", "*", "C", ".", "git_describe_format_options", "\n", "if", "opts", "!=", "nil", "{", "cDirtySuffix", ":=", "C", ".", "CString", "(", "opts", ".", "DirtySuffix", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cDirtySuffix", ")", ")", "\n\n", "cFormatOpts", "=", "&", "C", ".", "git_describe_format_options", "{", "version", ":", "C", ".", "GIT_DESCRIBE_FORMAT_OPTIONS_VERSION", ",", "abbreviated_size", ":", "C", ".", "uint", "(", "opts", ".", "AbbreviatedSize", ")", ",", "always_use_long_format", ":", "cbool", "(", "opts", ".", "AlwaysUseLongFormat", ")", ",", "dirty_suffix", ":", "cDirtySuffix", ",", "}", "\n", "}", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ecode", ":=", "C", ".", "git_describe_format", "(", "&", "resultBuf", ",", "result", ".", "ptr", ",", "cFormatOpts", ")", "\n", "runtime", ".", "KeepAlive", "(", "result", ")", "\n", "if", "ecode", "<", "0", "{", "return", "\"", "\"", ",", "MakeGitError", "(", "ecode", ")", "\n", "}", "\n", "defer", "C", ".", "git_buf_dispose", "(", "&", "resultBuf", ")", "\n\n", "return", "C", ".", "GoString", "(", "resultBuf", ".", "ptr", ")", ",", "nil", "\n", "}" ]
// Format prints the DescribeResult as a string.
[ "Format", "prints", "the", "DescribeResult", "as", "a", "string", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/describe.go#L191-L218
151,168
libgit2/git2go
describe.go
Free
func (result *DescribeResult) Free() { runtime.SetFinalizer(result, nil) C.git_describe_result_free(result.ptr) result.ptr = nil }
go
func (result *DescribeResult) Free() { runtime.SetFinalizer(result, nil) C.git_describe_result_free(result.ptr) result.ptr = nil }
[ "func", "(", "result", "*", "DescribeResult", ")", "Free", "(", ")", "{", "runtime", ".", "SetFinalizer", "(", "result", ",", "nil", ")", "\n", "C", ".", "git_describe_result_free", "(", "result", ".", "ptr", ")", "\n", "result", ".", "ptr", "=", "nil", "\n", "}" ]
// Free cleans up the C reference.
[ "Free", "cleans", "up", "the", "C", "reference", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/describe.go#L221-L225
151,169
libgit2/git2go
tag.go
Foreach
func (c *TagsCollection) Foreach(callback TagForeachCallback) error { data := tagForeachData{ callback: callback, err: nil, } handle := pointerHandles.Track(&data) defer pointerHandles.Untrack(handle) runtime.LockOSThread() defer runtime.UnlockOSThread() err := C._go_git_tag_foreach(c.repo.ptr, handle) runtime.KeepAlive(c) if err == C.GIT_EUSER { return data.err } if err < 0 { return MakeGitError(err) } return nil }
go
func (c *TagsCollection) Foreach(callback TagForeachCallback) error { data := tagForeachData{ callback: callback, err: nil, } handle := pointerHandles.Track(&data) defer pointerHandles.Untrack(handle) runtime.LockOSThread() defer runtime.UnlockOSThread() err := C._go_git_tag_foreach(c.repo.ptr, handle) runtime.KeepAlive(c) if err == C.GIT_EUSER { return data.err } if err < 0 { return MakeGitError(err) } return nil }
[ "func", "(", "c", "*", "TagsCollection", ")", "Foreach", "(", "callback", "TagForeachCallback", ")", "error", "{", "data", ":=", "tagForeachData", "{", "callback", ":", "callback", ",", "err", ":", "nil", ",", "}", "\n\n", "handle", ":=", "pointerHandles", ".", "Track", "(", "&", "data", ")", "\n", "defer", "pointerHandles", ".", "Untrack", "(", "handle", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "err", ":=", "C", ".", "_go_git_tag_foreach", "(", "c", ".", "repo", ".", "ptr", ",", "handle", ")", "\n", "runtime", ".", "KeepAlive", "(", "c", ")", "\n", "if", "err", "==", "C", ".", "GIT_EUSER", "{", "return", "data", ".", "err", "\n", "}", "\n", "if", "err", "<", "0", "{", "return", "MakeGitError", "(", "err", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// Foreach calls the callback for each tag in the repository.
[ "Foreach", "calls", "the", "callback", "for", "each", "tag", "in", "the", "repository", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/tag.go#L223-L245
151,170
libgit2/git2go
reference.go
EnsureLog
func (c *ReferenceCollection) EnsureLog(name string) error { cname := C.CString(name) defer C.free(unsafe.Pointer(cname)) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_reference_ensure_log(c.repo.ptr, cname) runtime.KeepAlive(c) if ret < 0 { return MakeGitError(ret) } return nil }
go
func (c *ReferenceCollection) EnsureLog(name string) error { cname := C.CString(name) defer C.free(unsafe.Pointer(cname)) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_reference_ensure_log(c.repo.ptr, cname) runtime.KeepAlive(c) if ret < 0 { return MakeGitError(ret) } return nil }
[ "func", "(", "c", "*", "ReferenceCollection", ")", "EnsureLog", "(", "name", "string", ")", "error", "{", "cname", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cname", ")", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_reference_ensure_log", "(", "c", ".", "repo", ".", "ptr", ",", "cname", ")", "\n", "runtime", ".", "KeepAlive", "(", "c", ")", "\n", "if", "ret", "<", "0", "{", "return", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// EnsureLog ensures that there is a reflog for the given reference // name and creates an empty one if necessary.
[ "EnsureLog", "ensures", "that", "there", "is", "a", "reflog", "for", "the", "given", "reference", "name", "and", "creates", "an", "empty", "one", "if", "necessary", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/reference.go#L103-L117
151,171
libgit2/git2go
reference.go
HasLog
func (c *ReferenceCollection) HasLog(name string) (bool, error) { cname := C.CString(name) defer C.free(unsafe.Pointer(cname)) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_reference_has_log(c.repo.ptr, cname) runtime.KeepAlive(c) if ret < 0 { return false, MakeGitError(ret) } return ret == 1, nil }
go
func (c *ReferenceCollection) HasLog(name string) (bool, error) { cname := C.CString(name) defer C.free(unsafe.Pointer(cname)) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_reference_has_log(c.repo.ptr, cname) runtime.KeepAlive(c) if ret < 0 { return false, MakeGitError(ret) } return ret == 1, nil }
[ "func", "(", "c", "*", "ReferenceCollection", ")", "HasLog", "(", "name", "string", ")", "(", "bool", ",", "error", ")", "{", "cname", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cname", ")", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_reference_has_log", "(", "c", ".", "repo", ".", "ptr", ",", "cname", ")", "\n", "runtime", ".", "KeepAlive", "(", "c", ")", "\n", "if", "ret", "<", "0", "{", "return", "false", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "ret", "==", "1", ",", "nil", "\n", "}" ]
// HasLog returns whether there is a reflog for the given reference // name
[ "HasLog", "returns", "whether", "there", "is", "a", "reflog", "for", "the", "given", "reference", "name" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/reference.go#L121-L135
151,172
libgit2/git2go
reference.go
Dwim
func (c *ReferenceCollection) Dwim(name string) (*Reference, error) { cname := C.CString(name) defer C.free(unsafe.Pointer(cname)) runtime.LockOSThread() defer runtime.UnlockOSThread() var ptr *C.git_reference ret := C.git_reference_dwim(&ptr, c.repo.ptr, cname) runtime.KeepAlive(c) if ret < 0 { return nil, MakeGitError(ret) } return newReferenceFromC(ptr, c.repo), nil }
go
func (c *ReferenceCollection) Dwim(name string) (*Reference, error) { cname := C.CString(name) defer C.free(unsafe.Pointer(cname)) runtime.LockOSThread() defer runtime.UnlockOSThread() var ptr *C.git_reference ret := C.git_reference_dwim(&ptr, c.repo.ptr, cname) runtime.KeepAlive(c) if ret < 0 { return nil, MakeGitError(ret) } return newReferenceFromC(ptr, c.repo), nil }
[ "func", "(", "c", "*", "ReferenceCollection", ")", "Dwim", "(", "name", "string", ")", "(", "*", "Reference", ",", "error", ")", "{", "cname", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cname", ")", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "var", "ptr", "*", "C", ".", "git_reference", "\n", "ret", ":=", "C", ".", "git_reference_dwim", "(", "&", "ptr", ",", "c", ".", "repo", ".", "ptr", ",", "cname", ")", "\n", "runtime", ".", "KeepAlive", "(", "c", ")", "\n", "if", "ret", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "newReferenceFromC", "(", "ptr", ",", "c", ".", "repo", ")", ",", "nil", "\n", "}" ]
// Dwim looks up a reference by DWIMing its short name
[ "Dwim", "looks", "up", "a", "reference", "by", "DWIMing", "its", "short", "name" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/reference.go#L138-L153
151,173
libgit2/git2go
reference.go
Owner
func (v *Reference) Owner() *Repository { return &Repository{ ptr: C.git_reference_owner(v.ptr), } }
go
func (v *Reference) Owner() *Repository { return &Repository{ ptr: C.git_reference_owner(v.ptr), } }
[ "func", "(", "v", "*", "Reference", ")", "Owner", "(", ")", "*", "Repository", "{", "return", "&", "Repository", "{", "ptr", ":", "C", ".", "git_reference_owner", "(", "v", ".", "ptr", ")", ",", "}", "\n", "}" ]
// Owner returns a weak reference to the repository which owns this // reference.
[ "Owner", "returns", "a", "weak", "reference", "to", "the", "repository", "which", "owns", "this", "reference", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/reference.go#L298-L302
151,174
libgit2/git2go
reference.go
Cmp
func (v *Reference) Cmp(ref2 *Reference) int { ret := int(C.git_reference_cmp(v.ptr, ref2.ptr)) runtime.KeepAlive(v) runtime.KeepAlive(ref2) return ret }
go
func (v *Reference) Cmp(ref2 *Reference) int { ret := int(C.git_reference_cmp(v.ptr, ref2.ptr)) runtime.KeepAlive(v) runtime.KeepAlive(ref2) return ret }
[ "func", "(", "v", "*", "Reference", ")", "Cmp", "(", "ref2", "*", "Reference", ")", "int", "{", "ret", ":=", "int", "(", "C", ".", "git_reference_cmp", "(", "v", ".", "ptr", ",", "ref2", ".", "ptr", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "v", ")", "\n", "runtime", ".", "KeepAlive", "(", "ref2", ")", "\n", "return", "ret", "\n", "}" ]
// Cmp compares v to ref2. It returns 0 on equality, otherwise a // stable sorting.
[ "Cmp", "compares", "v", "to", "ref2", ".", "It", "returns", "0", "on", "equality", "otherwise", "a", "stable", "sorting", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/reference.go#L306-L311
151,175
libgit2/git2go
reference.go
Shorthand
func (v *Reference) Shorthand() string { ret := C.GoString(C.git_reference_shorthand(v.ptr)) runtime.KeepAlive(v) return ret }
go
func (v *Reference) Shorthand() string { ret := C.GoString(C.git_reference_shorthand(v.ptr)) runtime.KeepAlive(v) return ret }
[ "func", "(", "v", "*", "Reference", ")", "Shorthand", "(", ")", "string", "{", "ret", ":=", "C", ".", "GoString", "(", "C", ".", "git_reference_shorthand", "(", "v", ".", "ptr", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "v", ")", "\n", "return", "ret", "\n", "}" ]
// Shorthand returns a "human-readable" short reference name.
[ "Shorthand", "returns", "a", "human", "-", "readable", "short", "reference", "name", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/reference.go#L314-L318
151,176
libgit2/git2go
reference.go
Name
func (v *Reference) Name() string { ret := C.GoString(C.git_reference_name(v.ptr)) runtime.KeepAlive(v) return ret }
go
func (v *Reference) Name() string { ret := C.GoString(C.git_reference_name(v.ptr)) runtime.KeepAlive(v) return ret }
[ "func", "(", "v", "*", "Reference", ")", "Name", "(", ")", "string", "{", "ret", ":=", "C", ".", "GoString", "(", "C", ".", "git_reference_name", "(", "v", ".", "ptr", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "v", ")", "\n", "return", "ret", "\n", "}" ]
// Name returns the full name of v.
[ "Name", "returns", "the", "full", "name", "of", "v", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/reference.go#L321-L325
151,177
libgit2/git2go
reference.go
IsNote
func (v *Reference) IsNote() bool { ret := C.git_reference_is_note(v.ptr) == 1 runtime.KeepAlive(v) return ret }
go
func (v *Reference) IsNote() bool { ret := C.git_reference_is_note(v.ptr) == 1 runtime.KeepAlive(v) return ret }
[ "func", "(", "v", "*", "Reference", ")", "IsNote", "(", ")", "bool", "{", "ret", ":=", "C", ".", "git_reference_is_note", "(", "v", ".", "ptr", ")", "==", "1", "\n", "runtime", ".", "KeepAlive", "(", "v", ")", "\n", "return", "ret", "\n", "}" ]
// IsNote checks if the reference is a note.
[ "IsNote", "checks", "if", "the", "reference", "is", "a", "note", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/reference.go#L352-L356
151,178
libgit2/git2go
reference.go
NewReferenceIterator
func (repo *Repository) NewReferenceIterator() (*ReferenceIterator, error) { var ptr *C.git_reference_iterator runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_reference_iterator_new(&ptr, repo.ptr) if ret < 0 { return nil, MakeGitError(ret) } return newReferenceIteratorFromC(ptr, repo), nil }
go
func (repo *Repository) NewReferenceIterator() (*ReferenceIterator, error) { var ptr *C.git_reference_iterator runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_reference_iterator_new(&ptr, repo.ptr) if ret < 0 { return nil, MakeGitError(ret) } return newReferenceIteratorFromC(ptr, repo), nil }
[ "func", "(", "repo", "*", "Repository", ")", "NewReferenceIterator", "(", ")", "(", "*", "ReferenceIterator", ",", "error", ")", "{", "var", "ptr", "*", "C", ".", "git_reference_iterator", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_reference_iterator_new", "(", "&", "ptr", ",", "repo", ".", "ptr", ")", "\n", "if", "ret", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "newReferenceIteratorFromC", "(", "ptr", ",", "repo", ")", ",", "nil", "\n", "}" ]
// NewReferenceIterator creates a new iterator over reference names
[ "NewReferenceIterator", "creates", "a", "new", "iterator", "over", "reference", "names" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/reference.go#L373-L385
151,179
libgit2/git2go
reference.go
NewReferenceNameIterator
func (repo *Repository) NewReferenceNameIterator() (*ReferenceNameIterator, error) { var ptr *C.git_reference_iterator runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_reference_iterator_new(&ptr, repo.ptr) if ret < 0 { return nil, MakeGitError(ret) } iter := newReferenceIteratorFromC(ptr, repo) return iter.Names(), nil }
go
func (repo *Repository) NewReferenceNameIterator() (*ReferenceNameIterator, error) { var ptr *C.git_reference_iterator runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_reference_iterator_new(&ptr, repo.ptr) if ret < 0 { return nil, MakeGitError(ret) } iter := newReferenceIteratorFromC(ptr, repo) return iter.Names(), nil }
[ "func", "(", "repo", "*", "Repository", ")", "NewReferenceNameIterator", "(", ")", "(", "*", "ReferenceNameIterator", ",", "error", ")", "{", "var", "ptr", "*", "C", ".", "git_reference_iterator", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_reference_iterator_new", "(", "&", "ptr", ",", "repo", ".", "ptr", ")", "\n", "if", "ret", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "iter", ":=", "newReferenceIteratorFromC", "(", "ptr", ",", "repo", ")", "\n", "return", "iter", ".", "Names", "(", ")", ",", "nil", "\n", "}" ]
// NewReferenceIterator creates a new branch iterator over reference names
[ "NewReferenceIterator", "creates", "a", "new", "branch", "iterator", "over", "reference", "names" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/reference.go#L388-L401
151,180
libgit2/git2go
reference.go
NewReferenceIteratorGlob
func (repo *Repository) NewReferenceIteratorGlob(glob string) (*ReferenceIterator, error) { cstr := C.CString(glob) defer C.free(unsafe.Pointer(cstr)) var ptr *C.git_reference_iterator runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_reference_iterator_glob_new(&ptr, repo.ptr, cstr) if ret < 0 { return nil, MakeGitError(ret) } return newReferenceIteratorFromC(ptr, repo), nil }
go
func (repo *Repository) NewReferenceIteratorGlob(glob string) (*ReferenceIterator, error) { cstr := C.CString(glob) defer C.free(unsafe.Pointer(cstr)) var ptr *C.git_reference_iterator runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_reference_iterator_glob_new(&ptr, repo.ptr, cstr) if ret < 0 { return nil, MakeGitError(ret) } return newReferenceIteratorFromC(ptr, repo), nil }
[ "func", "(", "repo", "*", "Repository", ")", "NewReferenceIteratorGlob", "(", "glob", "string", ")", "(", "*", "ReferenceIterator", ",", "error", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "glob", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "var", "ptr", "*", "C", ".", "git_reference_iterator", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_reference_iterator_glob_new", "(", "&", "ptr", ",", "repo", ".", "ptr", ",", "cstr", ")", "\n", "if", "ret", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "newReferenceIteratorFromC", "(", "ptr", ",", "repo", ")", ",", "nil", "\n", "}" ]
// NewReferenceIteratorGlob creates an iterator over reference names // that match the speicified glob. The glob is of the usual fnmatch // type.
[ "NewReferenceIteratorGlob", "creates", "an", "iterator", "over", "reference", "names", "that", "match", "the", "speicified", "glob", ".", "The", "glob", "is", "of", "the", "usual", "fnmatch", "type", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/reference.go#L406-L420
151,181
libgit2/git2go
reference.go
Next
func (v *ReferenceNameIterator) Next() (string, error) { var ptr *C.char runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_reference_next_name(&ptr, v.ptr) if ret < 0 { return "", MakeGitError(ret) } return C.GoString(ptr), nil }
go
func (v *ReferenceNameIterator) Next() (string, error) { var ptr *C.char runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_reference_next_name(&ptr, v.ptr) if ret < 0 { return "", MakeGitError(ret) } return C.GoString(ptr), nil }
[ "func", "(", "v", "*", "ReferenceNameIterator", ")", "Next", "(", ")", "(", "string", ",", "error", ")", "{", "var", "ptr", "*", "C", ".", "char", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_reference_next_name", "(", "&", "ptr", ",", "v", ".", "ptr", ")", "\n", "if", "ret", "<", "0", "{", "return", "\"", "\"", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "C", ".", "GoString", "(", "ptr", ")", ",", "nil", "\n", "}" ]
// NextName retrieves the next reference name. If the iteration is over, // the returned error is git.ErrIterOver
[ "NextName", "retrieves", "the", "next", "reference", "name", ".", "If", "the", "iteration", "is", "over", "the", "returned", "error", "is", "git", ".", "ErrIterOver" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/reference.go#L428-L440
151,182
libgit2/git2go
reference.go
Next
func (v *ReferenceIterator) Next() (*Reference, error) { var ptr *C.git_reference runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_reference_next(&ptr, v.ptr) if ret < 0 { return nil, MakeGitError(ret) } return newReferenceFromC(ptr, v.repo), nil }
go
func (v *ReferenceIterator) Next() (*Reference, error) { var ptr *C.git_reference runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_reference_next(&ptr, v.ptr) if ret < 0 { return nil, MakeGitError(ret) } return newReferenceFromC(ptr, v.repo), nil }
[ "func", "(", "v", "*", "ReferenceIterator", ")", "Next", "(", ")", "(", "*", "Reference", ",", "error", ")", "{", "var", "ptr", "*", "C", ".", "git_reference", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_reference_next", "(", "&", "ptr", ",", "v", ".", "ptr", ")", "\n", "if", "ret", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "newReferenceFromC", "(", "ptr", ",", "v", ".", "repo", ")", ",", "nil", "\n", "}" ]
// Next retrieves the next reference. If the iterationis over, the // returned error is git.ErrIterOver
[ "Next", "retrieves", "the", "next", "reference", ".", "If", "the", "iterationis", "over", "the", "returned", "error", "is", "git", ".", "ErrIterOver" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/reference.go#L444-L456
151,183
libgit2/git2go
reference.go
Free
func (v *ReferenceIterator) Free() { runtime.SetFinalizer(v, nil) C.git_reference_iterator_free(v.ptr) }
go
func (v *ReferenceIterator) Free() { runtime.SetFinalizer(v, nil) C.git_reference_iterator_free(v.ptr) }
[ "func", "(", "v", "*", "ReferenceIterator", ")", "Free", "(", ")", "{", "runtime", ".", "SetFinalizer", "(", "v", ",", "nil", ")", "\n", "C", ".", "git_reference_iterator_free", "(", "v", ".", "ptr", ")", "\n", "}" ]
// Free the reference iterator
[ "Free", "the", "reference", "iterator" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/reference.go#L468-L471
151,184
libgit2/git2go
checkout.go
populateCheckoutOpts
func populateCheckoutOpts(ptr *C.git_checkout_options, opts *CheckoutOpts) *C.git_checkout_options { if opts == nil { return nil } C.git_checkout_init_options(ptr, 1) ptr.checkout_strategy = C.uint(opts.Strategy) ptr.disable_filters = cbool(opts.DisableFilters) ptr.dir_mode = C.uint(opts.DirMode.Perm()) ptr.file_mode = C.uint(opts.FileMode.Perm()) ptr.notify_flags = C.uint(opts.NotifyFlags) if opts.NotifyCallback != nil || opts.ProgressCallback != nil { C._go_git_populate_checkout_cb(ptr) } payload := pointerHandles.Track(opts) if opts.NotifyCallback != nil { ptr.notify_payload = payload } if opts.ProgressCallback != nil { ptr.progress_payload = payload } if opts.TargetDirectory != "" { ptr.target_directory = C.CString(opts.TargetDirectory) } if len(opts.Paths) > 0 { ptr.paths.strings = makeCStringsFromStrings(opts.Paths) ptr.paths.count = C.size_t(len(opts.Paths)) } if opts.Baseline != nil { ptr.baseline = opts.Baseline.cast_ptr } return ptr }
go
func populateCheckoutOpts(ptr *C.git_checkout_options, opts *CheckoutOpts) *C.git_checkout_options { if opts == nil { return nil } C.git_checkout_init_options(ptr, 1) ptr.checkout_strategy = C.uint(opts.Strategy) ptr.disable_filters = cbool(opts.DisableFilters) ptr.dir_mode = C.uint(opts.DirMode.Perm()) ptr.file_mode = C.uint(opts.FileMode.Perm()) ptr.notify_flags = C.uint(opts.NotifyFlags) if opts.NotifyCallback != nil || opts.ProgressCallback != nil { C._go_git_populate_checkout_cb(ptr) } payload := pointerHandles.Track(opts) if opts.NotifyCallback != nil { ptr.notify_payload = payload } if opts.ProgressCallback != nil { ptr.progress_payload = payload } if opts.TargetDirectory != "" { ptr.target_directory = C.CString(opts.TargetDirectory) } if len(opts.Paths) > 0 { ptr.paths.strings = makeCStringsFromStrings(opts.Paths) ptr.paths.count = C.size_t(len(opts.Paths)) } if opts.Baseline != nil { ptr.baseline = opts.Baseline.cast_ptr } return ptr }
[ "func", "populateCheckoutOpts", "(", "ptr", "*", "C", ".", "git_checkout_options", ",", "opts", "*", "CheckoutOpts", ")", "*", "C", ".", "git_checkout_options", "{", "if", "opts", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "C", ".", "git_checkout_init_options", "(", "ptr", ",", "1", ")", "\n", "ptr", ".", "checkout_strategy", "=", "C", ".", "uint", "(", "opts", ".", "Strategy", ")", "\n", "ptr", ".", "disable_filters", "=", "cbool", "(", "opts", ".", "DisableFilters", ")", "\n", "ptr", ".", "dir_mode", "=", "C", ".", "uint", "(", "opts", ".", "DirMode", ".", "Perm", "(", ")", ")", "\n", "ptr", ".", "file_mode", "=", "C", ".", "uint", "(", "opts", ".", "FileMode", ".", "Perm", "(", ")", ")", "\n", "ptr", ".", "notify_flags", "=", "C", ".", "uint", "(", "opts", ".", "NotifyFlags", ")", "\n", "if", "opts", ".", "NotifyCallback", "!=", "nil", "||", "opts", ".", "ProgressCallback", "!=", "nil", "{", "C", ".", "_go_git_populate_checkout_cb", "(", "ptr", ")", "\n", "}", "\n", "payload", ":=", "pointerHandles", ".", "Track", "(", "opts", ")", "\n", "if", "opts", ".", "NotifyCallback", "!=", "nil", "{", "ptr", ".", "notify_payload", "=", "payload", "\n", "}", "\n", "if", "opts", ".", "ProgressCallback", "!=", "nil", "{", "ptr", ".", "progress_payload", "=", "payload", "\n", "}", "\n", "if", "opts", ".", "TargetDirectory", "!=", "\"", "\"", "{", "ptr", ".", "target_directory", "=", "C", ".", "CString", "(", "opts", ".", "TargetDirectory", ")", "\n", "}", "\n", "if", "len", "(", "opts", ".", "Paths", ")", ">", "0", "{", "ptr", ".", "paths", ".", "strings", "=", "makeCStringsFromStrings", "(", "opts", ".", "Paths", ")", "\n", "ptr", ".", "paths", ".", "count", "=", "C", ".", "size_t", "(", "len", "(", "opts", ".", "Paths", ")", ")", "\n", "}", "\n\n", "if", "opts", ".", "Baseline", "!=", "nil", "{", "ptr", ".", "baseline", "=", "opts", ".", "Baseline", ".", "cast_ptr", "\n", "}", "\n\n", "return", "ptr", "\n", "}" ]
// Convert the CheckoutOpts struct to the corresponding // C-struct. Returns a pointer to ptr, or nil if opts is nil, in order // to help with what to pass.
[ "Convert", "the", "CheckoutOpts", "struct", "to", "the", "corresponding", "C", "-", "struct", ".", "Returns", "a", "pointer", "to", "ptr", "or", "nil", "if", "opts", "is", "nil", "in", "order", "to", "help", "with", "what", "to", "pass", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/checkout.go#L132-L166
151,185
libgit2/git2go
checkout.go
CheckoutHead
func (v *Repository) CheckoutHead(opts *CheckoutOpts) error { runtime.LockOSThread() defer runtime.UnlockOSThread() cOpts := opts.toC() defer freeCheckoutOpts(cOpts) ret := C.git_checkout_head(v.ptr, cOpts) runtime.KeepAlive(v) if ret < 0 { return MakeGitError(ret) } return nil }
go
func (v *Repository) CheckoutHead(opts *CheckoutOpts) error { runtime.LockOSThread() defer runtime.UnlockOSThread() cOpts := opts.toC() defer freeCheckoutOpts(cOpts) ret := C.git_checkout_head(v.ptr, cOpts) runtime.KeepAlive(v) if ret < 0 { return MakeGitError(ret) } return nil }
[ "func", "(", "v", "*", "Repository", ")", "CheckoutHead", "(", "opts", "*", "CheckoutOpts", ")", "error", "{", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "cOpts", ":=", "opts", ".", "toC", "(", ")", "\n", "defer", "freeCheckoutOpts", "(", "cOpts", ")", "\n\n", "ret", ":=", "C", ".", "git_checkout_head", "(", "v", ".", "ptr", ",", "cOpts", ")", "\n", "runtime", ".", "KeepAlive", "(", "v", ")", "\n", "if", "ret", "<", "0", "{", "return", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// Updates files in the index and the working tree to match the content of // the commit pointed at by HEAD. opts may be nil.
[ "Updates", "files", "in", "the", "index", "and", "the", "working", "tree", "to", "match", "the", "content", "of", "the", "commit", "pointed", "at", "by", "HEAD", ".", "opts", "may", "be", "nil", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/checkout.go#L183-L197
151,186
libgit2/git2go
checkout.go
CheckoutIndex
func (v *Repository) CheckoutIndex(index *Index, opts *CheckoutOpts) error { var iptr *C.git_index = nil if index != nil { iptr = index.ptr } runtime.LockOSThread() defer runtime.UnlockOSThread() cOpts := opts.toC() defer freeCheckoutOpts(cOpts) ret := C.git_checkout_index(v.ptr, iptr, cOpts) runtime.KeepAlive(v) if ret < 0 { return MakeGitError(ret) } return nil }
go
func (v *Repository) CheckoutIndex(index *Index, opts *CheckoutOpts) error { var iptr *C.git_index = nil if index != nil { iptr = index.ptr } runtime.LockOSThread() defer runtime.UnlockOSThread() cOpts := opts.toC() defer freeCheckoutOpts(cOpts) ret := C.git_checkout_index(v.ptr, iptr, cOpts) runtime.KeepAlive(v) if ret < 0 { return MakeGitError(ret) } return nil }
[ "func", "(", "v", "*", "Repository", ")", "CheckoutIndex", "(", "index", "*", "Index", ",", "opts", "*", "CheckoutOpts", ")", "error", "{", "var", "iptr", "*", "C", ".", "git_index", "=", "nil", "\n", "if", "index", "!=", "nil", "{", "iptr", "=", "index", ".", "ptr", "\n", "}", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "cOpts", ":=", "opts", ".", "toC", "(", ")", "\n", "defer", "freeCheckoutOpts", "(", "cOpts", ")", "\n\n", "ret", ":=", "C", ".", "git_checkout_index", "(", "v", ".", "ptr", ",", "iptr", ",", "cOpts", ")", "\n", "runtime", ".", "KeepAlive", "(", "v", ")", "\n", "if", "ret", "<", "0", "{", "return", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// Updates files in the working tree to match the content of the given // index. If index is nil, the repository's index will be used. opts // may be nil.
[ "Updates", "files", "in", "the", "working", "tree", "to", "match", "the", "content", "of", "the", "given", "index", ".", "If", "index", "is", "nil", "the", "repository", "s", "index", "will", "be", "used", ".", "opts", "may", "be", "nil", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/checkout.go#L202-L221
151,187
libgit2/git2go
packbuilder.go
ForEach
func (pb *Packbuilder) ForEach(callback PackbuilderForeachCallback) error { data := packbuilderCbData{ callback: callback, err: nil, } handle := pointerHandles.Track(&data) defer pointerHandles.Untrack(handle) runtime.LockOSThread() defer runtime.UnlockOSThread() err := C._go_git_packbuilder_foreach(pb.ptr, handle) runtime.KeepAlive(pb) if err == C.GIT_EUSER { return data.err } if err < 0 { return MakeGitError(err) } return nil }
go
func (pb *Packbuilder) ForEach(callback PackbuilderForeachCallback) error { data := packbuilderCbData{ callback: callback, err: nil, } handle := pointerHandles.Track(&data) defer pointerHandles.Untrack(handle) runtime.LockOSThread() defer runtime.UnlockOSThread() err := C._go_git_packbuilder_foreach(pb.ptr, handle) runtime.KeepAlive(pb) if err == C.GIT_EUSER { return data.err } if err < 0 { return MakeGitError(err) } return nil }
[ "func", "(", "pb", "*", "Packbuilder", ")", "ForEach", "(", "callback", "PackbuilderForeachCallback", ")", "error", "{", "data", ":=", "packbuilderCbData", "{", "callback", ":", "callback", ",", "err", ":", "nil", ",", "}", "\n", "handle", ":=", "pointerHandles", ".", "Track", "(", "&", "data", ")", "\n", "defer", "pointerHandles", ".", "Untrack", "(", "handle", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "err", ":=", "C", ".", "_go_git_packbuilder_foreach", "(", "pb", ".", "ptr", ",", "handle", ")", "\n", "runtime", ".", "KeepAlive", "(", "pb", ")", "\n", "if", "err", "==", "C", ".", "GIT_EUSER", "{", "return", "data", ".", "err", "\n", "}", "\n", "if", "err", "<", "0", "{", "return", "MakeGitError", "(", "err", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// ForEach repeatedly calls the callback with new packfile data until // there is no more data or the callback returns an error
[ "ForEach", "repeatedly", "calls", "the", "callback", "with", "new", "packfile", "data", "until", "there", "is", "no", "more", "data", "or", "the", "callback", "returns", "an", "error" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/packbuilder.go#L162-L183
151,188
libgit2/git2go
object.go
Owner
func (o *Object) Owner() *Repository { ret := &Repository{ ptr: C.git_object_owner(o.ptr), } runtime.KeepAlive(o) return ret }
go
func (o *Object) Owner() *Repository { ret := &Repository{ ptr: C.git_object_owner(o.ptr), } runtime.KeepAlive(o) return ret }
[ "func", "(", "o", "*", "Object", ")", "Owner", "(", ")", "*", "Repository", "{", "ret", ":=", "&", "Repository", "{", "ptr", ":", "C", ".", "git_object_owner", "(", "o", ".", "ptr", ")", ",", "}", "\n", "runtime", ".", "KeepAlive", "(", "o", ")", "\n", "return", "ret", "\n", "}" ]
// Owner returns a weak reference to the repository which owns this // object. This won't keep the underlying repository alive.
[ "Owner", "returns", "a", "weak", "reference", "to", "the", "repository", "which", "owns", "this", "object", ".", "This", "won", "t", "keep", "the", "underlying", "repository", "alive", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/object.go#L82-L88
151,189
libgit2/git2go
odb.go
NewReadStream
func (v *Odb) NewReadStream(id *Oid) (*OdbReadStream, error) { stream := new(OdbReadStream) var ctype C.git_object_t var csize C.size_t runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_odb_open_rstream(&stream.ptr, &csize, &ctype, v.ptr, id.toC()) runtime.KeepAlive(v) runtime.KeepAlive(id) if ret < 0 { return nil, MakeGitError(ret) } stream.Size = uint64(csize) stream.Type = ObjectType(ctype) runtime.SetFinalizer(stream, (*OdbReadStream).Free) return stream, nil }
go
func (v *Odb) NewReadStream(id *Oid) (*OdbReadStream, error) { stream := new(OdbReadStream) var ctype C.git_object_t var csize C.size_t runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_odb_open_rstream(&stream.ptr, &csize, &ctype, v.ptr, id.toC()) runtime.KeepAlive(v) runtime.KeepAlive(id) if ret < 0 { return nil, MakeGitError(ret) } stream.Size = uint64(csize) stream.Type = ObjectType(ctype) runtime.SetFinalizer(stream, (*OdbReadStream).Free) return stream, nil }
[ "func", "(", "v", "*", "Odb", ")", "NewReadStream", "(", "id", "*", "Oid", ")", "(", "*", "OdbReadStream", ",", "error", ")", "{", "stream", ":=", "new", "(", "OdbReadStream", ")", "\n", "var", "ctype", "C", ".", "git_object_t", "\n", "var", "csize", "C", ".", "size_t", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_odb_open_rstream", "(", "&", "stream", ".", "ptr", ",", "&", "csize", ",", "&", "ctype", ",", "v", ".", "ptr", ",", "id", ".", "toC", "(", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "v", ")", "\n", "runtime", ".", "KeepAlive", "(", "id", ")", "\n", "if", "ret", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "stream", ".", "Size", "=", "uint64", "(", "csize", ")", "\n", "stream", ".", "Type", "=", "ObjectType", "(", "ctype", ")", "\n", "runtime", ".", "SetFinalizer", "(", "stream", ",", "(", "*", "OdbReadStream", ")", ".", "Free", ")", "\n", "return", "stream", ",", "nil", "\n", "}" ]
// NewReadStream opens a read stream from the ODB. Reading from it will give you the // contents of the object.
[ "NewReadStream", "opens", "a", "read", "stream", "from", "the", "ODB", ".", "Reading", "from", "it", "will", "give", "you", "the", "contents", "of", "the", "object", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/odb.go#L194-L213
151,190
libgit2/git2go
odb.go
NewWriteStream
func (v *Odb) NewWriteStream(size int64, otype ObjectType) (*OdbWriteStream, error) { stream := new(OdbWriteStream) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_odb_open_wstream(&stream.ptr, v.ptr, C.git_off_t(size), C.git_object_t(otype)) runtime.KeepAlive(v) if ret < 0 { return nil, MakeGitError(ret) } runtime.SetFinalizer(stream, (*OdbWriteStream).Free) return stream, nil }
go
func (v *Odb) NewWriteStream(size int64, otype ObjectType) (*OdbWriteStream, error) { stream := new(OdbWriteStream) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_odb_open_wstream(&stream.ptr, v.ptr, C.git_off_t(size), C.git_object_t(otype)) runtime.KeepAlive(v) if ret < 0 { return nil, MakeGitError(ret) } runtime.SetFinalizer(stream, (*OdbWriteStream).Free) return stream, nil }
[ "func", "(", "v", "*", "Odb", ")", "NewWriteStream", "(", "size", "int64", ",", "otype", "ObjectType", ")", "(", "*", "OdbWriteStream", ",", "error", ")", "{", "stream", ":=", "new", "(", "OdbWriteStream", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_odb_open_wstream", "(", "&", "stream", ".", "ptr", ",", "v", ".", "ptr", ",", "C", ".", "git_off_t", "(", "size", ")", ",", "C", ".", "git_object_t", "(", "otype", ")", ")", "\n", "runtime", ".", "KeepAlive", "(", "v", ")", "\n", "if", "ret", "<", "0", "{", "return", "nil", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "runtime", ".", "SetFinalizer", "(", "stream", ",", "(", "*", "OdbWriteStream", ")", ".", "Free", ")", "\n", "return", "stream", ",", "nil", "\n", "}" ]
// NewWriteStream opens a write stream to the ODB, which allows you to // create a new object in the database. The size and type must be // known in advance
[ "NewWriteStream", "opens", "a", "write", "stream", "to", "the", "ODB", "which", "allows", "you", "to", "create", "a", "new", "object", "in", "the", "database", ".", "The", "size", "and", "type", "must", "be", "known", "in", "advance" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/odb.go#L218-L232
151,191
libgit2/git2go
odb.go
Data
func (object *OdbObject) Data() (data []byte) { var c_blob unsafe.Pointer = C.git_odb_object_data(object.ptr) var blob []byte len := int(C.git_odb_object_size(object.ptr)) sliceHeader := (*reflect.SliceHeader)((unsafe.Pointer(&blob))) sliceHeader.Cap = len sliceHeader.Len = len sliceHeader.Data = uintptr(c_blob) return blob }
go
func (object *OdbObject) Data() (data []byte) { var c_blob unsafe.Pointer = C.git_odb_object_data(object.ptr) var blob []byte len := int(C.git_odb_object_size(object.ptr)) sliceHeader := (*reflect.SliceHeader)((unsafe.Pointer(&blob))) sliceHeader.Cap = len sliceHeader.Len = len sliceHeader.Data = uintptr(c_blob) return blob }
[ "func", "(", "object", "*", "OdbObject", ")", "Data", "(", ")", "(", "data", "[", "]", "byte", ")", "{", "var", "c_blob", "unsafe", ".", "Pointer", "=", "C", ".", "git_odb_object_data", "(", "object", ".", "ptr", ")", "\n", "var", "blob", "[", "]", "byte", "\n\n", "len", ":=", "int", "(", "C", ".", "git_odb_object_size", "(", "object", ".", "ptr", ")", ")", "\n\n", "sliceHeader", ":=", "(", "*", "reflect", ".", "SliceHeader", ")", "(", "(", "unsafe", ".", "Pointer", "(", "&", "blob", ")", ")", ")", "\n", "sliceHeader", ".", "Cap", "=", "len", "\n", "sliceHeader", ".", "Len", "=", "len", "\n", "sliceHeader", ".", "Data", "=", "uintptr", "(", "c_blob", ")", "\n\n", "return", "blob", "\n", "}" ]
// Data returns a slice pointing to the unmanaged object memory. You must make // sure the object is referenced for at least as long as the slice is used.
[ "Data", "returns", "a", "slice", "pointing", "to", "the", "unmanaged", "object", "memory", ".", "You", "must", "make", "sure", "the", "object", "is", "referenced", "for", "at", "least", "as", "long", "as", "the", "slice", "is", "used", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/odb.go#L267-L279
151,192
libgit2/git2go
odb.go
Read
func (stream *OdbReadStream) Read(data []byte) (int, error) { header := (*reflect.SliceHeader)(unsafe.Pointer(&data)) ptr := (*C.char)(unsafe.Pointer(header.Data)) size := C.size_t(header.Cap) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_odb_stream_read(stream.ptr, ptr, size) runtime.KeepAlive(stream) if ret < 0 { return 0, MakeGitError(ret) } if ret == 0 { return 0, io.EOF } header.Len = int(ret) return len(data), nil }
go
func (stream *OdbReadStream) Read(data []byte) (int, error) { header := (*reflect.SliceHeader)(unsafe.Pointer(&data)) ptr := (*C.char)(unsafe.Pointer(header.Data)) size := C.size_t(header.Cap) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_odb_stream_read(stream.ptr, ptr, size) runtime.KeepAlive(stream) if ret < 0 { return 0, MakeGitError(ret) } if ret == 0 { return 0, io.EOF } header.Len = int(ret) return len(data), nil }
[ "func", "(", "stream", "*", "OdbReadStream", ")", "Read", "(", "data", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "header", ":=", "(", "*", "reflect", ".", "SliceHeader", ")", "(", "unsafe", ".", "Pointer", "(", "&", "data", ")", ")", "\n", "ptr", ":=", "(", "*", "C", ".", "char", ")", "(", "unsafe", ".", "Pointer", "(", "header", ".", "Data", ")", ")", "\n", "size", ":=", "C", ".", "size_t", "(", "header", ".", "Cap", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_odb_stream_read", "(", "stream", ".", "ptr", ",", "ptr", ",", "size", ")", "\n", "runtime", ".", "KeepAlive", "(", "stream", ")", "\n", "if", "ret", "<", "0", "{", "return", "0", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n", "if", "ret", "==", "0", "{", "return", "0", ",", "io", ".", "EOF", "\n", "}", "\n\n", "header", ".", "Len", "=", "int", "(", "ret", ")", "\n\n", "return", "len", "(", "data", ")", ",", "nil", "\n", "}" ]
// Read reads from the stream
[ "Read", "reads", "from", "the", "stream" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/odb.go#L288-L308
151,193
libgit2/git2go
odb.go
Write
func (stream *OdbWriteStream) Write(data []byte) (int, error) { header := (*reflect.SliceHeader)(unsafe.Pointer(&data)) ptr := (*C.char)(unsafe.Pointer(header.Data)) size := C.size_t(header.Len) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_odb_stream_write(stream.ptr, ptr, size) runtime.KeepAlive(stream) if ret < 0 { return 0, MakeGitError(ret) } return len(data), nil }
go
func (stream *OdbWriteStream) Write(data []byte) (int, error) { header := (*reflect.SliceHeader)(unsafe.Pointer(&data)) ptr := (*C.char)(unsafe.Pointer(header.Data)) size := C.size_t(header.Len) runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_odb_stream_write(stream.ptr, ptr, size) runtime.KeepAlive(stream) if ret < 0 { return 0, MakeGitError(ret) } return len(data), nil }
[ "func", "(", "stream", "*", "OdbWriteStream", ")", "Write", "(", "data", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "header", ":=", "(", "*", "reflect", ".", "SliceHeader", ")", "(", "unsafe", ".", "Pointer", "(", "&", "data", ")", ")", "\n", "ptr", ":=", "(", "*", "C", ".", "char", ")", "(", "unsafe", ".", "Pointer", "(", "header", ".", "Data", ")", ")", "\n", "size", ":=", "C", ".", "size_t", "(", "header", ".", "Len", ")", "\n\n", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_odb_stream_write", "(", "stream", ".", "ptr", ",", "ptr", ",", "size", ")", "\n", "runtime", ".", "KeepAlive", "(", "stream", ")", "\n", "if", "ret", "<", "0", "{", "return", "0", ",", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "len", "(", "data", ")", ",", "nil", "\n", "}" ]
// Write writes to the stream
[ "Write", "writes", "to", "the", "stream" ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/odb.go#L327-L342
151,194
libgit2/git2go
odb.go
Close
func (stream *OdbWriteStream) Close() error { runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_odb_stream_finalize_write(stream.Id.toC(), stream.ptr) runtime.KeepAlive(stream) if ret < 0 { return MakeGitError(ret) } return nil }
go
func (stream *OdbWriteStream) Close() error { runtime.LockOSThread() defer runtime.UnlockOSThread() ret := C.git_odb_stream_finalize_write(stream.Id.toC(), stream.ptr) runtime.KeepAlive(stream) if ret < 0 { return MakeGitError(ret) } return nil }
[ "func", "(", "stream", "*", "OdbWriteStream", ")", "Close", "(", ")", "error", "{", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "ret", ":=", "C", ".", "git_odb_stream_finalize_write", "(", "stream", ".", "Id", ".", "toC", "(", ")", ",", "stream", ".", "ptr", ")", "\n", "runtime", ".", "KeepAlive", "(", "stream", ")", "\n", "if", "ret", "<", "0", "{", "return", "MakeGitError", "(", "ret", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// Close signals that all the data has been written and stores the // resulting object id in the stream's Id field.
[ "Close", "signals", "that", "all", "the", "data", "has", "been", "written", "and", "stores", "the", "resulting", "object", "id", "in", "the", "stream", "s", "Id", "field", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/odb.go#L346-L357
151,195
libgit2/git2go
credentials.go
NewCredSshKey
func NewCredSshKey(username string, publicKeyPath string, privateKeyPath string, passphrase string) (int, Cred) { cred := Cred{} cusername := C.CString(username) defer C.free(unsafe.Pointer(cusername)) cpublickey := C.CString(publicKeyPath) defer C.free(unsafe.Pointer(cpublickey)) cprivatekey := C.CString(privateKeyPath) defer C.free(unsafe.Pointer(cprivatekey)) cpassphrase := C.CString(passphrase) defer C.free(unsafe.Pointer(cpassphrase)) ret := C.git_cred_ssh_key_new(&cred.ptr, cusername, cpublickey, cprivatekey, cpassphrase) return int(ret), cred }
go
func NewCredSshKey(username string, publicKeyPath string, privateKeyPath string, passphrase string) (int, Cred) { cred := Cred{} cusername := C.CString(username) defer C.free(unsafe.Pointer(cusername)) cpublickey := C.CString(publicKeyPath) defer C.free(unsafe.Pointer(cpublickey)) cprivatekey := C.CString(privateKeyPath) defer C.free(unsafe.Pointer(cprivatekey)) cpassphrase := C.CString(passphrase) defer C.free(unsafe.Pointer(cpassphrase)) ret := C.git_cred_ssh_key_new(&cred.ptr, cusername, cpublickey, cprivatekey, cpassphrase) return int(ret), cred }
[ "func", "NewCredSshKey", "(", "username", "string", ",", "publicKeyPath", "string", ",", "privateKeyPath", "string", ",", "passphrase", "string", ")", "(", "int", ",", "Cred", ")", "{", "cred", ":=", "Cred", "{", "}", "\n", "cusername", ":=", "C", ".", "CString", "(", "username", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cusername", ")", ")", "\n", "cpublickey", ":=", "C", ".", "CString", "(", "publicKeyPath", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cpublickey", ")", ")", "\n", "cprivatekey", ":=", "C", ".", "CString", "(", "privateKeyPath", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cprivatekey", ")", ")", "\n", "cpassphrase", ":=", "C", ".", "CString", "(", "passphrase", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cpassphrase", ")", ")", "\n", "ret", ":=", "C", ".", "git_cred_ssh_key_new", "(", "&", "cred", ".", "ptr", ",", "cusername", ",", "cpublickey", ",", "cprivatekey", ",", "cpassphrase", ")", "\n", "return", "int", "(", "ret", ")", ",", "cred", "\n", "}" ]
// NewCredSshKey creates new ssh credentials reading the public and private keys // from the file system.
[ "NewCredSshKey", "creates", "new", "ssh", "credentials", "reading", "the", "public", "and", "private", "keys", "from", "the", "file", "system", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/credentials.go#L49-L61
151,196
libgit2/git2go
credentials.go
NewCredSshKeyFromMemory
func NewCredSshKeyFromMemory(username string, publicKey string, privateKey string, passphrase string) (int, Cred) { cred := Cred{} cusername := C.CString(username) defer C.free(unsafe.Pointer(cusername)) cpublickey := C.CString(publicKey) defer C.free(unsafe.Pointer(cpublickey)) cprivatekey := C.CString(privateKey) defer C.free(unsafe.Pointer(cprivatekey)) cpassphrase := C.CString(passphrase) defer C.free(unsafe.Pointer(cpassphrase)) ret := C.git_cred_ssh_key_memory_new(&cred.ptr, cusername, cpublickey, cprivatekey, cpassphrase) return int(ret), cred }
go
func NewCredSshKeyFromMemory(username string, publicKey string, privateKey string, passphrase string) (int, Cred) { cred := Cred{} cusername := C.CString(username) defer C.free(unsafe.Pointer(cusername)) cpublickey := C.CString(publicKey) defer C.free(unsafe.Pointer(cpublickey)) cprivatekey := C.CString(privateKey) defer C.free(unsafe.Pointer(cprivatekey)) cpassphrase := C.CString(passphrase) defer C.free(unsafe.Pointer(cpassphrase)) ret := C.git_cred_ssh_key_memory_new(&cred.ptr, cusername, cpublickey, cprivatekey, cpassphrase) return int(ret), cred }
[ "func", "NewCredSshKeyFromMemory", "(", "username", "string", ",", "publicKey", "string", ",", "privateKey", "string", ",", "passphrase", "string", ")", "(", "int", ",", "Cred", ")", "{", "cred", ":=", "Cred", "{", "}", "\n", "cusername", ":=", "C", ".", "CString", "(", "username", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cusername", ")", ")", "\n", "cpublickey", ":=", "C", ".", "CString", "(", "publicKey", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cpublickey", ")", ")", "\n", "cprivatekey", ":=", "C", ".", "CString", "(", "privateKey", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cprivatekey", ")", ")", "\n", "cpassphrase", ":=", "C", ".", "CString", "(", "passphrase", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cpassphrase", ")", ")", "\n", "ret", ":=", "C", ".", "git_cred_ssh_key_memory_new", "(", "&", "cred", ".", "ptr", ",", "cusername", ",", "cpublickey", ",", "cprivatekey", ",", "cpassphrase", ")", "\n", "return", "int", "(", "ret", ")", ",", "cred", "\n", "}" ]
// NewCredSshKeyFromMemory creates new ssh credentials using the publicKey and privateKey // arguments as the values for the public and private keys.
[ "NewCredSshKeyFromMemory", "creates", "new", "ssh", "credentials", "using", "the", "publicKey", "and", "privateKey", "arguments", "as", "the", "values", "for", "the", "public", "and", "private", "keys", "." ]
bf1e8a4338822ad2539a3876f58b15b590eb9e1f
https://github.com/libgit2/git2go/blob/bf1e8a4338822ad2539a3876f58b15b590eb9e1f/credentials.go#L65-L77
151,197
uber-go/fx
shutdown.go
Shutdown
func (s *shutdowner) Shutdown(opts ...ShutdownOption) error { return s.app.broadcastSignal(syscall.SIGTERM) }
go
func (s *shutdowner) Shutdown(opts ...ShutdownOption) error { return s.app.broadcastSignal(syscall.SIGTERM) }
[ "func", "(", "s", "*", "shutdowner", ")", "Shutdown", "(", "opts", "...", "ShutdownOption", ")", "error", "{", "return", "s", ".", "app", ".", "broadcastSignal", "(", "syscall", ".", "SIGTERM", ")", "\n", "}" ]
// Shutdown broadcasts a signal to all of the application's Done channels // and begins the Stop process.
[ "Shutdown", "broadcasts", "a", "signal", "to", "all", "of", "the", "application", "s", "Done", "channels", "and", "begins", "the", "Stop", "process", "." ]
544d97a6e020226621cefffcbc38a9e2d320584c
https://github.com/uber-go/fx/blob/544d97a6e020226621cefffcbc38a9e2d320584c/shutdown.go#L49-L51
151,198
uber-go/fx
internal/lifecycle/lifecycle.go
New
func New(logger *fxlog.Logger) *Lifecycle { if logger == nil { logger = fxlog.New() } return &Lifecycle{logger: logger} }
go
func New(logger *fxlog.Logger) *Lifecycle { if logger == nil { logger = fxlog.New() } return &Lifecycle{logger: logger} }
[ "func", "New", "(", "logger", "*", "fxlog", ".", "Logger", ")", "*", "Lifecycle", "{", "if", "logger", "==", "nil", "{", "logger", "=", "fxlog", ".", "New", "(", ")", "\n", "}", "\n", "return", "&", "Lifecycle", "{", "logger", ":", "logger", "}", "\n", "}" ]
// New constructs a new Lifecycle.
[ "New", "constructs", "a", "new", "Lifecycle", "." ]
544d97a6e020226621cefffcbc38a9e2d320584c
https://github.com/uber-go/fx/blob/544d97a6e020226621cefffcbc38a9e2d320584c/internal/lifecycle/lifecycle.go#L47-L52
151,199
uber-go/fx
internal/lifecycle/lifecycle.go
Append
func (l *Lifecycle) Append(hook Hook) { hook.caller = fxreflect.Caller() l.hooks = append(l.hooks, hook) }
go
func (l *Lifecycle) Append(hook Hook) { hook.caller = fxreflect.Caller() l.hooks = append(l.hooks, hook) }
[ "func", "(", "l", "*", "Lifecycle", ")", "Append", "(", "hook", "Hook", ")", "{", "hook", ".", "caller", "=", "fxreflect", ".", "Caller", "(", ")", "\n", "l", ".", "hooks", "=", "append", "(", "l", ".", "hooks", ",", "hook", ")", "\n", "}" ]
// Append adds a Hook to the lifecycle.
[ "Append", "adds", "a", "Hook", "to", "the", "lifecycle", "." ]
544d97a6e020226621cefffcbc38a9e2d320584c
https://github.com/uber-go/fx/blob/544d97a6e020226621cefffcbc38a9e2d320584c/internal/lifecycle/lifecycle.go#L55-L58