Jump to content


Usage of ignore files


  • Please log in to reply
4 replies to this topic

#1 Furiant

Furiant

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 15 July 2013 - 03:08 PM

Your documentation says to create a file called .ignore (and another article of yours says .p4ignore) in the root of the solution. I'm not sure what OS you're on, but you can't name a file (nothing).(something) in Windows. Would Perforce pick up any file with "ignore" in the extension string, no matter what the file name? Does that mean we could do multiple ignore files - like a template we shared, then per-project ones?

Also, we want to be able to ignore files by directory, meaning we can have it behave as if a directory did not exist in the solution folder, or to filter out certain files within that directory.

ProjectName/bin  (ignore entire directory and don't add to the repo)
/*Resharper.*/ (for directories with a matching name, ignore entire directory and don't add to repo)
/_UpgradeReport_Files/*.* (add directory to repo and ignore all files within it)
/Backup/*.htm* (ignore all matching files within this directory only)
/Backup/*someString

We're also not clear on how much wildcard support to expect. This is how most SCM's I've used behave. Having to blacklist all files by extension, then whitelist all the exceptions seems very primitive and awkward.

Sorry, we did google extensively but didn't come up with these answers; we don't care to spend all morning creating, managing, testing, and deleting fake solutions just to find out how things work.

#2 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 15 July 2013 - 07:06 PM

Laura's old blog post is a good primer on P4IGNORE.

    http://www.perforce....-20121-p4ignore

We originally used the Git syntax so that people could user their ignore files for both systems. The Git syntax has changed a bit since then though. It also looks like some of our behavior is less than desirable; we don't handle wildcards in directories as well as I would hope. With your cases above, we can't handle the 2nd one; wildcards apparently won't match a directory alone. I was able to successfully ignore your other examples though. We also don't use the leading '/'. I can post a sample ignore file if that would help.

#3 Furiant

Furiant

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 15 July 2013 - 07:20 PM

Yes that would help, thank you. I discovered in yet another help article that it needs to be a .txt file (.p4ignore.txt).

#4 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 15 July 2013 - 09:25 PM

I've create a sample P4IGNORE based on your examples.


mac-matt:ignoreTest matt $ p4 set
P4CLIENT=matt-mac-matt (config)
P4CONFIG=p4.config (config '/Users/matt/clients/test/play1999/p4.config')
P4IGNORE=p4.ignore
P4PORT=qaplay:1999 (config)
P4USER=matt (config)

mac-matt:ignoreTest matt $ cat p4.ignore
ProjectName/bin
_UpgradeReport_Files/*.*
Backup/*.htm*
Backup/*someString

mac-matt:ignoreTest matt $ ls -R
Backup			   ProjectName		  _UpgradeReport_Files p4.ignore

./Backup:
asdf.htmlol			  qwerty.html			  trololololololsomeString

./ProjectName:
bin src

./ProjectName/bin:

./ProjectName/src:
foo.js

./_UpgradeReport_Files:
bar.jpg foo.txt

mac-matt:ignoreTest matt $ p4 status
ProjectName/src/foo.js - reconcile to add //depot/matt/ignoreTest/ProjectName/src/foo.js#1

The 'p4 status' at the ends show that only the one .js file which is not configured to be ignored is added, so all appears to be well. One thing to note is the file can have any extension you want. I use 'p4.ignore' across all my various platforms.

#5 Furiant

Furiant

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 16 July 2013 - 11:27 AM

Thank you for your help. I'll play with this sometime today.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users