When an Xcode project file (*.pbxproj) file is selected in the working directory or staging area in SourceTree, it shows it as a binary file and SourceTree doesn't show the comparison with the previous version. Is it possible to configure SourceTree to recognize *.pbxproj as a text file so I can see the comparison without launching an external diff tool?
When a file shows as a binary file, it's usually because it's been encoded as UTF-16. Git and Mercurial can only provide diffs for UTF-8 encoded files, which is why if you encode any other way it treats them as binary.
It's a good idea to change your encoding to UTF-8 for all text files, because as well as not being able to show a diff, Git and Mercurial can't merge UTF-16 files either, so it's much harder to deal with changes across branches. If you have a UTF-16 aware external merge tool you can manually merge things but it does make it harder for you.
When I open the project.pbxproj file (contained in the <projectname>.xcodeproj package) in TextWrangler, the encoding shown in the status bar for the file is UTF-8, so that doesn't seem to be the issue - thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's odd because I use XCode 4.5.2 too and I always get diffs on pbxproj files. The similar problem here https://answers.atlassian.com/questions/116001/can-sourcetree-diff-markdown-with-file-extension-md-or-markdown/118201 was also a UTF-16 problem, and this has been the case for all other instances of this problem that I've seen too.
The other possibility is that you've marked these files as binary in Git (assuming you're using git), via the .gitattributes file. This can be used to override how Git treats files for diff purposes. Essentially we have no control in SourceTree over what it shown as a text diff and what is considered to be binary, it's all decided by git/hg. Do you have a .gitattributes setup in your repo, and does it mention pbxproj or xcodeproj?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That was the problem. My .gitattributes file contained the following:
*.pbxproj -crlf -diff -merge
As soon as I commented out that line, it worked great - thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As I mentioned in beepscores post, it _may_ be to do with file associations, but the problem is both pbxproj and md/markdown formats work fine on diffs for me. It's hard to 'undo' those associations on Mac OS X. Out of interest, what happens if you try to open the file in a text editor, then restart SourceTree and take a look at the diff from the staging area?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
On my machine SourceTree shows diff for project.pbxproj file. I think this always worked for me.
I'm using Xcode 4.5.2, within Xcode the project is configured to use git, and using SourceTree version 1.5.6.
However, SourceTree won't show diff for .md file, says it's a binary file. So I asked a related question:
Maybe a more general question is "How can the user set SourceTree to diff a file of a given type extension?"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
On my machine SourceTree shows diff for .xcodeproj file. I think this always worked for me.
I'm using Xcode 4.5.2, within Xcode the project is configured to use git, and using SourceTree version 1.5.6.
However, SourceTree won't show diff for .md file, says it's a binary file. So I asked a related question:
Maybe a more general question is "How can the user set SourceTree to diff a file of a given type extension?"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My machine shows diff for .xcodeproj file. I think this always worked for me.
I'm using Xcode 4.5.2, within Xcode the project is configured to use git, and using SourceTree version 1.5.6.
However, SourceTree won't show diff for .md file, says it's a binary file. So I asked a similar question:
Maybe a more general question is "How can the user set SourceTree to diff a file of a given type extension?"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My machine shows diff for .xcodeproj file. I think this always worked for me. I'm using Xcode 4.5.2, within Xcode the project is configured to use git, and using SourceTree version 1.5.6. However, SourceTree won't show diff for .md file, says it's a binary file. So I asked a similar question: Maybe a more general question is "How can the user set SourceTree to diff a file of a given type extension?" |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.