← All procedures

git.blame

Show the commit and the author of each line of a file

CLI
Package
@procedures/git · README
Path
["git","blame"]
CLI
mark git blame --path <string>
As data
{"$proc":["git","blame"],"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","blame"], { path: "<path>" });
console.log(JSON.stringify(result));

From the command line

$ mark git blame --path <string>

As data, in a program

{ "$proc": ["git", "blame"], "input": { "path": "<path>" } }

Input

FieldTypeRequiredDefaultDescription
pathstringyesThe file
refstringnoThe commit (default: the working tree)
startLineintegernoThe first line (default: 1)
endLineintegernoThe last line (default: the last line of the file)
cwdstringnoWorking directory

Output

FieldTypeRequiredDefaultDescription
pathstringyesThe file
linesobject[]yesThe lines of the file
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "path": {
        "type": "string",
        "description": "The file"
      },
      "ref": {
        "description": "The commit (default: the working tree)",
        "type": "string"
      },
      "startLine": {
        "description": "The first line (default: 1)",
        "type": "integer",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991
      },
      "endLine": {
        "description": "The last line (default: the last line of the file)",
        "type": "integer",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991
      },
      "cwd": {
        "description": "Working directory",
        "type": "string"
      }
    },
    "required": [
      "path"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "path": {
        "type": "string",
        "description": "The file"
      },
      "lines": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "line": {
              "type": "number",
              "description": "The line number (1 is the first line)"
            },
            "hash": {
              "type": "string",
              "description": "The commit that last changed the line (zeros when it is not committed)"
            },
            "author": {
              "type": "string",
              "description": "The author name"
            },
            "email": {
              "type": "string",
              "description": "The author email"
            },
            "date": {
              "type": "string",
              "description": "The author date, as an ISO 8601 string"
            },
            "summary": {
              "type": "string",
              "description": "The subject of the commit"
            },
            "content": {
              "type": "string",
              "description": "The text of the line"
            }
          },
          "required": [
            "line",
            "hash",
            "author",
            "email",
            "date",
            "summary",
            "content"
          ],
          "additionalProperties": {}
        },
        "description": "The lines of the file"
      }
    },
    "required": [
      "path",
      "lines"
    ],
    "additionalProperties": {}
  }
}