core-validate-commit icon indicating copy to clipboard operation
core-validate-commit copied to clipboard

bin: allow file:/// urls to files containing commit messages

Open srl295 opened this issue 9 years ago • 5 comments

add the usage model of core-validate-commit file:///somefile…

The file needs to approximate the output of git show --quiet --format=medium ${sha}

Semver: minor

srl295 avatar Oct 27 '16 19:10 srl295

  • [x] TODO lint

srl295 avatar Oct 27 '16 20:10 srl295

Would it be possible to just allow a filepath, rather than a file:/// URL? A filepath seems like it would be easier to use.

not-an-aardvark avatar Oct 27 '16 20:10 not-an-aardvark

@not-an-aardvark right now the implementation is that it checks whether it's a valid URL, otherwise assumes it's a sha.

I think that makes sense, however, I wasn't sure what the best parameter option would be. I think a related question here is about the format of the input. right now it needs to be equivalent to git show …, see what I did in #13 to make the input acceptable.

The current use cases (sha, url) are the higher runner cases for command line usage. Probably this should be handled by just two additional paramteres:

$ cat > /some/fileA <<EOF
commit 9236b187d1bc49aea9205a52b516f1c5
Author: My Self <[email protected]>
Date:    Jan 1 00:00:00 1970 -0000

    subsys: something

    * stuff

    metadata…
EOF

$ core-validate-commit --commit-info /some/fileA

$ cat > /some/fileB <<EOF
subsys: something

* stuff

metadata…
EOF

$ core-validate-commit --commit-msg /some/fileB

expecting fileA to have the full git show output (indented), but fileB to just have the commit message.

( --commit-info would correspond to the behavior in this PR, the other isn't implemented. )

srl295 avatar Oct 27 '16 21:10 srl295

It may make sense to just make the three different types of inputs (sha, url, file) require a different flag for each one. It would definitely make it less ambiguous.

evanlucas avatar Oct 28 '16 13:10 evanlucas