aboutsummaryrefslogblamecommitdiffstats
path: root/community/hugo/0001-Remove-git-tests.patch
blob: 0f4eb961709eec5fb2bfea1de8341e7698809926 (plain) (tree)
1
2
3
4
5
6
7
8


                                

                                                        

                          
                                 




                       
                                         
 
                           



                                         
 

                                                     
                                
                                
 

                                                           
                              

  
                                                    
                      





                                             


                               


                                                       













                                                     
 
                                        

                                      

                                                            
                                                                                                 
 

                                           
 
                                            

                            
                                                          

                                                                               
                                                                                                  

                            
                                                          

                                                                                  
                                                                                                  
 






































































                                                                                                                 

                                                        
                      
                          
             
                

















                                                                            
                                          


                                  
                      


                                                             

                                                 


                                  
                      











                                     


                                           




                                             
                      
                                               

                                        



                                   
                      
                                     

                                     

                                         

                                      









                                                                                                                      
 
Upstream: No
Reason: Remove git related tests

diff --git a/hugolib/page_test.go b/hugolib/page_test.go
index 6cf03b8..8e5ae96 100644
--- a/hugolib/page_test.go
+++ b/hugolib/page_test.go
@@ -16,7 +16,6 @@ package hugolib
 import (
 	"fmt"
 	"html/template"
-	"os"
 
 	"github.com/gohugoio/hugo/config"
 
@@ -27,11 +26,8 @@ import (
 	"testing"
 	"time"
 
-	"github.com/gohugoio/hugo/hugofs"
-
 	"github.com/gohugoio/hugo/resources/page"
 	"github.com/gohugoio/hugo/resources/resource"
-	"github.com/spf13/afero"
 	"github.com/spf13/viper"
 
 	qt "github.com/frankban/quicktest"
@@ -772,127 +768,6 @@ func TestPageWithDate(t *testing.T) {
 	checkPageDate(t, p, d)
 }
 
-func TestPageWithLastmodFromGitInfo(t *testing.T) {
-	c := qt.New(t)
-
-	// We need to use the OS fs for this.
-	cfg := viper.New()
-	fs := hugofs.NewFrom(hugofs.Os, cfg)
-	fs.Destination = &afero.MemMapFs{}
-
-	wd, err := os.Getwd()
-	c.Assert(err, qt.IsNil)
-
-	cfg.Set("frontmatter", map[string]interface{}{
-		"lastmod": []string{":git", "lastmod"},
-	})
-	cfg.Set("defaultContentLanguage", "en")
-
-	langConfig := map[string]interface{}{
-		"en": map[string]interface{}{
-			"weight":       1,
-			"languageName": "English",
-			"contentDir":   "content",
-		},
-		"nn": map[string]interface{}{
-			"weight":       2,
-			"languageName": "Nynorsk",
-			"contentDir":   "content_nn",
-		},
-	}
-
-	cfg.Set("languages", langConfig)
-	cfg.Set("enableGitInfo", true)
-
-	cfg.Set("workingDir", filepath.Join(wd, "testsite"))
-
-	b := newTestSitesBuilderFromDepsCfg(t, deps.DepsCfg{Fs: fs, Cfg: cfg}).WithNothingAdded()
-
-	b.Build(BuildCfg{SkipRender: true})
-	h := b.H
-
-	c.Assert(len(h.Sites), qt.Equals, 2)
-
-	enSite := h.Sites[0]
-	c.Assert(len(enSite.RegularPages()), qt.Equals, 1)
-
-	// 2018-03-11 is the Git author date for testsite/content/first-post.md
-	c.Assert(enSite.RegularPages()[0].Lastmod().Format("2006-01-02"), qt.Equals, "2018-03-11")
-
-	nnSite := h.Sites[1]
-	c.Assert(len(nnSite.RegularPages()), qt.Equals, 1)
-
-	// 2018-08-11 is the Git author date for testsite/content_nn/first-post.md
-	c.Assert(nnSite.RegularPages()[0].Lastmod().Format("2006-01-02"), qt.Equals, "2018-08-11")
-
-}
-
-func TestPageWithFrontMatterConfig(t *testing.T) {
-	for _, dateHandler := range []string{":filename", ":fileModTime"} {
-		dateHandler := dateHandler
-		t.Run(fmt.Sprintf("dateHandler=%q", dateHandler), func(t *testing.T) {
-			t.Parallel()
-			c := qt.New(t)
-			cfg, fs := newTestCfg()
-
-			pageTemplate := `
----
-title: Page
-weight: %d
-lastMod: 2018-02-28
-%s
----
-Content
-`
-
-			cfg.Set("frontmatter", map[string]interface{}{
-				"date": []string{dateHandler, "date"},
-			})
-
-			c1 := filepath.Join("content", "section", "2012-02-21-noslug.md")
-			c2 := filepath.Join("content", "section", "2012-02-22-slug.md")
-
-			writeSource(t, fs, c1, fmt.Sprintf(pageTemplate, 1, ""))
-			writeSource(t, fs, c2, fmt.Sprintf(pageTemplate, 2, "slug: aslug"))
-
-			c1fi, err := fs.Source.Stat(c1)
-			c.Assert(err, qt.IsNil)
-			c2fi, err := fs.Source.Stat(c2)
-			c.Assert(err, qt.IsNil)
-
-			b := newTestSitesBuilderFromDepsCfg(t, deps.DepsCfg{Fs: fs, Cfg: cfg}).WithNothingAdded()
-			b.Build(BuildCfg{SkipRender: true})
-
-			s := b.H.Sites[0]
-			c.Assert(len(s.RegularPages()), qt.Equals, 2)
-
-			noSlug := s.RegularPages()[0]
-			slug := s.RegularPages()[1]
-
-			c.Assert(noSlug.Lastmod().Day(), qt.Equals, 28)
-
-			switch strings.ToLower(dateHandler) {
-			case ":filename":
-				c.Assert(noSlug.Date().IsZero(), qt.Equals, false)
-				c.Assert(slug.Date().IsZero(), qt.Equals, false)
-				c.Assert(noSlug.Date().Year(), qt.Equals, 2012)
-				c.Assert(slug.Date().Year(), qt.Equals, 2012)
-				c.Assert(noSlug.Slug(), qt.Equals, "noslug")
-				c.Assert(slug.Slug(), qt.Equals, "aslug")
-			case ":filemodtime":
-				c.Assert(noSlug.Date().Year(), qt.Equals, c1fi.ModTime().Year())
-				c.Assert(slug.Date().Year(), qt.Equals, c2fi.ModTime().Year())
-				fallthrough
-			default:
-				c.Assert(noSlug.Slug(), qt.Equals, "")
-				c.Assert(slug.Slug(), qt.Equals, "aslug")
-
-			}
-		})
-	}
-
-}
-
 func TestWordCountWithAllCJKRunesWithoutHasCJKLanguage(t *testing.T) {
 	t.Parallel()
 	assertFunc := func(t *testing.T, ext string, pages page.Pages) {
diff --git a/releaser/git_test.go b/releaser/git_test.go
deleted file mode 100644
index 1c5f788..0000000
--- a/releaser/git_test.go
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2017-present The Hugo Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package releaser
-
-import (
-	"testing"
-
-	qt "github.com/frankban/quicktest"
-)
-
-func TestGitInfos(t *testing.T) {
-	c := qt.New(t)
-	skipIfCI(t)
-	infos, err := getGitInfos("v0.20", "hugo", "", false)
-
-	c.Assert(err, qt.IsNil)
-	c.Assert(len(infos) > 0, qt.Equals, true)
-}
-
-func TestIssuesRe(t *testing.T) {
-	c := qt.New(t)
-
-	body := `
-This is a commit message.
-
-Updates #123
-Fix #345
-closes #543
-See #456
-	`
-
-	issues := extractIssues(body)
-
-	c.Assert(len(issues), qt.Equals, 4)
-	c.Assert(issues[0], qt.Equals, 123)
-	c.Assert(issues[2], qt.Equals, 543)
-
-}
-
-func TestGitVersionTagBefore(t *testing.T) {
-	skipIfCI(t)
-	c := qt.New(t)
-	v1, err := gitVersionTagBefore("v0.18")
-	c.Assert(err, qt.IsNil)
-	c.Assert(v1, qt.Equals, "v0.17")
-}
-
-func TestTagExists(t *testing.T) {
-	skipIfCI(t)
-	c := qt.New(t)
-	b1, err := tagExists("v0.18")
-	c.Assert(err, qt.IsNil)
-	c.Assert(b1, qt.Equals, true)
-
-	b2, err := tagExists("adfagdsfg")
-	c.Assert(err, qt.IsNil)
-	c.Assert(b2, qt.Equals, false)
-
-}
-
-func skipIfCI(t *testing.T) {
-	if isCI() {
-		// Travis has an ancient git with no --invert-grep: https://github.com/travis-ci/travis-ci/issues/6328
-		// Also Travis clones very shallowly, making some of the tests above shaky.
-		t.Skip("Skip git test on Linux to make Travis happy.")
-	}
-}