Page MenuHomePhabricator

Diffusion doesn't handle non-bare hosted git repos
Closed, InvalidPublic

Description

Basically, if a git repository hosted by Phabricator is non-bare on disk, Diffusion doesn't handle it well. This may be by design, but I couldn't find anything in the docs calling it out. Potentially related to T10467: Diffusion history doesn't update.

Version:

Steps to reproduce:

  1. Create a new, empty hosted git repo in Phabricator.
  2. Clone the repo to another machine.
  3. Make some commits to the master branch and push them to origin.
  4. Log into the server that Phabricator is hosted on. su to the daemon-user. Navigate to the directory where the repo is stored on disk.
  5. git config --local core.bare false && mkdir .git && mv * .git/ && git reset --hard HEAD to make the repo non-bare.
  6. View the repo in Diffusion.

Expected:
Files, commits, and branches are displayed and navigable as usual.

Actual:
An error is displayed:

No Such Branch
There is no branch named "master" in this repository.

Event Timeline

Do we tell you to do this in the documentation anywhere?

Why do you consider this to be a bug, then?

It's fine to consider it not a bug. Mainly I wanted to provide the info that it doesn't work for documentation purposes, in case anyone else runs into the same situation in the future. (We ran into this by trying to transition from a very old Phabricator installation to a new one with hosted repos, but with a legacy deployment setup that needs a non-bare repo copy, and didn't realize that Phabricator didn't fully support hosted non-bare repos.)

I also can't reproduce this:

epriestley@orbital ~/dev/core/repo/local/POEMS $ git config --local core.bare false && mkdir .git && mv * .git/ && git reset --hard HEAD
...
epriestley@orbital ~/dev/core/repo/local/POEMS $ ls
12MB_of_the_letter_q.txt	circle.txt			hook.txt			number_j.txt			space file
README				circle.yml			image.png			pasta.txt			test.txt
back\\slash			clock.txt			latin1.diff			photography			unreasonably_huge_directory
cat.txt				generate_the_letter_q.php	mirror.txt			shiftjis.txt
epriestley@orbital ~/dev/core/repo/local/POEMS $ git show
commit 4313d921640de9e06b43b34c279eb895177c865b
Author: epriestley <git@epriestley.com>
Date:   Fri Aug 26 10:16:38 2016 -0700

    meow

diff --git a/cat.txt b/cat.txt
index a3172e2e..fe200d86 100644
--- a/cat.txt
+++ b/cat.txt
@@ -14,3 +14,4 @@ meow
 meow
 meow
 meow
+meow

UI works fine, though:

Screen Shot 2016-12-13 at 11.31.39 AM.png (1×1 px, 234 KB)

Oh, I think the issue is this:

  • When the repository is non-bare, we assume it's an old repository and that refs are relative to origin (for example, origin/master). This is required for very old repositories to continue working.
  • My repository was originally cloned, so it has an origin/master.
  • Your repository was not, so it presumably does not have an origin remote.

But, generally, you should assume that you're voiding the warranty if you touch Phabricator's working copies. We support non-bare repositories, but assume origin exists as a legacy compatibility mechanism.