From 9fb64ae29cb978f869de5ff11a47f86e070b4274 Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Fri, 8 Jul 2022 10:50:10 +0200 Subject: upload: add ‘--ignore-untracked-files’ option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This option will suppress the Uncommitted changes in ... (did you forget to amend?) prompt when there are untracked (unknown) files in the working copy. The prompt is still shown if tracked files are modified. Change-Id: Ia3fcc82989b7fad09b69214eda31e2d0dfc14600 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/340456 Tested-by: Martin Geisler Reviewed-by: Mike Frysinger --- subcmds/upload.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'subcmds/upload.py') diff --git a/subcmds/upload.py b/subcmds/upload.py index 20b8fe5d..09ee5c02 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py @@ -204,6 +204,12 @@ Gerrit Code Review: https://www.gerritcodereview.com/ p.add_option('-y', '--yes', default=False, action='store_true', help='answer yes to all safe prompts') + p.add_option('--ignore-untracked-files', + action='store_true', default=False, + help='ignore untracked files in the working copy') + p.add_option('--no-ignore-untracked-files', + dest='ignore_untracked_files', action='store_false', + help='always ask about untracked files in the working copy') p.add_option('--no-cert-checks', dest='validate_certs', action='store_false', default=True, help='disable verifying ssl certs (unsafe)') @@ -370,6 +376,10 @@ Gerrit Code Review: https://www.gerritcodereview.com/ # Check if there are local changes that may have been forgotten changes = branch.project.UncommitedFiles() + if opt.ignore_untracked_files: + untracked = set(branch.project.UntrackedFiles()) + changes = [x for x in changes if x not in untracked] + if changes: key = 'review.%s.autoupload' % branch.project.remote.review answer = branch.project.config.GetBoolean(key) -- cgit v1.2.3-54-g00ecf