New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nix-gitignore: update to addd0c9665ddb28e4dd2067dd50a7d4e135fbb29 version #66447
Conversation
…sion (contains fix for siers/nix-gitignore#22 issue)
withGitignoreFile = patterns: root: | ||
lib.toList patterns ++ [(root + "/.gitignore")]; | ||
withGitIgnoredFilesAndDirs = patterns: root: | ||
lib.toList patterns ++ [(root + "/.gitignore") (".git")]; |
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.
Shouldn’t this be (root + "/.git")
? This looks like we are ignoring everything that contains .git
really.
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.
no, it will try to read .git
dir
and throw with error
~/projects/nix-gitignore master ./run-tests.sh
nix-gitignore: using test dir /tmp/tmp.eSD2CjC4hr
error (ignored): writing to file: Bad file descriptor
error: while evaluating the attribute 'success' at /home/srghma/projects/nix-gitignore/test.nix:207:3:
while evaluating 'sourceActualAux' at /home/srghma/projects/nix-gitignore/test.nix:154:21, called from /home/srghma/projects/nix-gitignore/test.nix:159:36:
while evaluating 'gitignoreFilterSource' at /home/srghma/projects/nix-gitignore/default.nix:159:45, called from /home/srghma/projects/nix-gitignore/test.nix:154:26:
while evaluating 'gitignoreFilterSourcePure' at /home/srghma/projects/nix-gitignore/default.nix:156:49, called from /home/srghma/projects/nix-gitignore/default.nix:160:5:
while evaluating 'gitignoreFilterPure' at /home/srghma/projects/nix-gitignore/default.nix:101:55, called from undefined position:
while evaluating 'filterPattern' at /home/srghma/projects/nix-gitignore/default.nix:21:12, called from /home/srghma/projects/nix-gitignore/default.nix:102:5:
while evaluating 'last' at /home/srghma/projects/nix-gitignore/default.nix:12:10, called from /home/srghma/projects/nix-gitignore/default.nix:27:9:
while evaluating 'last' at /home/srghma/projects/nix-gitignore/default.nix:12:10, called from /home/srghma/projects/nix-gitignore/default.nix:27:15:
while evaluating 'gitignoreToPatterns' at /home/srghma/projects/nix-gitignore/default.nix:31:25, called from /home/srghma/projects/nix-gitignore/default.nix:92:47:
while evaluating 'gitignoreCompileIgnore' at /home/srghma/projects/nix-gitignore/default.nix:95:47, called from /home/srghma/projects/nix-gitignore/default.nix:102:22:
while evaluating 'onPath' at /home/srghma/projects/nix-gitignore/default.nix:97:19, called from undefined position:
opening file '/tmp/tmp.eSD2CjC4hr/test-tree-normal/.git': No such file or directory
I've added tests siers/nix-gitignore#25
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.
So does that mean we can change the root + "/.gitignore"
to ".gitignore"
?
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.
ping ;)
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.
no, it fails tests, dont know why
building '/nix/store/bkzay1c3iw2m44mf4x7id0mcyy33q9lh-nix-gitignore-test.drv'...
2d1
< .gitignore
5a5
> 1-simpl/1
24a25,26
> 1-simpl/1-simpl/simpletest
> 1-simpl/2
29a32
> 1-simpl/\
31a35
> 1-simpl/]]
35a40
> 1-simpl/bb
36a42
> 1-simpl/simple-test
43a50
> 2-negation/20
44a52
> 2-negation/40
45a54
> 2-negation/60
47a57
> 3-wildcards/bar.html
49a60
> 3-wildcards/foo.html
50a62
> 3-wildcards/html/bar.html
54a67,69
> 4-escapes/*.html
> 4-escapes/o?ther.html
> 4-escapes/o__ther.html
56a72
> 4-escapes/other.html$
57a74,92
> 5-directory
> 5-directory/$
> 5-directory/$^
> 5-directory/1
> 5-directory/2
> 5-directory/3
> 5-directory/4
> 5-directory/5
> 5-directory/[
> 5-directory/[[
> 5-directory/\
> 5-directory/\\
> 5-directory/]
> 5-directory/]]
> 5-directory/]]]
> 5-directory/^
> 5-directory/^$
> 5-directory/ab
> 5-directory/bb
builder for '/nix/store/bkzay1c3iw2m44mf4x7id0mcyy33q9lh-nix-gitignore-test.drv' failed with exit code 1
error: build of '/nix/store/bkzay1c3iw2m44mf4x7id0mcyy33q9lh-nix-gitignore-test.drv' failed
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.
@Profpatsch I think we can merge
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.
I have to take another closer look on Monday or Tuesday.
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.
It fails because root
is a path and so is `root + "/.git".
Now, I added this feature that reads path values and uses the ignore patterns in them. Because this, unlike, root + "/.gitignore"
should be a literal pattern, we have to cast it to string with (toString (root + "/.git"))
.
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.
Nah, I am wrong! root +
should be prepended so it can be read as a file of patterns. ".git"
, however, is a pattern, so it shouldn't be a full path.
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.
It's going to be a little tricky with the testcases because of 1. shopt -s dotglob
in sourceGitFrom
, 2. because sourceGitFrom
does rm -r .git
before handing over the filtered contents.
I didn't succeed to create them yet.
index b0bf3ca..45aa1c4 100644
--- a/default.nix
+++ b/default.nix
@@ -146,10 +146,10 @@ in rec {
'');
withGitIgnoredFilesAndDirs = patterns: root:
- lib.toList patterns ++ [(root + "/.gitignore") (".git")];
+ lib.toList patterns ++ [(root + "/.gitignore") ".git"];
withRecursiveGitIgnoredFilesAndDirs = patterns: root:
- lib.toList patterns ++ [(compileRecursiveGitignore root)];
+ lib.toList patterns ++ [(compileRecursiveGitignore root) ".git"];
# filterSource derivatives
This is how the default.nix
code should look though.
@@ -147,10 +147,10 @@ in rec { | |||
' sh {} \; > $out | |||
''); | |||
|
|||
withGitignoreFile = patterns: root: | |||
lib.toList patterns ++ [(root + "/.gitignore")]; | |||
withGitIgnoredFilesAndDirs = patterns: root: |
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.
If we rename this, we break the interface I’m not sure this should have been exposed in the first place, so I recommend we move it out of the record.
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.
cc @siers
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.
I doubt many users are using this function and even if they are, it's easily fixable.
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.
You could always add builtins.trace "please use with..Dirs instead of with...File" with...Dirs
.
Hello, I'm a bot and I thank you in the name of the community for your contributions. Nixpkgs is a busy repository, and unfortunately sometimes PRs get left behind for too long. Nevertheless, we'd like to help committers reach the PRs that are still important. This PR has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human. If this is still important to you and you'd like to remove the stale label, we ask that you leave a comment. Your comment can be as simple as "still important to me". But there's a bit more you can do: If you received an approval by an unprivileged maintainer and you are just waiting for a merge, you can @ mention someone with merge permissions and ask them to help. You might be able to find someone relevant by using Git blame on the relevant files, or via GitHub's web interface. You can see if someone's a member of the nixpkgs-committers team, by hovering with the mouse over their username on the web interface, or by searching them directly on the list. If your PR wasn't reviewed at all, it might help to find someone who's perhaps a user of the package or module you are changing, or alternatively, ask once more for a review by the maintainer of the package/module this is about. If you don't know any, you can use Git blame on the relevant files, or GitHub's web interface to find someone who touched the relevant files in the past. If your PR has had reviews and nevertheless got stale, make sure you've responded to all of the reviewer's requests / questions. Usually when PR authors show responsibility and dedication, reviewers (privileged or not) show dedication as well. If you've pushed a change, it's possible the reviewer wasn't notified about your push via email, so you can always officially request them for a review, or just @ mention them and say you've addressed their comments. Lastly, you can always ask for help at our Discourse Forum, or more specifically, at this thread or at #nixos' IRC channel. |
I marked this as stale due to inactivity. → More info |
Closing due to inactivity. |
Motivation for this change
siers/nix-gitignore#22 (comment)
Things done
tested with https://github.com/siers/nix-gitignore/blob/master/test.sh
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)Notify maintainers
cc @Profpatsch