Support passing ref to git-commits-since#1228
Conversation
bin/git-commits-since
Outdated
| git log --pretty='%an - %s' "$REF..HEAD" | ||
| else | ||
| git log --pretty='%an - %s' --after="@{$SINCE}" | ||
| fi No newline at end of file |
There was a problem hiding this comment.
Let's fix the editorconfig lint
|
|
||
| echo "... commits since ${REF:-$SINCE}" >&2 | ||
|
|
||
| if [[ -n "$REF" ]]; then |
There was a problem hiding this comment.
Check if "$REF" exist before using it
There was a problem hiding this comment.
You mean the actual ref or the variable itself? IOW do you want me to first verify that git can resolve the ref before I use it with the log command? If so, that was a deliberate decision, because the error from git is quite clear, IOW if invalidtag is used as a tag ref then it's a user error and we should let the command fail explicitly.
| echo "error: option $1 requires an argument" >&2 | ||
| exit 1 | ||
| fi | ||
| REF="$2" |
There was a problem hiding this comment.
Let's report an error if both $SINCE and $REF given
This line provides little to no value to the end user since the input is very clear. Additionally, from a maintainer's POV it pretty much just pollutes the expected formatted output regardless of the fact that we can avoid it by redirecting stderr and therefore feels redundant --> drop it. Signed-off-by: Erik Skultety <skultety.erik@gmail.com>
Having pretty formatting does aid human readability, but from a maintainer's POV having a commit reference in the commit list to be able to quickly inspect what a given commit from the list is about is invaluable. Signed-off-by: Erik Skultety <skultety.erik@gmail.com>
The commits-since command only considers dates. It's useful to dump a list of commits based on a ref, i.e. a tag, branch, or even another commit. This patch introduces a new optional '--ref|-r' flag that toggles a ref-specific variant of 'git log'. Docs for the respective module has been updated & regenerated as well. Signed-off-by: Erik Skultety <skultety.erik@gmail.com>
05f00c8 to
6dd789f
Compare
|
I added 2 more stylistic commits since last revision as I was primarily testing the interest and seeking approval for the feature with my original proposal.
I hope it won't be necessary for this PR to be re-adjusted :) |
It's OK. This PR is small so I can simply re-review it :) |
git-commits-since
git-commits-sincegit-commits-since
The commits-since command only considers dates. It's useful to dump a list of commits based on a ref, i.e. a tag, branch, or even another commit. This patch introduces a new optional '--ref|-r' flag that toggles a ref-specific variant of 'git log'.
Docs for the respective module has been updated & regenerated as well.