spack/share/spack/qa/changed_files
Adam J. Stewart 64194a823a Remove duplicate ICU package (#1837)
* Remove duplicate ICU package

* Ignore deleted files during flake8 tests

* Rename Boost ICU variant
2016-09-23 14:16:59 -07:00

32 lines
993 B
Bash
Executable File

#!/usr/bin/env bash
#
# Description:
# Returns a list of changed files.
#
# Usage:
# changed_files [<directory> ...]
# changed_files [<file> ...]
# changed_files ["*.<extension>" ...]
#
# Options:
# Directories, files, or globs to search for changed files.
#
# Move to root directory of Spack
# Allows script to be run from anywhere
SPACK_ROOT="$(dirname "$0")/../../.."
cd "$SPACK_ROOT"
# Add changed files that have been committed since branching off of develop
changed=($(git diff --name-only --diff-filter=ACMR develop... -- "$@"))
# Add changed files that have been staged but not yet committed
changed+=($(git diff --name-only --diff-filter=ACMR --cached -- "$@"))
# Add changed files that are unstaged
changed+=($(git diff --name-only --diff-filter=ACMR -- "$@"))
# Add new files that are untracked
changed+=($(git ls-files --exclude-standard --other -- "$@"))
# Return array
# Ensure that each file in the array is unique
printf '%s\n' "${changed[@]}" | sort -u