Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-07-12 01:40:49 +0300
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-07-19 13:08:32 +0300
commit11c9babe1f9e5a3e96a45bed8993d74a1b20c74f (patch)
treea8ba8364b79b124e9257bdbb2c0753ab51d2af44 /internal/helper
parent4fbcb890250f795a583619e3232812fd704924ff (diff)
Implement CommitService.ListFiles
- implement helper.IsValidRef. Use that in commit.ListFiles
Diffstat (limited to 'internal/helper')
-rw-r--r--internal/helper/repo.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/helper/repo.go b/internal/helper/repo.go
index 5d9ecf8ec..de8b2a846 100644
--- a/internal/helper/repo.go
+++ b/internal/helper/repo.go
@@ -71,3 +71,19 @@ func IsGitDirectory(dir string) bool {
return true
}
+
+// IsValidRef checks if a ref in a repo is valid
+func IsValidRef(path, ref string) bool {
+ if path == "" || ref == "" {
+ return false
+ }
+
+ cmd, err := GitCommandReader("--git-dir", path, "log", "-1", ref)
+ if err != nil {
+ return false
+ }
+ defer cmd.Kill()
+ cmd.Stdout, cmd.Stderr, cmd.Stdin = nil, nil, nil
+
+ return cmd.Wait() == nil
+}