@@ -22,7 +22,7 @@ func GetFullCommitSha(repoPath, shortID string) (string, error) {
2222
2323// LastCommitForPath returns the last commit which modified path for given revision.
2424func LastCommitForPath (repoPath , revision string , path string ) (string , error ) {
25- cmd := exec .Command ("bash" , "-c" , "git log --pretty=%H --max-count=1 " + revision + " -- \" " + path + "\" " )
25+ cmd := exec .Command ("bash" , "-c" , "git log --pretty=%H --max-count=1 " + revision + " -- \" " + strings . ReplaceAll ( path , " \" " , " \\ \" " ) + "\" " )
2626 cmd .Dir = repoPath
2727 out , err := cmd .Output ()
2828 if err != nil {
@@ -34,7 +34,7 @@ func LastCommitForPath(repoPath, revision string, path string) (string, error) {
3434
3535// CommitHistory returns the commit history for given revision or path.
3636func CommitHistory (repoPath , revision string , path string , offset int , limit int ) ([]string , error ) {
37- cmd := exec .Command ("bash" , "-c" , "git log --pretty=%H --max-count=" + strconv .Itoa (limit )+ " --skip=" + strconv .Itoa (offset )+ " " + revision + " -- " + path )
37+ cmd := exec .Command ("bash" , "-c" , "git log --pretty=%H --max-count=" + strconv .Itoa (limit )+ " --skip=" + strconv .Itoa (offset )+ " " + revision + " -- \" " + strings . ReplaceAll ( path , " \" " , " \\ \" " ) + " \" " )
3838 cmd .Dir = repoPath
3939 out , err := cmd .Output ()
4040 if err != nil {
@@ -50,7 +50,7 @@ func CommitHistory(repoPath, revision string, path string, offset int, limit int
5050
5151// CountCommits returns total count of commits.
5252func CountCommits (repoPath , revision string , path string ) (string , error ) {
53- cmd := exec .Command ("bash" , "-c" , "git rev-list --count " + revision + " -- " + path )
53+ cmd := exec .Command ("bash" , "-c" , "git rev-list --count " + revision + " -- \" " + strings . ReplaceAll ( path , " \" " , " \\ \" " ) + " \" " )
5454 cmd .Dir = repoPath
5555 out , err := cmd .Output ()
5656 if err != nil {
0 commit comments