-
Notifications
You must be signed in to change notification settings - Fork 534
object: fix Change.Files() method behavior (fix #317) #324
object: fix Change.Files() method behavior (fix #317) #324
Conversation
Codecov Report
@@ Coverage Diff @@
## master #324 +/- ##
==========================================
+ Coverage 77.35% 77.36% +0.01%
==========================================
Files 117 117
Lines 8015 8019 +4
==========================================
+ Hits 6200 6204 +4
Misses 1156 1156
Partials 659 659
Continue to review full report at Codecov.
|
plumbing/object/change.go
Outdated
@@ -61,6 +70,12 @@ func (c *Change) Files() (from, to *File, err error) { | |||
return | |||
} | |||
|
|||
func isInvalidFileMode(t TreeEntry) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the FileMode methods: https://godoc.org/gopkg.in/src-d/go-git.v4/plumbing/filemode
I think that is this method can be replaced with a call to FileMode.IsRegular()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mcuadros I think FileMode.IsRegular()
doesn't cover all the cases, like executable files. Maybe @alcortesm could bring us some hints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then you have IsFile
. Why the symlink is being skip, is a regular file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alcortesm It's @smola ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol, sorry!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I was confused when we talked this morning.
@ajnavarro Symlinks can be returned by Files()
- If 'from' or 'to' are tree entries that aren't files, Files() method will return nil instead of object not found error. - Added a test checking this using modules fixture.
Uh oh!
There was an error while loading. Please reload this page.