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

.gitignore comment issue #53

Closed
mrardon opened this issue Jul 10, 2014 · 2 comments
Closed

.gitignore comment issue #53

mrardon opened this issue Jul 10, 2014 · 2 comments

Comments

@mrardon
Copy link
Contributor

mrardon commented Jul 10, 2014

.gitignore files are allowed to have comments however they must be at the beginning of the line not after pattern that is ignored.

The issue is here:

Generated_Code #added for RIA/Silverlight projects

We recently switched to using satis and this issue came up when trying to pull down the code for this. It consistently died with the following exception:

Dumping 'mindscape/raygun4php-1.2.1.0'.
  - Installing mindscape/raygun4php (1.2.1)
    Cloning e65e879e6e2ecc16208cbaab53a74154f6f11017




  [ErrorException]                    
  preg_match(): Unknown modifier 'a'  



Exception trace:
 () at /vendor/composer/composer/src/Composer/Package/Archiver/BaseExcludeFilter.php:62

Info on .gitignore is here: http:https://git-scm.com/book/en/Git-Basics-Recording-Changes-to-the-Repository#Ignoring-Files

The reason it is dying with that exception is due to how composer processes ignore files, namely it makes patterns to ignore and follows the standard set forward in the previous document. So for each line of .gitignore it makes a regex pattern using the delimiter of #

So if the pattern for the line referenced above is invalid because it is not ignored (required # at the beginning of the line):
#(?=[^\.])Generated_Code #added for RIA/(?=[^\.])Silverlight projects(?=$|/)#

@mrardon
Copy link
Contributor Author

mrardon commented Jul 10, 2014

Just as a side note I was able to clean this up - including all the history as you can see on my fork of this project by following the instructions below. I don't know if you all want to get into this but I'll put them here for reference.

Using http:https://rtyley.github.io/bfg-repo-cleaner/ as recommended by Github: https://help.github.com/articles/remove-sensitive-data#using-the-bfg

  1. Make a commit to fix the .gitignore line by removing the trailing comment as discussed. This is necessary because BFG will not touch HEAD files

  2. Create a file called remove.txt with the contents below. This is our pattern we are looking for it will replace it with an empty string

#added for RIA/Silverlight projects==>
  1. Download BFG from http:https://rtyley.github.io/bfg-repo-cleaner/
  2. Mirror the repo and make sure you copy this folder to someplace safe as a backup
$ git clone --mirror [email protected]:MindscapeHQ/raygun4php.git
  1. Run bfg
$ java -jar bfg-1.11.7.jar --replace-text remove.txt raygun4php.git
  1. Force gc and reference fixes:
$ cd some-big-repo.git
$ git reflog expire --expire=now --all
$ git gc --prune=now --aggressive
  1. Push up reference changes
$ git push

The final git push will push everything back up and the file will be fixed.

I figured even if you don't do this its good git-fu to know. For now I will just use my fork and pull down whenever necessary.

Cheers.

@mduncan26
Copy link

Closing this issue for now. If you wish to see this issue addressed please create a new issue or post within our forums (https://raygun.com/forums). Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants