#!/usr/bin/env bash # # List configured remote branches. # Copyright (c) Steven Cole 2005 # # Print a listing of all known branches. # # The output has the following format: # # BRANCH LOCATION # # For example # # origin http://www.kernel.org/pub/scm/cogito/cogito.git # # Terminology note: This command concerns remote branches, not the local # ones (those managed by `cg-switch` and listed by `cg-status -g`). USAGE="cg-branch-ls" . "${COGITO_LIB}"cg-Xlib || exit 1 mkdir -p "$_git/branches" [ "$(find "$_git/branches" -follow -type f)" ] \ || die "list of branches is empty (see cg-branch-add(1))" cd "$_git/branches" find . -type f -print | sort | while read -r branch; do echo -n "${branch#./}" echo -ne "\t" cat "$branch" done