remove leading path from branch name

Remove the f/ or r/ from a branch name so we can create valid
prefix for the new manifest that gets created with the --manifest
flag.

Change-Id: I4eb8f3c70f85566463fb114944309597241a7a89
Signed-off-by: Saul Wold <sgw@linux.intel.com>
This commit is contained in:
Saul Wold 2020-06-16 14:43:56 -07:00
parent 5003bb100d
commit 5e85a4bb54
1 changed files with 9 additions and 1 deletions

View File

@ -100,7 +100,15 @@ if [ $MANIFEST -eq 1 ]; then
exit 1
fi
new_manifest="$(dirname $manifest)/${branch}-$(basename $manifest)"
# String the leading feature (f/) or branch (b/) from the
# branch name so we have a valid branch prefix
if [[ ${branch} =~ .*/.*$ ]]; then
manifest_prefix="$(basename ${branch})"
else
manifest_prefix="${branch}"
fi
new_manifest="$(dirname $manifest)/$manifest_prefix-$(basename $manifest)"
if [ -f $new_manifest ]; then
echo_stderr "branched manifest file already present '$new_manifest'."
exit 1