Skip to content

Instantly share code, notes, and snippets.

@vitkin
Last active August 26, 2021 09:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vitkin/5565443 to your computer and use it in GitHub Desktop.
Save vitkin/5565443 to your computer and use it in GitHub Desktop.
"git-p4" - Exclude files for extensions
770a771,782
> def p4PathEndsWith(path, suffix):
> # This method tries to remedy a potential mixed-case issue:
> #
> # If UserA adds //depot/DirA/file1
> # and UserB adds //depot/dira/file2
> #
> # we may or may not have a problem. If you have core.ignorecase=true,
> # we treat DirA and dira as the same directory
> if gitConfigBool("core.ignorecase"):
> return path.lower().endswith(suffix.lower())
> return path.endswith(suffix)
>
2061a2074,2075
> self.ignorePaths = gitConfig("git-p4.ignorePaths").split("|")
>
2080a2095,2097
> elif [s for s in self.ignorePaths
> if p4PathEndsWith(path, s)]:
> found = False
2137,2138c2154,2159
< found = [p for p in self.depotPaths
< if p4PathStartsWith(path, p)]
---
> if [s for s in self.ignorePaths
> if p4PathEndsWith(path, s)]:
> found = False
> else:
> found = [p for p in self.depotPaths
> if p4PathStartsWith(path, p)]
3388a3410,3411
>
>
@vitkin
Copy link
Author

vitkin commented May 13, 2013

This patch is intended for http://github.com/git/git/blob/bbd848633eb0a26ccd7306cb76964ab41cff6b83/git-p4.py

Example of usage in ".git/config":
[git-p4]
ignorePaths = .exe|.bin|.com|.so|.dll|.jar|.class|.zip|.apk|.war|.ear|.iso|.tar.gz|.tgz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment