aboutsummaryrefslogtreecommitdiff
path: root/modules/git
diff options
context:
space:
mode:
Diffstat (limited to 'modules/git')
-rw-r--r--modules/git/repo_commit.go4
-rw-r--r--modules/git/tree.go7
2 files changed, 10 insertions, 1 deletions
diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go
index 7c47b53d..66d61b9b 100644
--- a/modules/git/repo_commit.go
+++ b/modules/git/repo_commit.go
@@ -275,9 +275,11 @@ func (repo *Repository) searchCommits(id sha1, keyword string) (*list.List, erro
return parsePrettyFormatLog(repo, stdout)
}
+var CommitsRangeSize = 50
+
func (repo *Repository) commitsByRange(id sha1, page int) (*list.List, error) {
stdout, stderr, err := com.ExecCmdDirBytes(repo.Path, "git", "log", id.String(),
- "--skip="+com.ToStr((page-1)*50), "--max-count=50", prettyLogFormat)
+ "--skip="+com.ToStr((page-1)*CommitsRangeSize), "--max-count="+com.ToStr(CommitsRangeSize), prettyLogFormat)
if err != nil {
return nil, errors.New(string(stderr))
}
diff --git a/modules/git/tree.go b/modules/git/tree.go
index be77bfce..27539f06 100644
--- a/modules/git/tree.go
+++ b/modules/git/tree.go
@@ -71,6 +71,13 @@ func parseTreeData(tree *Tree, data []byte) ([]*TreeEntry, error) {
step = bytes.IndexByte(data[pos:], '\n')
entry.name = string(data[pos : pos+step])
+
+ // In case entry name is surrounded by double quotes(it happens only in git-shell).
+ if entry.name[0] == '"' {
+ entry.name = string(data[pos+1 : pos+step-1])
+ entry.name = strings.Replace(entry.name, `\"`, `"`, -1)
+ }
+
pos += step + 1
entries = append(entries, entry)
}