Skip to content

Commit 1cd4b15

Browse files
committed
uniq files
1 parent 0f7ab4e commit 1cd4b15

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

bashrc/functions.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,20 @@ rspec_show_affected_files() {
187187
fail_if_not_git_repo || return 1;
188188
local f=0;
189189
local spec_files=();
190+
local seen_files=();
190191

191192
echo -n "# ";
192193
git show --oneline --name-only "$@" | head -n1;
193194
echo "# ";
194195

195196
for file in $(git show --pretty="format:" --name-only "$@" | \grep -v '^$'); do
196197
if [[ "$file" == spec/* ]] && [[ "$file" == *_spec.rb ]]; then
198+
# Skip if we've already seen this file
199+
if [[ " ${seen_files[*]} " == *" $file "* ]]; then
200+
continue
201+
fi
202+
seen_files+=("$file")
203+
197204
(( f++ ))
198205
export "$GIT_ENV_CHAR"$f="$file";
199206
echo -e "# \033[2;37m[\033[0m$f\033[2;37m]\033[0m $file";

0 commit comments

Comments
 (0)