summaryrefslogtreecommitdiffstats
path: root/modules/git/commit.go
diff options
context:
space:
mode:
authorMario Lubenka <mario.lubenka@googlemail.com>2019-10-04 21:58:54 +0200
committertechknowlogick <techknowlogick@gitea.io>2019-10-04 15:58:54 -0400
commitf92a0b68fed81128fa278e82aa0e3d49d74ffdf6 (patch)
tree41a6a7cd2a8a6153046851b5ab3a9c5aacb0cdfd /modules/git/commit.go
parentde8a0a3938e811ffaa6800a771d7f09fd6428608 (diff)
downloadgitea-f92a0b68fed81128fa278e82aa0e3d49d74ffdf6.tar.gz
gitea-f92a0b68fed81128fa278e82aa0e3d49d74ffdf6.zip
Bugfix for image compare and minor improvements to image compare (#8289)
* Resolve error when comparing images Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Check blob existence instead of git-ls when checking if file exists Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Show file metadata also when a file was newly added Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Fixes error in commit view Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Excludes assigning path and image infos for compare routers to service package Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Removes nil default and fixes import order Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Adds missing comments Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Moves methods for assigning compare data to context into repo router package Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Show image compare for deleted images as well. Simplify check if image should be displayed Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
Diffstat (limited to 'modules/git/commit.go')
-rw-r--r--modules/git/commit.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/git/commit.go b/modules/git/commit.go
index 83e03c2795..eb442f988d 100644
--- a/modules/git/commit.go
+++ b/modules/git/commit.go
@@ -355,8 +355,11 @@ func (c *Commit) FileChangedSinceCommit(filename, pastCommit string) (bool, erro
// HasFile returns true if the file given exists on this commit
// This does only mean it's there - it does not mean the file was changed during the commit.
func (c *Commit) HasFile(filename string) (bool, error) {
- result, err := c.repo.LsFiles(filename)
- return result[0] == filename, err
+ _, err := c.GetBlobByPath(filename)
+ if err != nil {
+ return false, err
+ }
+ return true, nil
}
// GetSubModules get all the sub modules of current revision git tree