Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] HEAD symbolic ref is not being set up when pushing a repository
  • From: "Sohn, Matthias" <matthias.sohn@xxxxxxx>
  • Date: Tue, 13 Aug 2024 14:41:37 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sap.com; dmarc=pass action=none header.from=sap.com; dkim=pass header.d=sap.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gnd1BxVw21ARmeL1dXgezUJaHN+5EOX9WY/ax6z8uXQ=; b=SYkjH77CqU8C0qDU1k0xC3Grq7l0B+2gPxapBivupX3yOGQGP0JJzWabtNL6fJe2lVLqQ0pwrfEnEPKM5G41hjQbcmK4zdPV5tPWihxwJkRYWNx0E+livPfwkDd/JC0+A62ARTuCfxzCo45Mt9RO/qRUb46XB55SPrKXqiGZMPX5KIk5ldbOYexNz3RUVT6FX4KtPPnd2jKX/KJXPVrmk/PBmxRnLRqJ0IszzoaMm5/7JO6uzFVNguFnLtx/2gTVXAEhVp19RRGCj8wOy+zTNo+lzSoZkqgiNnWL2lmHNKgLAUIs+hRWrnb3GVO+HR4byBVsP81eBMlvmPTjfKRTCQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Y7GL29XjI5XqvJoeZ8Gd4FqvXhseSFuAGJJcak8uY/wnO3rR7Q9MXQjntEhd0ZaV7Ifo3ID7U+Yn4pRpXkDyKJ1Wkz1VccMY/cRnSJHacZishLAD3MabbTAwBq2U7NsRTvhztAATbL+BZY0FFMFrCzgWAFZ9ApXdVOZLYNGJGbadhAlXpNCG1RPp+Psya4JlTCKFeevziPsXyyH0UVw/2hez1pHpJGsLW/kV1iwW2dfYcsQDygVJst0JudCu9swauCiGCtP8mCegPOS0JEEDESFqJ5OxqVLreKM0maCec5Jj7OrhpeLMMtzyWZc5KqWkyubCX601GnNwKP/IqWTBaw==
  • Delivered-to: jgit-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/jgit-dev/>
  • List-help: <mailto:jgit-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/jgit-dev>, <mailto:jgit-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/jgit-dev>, <mailto:jgit-dev-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AQHa7E+rNJowSMCfOU+7V5DX3HtKobIlQoBzgAAClt4=
  • Thread-topic: [jgit-dev] HEAD symbolic ref is not being set up when pushing a repository

Sorry, I meant

 

      RefUpdate u = git.updateRef(Constants.HEAD);

      u.link(Constants.R_HEADS + "master");

 

 

From: jgit-dev <jgit-dev-bounces@xxxxxxxxxxx> on behalf of Sohn, Matthias via jgit-dev <jgit-dev@xxxxxxxxxxx>
Date: Tuesday, 13. August 2024 at 16:40
To: JGit Developers list <jgit-dev@xxxxxxxxxxx>
Cc: Sohn, Matthias <matthias.sohn@xxxxxxx>
Subject: Re: [jgit-dev] HEAD symbolic ref is not being set up when pushing a repository

In a bare repository HEAD defines the default branch, that’s the branch which a client checks out by default when cloning the repository.

In a repository with a working tree HEAD is used to persist which ref or commit is currently checked out.

 

This means when a bare repository is created in your server it should set HEAD to the desired default branch using a RefUpdate, e.g.

 

      RefUpdate u = git.updateRef(Constants.HEAD);

      u.link(Constants.R_REFS + "master");

 

-Matthias

 

From: jgit-dev <jgit-dev-bounces@xxxxxxxxxxx> on behalf of Ignas Mikalajunas via jgit-dev <jgit-dev@xxxxxxxxxxx>
Date: Monday, 12. August 2024 at 02:36
To: jgit-dev@xxxxxxxxxxx <jgit-dev@xxxxxxxxxxx>
Cc: Ignas Mikalajunas <ignas@xxxxxx>
Subject: [jgit-dev] HEAD symbolic ref is not being set up when pushing a repository

Hello, so I am working on a simple jgit server with a DFS backend (s3 compatible block store + mysql). And while testing the reference in-memory (and my own implementation) of the repository I have encountered a weird issue:

 

HEAD symbolic ref is not getting set, updated or returned by the server.

 

So if I push a repository to my server (both jgit and git client have this issue) and then do an ls-remote I get something like:

 

$ git ls-remote memory
3b5b17e2a94e08eda5c2378e3a91f0656e55ecf8 refs/heads/main

 

But if I ls-remote a repository on github I get:

 

$ git ls-remote https://github.com/Ignas/nukagit
5f97643f20b22706311e89576a31401c30a60c7b HEAD
5f97643f20b22706311e89576a31401c30a60c7b refs/heads/main

 

I even encountered problems cloning non-empty repositories using jgit that only disappeared when I did a setBranch on my clone command. Otherwise I was getting:

 

org.eclipse.jgit.errors.TransportException: Remote branch 'HEAD' not found in upstream origin

 

(cgit does not have this problem even when HEAD remote symbolic ref is missing)

 

Unfortunately my knowledge around how HEAD symbolic ref is maintained on the server and how it is treated on the client is lacking, so I don't know where to begin diagnosing this issue.

 

All the code of my project is open source and you can easily reproduce the problem by commenting out:

 

 

and running out any of the integration tests.

 

Thank you for your time,

Ignas


Back to the top