From df30010dbdd2c9479aee292f5759b85143558498 Mon Sep 17 00:00:00 2001
From: John Olheiser <42128690+jolheiser@users.noreply.github.com>
Date: Thu, 21 Feb 2019 16:07:58 -0600
Subject: [PATCH] Make repo creation for API similar to UI (#6142)

---
 routers/api/v1/repo/repo.go | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go
index f69cbee0c0..4156775286 100644
--- a/routers/api/v1/repo/repo.go
+++ b/routers/api/v1/repo/repo.go
@@ -213,6 +213,9 @@ func Search(ctx *context.APIContext) {
 
 // CreateUserRepo create a repository for a user
 func CreateUserRepo(ctx *context.APIContext, owner *models.User, opt api.CreateRepoOption) {
+	if opt.AutoInit && opt.Readme == "" {
+		opt.Readme = "Default"
+	}
 	repo, err := models.CreateRepository(ctx.User, owner, models.CreateRepoOptions{
 		Name:        opt.Name,
 		Description: opt.Description,