← All procedures

git.revParse

Give the hash or the short name of a ref. An unknown ref is an error

CLI
Package
@procedures/git · README
Path
["git","revParse"]
CLI
mark git revParse
As data
{"$proc":["git","revParse"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/git/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["git","revParse"], {});
console.log(JSON.stringify(result));

From the command line

$ mark git revParse

As data, in a program

{ "$proc": ["git", "revParse"], "input": {} }

Input

FieldTypeRequiredDefaultDescription
refstringnoThe ref, for example HEAD, main, v1.0 or HEAD~2 (default: HEAD)
abbrevRefbooleannoGive the short name of the ref, for example main for HEAD (default: false)
shortbooleannoGive the short hash (default: false)
cwdstringnoWorking directory

Output

FieldTypeRequiredDefaultDescription
refstringyesThe ref of the input
valuestringyesThe hash, the short hash or the short name
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "ref": {
        "description": "The ref, for example HEAD, main, v1.0 or HEAD~2 (default: HEAD)",
        "type": "string"
      },
      "abbrevRef": {
        "description": "Give the short name of the ref, for example main for HEAD (default: false)",
        "type": "boolean"
      },
      "short": {
        "description": "Give the short hash (default: false)",
        "type": "boolean"
      },
      "cwd": {
        "description": "Working directory",
        "type": "string"
      }
    }
  },
  "output": {
    "type": "object",
    "properties": {
      "ref": {
        "type": "string",
        "description": "The ref of the input"
      },
      "value": {
        "type": "string",
        "description": "The hash, the short hash or the short name"
      }
    },
    "required": [
      "ref",
      "value"
    ],
    "additionalProperties": {}
  }
}