~edwargix/git.sr.ht

3e6435b4e21c4f8bc5ae65363bb7c313be9713a2 — Drew DeVault 5 years ago 4599042
gitsrht-shell: increase precision of error branch

Errors other than no rows in set (e.g. I/O timeout) would be treated as
a non-existent repository, which may not in fact be the case. This could
lead to auto-creation kicking in and making duplicate repositories,
breaking the database invariants.
1 files changed, 4 insertions(+), 1 deletions(-)

M gitsrht-shell/main.go
M gitsrht-shell/main.go => gitsrht-shell/main.go +4 -1
@@ 231,7 231,7 @@ func main() {

		if err := row.Scan(&repoId, &repoName, &repoOwnerId, &repoOwnerName,
			&repoVisibility, &pusherType, &pusherSuspendNotice,
			&accessGrant); err != nil {
			&accessGrant); err == sql.ErrNoRows {

			logger.Printf("Lookup failed: %v", err)



@@ 312,6 312,9 @@ func main() {

				logger.Printf("Autocreated repo %s", path)
			}
		} else if err != nil {
			log.Println("A temporary error has occured. Please try again.")
			logger.Fatal("Error occured looking up repo: %v", err)
		} else {
			log.Printf("\033[93mNOTICE\033[0m: This repository has moved.")
			log.Printf("Please update your remote to:")