@@ -1694,6 +1694,42 @@ func (s *RepositorySuite) TestLogPathRegexpWithError(c *C) {
1694
1694
c .Assert (err , NotNil )
1695
1695
}
1696
1696
1697
+ func (s * RepositorySuite ) TestLogPathFilterRegexp (c * C ) {
1698
+ pathRE := regexp .MustCompile (".*\\ .go" )
1699
+ pathIter := func (path string ) bool {
1700
+ return pathRE .MatchString (path )
1701
+ }
1702
+
1703
+ r , _ := Init (memory .NewStorage (), nil )
1704
+ err := r .clone (context .Background (), & CloneOptions {
1705
+ URL : s .GetBasicLocalRepositoryURL (),
1706
+ })
1707
+ c .Assert (err , IsNil )
1708
+
1709
+ expectedCommitIDs := []string {
1710
+ "6ecf0ef2c2dffb796033e5a02219af86ec6584e5" ,
1711
+ "918c48b83bd081e863dbe1b80f8998f058cd8294" ,
1712
+ }
1713
+ commitIDs := []string {}
1714
+
1715
+ cIter , err := r .Log (& LogOptions {
1716
+ PathFilter : pathIter ,
1717
+ From : plumbing .NewHash ("6ecf0ef2c2dffb796033e5a02219af86ec6584e5" ),
1718
+ })
1719
+ c .Assert (err , IsNil )
1720
+ defer cIter .Close ()
1721
+
1722
+ cIter .ForEach (func (commit * object.Commit ) error {
1723
+ commitIDs = append (commitIDs , commit .ID ().String ())
1724
+ return nil
1725
+ })
1726
+ c .Assert (
1727
+ strings .Join (commitIDs , ", " ),
1728
+ Equals ,
1729
+ strings .Join (expectedCommitIDs , ", " ),
1730
+ )
1731
+ }
1732
+
1697
1733
func (s * RepositorySuite ) TestLogLimitNext (c * C ) {
1698
1734
r , _ := Init (memory .NewStorage (), nil )
1699
1735
err := r .clone (context .Background (), & CloneOptions {
0 commit comments