isomorphic-git 1.36.2 → 1.36.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -5817,7 +5817,10 @@ async function _commit({
5817
5817
  }) {
5818
5818
  // Determine ref and the commit pointed to by ref, and if it is the initial commit
5819
5819
  let initialCommit = false;
5820
+ let detachedHead = false;
5820
5821
  if (!ref) {
5822
+ const headContent = await fs.read(`${gitdir}/HEAD`, { encoding: 'utf8' });
5823
+ detachedHead = !headContent.startsWith('ref:');
5821
5824
  ref = await GitRefManager.resolve({
5822
5825
  fs,
5823
5826
  gitdir,
@@ -5923,11 +5926,11 @@ async function _commit({
5923
5926
  dryRun,
5924
5927
  });
5925
5928
  if (!noUpdateBranch && !dryRun) {
5926
- // Update branch pointer
5929
+ // Update branch pointer (or HEAD directly if detached)
5927
5930
  await GitRefManager.writeRef({
5928
5931
  fs,
5929
5932
  gitdir,
5930
- ref,
5933
+ ref: detachedHead ? 'HEAD' : ref,
5931
5934
  value: oid,
5932
5935
  });
5933
5936
  }
@@ -8261,8 +8264,8 @@ function filterCapabilities(server, client) {
8261
8264
 
8262
8265
  const pkg = {
8263
8266
  name: 'isomorphic-git',
8264
- version: '1.36.2',
8265
- agent: 'git/isomorphic-git@1.36.2',
8267
+ version: '1.36.3',
8268
+ agent: 'git/isomorphic-git@1.36.3',
8266
8269
  };
8267
8270
 
8268
8271
  class FIFO {
package/index.js CHANGED
@@ -5811,7 +5811,10 @@ async function _commit({
5811
5811
  }) {
5812
5812
  // Determine ref and the commit pointed to by ref, and if it is the initial commit
5813
5813
  let initialCommit = false;
5814
+ let detachedHead = false;
5814
5815
  if (!ref) {
5816
+ const headContent = await fs.read(`${gitdir}/HEAD`, { encoding: 'utf8' });
5817
+ detachedHead = !headContent.startsWith('ref:');
5815
5818
  ref = await GitRefManager.resolve({
5816
5819
  fs,
5817
5820
  gitdir,
@@ -5917,11 +5920,11 @@ async function _commit({
5917
5920
  dryRun,
5918
5921
  });
5919
5922
  if (!noUpdateBranch && !dryRun) {
5920
- // Update branch pointer
5923
+ // Update branch pointer (or HEAD directly if detached)
5921
5924
  await GitRefManager.writeRef({
5922
5925
  fs,
5923
5926
  gitdir,
5924
- ref,
5927
+ ref: detachedHead ? 'HEAD' : ref,
5925
5928
  value: oid,
5926
5929
  });
5927
5930
  }
@@ -8255,8 +8258,8 @@ function filterCapabilities(server, client) {
8255
8258
 
8256
8259
  const pkg = {
8257
8260
  name: 'isomorphic-git',
8258
- version: '1.36.2',
8259
- agent: 'git/isomorphic-git@1.36.2',
8261
+ version: '1.36.3',
8262
+ agent: 'git/isomorphic-git@1.36.3',
8260
8263
  };
8261
8264
 
8262
8265
  class FIFO {