From af79c18ac70c235a7dff61fe26dd6fdd05d3aaf6 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Fri, 10 Sep 2010 14:20:44 -0400 Subject: fedpkg: Use git plumbing to complete branch names The output of 'git branch' is not guaranteed to remain constant. Using the for-each-ref plumbing command should work reliably for longer. --- src/fedpkg.bash | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/fedpkg.bash b/src/fedpkg.bash index d986465..45d6c21 100644 --- a/src/fedpkg.bash +++ b/src/fedpkg.bash @@ -241,11 +241,12 @@ _fedpkg_arch() have _fedpkg && _fedpkg_branch() { - local git_options= + local git_options= format="--format %(refname:short)" [[ -n $1 ]] && git_options="--git-dir=$1/.git" - git $git_options branch -l 2>/dev/null | sed 's/^\W*//' - git $git_options branch -rl 2>/dev/null | grep -v origin/HEAD | sed 's/^\W*//' | cut -d/ -f2 + git $git_options for-each-ref $format 'refs/remotes/origin/*/master' \ + | sed 's,origin/\(.*\)/master,\1,' + git $git_options for-each-ref $format 'refs/heads' } have _fedpkg && -- cgit