Conversation
|
@jsoref this pull request has failed checks 🛠 |
Codecov Report
@@ Coverage Diff @@
## master #949 +/- ##
==========================================
+ Coverage 49.27% 57.03% +7.76%
==========================================
Files 23 32 +9
Lines 2401 4632 +2231
==========================================
+ Hits 1183 2642 +1459
- Misses 1090 1767 +677
- Partials 128 223 +95
Continue to review full report at Codecov.
|
|
PR is stale and will be closed in 14 days unless there is new activity |
ChristopherHX
left a comment
There was a problem hiding this comment.
Thanks, but I cannot approve this yet. Waiting for other maintainers to have a look.
| linkName, err = os.Readlink(file) | ||
| _, err := os.Readlink(file) |
There was a problem hiding this comment.
Althought this change made the linter happy, it is a bad idea to skip assigning linkName.
var err error before linkName, err = os.Readlink(file), would still assign linkName.
Not assigning linkName here, breaks the whole symlink handling of act and all symlinks ends up pointing to itself.
[main.yml/test] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/1] user= workdir=
| total 14488
| drwxr-xr-x 3 root root 4096 Feb 2 15:37 .
| drwxr-xr-x 3 root root 4096 Feb 2 15:37 ..
| drwxr-xr-x 3 root root 4096 Feb 2 15:37 .github
| -rwxrwxrwx 1 1000 1000 14819328 Feb 2 15:35 act
| -rwxrwxrwx 1 1000 1000 5 Feb 2 15:37 atc
| lrwxrwxrwx 1 1000 1000 8 Feb 2 15:37 main.yml -> main.yml
Symlink main.yml does actually point to .github/workflows/main.yml and not to itself.
No CI test detected that defect, we need better tests
There was a problem hiding this comment.
I definitely wasn't pleased about the linter nor that I couldn't figure out the need.
Will see about the right change.
| return err | ||
| } | ||
| if useGitIgnore { | ||
| if tryGitIgnore() != nil { |
There was a problem hiding this comment.
What if tryGitIgnore has a partial failure?
e.g. only one file failes, then you may have duplicated entries, since you just continue with the old codepath.
There was a problem hiding this comment.
My hope was to abandon what I had, but thinking about it, I suspect I need to actually reset my stash and that I haven't done that yet.
| walker := object.NewTreeWalker(tree, true, nil) | ||
|
|
||
| for { | ||
| var name string | ||
| name, _, err = walker.Next() |
There was a problem hiding this comment.
So this change no longer copies untracked files at all. I would expect they are still being copied if not ignored.
I use git ls-files -s -o --exclude-standard in my own client, no idea what go-git has for this functionality.
-sprovide file mode bits and include staged changes ( only these file get copied by this PR )-oprovide untracked files--exclude-standardremove ignored untracked files from the output.
There was a problem hiding this comment.
Oh I forget to write, you have to be very careful if the repository has submodules. My own client need to do this recursively for all submodule objects, I forget this once and ran into my own bug.
There was a problem hiding this comment.
I try very hard to stay very far away from submodules. Indeed, for this, I won't be able to...
I'll try to look tonight, maybe...
|
First of all thank you 😃 I find it hard to review currently, as we don't have tests (at least not much) for that. |
|
That seems reasonable. If you have any preferences about naming, please feel free to provide it before I start. I'm not a big go dev, but so far, the ability to refactor the code here makes me fairly confident that moving it into a distinct file wouldn't be a big deal. |
I have no preference, just give it a start.
It should be straight forward if you stay in the folder (same package). |
|
PR is stale and will be closed in 14 days unless there is new activity |
|
Maybe i'll look again this week... |
So, this is almost certainly not the right fix for #912, but for git oriented projects it does something which would probably be good enough for me anyway. -- Note: I'm not a go dev, so the style here is probably very wrong, it's just an attempt at playing with things. I'm sure I could find the proper go-git function to ask "are you tracked", but I decided to start with the simpler "go ls-files" approach.
Before
After