Conversation
6960fb7 to
cfd4820
Compare
|
@LecrisUT would you have any idea why https://artifacts.dev.testing-farm.io/923c8df6-c4cb-41fa-899f-5fafc4068b8d/work-stream10y1vl1yxx/plans/provision/container/install/centos/stream10/execute/data/guest/default-0/tests/prepare/artifact/install-cases-3/output.txt would be sensitive to |
The rpms in that test are in But that does raise the question if there are users who would do something similar outside of a clean testing-farm execution |
Any idea how to change to test to amend it with the |
The quick fix is to drop the but also I think we should make this configurable |
67cf7f0 to
0725140
Compare
0725140 to
98739f5
Compare
98739f5 to
b47083a
Compare
b47083a to
e3ad657
Compare
|
2c761f2 to
24c9963
Compare
24c9963 to
0b70854
Compare
|
|
||
| subprocess.check_call(['git', 'init'], cwd=source_dir) | ||
|
|
||
| (source_dir / 'this-file-is-apparently-ignored.ignore-me').touch() |
There was a problem hiding this comment.
Why? The .gitignore in subdir should ignore only from that path down. Implementation wise also it doesn't look to deal with nested git repos. There are at least 4 cases to consider:
- top-level
.gitignore - subdir
.gitignore - submodule ignores
.git/info/exclude
There was a problem hiding this comment.
Why? The
.gitignorein subdir should ignore only from that path down.
Yes, hence adding an apparently ignorable file above the .gitignore. If this works, the file should land in the destination as it is not in fact ignored by git.
Implementation wise also it doesn't look to deal with nested git repos.
Hmm, probably a new can of worms. I wouldn't mind adding a "nested git repos/submodules not supported yet" note for now. rsync strategy could support it well, shutil most likely not.
There are at least 4 cases to consider:
- top-level
.gitignore- subdir
.gitignore
These should be supported and covered by the implementation and tests.
- submodule ignores
Inclined to ignore this for now.
.git/info/exclude
Inclined to "ignore" this for now, although it should be possible to support this with what we already have here. I will take a look at this one.
3def217 to
fab0ef2
Compare
fab0ef2 to
ea3ed3b
Compare
| gitignore = current / '.gitignore' | ||
|
|
||
| if gitignore.is_file(): | ||
| filters += ['--filter', f'dir-merge,- {gitignore}'] |
There was a problem hiding this comment.
The dir-merge filter option in rsync expects a relative path pattern, not an absolute path to a specific file. This line attempts to pass an absolute path like /path/to/parent/.gitignore which will not work correctly.
The dir-merge filter is designed to find and apply rules from files matching a pattern within the transfer tree, not to reference specific files outside the source directory. For parent .gitignore files above src but within git_root, rsync cannot directly process them with dir-merge.
To fix this, parent .gitignore files should either be:
- Read and their rules converted to explicit
--excludepatterns, or - Handled differently, potentially by using
--exclude-fromwith a temporary merged file
# Option 1: Read parent .gitignore and convert to exclude patterns
with open(gitignore) as f:
for line in f:
line = line.strip()
if line and not line.startswith('#'):
filters += ['--exclude', line]| filters += ['--filter', f'dir-merge,- {gitignore}'] | |
| with open(gitignore) as f: | |
| for line in f: | |
| line = line.strip() | |
| if line and not line.startswith('#'): | |
| filters += ['--exclude', line] | |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
d8306d9 to
0f7a812
Compare
0f7a812 to
06fd410
Compare
When copying a tree from a git repository, it is useful to not copy files ignored by git, i.e. "honoring" the `.gitignore` files. This has been implemented at one place - plan populating its worktree - but there are other places that would benefit from this feature. Therefore `copy_tree` gains new parameters, existing strategies are extended where possible.
06fd410 to
388586e
Compare
When copying a tree from a git repository, it is useful to not copy
files ignored by git, i.e. "honoring" the
.gitignorefiles. This hasbeen implemented at one place - plan populating its worktree - but there
are other places that would benefit from this feature.
Therefore
copy_treegains new parameters, existing strategies areextended where possible.
Pull Request Checklist