[GH-ISSUE #1158] Issue: .gitignore feature does not take index into account #649

Closed
opened 2026-03-01 21:45:13 +03:00 by kerem · 6 comments
Owner

Originally created by @hakre on GitHub (May 11, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1158

this is a feature request to improve the handling of the patterns within .gitignore file by taking the tracked files into account that are effectively not ignored any longer even if a git-ignore pattern matches their path.

this would allow to not copy ignored files into the container while copying those that are tracked paths of the git repository.

System information

  • Operating System: Linux
  • Architecture: x64 (64-bit)
  • Apple M1: no
  • Docker version: 20.10.5
  • Docker image used in act: shivammathur/node:latest
  • act version: act version 0.2.26

Expected behaviour

if the feature is enabled (default) that the .gitignore prevents copying files into the container, then I'd expect that files that are not ignored by git to be copied into the container as well.

Actual behaviour

files not ignored by git (by the index - not by pattern in the .gitignore) are not copied into the container if there is a line in a .gitignore file that matches the non-ignored file.

Extra

  • setup: basic git 101, .gitignore ignore a file, then git add --force it, commit it to provoke such a scenario. bonus by ignoring a directory in the root and force-add a file much deeper within.
  • workaround: i have no one other than editing the .gitignore file and inverse the pattern (over the tree)
  • context: #193, #537
Originally created by @hakre on GitHub (May 11, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1158 this is a feature request to improve the handling of the patterns within .gitignore file by taking the tracked files into account that are effectively not ignored any longer even if a git-ignore pattern matches their path. this would allow to not copy ignored files into the container while copying those that are tracked paths of the git repository. ## System information - Operating System: Linux - Architecture: x64 (64-bit) - Apple M1: no - Docker version: 20.10.5 - Docker image used in `act`: shivammathur/node:latest - `act` version: act version 0.2.26 ## Expected behaviour if the feature is enabled (default) that the .gitignore prevents copying files into the container, then I'd expect that files that are not ignored by git to be copied into the container as well. ## Actual behaviour files not ignored by git (by the index - not by pattern in the .gitignore) are not copied into the container if there is a line in a .gitignore file that matches the non-ignored file. ## Extra - setup: basic git 101, .gitignore ignore a file, then git add --force it, commit it to provoke such a scenario. bonus by ignoring a directory in the root and force-add a file much deeper within. - workaround: i have no one other than editing the .gitignore file and inverse the pattern (over the tree) - context: #193, #537
kerem 2026-03-01 21:45:13 +03:00
  • closed this issue
  • added the
    kind/bug
    label
Author
Owner

@catthehacker commented on GitHub (May 11, 2022):

Duplicate of #912

<!-- gh-comment-id:1124181405 --> @catthehacker commented on GitHub (May 11, 2022): Duplicate of #912
Author
Owner

@hakre commented on GitHub (May 11, 2022):

@catthehacker ups, didn't find it. if I may expand on this, repository excludes (optionally worktree / git-worktree(1)) and local / user .gitignore (core excludes file) - this just popped in my mind after creating the issue. but then it perhaps also already exists.

<!-- gh-comment-id:1124195965 --> @hakre commented on GitHub (May 11, 2022): @catthehacker ups, didn't find it. if I may expand on this, repository excludes (optionally worktree / git-worktree(1)) and local / user .gitignore (core excludes file) - this just popped in my mind after creating the issue. but then it perhaps also already exists.
Author
Owner

@catthehacker commented on GitHub (May 11, 2022):

worktree: https://github.com/nektos/act/pull/829
core exclude: https://github.com/nektos/act/issues/1000

<!-- gh-comment-id:1124197170 --> @catthehacker commented on GitHub (May 11, 2022): worktree: https://github.com/nektos/act/pull/829 core exclude: https://github.com/nektos/act/issues/1000
Author
Owner

@hakre commented on GitHub (May 11, 2022):

double checked, looks like core.excludesfile setting is missing at least on my test user-wide excluded files from the development setup went into the container. if I read #1000 correctly it is about .git/info/exclude and not core.excludesfile.

regression? or just new? worth filing? (from my perspective yes, but if the go dependency does not support it this is perhaps something for upstream, it does not have the kind of problems worktree has thought)

<!-- gh-comment-id:1124209351 --> @hakre commented on GitHub (May 11, 2022): double checked, looks like core.excludesfile setting is missing at least on my test user-wide excluded files from the development setup went into the container. if I read #1000 correctly it is about `.git/info/exclude` and not `core.excludesfile`. regression? or just new? worth filing? (from my perspective yes, but if the go dependency does not support it this is perhaps something for upstream, it does not have the kind of problems worktree has thought)
Author
Owner

@catthehacker commented on GitHub (May 11, 2022):

make feature request and someone will look at it

<!-- gh-comment-id:1124215749 --> @catthehacker commented on GitHub (May 11, 2022): make [feature request](https://github.com/nektos/act/issues/new?assignees=&labels=kind%2Ffeature-request&template=feature_template.md&title=Enhancement%3A+) and someone will look at it
Author
Owner

@hakre commented on GitHub (Jun 20, 2022):

feature request created in #1160; open for feedback.

<!-- gh-comment-id:1160958560 --> @hakre commented on GitHub (Jun 20, 2022): feature request created in #1160; open for feedback.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#649
No description provided.