summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodd Zullinger <tmz@pobox.com>2010-09-10 14:20:44 -0400
committerJesse Keating <jkeating@redhat.com>2010-09-10 18:43:43 -0700
commitaf79c18ac70c235a7dff61fe26dd6fdd05d3aaf6 (patch)
tree81010fa1a39b9d8a9daa7b48cb8257588765e525
parentf975ee3eee19008aada42519c563ea21b841f59c (diff)
downloadfedora-packager-af79c18ac70c235a7dff61fe26dd6fdd05d3aaf6.tar.gz
fedora-packager-af79c18ac70c235a7dff61fe26dd6fdd05d3aaf6.tar.xz
fedora-packager-af79c18ac70c235a7dff61fe26dd6fdd05d3aaf6.zip
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.
-rw-r--r--src/fedpkg.bash7
1 files 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 &&