async function currentBranch({
  fs,
  dir,
  gitdir = join(dir, '.git'),
  fullname = false,
  test = false,
}) {
  try {
    assertParameter('fs', fs)
    assertParameter('gitdir', gitdir)
    return await _currentBranch({
      fs: new FileSystem(fs),
      gitdir,
      fullname,
      test,
    })
  } catch (err) {
    err.caller = 'git.currentBranch'
    throw err
  }
}
Get the name of the branch currently pointed to by .git/HEAD

@param {Object} args
@param {FsClient} args.fs - a file system implementation
@param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
@param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
@param {boolean} [args.fullname = false] - Return the full path (e.g. "refs/heads/main") instead of the abbreviated form.
@param {boolean} [args.test = false] - If the current branch doesn't actually exist (such as right after git init) then return `undefined`.

@returns {Promise<string|void>} The name of the current branch or undefined if the HEAD is detached.

@example
// Get the current branch name
let branch = await git.currentBranch({
  fs,
  dir: '/tutorial',
  fullname: false
})
console.log(branch)