Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitflow
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tools
gitflow
Commits
1adbc3e9
Commit
1adbc3e9
authored
Jan 30, 2010
by
Vincent Driessen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dynamically calculate maximal column width used in verbose feature list output.
parent
f2536f4c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
git-flow-feature
git-flow-feature
+11
-1
No files found.
git-flow-feature
View file @
1adbc3e9
...
@@ -40,6 +40,8 @@ cmd_default() {
...
@@ -40,6 +40,8 @@ cmd_default() {
cmd_list "$@"
cmd_list "$@"
}
}
max() { if [ "$1" -gt "$2" ]; then echo "$1"; else echo "$2"; fi; }
cmd_list() {
cmd_list() {
DEFINE_boolean verbose 0 'verbose (more) output' v
DEFINE_boolean verbose 0 'verbose (more) output' v
parse_args "$@"
parse_args "$@"
...
@@ -54,12 +56,20 @@ cmd_list() {
...
@@ -54,12 +56,20 @@ cmd_list() {
if [ $FLAGS_verbose -eq 0 ]; then
if [ $FLAGS_verbose -eq 0 ]; then
echo "$SHORT_NAMES"
echo "$SHORT_NAMES"
else
else
# determine column width first
width=0
for branch in $SHORT_NAMES; do
len=$(($(echo "$branch" | wc -c) - 1))
width=$(max $width $len)
done
width=$(($width + 3))
for branch in $SHORT_NAMES; do
for branch in $SHORT_NAMES; do
fullname="$PREFIX$branch"
fullname="$PREFIX$branch"
base=$(git merge-base "$fullname" "$DEVELOP_BRANCH")
base=$(git merge-base "$fullname" "$DEVELOP_BRANCH")
develop_sha=$(git rev-parse "$DEVELOP_BRANCH")
develop_sha=$(git rev-parse "$DEVELOP_BRANCH")
branch_sha=$(git rev-parse "$fullname")
branch_sha=$(git rev-parse "$fullname")
printf "%-
40
s" "$branch"
printf "%-
${width}
s" "$branch"
if [ "$branch_sha" = "$develop_sha" ]; then
if [ "$branch_sha" = "$develop_sha" ]; then
printf "(no commits yet)"
printf "(no commits yet)"
elif [ "$base" = "$branch_sha" ]; then
elif [ "$base" = "$branch_sha" ]; then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment