Skip to content

submoduleStatus

Get the status for a submodule.

This looks at a submodule and tries to determine the status. It will return a combination of the SubmoduleStatus values.

Signature

ts
class Repository {
  submoduleStatus(name: string, ignore: SubmoduleIgnore): number;
}

Parameters

  • namerequired · string

    The name of the submodule.

  • ignorerequired · SubmoduleIgnore

    The ignore rules to follow.

    Submodule ignore values

    These values represent settings for the submodule.$name.ignore
    configuration value which says how deeply to look at the working
    directory when getting the submodule status.

Returns

  • number

    The combination of the SubmoduleStatus values.

Examples

ts
import { openRepository, submoduleStatusContains, SubmoduleStatus } from 'es-git';

const repo = await openRepository('...');
const status = repo.submoduleStatus('mysubmodule', 'None');

console.log(
  submoduleStatusContains(status, SubmoduleStatus.InHead | SubmoduleStatus.InIndex)
); // true

Released under the MIT License.