Commit cd49e598 authored by Brad King's avatar Brad King

git-gerrit-push: Refine topic name validation

Use bash features instead of 'sed'.
parent e848bb0c
#!/usr/bin/env bash
#=============================================================================
# Copyright 2010-2012 Kitware, Inc.
# Copyright 2010-2015 Kitware, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
......@@ -45,8 +45,8 @@ test -n "$remote" || remote="gerrit"
if test -z "$no_topic"; then
# Identify and validate the topic branch name.
topic="$(git symbolic-ref HEAD | sed -e 's|^refs/heads/||')"
if test "$topic" = "master"; then
head="$(git symbolic-ref HEAD)" && topic="${head#refs/heads/}" || topic=''
if test -z "$topic" -o "$topic" = "master"; then
die 'Please name your topic:
git checkout -b descriptive-name'
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment