#150 ✓ resolved
Jeff Hamilton

Commit mode doesn't work when core.bare isn't set

Reported by Jeff Hamilton | May 14th, 2009 @ 09:09 AM

When syncing down and Android source tree using the repo tool you end up with roughly 125 different git repositories all managed by repo (see http://source.android.com/download/using-repo). Repo has its own copy of the .git directories for the various projects and symlinks the contents of the .git repositories scattered around the Android to its copies. For example, the code for the contacts application lives in its own git repository at:

<src_root>/packages/apps/Contacts

but the contents of .git look like this:

jham:/Volumes/source/android/packages/apps/Contacts/.git$ ls -l
total 136
-rw-r--r-- 1 jham eng 41 May 7 20:40 HEAD lrwxr-xr-x 1 jham eng 60 May 7 20:40 config -> ../../../../.repo/projects/packages/apps/Contacts.git/config
lrwxr-xr-x 1 jham eng 65 May 7 20:40 description -> ../../../../.repo/projects/packages/apps/Contacts.git/description
lrwxr-xr-x 1 jham eng 59 May 7 20:40 hooks -> ../../../../.repo/projects/packages/apps/Contacts.git/hooks
-rw-r--r-- 1 jham eng 21038 May 7 20:40 index lrwxr-xr-x 1 jham eng 58 May 7 20:40 info -> ../../../../.repo/projects/packages/apps/Contacts.git/info
lrwxr-xr-x 1 jham eng 58 May 7 20:40 logs -> ../../../../.repo/projects/packages/apps/Contacts.git/logs
lrwxr-xr-x 1 jham eng 61 May 7 20:40 objects -> ../../../../.repo/projects/packages/apps/Contacts.git/objects
lrwxr-xr-x 1 jham eng 65 May 7 20:40 packed-refs -> ../../../../.repo/projects/packages/apps/Contacts.git/packed-refs
lrwxr-xr-x 1 jham eng 58 May 7 20:40 refs -> ../../../../.repo/projects/packages/apps/Contacts.git/refs
lrwxr-xr-x 1 jham eng 62 May 7 20:40 rr-cache -> ../../../../.repo/projects/packages/apps/Contacts.git/rr-cache
lrwxr-xr-x 1 jham eng 57 May 7 20:40 svn -> ../../../../.repo/projects/packages/apps/Contacts.git/svn

This setup works fine with the command line git, but causes the GitX commit mode to fail. Note that history mode works fine.

I'm using GitX 0.6.2, git 1.6.2.2, OS X 10.5.6, and repo 1.6.7.4.

Comments and changes to this ticket

  • Jeff Hamilton

    Jeff Hamilton May 15th, 2009 @ 12:57 AM

    I don't know ObjC so haven't been able to track down the problem very well, but after some poking I discovered that forcing PBGitRepository isBareRepository to return NO gets commit mode to work on these symlinked repositories. Running "git rev-parse --is-bare-repository" from the command line does return false as would be expected.

  • Jeff Hamilton

    Jeff Hamilton May 15th, 2009 @ 02:41 AM

    • Title changed from “Commit mode doesn't like symlinks in .git” to “Commit mode doesn't work when core.bare isn't set”

    I talked to Shawn Pearce about this a bit and he pointed out that when using repo to manage the git repositories .git/config ends up not having core.bare set, which he guessed could cause the problem. I verified that was the case by manually setting it in the config file, and things worked as expected. Repo does some interesting things and can't set the bare property for real since the copy that is symlinked to is an actual bare repository and commands get run in both places.

  • Johannes Gilger

    Johannes Gilger May 20th, 2009 @ 04:38 PM

    Ok, for displaying repos without the core.bare in their config I've written a patch. It's short, still took me some time to figure out the problem (which hopefully I clarified in the commit-message). The commit is in my bugfixes-branch: http://github.com/heipei/gitx/commits/bugfixes

    Please comment if you've got a better idea to do this (right now we can handle the cases of bare repos, non-bare repos with/without core.bare, non-bare repos with core.bare = true. The only case that still breaks gitx (though this is pathological) is setting "core.bare = false" in a bare repo.

  • Pieter de Bie

    Pieter de Bie May 20th, 2009 @ 04:55 PM

    Hmm, the bare repository thing doesn't do what I had expected. In that
    case, we might as well drop it completely and just return ![self
    workingDirectory]..

  • Pieter de Bie

    Pieter de Bie May 28th, 2009 @ 04:45 PM

    • State changed from “new” to “resolved”

    I'll keep your fix for now. When rewriting this stuff (which I still plan to do), we might simplify it like I said, but if this works, then whatever :)

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

GitX is the nice-looking gitk clone for OS X

People watching this ticket

Referenced by

Pages