From 1559d4e0b5804ee4e087e6a731b2f83b1fb952de Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Thu, 31 Mar 2022 22:08:43 -0700 Subject: [PATCH] log: improve query results Comparing whether commit hashes for `HEAD` and `origin/master` are not equal captures three typical scenarios: 1. HEAD is behind origin/master 2. HEAD is ahead of origin/master 3. HEAD is ahead of an older commit in origin/master The intent of `make log` is to capture cases #2 and #3, and not #1, so use `git rev-list ...` with the appropriate commit range instead. Signed-off-by: Patrick McCarty --- Makefile.toplevel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.toplevel b/Makefile.toplevel index 155d7a3..5eae9fd 100644 --- a/Makefile.toplevel +++ b/Makefile.toplevel @@ -170,7 +170,7 @@ diff: $(PACKAGES_FILE) $(addprefix packages/,$(PKGS_LOCAL)) #help displaying any committed but unpushed changes. log: $(PACKAGES_FILE) $(addprefix packages/,$(PKGS_LOCAL)) @for p in projects/common $(addprefix packages/,$(PKGS_LOCAL)); do \ - ( cd $$p; if [ "$$(git rev-parse --verify HEAD)" != "$$(git rev-parse --verify origin/master)" ] ; then \ + ( cd $$p; if [ -n "$$(git rev-list origin/master..HEAD)" ] ; then \ echo $$p ; git --no-pager log --pretty="format:%s" origin/master..HEAD ; echo ; echo;\ fi ; ) \ done