Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

srghma
Copy link
Contributor

@srghma srghma commented Aug 10, 2019

Motivation for this change

siers/nix-gitignore#22 (comment)

Things done

tested with https://github.com/siers/nix-gitignore/blob/master/test.sh

 ~/projects/nix-gitignore   master  ./test.sh
these derivations will be built:
  /nix/store/wkz7bmkrhjr36ci6i1gcw5bggy6rmr6y-test-tree.drv
building '/nix/store/wkz7bmkrhjr36ci6i1gcw5bggy6rmr6y-test-tree.drv'...
these derivations will be built:
  /nix/store/x6sddi1xvvm7di7cvg02nfsjv8jv6v1h-test-tree.drv
building '/nix/store/x6sddi1xvvm7di7cvg02nfsjv8jv6v1h-test-tree.drv'...
building '/nix/store/9hgd5c9p5wc625fhj2f4m06pzj7bg56q-test-tree-recursive-recursive-gitignore.drv'...
these derivations will be built:
  /nix/store/n6mzzil7c2wsyav793xan329c4xl1w9y-test-tree-git.drv
  /nix/store/sr7wspzlsclp9aqpfrl1027si6gdln58-test-tree-git.drv
  /nix/store/h9sy6d8kxcbdfzg0rdyrkf1nzw83nk1s-nix-gitignore-test.drv
building '/nix/store/n6mzzil7c2wsyav793xan329c4xl1w9y-test-tree-git.drv'...
building '/nix/store/sr7wspzlsclp9aqpfrl1027si6gdln58-test-tree-git.drv'...
building '/nix/store/h9sy6d8kxcbdfzg0rdyrkf1nzw83nk1s-nix-gitignore-test.drv'...
success
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @Profpatsch

withGitignoreFile = patterns: root:
lib.toList patterns ++ [(root + "/.gitignore")];
withGitIgnoredFilesAndDirs = patterns: root:
lib.toList patterns ++ [(root + "/.gitignore") (".git")];
Copy link
Member

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.

Copy link
Contributor Author

@srghma srghma Aug 13, 2019

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

https://github.com/siers/nix-gitignore/blob/addd0c9665ddb28e4dd2067dd50a7d4e135fbb29/default.nix#L97-L98

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

Copy link
Member

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"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping ;)

Copy link
Contributor Author

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

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Member

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")).

Copy link
Member

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.

Copy link
Member

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.

@lheckemann lheckemann added this to the 20.03 milestone Sep 12, 2019
@@ -147,10 +147,10 @@ in rec {
' sh {} \; > $out
'');

withGitignoreFile = patterns: root:
lib.toList patterns ++ [(root + "/.gitignore")];
withGitIgnoredFilesAndDirs = patterns: root:
Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @siers

Copy link
Member

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.

Copy link
Member

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.

@disassembler disassembler modified the milestones: 20.03, 20.09 Feb 5, 2020
@stale
Copy link

stale bot commented Aug 3, 2020

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.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 3, 2020
@SuperSandro2000 SuperSandro2000 changed the title nix-gitignore: update to addd0c9665ddb28e4dd2067dd50a7d4e135fbb29 version (contains fix for https://github.com/siers/nix-gitignore/issues/22 issue) nix-gitignore: update to addd0c9665ddb28e4dd2067dd50a7d4e135fbb29 version Nov 29, 2020
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Nov 29, 2020
@SuperSandro2000 SuperSandro2000 marked this pull request as draft November 29, 2020 04:44
@FRidh FRidh modified the milestones: 20.09, 21.03 Dec 20, 2020
@stale
Copy link

stale bot commented Jul 21, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 21, 2021
@Profpatsch
Copy link
Member

Closing due to inactivity.

@Profpatsch Profpatsch closed this Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 10.rebuild-darwin: 0 10.rebuild-linux: 0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants