File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ type Server struct {
56
56
DisableGit bool `long:"no-git" description:"disable the load of git standard repositories."`
57
57
DisableSiva bool `long:"no-siva" description:"disable the load of siva files."`
58
58
Verbose bool `short:"v" description:"Activates the verbose mode"`
59
+ OldUast bool `long:"old-uast-serialization" description:"serialize uast in the old format" env:"GITBASE_UAST_SERIALIZATION"`
59
60
}
60
61
61
62
type jaegerLogrus struct {
@@ -138,12 +139,17 @@ func (c *Server) Execute(args []string) error {
138
139
c .engine ,
139
140
gitbase .NewSessionBuilder (c .pool ,
140
141
gitbase .WithSkipGitErrors (c .SkipGitErrors ),
142
+ gitbase .WithOldUASTSerialization (c .OldUast ),
141
143
),
142
144
)
143
145
if err != nil {
144
146
return err
145
147
}
146
148
149
+ if c .OldUast {
150
+ function .UASTExpressionType = sql .Array (sql .Blob )
151
+ }
152
+
147
153
logrus .Infof ("server started and listening on %s:%d" , c .Host , c .Port )
148
154
return s .Start ()
149
155
}
Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ type Session struct {
25
25
bblfshEndpoint string
26
26
bblfshClient * BblfshClient
27
27
28
- SkipGitErrors bool
28
+ SkipGitErrors bool
29
+ OldUASTSerialization bool
29
30
}
30
31
31
32
// getSession returns the gitbase session from a context or an error if there
@@ -65,6 +66,13 @@ func WithSkipGitErrors(enabled bool) SessionOption {
65
66
}
66
67
}
67
68
69
+ // WithOldUASTSerialization set the way UASTs must be serialized.
70
+ func WithOldUASTSerialization (enabled bool ) SessionOption {
71
+ return func (s * Session ) {
72
+ s .OldUASTSerialization = enabled
73
+ }
74
+ }
75
+
68
76
// NewSession creates a new Session. It requires a repository pool and any
69
77
// number of session options can be passed to configure the session.
70
78
func NewSession (pool * RepositoryPool , opts ... SessionOption ) * Session {
You can’t perform that action at this time.
0 commit comments