Skip to content

[Feature Request] Add commit being operated on as an arg to 'git test' #1337

@mfulbright

Description

@mfulbright

So far as I know, there is no way to refer to the commit that a git test command is operating on. I would find it useful to be able to do this:

# Fail any commits that still have "TODO_BEFORE_SUBMIT" in their changes:
$ git test run --exec '[[ ! $(git diff "$1^" "$1" | grep TODO_BEFORE_SUBMIT) ]]'

$1 represents the commit that git test is currently operating on, e.g. if git test is going to operate on 2 commits, abc and def, then the first test would be
[[ ! $(git diff "abc^" "abc" | grep TODO_BEFORE_SUBMIT) ]]
and the second test would be
[[ ! $(git diff "def^" "def" | grep TODO_BEFORE_SUBMIT) ]]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions