|
@@ -303,3 +303,19 @@ func GetCommitFileStatus(repoPath, commitID string) (*CommitFileStatus, error) {
|
|
func (c *Commit) FileStatus() (*CommitFileStatus, error) {
|
|
func (c *Commit) FileStatus() (*CommitFileStatus, error) {
|
|
return GetCommitFileStatus(c.repo.Path, c.ID.String())
|
|
return GetCommitFileStatus(c.repo.Path, c.ID.String())
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func GetFullCommitID(repoPath, shortID string) (string, error) {
|
|
|
|
+ if len(shortID) >= 40 {
|
|
|
|
+ return shortID, nil
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ commitID, err := NewCommand("rev-parse", shortID).RunInDir(repoPath)
|
|
|
|
+ if err != nil {
|
|
|
|
+ if strings.Contains(err.Error(), "exit status 128") {
|
|
|
|
+ return "", ErrNotExist{shortID, ""}
|
|
|
|
+ }
|
|
|
|
+ return "", err
|
|
|
|
+ }
|
|
|
|
+ return strings.TrimSpace(commitID), nil
|
|
|
|
+}
|