瀏覽代碼

Handle the case of git cl lint when the CL is empty.

Review URL: https://codereview.chromium.org/293153004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@273852 0039d316-1c4b-4281-b951-d872f2087c98
thestig@chromium.org 11 年之前
父節點
當前提交
5839eb5eb4
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      git_cl.py

+ 3 - 0
git_cl.py

@@ -1417,6 +1417,9 @@ def CMDlint(parser, args):
     cl = Changelist()
     change = cl.GetChange(cl.GetCommonAncestorWithUpstream(), None)
     files = [f.LocalPath() for f in change.AffectedFiles()]
+    if not files:
+      print "Cannot lint an empty CL"
+      return 1
 
     # Process cpplints arguments if any.
     command = args + files