From 4f59170c538c3b10a5edbd5153a6eaf2c2862537 Mon Sep 17 00:00:00 2001 From: Anders Eurenius Date: Thu, 7 Jul 2016 15:19:56 +0200 Subject: [PATCH] Fix #5: Have file/s and branche/s with same name This confuses git rev-list, so now we always use the -- separator. --- git-test | 4 ++-- test.sh | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/git-test b/git-test index 3baf374..f10a0bc 100755 --- a/git-test +++ b/git-test @@ -430,7 +430,7 @@ if [ $action = clear ] ; then rm -f "$cache"/*_fail "$cache"/*_pass else refs="$(decide_refs "$@")" - commits="$(git rev-list --reverse $refs | tr "$NL" " ")" + commits="$(git rev-list --reverse $refs -- | tr "$NL" " ")" count="$(echo "$commits" | wc -w)" if test 1 -gt "$count" ; then @@ -469,7 +469,7 @@ fi refs="$(decide_refs "$@")" refs="${refs% }" -commits="$(git rev-list --reverse $refs | tr "$NL" " ")" +commits="$(git rev-list --reverse $refs -- | tr "$NL" " ")" count="$(echo "$commits" | wc -w)" if test 1 -gt "$count" ; then diff --git a/test.sh b/test.sh index 6939a66..8f590d2 100644 --- a/test.sh +++ b/test.sh @@ -381,6 +381,14 @@ info "Should just show version, even when not in a repo" GIT_DIR=.git/refs $PROJECT --version >out 2>err ; check grep "Not a git repo" out err >/dev/null 2>&1 ; check_fail +info "Should not confuse files and branches" +$PROJECT --clear >/dev/null 2>&1 ; check +git checkout -b subject >/dev/null 2>&1 ; check +add_commit "x" "differentiate branches" >/dev/null 2>&1 ; check +$PROJECT -v --verify=true subject ^master >out 2>err ; check +grep "^iter.*commit.*tree.*result$" out err >/dev/null 2>&1 ; check + + info "TODO: check output report feature/s" if [ $verb -ge 1 ]; then