Fix git-branch-check to prune branches first
This commit is contained in:
parent
24f561b0eb
commit
f3e2c69a36
|
@ -9,6 +9,8 @@
|
||||||
# --Kirsle
|
# --Kirsle
|
||||||
# https://www.kirsle.net/
|
# https://www.kirsle.net/
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
@ -19,7 +21,9 @@ if len(sys.argv) >= 2:
|
||||||
local_branch = set()
|
local_branch = set()
|
||||||
remote_branch = set()
|
remote_branch = set()
|
||||||
|
|
||||||
data = subprocess.check_output(["git", "branch", "-a"])
|
subprocess.call(["git", "remote", "update", remote, "--prune"])
|
||||||
|
|
||||||
|
data = subprocess.check_output(["git", "branch", "-a"]).decode()
|
||||||
for line in data.split("\n"):
|
for line in data.split("\n"):
|
||||||
# Remove the currently active branch indicator and extra spaces.
|
# Remove the currently active branch indicator and extra spaces.
|
||||||
line = line.strip("*").strip()
|
line = line.strip("*").strip()
|
||||||
|
@ -36,9 +40,9 @@ for line in data.split("\n"):
|
||||||
local_branch.add(line)
|
local_branch.add(line)
|
||||||
|
|
||||||
# Show comparisons.
|
# Show comparisons.
|
||||||
print "Local branches that are not on the remote:"
|
print("Local branches that are not on the remote:")
|
||||||
for branch in sorted(local_branch):
|
for branch in sorted(local_branch):
|
||||||
if not branch in remote_branch:
|
if not branch in remote_branch:
|
||||||
print "*", branch
|
print("*", branch)
|
||||||
|
|
||||||
# vim:expandtab
|
# vim:expandtab
|
||||||
|
|
Loading…
Reference in New Issue
Block a user