Fix #151: git ambiguous argument error (#531)

We check if origin/HEAD is present. In case that reference is
missing, we show a meaningful error message now, with an explanation
on how to add it. Also moved find_out_of_sync_files_tracked() to
pmb.helpers.git
This commit is contained in:
Oliver Smith 2017-09-25 22:05:29 +00:00 committed by GitHub
parent 1416ce241d
commit e60eee7dfa
3 changed files with 53 additions and 6 deletions

View file

@ -23,8 +23,9 @@ import shutil
import pmb.build.other
import pmb.chroot
import pmb.helpers.run
import pmb.helpers.file
import pmb.helpers.git
import pmb.helpers.run
import pmb.parse.apkindex
import pmb.parse.version
@ -127,11 +128,8 @@ def aports_files_out_of_sync_with_git(args, package=None):
git_root = git_root.rstrip()
ret = []
if git_root and os.path.exists(git_root):
# Find tracked files out of sync with upstream
tracked = pmb.helpers.run.user(args, ["git", "diff", "--name-only", "origin"],
working_dir=git_root, return_stdout=True)
# Find all untracked files
# Find all out of sync files
tracked = pmb.helpers.git.find_out_of_sync_files_tracked(args, git_root)
untracked = pmb.helpers.run.user(
args, ["git", "ls-files", "--others", "--exclude-standard"],
working_dir=git_root, return_stdout=True)