@@ -201,23 +201,23 @@ pub fn (mut app App) handle_new_repo(mut ctx Context, name string, clone_url str
201201 ctx.error ('The repository name is too long (should be fewer than ${max_repo_name_len} characters)' )
202202 return app.new (mut ctx)
203203 }
204- println (1 )
204+ eprintln (1 )
205205 if _ := app.find_repo_by_name_and_username (name, ctx.user.username) {
206206 ctx.error ('A repository with the name "${name} " already exists' )
207207 return app.new (mut ctx)
208208 }
209- println (2 )
209+ eprintln (2 )
210210 if name.contains (' ' ) {
211211 ctx.error ('Repository name cannot contain spaces' )
212212 return app.new (mut ctx)
213213 }
214- println (3 )
214+ eprintln (3 )
215215 is_repo_name_valid := validation.is_repository_name_valid (name)
216216 if ! is_repo_name_valid {
217217 ctx.error ('The repository name is not valid' )
218218 return app.new (mut ctx)
219219 }
220- println (4 )
220+ eprintln (4 )
221221 has_clone_url_https_prefix := clone_url.starts_with ('https://' )
222222 if ! is_clone_url_empty {
223223 if ! has_clone_url_https_prefix {
@@ -253,7 +253,8 @@ pub fn (mut app App) handle_new_repo(mut ctx Context, name string, clone_url str
253253 app.debug ('cloning' )
254254 // t := time.now()
255255
256- spawn app.foo (mut new_repo)
256+ new_repo.status = .cloning
257+ spawn app.clone_repo (mut new_repo)
257258 // new_repo.clone()
258259 // println(time.since(t))
259260 }
@@ -292,21 +293,30 @@ pub fn (mut app App) handle_new_repo(mut ctx Context, name string, clone_url str
292293 if ! has_first_repo_activity {
293294 app.add_activity (ctx.user.id, 'first_repo' ) or { app.info (err.str ()) }
294295 }
295- return ctx.redirect ('/${ctx.user.username} /repos ' )
296+ return ctx.redirect ('/${ctx.user.username} /${new_repo.name} ' )
296297}
297298
298- pub fn (mut app App) foo (mut new_repo Repo) {
299+ pub fn (mut app App) clone_repo (mut new_repo Repo) {
299300 new_repo.clone ()
300301 app.debug ('cloning done' )
301302 app.update_repo_from_fs (mut new_repo) or {}
303+ app.set_repo_status (new_repo.id, .done) or {}
302304 // git.clone(valid_clone_url, repo_path)
303305}
304306
307+ pub fn (mut app App) kekw (mut ctx Context) veb.Result {
308+ return $veb.html ('templates/cloning_in_process.html' )
309+ }
310+
305311@['/:username/:repo_name/tree/:branch_name/:path...' ]
306312pub fn (mut app App) tree (mut ctx Context, username string , repo_name string , branch_name string , path string ) veb.Result {
307313 mut repo := app.find_repo_by_name_and_username (repo_name, username) or {
308314 return ctx.not_found ()
309315 }
316+ eprintln ('!!! REPO STATUS = ${repo.status} ' )
317+ if repo.status == .cloning {
318+ return $veb.html ('templates/cloning_in_process.html' )
319+ }
310320
311321 _ , user := app.check_username (username)
312322 if ! repo.is_public {
0 commit comments