Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4 Git—"This file does not exist at the requested revision"

Tags:

git

xcode4

I have a local git repository that I set up with a project in Xcode 4. The repository shows up fine in the Organizer and I can see commit histories and Source Control icons in the File Navigator. Commits work fine as well. However, when I use the version editor, I get the error "This file does not exist at the requested revision" whenever I try to see any previous revision. I can't find any information on this error and have no idea how to fix. git log shows four recent commits (I know there are more, but I don't know if this is a restriction of the command or if something's disappearing). Any ideas?

like image 792
FeifanZ Avatar asked Aug 18 '11 00:08

FeifanZ


4 Answers

I just ran into this same problem. I think (in my case anyway) that it was related to the fact that I had move the project directory outside of xcode. I believe xcode had cached some index files off in ~/Library somewhere. They seem to have gotten tangled up by the move.

The fix (for me) was to open xcode, open the organizer->projects pane and find the project in question. Delete the derived data (there is a button in the upper right pane for this).

After this, everything seemed fine.

like image 87
Tad Avatar answered Nov 05 '22 14:11

Tad


This helped for me:

  1. Go to XCode -> Organizer -> Repositories
  2. Remove all repositories, with the name written in red (i.e. File not found)
  3. Tap the "+" button in the lower left -> "Add Repository..."
  4. Enter the requested information: Path = file://....<full path, which contains the .git directory>. Make sure to have Type set to "Git", Xcode changed it to "Subversion", ignore the message "Authentication required"
  5. Done
like image 43
freytag Avatar answered Nov 05 '22 12:11

freytag


I encountered this when I changed case in a class name. Git had a lower case letter where I wanted upper case. I tried many of the things above shy of completely rebuilding the repository. I finally simply removed the class from the project, changed the name slightly then re-added it.

like image 4
Jim T Avatar answered Nov 05 '22 12:11

Jim T


I'm guessing this is one of these problems that could be caused by multiple issues. This is mine and how I solved it.

My project had some file system name changes in progress. Namely, moving from all lower caps to Pascal casing. This got backed out at some point during my coding cycle. When I checked in, the file system was:

mydirectoryname

All the files under mydirectoryname were no longer managed by git under Xcode. When viewing under the Version Editor, I ended up with the "This file does not exist at the requested version" error message.

However, if I selected one of the files and clicked on the File Inspector (available in the Utilities pane), I noticed the full file path was listed as:

MyRootPath/MyDirectoryName/TheCodeFile.h

I closed Xcode, opened the .pbxproj file in an editor, fixed the path, and reopened the project. Git integration was working once again.

like image 1
MikeG Avatar answered Nov 05 '22 12:11

MikeG