Support file resolution in Git submodules for apply_edits.py [chromium/src : main]

0 views
Skip to first unread message

Sergio Solano (Gerrit)

unread,
May 7, 2026, 5:01:41 PM (3 days ago) May 7
to Bryan Enrique Gonzalez, Daniel Angulo, Chromium LUCI CQ, chromium...@chromium.org, Hans Wennborg
Attention needed from Bryan Enrique Gonzalez and Daniel Angulo

Sergio Solano added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Sergio Solano . resolved

Hi guys, could you take a look?

Open in Gerrit

Related details

Attention is currently required from:
  • Bryan Enrique Gonzalez
  • Daniel Angulo
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I95913a8f276cb659e13d49410ce05773e0282116
Gerrit-Change-Number: 7830660
Gerrit-PatchSet: 1
Gerrit-Owner: Sergio Solano <sergio...@google.com>
Gerrit-Reviewer: Bryan Enrique Gonzalez <bryanen...@google.com>
Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
Gerrit-Reviewer: Sergio Solano <sergio...@google.com>
Gerrit-CC: Hans Wennborg <ha...@chromium.org>
Gerrit-Attention: Bryan Enrique Gonzalez <bryanen...@google.com>
Gerrit-Attention: Daniel Angulo <angd...@google.com>
Gerrit-Comment-Date: Thu, 07 May 2026 21:01:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Sergio Solano (Gerrit)

unread,
May 7, 2026, 7:42:03 PM (3 days ago) May 7
to Stephen Nusko, Bryan Enrique Gonzalez, Daniel Angulo, Chromium LUCI CQ, chromium...@chromium.org, Hans Wennborg
Attention needed from Bryan Enrique Gonzalez, Daniel Angulo and Stephen Nusko

Sergio Solano voted and added 1 comment

Votes added by Sergio Solano

Commit-Queue+1

1 comment

Patchset-level comments
Sergio Solano . resolved

Hi, Stephen, could you help me with a code review? I think this complements the work on https://chromium-review.git.corp.google.com/c/chromium/src/+/7757140. This allows files to be discovered in git subrepos during the apply_edits step of the spanification.

Open in Gerrit

Related details

Attention is currently required from:
  • Bryan Enrique Gonzalez
  • Daniel Angulo
  • Stephen Nusko
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I95913a8f276cb659e13d49410ce05773e0282116
Gerrit-Change-Number: 7830660
Gerrit-PatchSet: 1
Gerrit-Owner: Sergio Solano <sergio...@google.com>
Gerrit-Reviewer: Bryan Enrique Gonzalez <bryanen...@google.com>
Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
Gerrit-Reviewer: Sergio Solano <sergio...@google.com>
Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
Gerrit-CC: Hans Wennborg <ha...@chromium.org>
Gerrit-Attention: Bryan Enrique Gonzalez <bryanen...@google.com>
Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
Gerrit-Attention: Daniel Angulo <angd...@google.com>
Gerrit-Comment-Date: Thu, 07 May 2026 23:41:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Stephen Nusko (Gerrit)

unread,
May 7, 2026, 9:16:45 PM (3 days ago) May 7
to Sergio Solano, Bryan Enrique Gonzalez, Daniel Angulo, Chromium LUCI CQ, chromium...@chromium.org, Hans Wennborg
Attention needed from Bryan Enrique Gonzalez, Daniel Angulo and Sergio Solano

Stephen Nusko added 1 comment

File tools/clang/scripts/apply_edits.py
Line 61, Patchset 1 (Latest): # Some rewrites target submodules (e.g. dawn, skia, angle, webrtc, ...), so
# if they are specifically passed as an argument, we should also call
# git ls-files there.
if paths:
for p in paths:
real_path = os.path.realpath(p)
if os.path.isdir(real_path):
# Walk up the directory tree to find if this path is within a submodule
curr = real_path
submodule_root = None
while curr and curr != os.path.dirname(curr):
if os.path.exists(os.path.join(curr, '.git')):
submodule_root = curr
break
curr = os.path.dirname(curr)

if submodule_root:
submodule_files = run_ls_files(cwd=submodule_root)
files.extend([
os.path.realpath(os.path.join(submodule_root, f))
for f in submodule_files
])

return files
Stephen Nusko . unresolved

Is there a way we could make a test for this logic? At least in our spanify plugin where we want this?

Could we introduce a test case that has a file inside a git submodule? That would fail before this change and applies the rewrite afterwards?

The actual logic seems legit and correct but I'd feel better with a test showing it working.

Open in Gerrit

Related details

Attention is currently required from:
  • Bryan Enrique Gonzalez
  • Daniel Angulo
  • Sergio Solano
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I95913a8f276cb659e13d49410ce05773e0282116
    Gerrit-Change-Number: 7830660
    Gerrit-PatchSet: 1
    Gerrit-Owner: Sergio Solano <sergio...@google.com>
    Gerrit-Reviewer: Bryan Enrique Gonzalez <bryanen...@google.com>
    Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
    Gerrit-Reviewer: Sergio Solano <sergio...@google.com>
    Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
    Gerrit-CC: Hans Wennborg <ha...@chromium.org>
    Gerrit-Attention: Bryan Enrique Gonzalez <bryanen...@google.com>
    Gerrit-Attention: Daniel Angulo <angd...@google.com>
    Gerrit-Attention: Sergio Solano <sergio...@google.com>
    Gerrit-Comment-Date: Fri, 08 May 2026 01:16:12 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sergio Solano (Gerrit)

    unread,
    May 8, 2026, 2:57:37 PM (2 days ago) May 8
    to Bryan Enrique Gonzalez, Stephen Nusko, Daniel Angulo, Chromium LUCI CQ, chromium...@chromium.org, Hans Wennborg
    Attention needed from Daniel Angulo and Stephen Nusko

    Sergio Solano voted and added 2 comments

    Votes added by Sergio Solano

    Auto-Submit+1

    2 comments

    Patchset-level comments
    File-level comment, Patchset 2 (Latest):
    Sergio Solano . resolved

    Hi,Stephen, i've added a unit test testSubmoduleSupport.

    The test mocks a submodule/subrepo environment (the .git directory and the targeted git ls-files calls). This validates the added logic is needed to discover files within a submodule and the 'rewrite' part is already proven by the existing spanify tests.

    From your comment i understand that ideally we would have a subrepo and inside it a file to be rewritten. Am i getting your idea right? Is that to validate the rest of the spanify pipeline?

    I've also tested the listing of submodules for ANGLE and this was missing to see it being rewritten. Bryan's also tested it in Skia.

    File tools/clang/scripts/apply_edits.py
    Line 61, Patchset 1: # Some rewrites target submodules (e.g. dawn, skia, angle, webrtc, ...), so

    # if they are specifically passed as an argument, we should also call
    # git ls-files there.
    if paths:
    for p in paths:
    real_path = os.path.realpath(p)
    if os.path.isdir(real_path):
    # Walk up the directory tree to find if this path is within a submodule
    curr = real_path
    submodule_root = None
    while curr and curr != os.path.dirname(curr):
    if os.path.exists(os.path.join(curr, '.git')):
    submodule_root = curr
    break
    curr = os.path.dirname(curr)

    if submodule_root:
    submodule_files = run_ls_files(cwd=submodule_root)
    files.extend([
    os.path.realpath(os.path.join(submodule_root, f))
    for f in submodule_files
    ])

    return files
    Stephen Nusko . resolved

    Is there a way we could make a test for this logic? At least in our spanify plugin where we want this?

    Could we introduce a test case that has a file inside a git submodule? That would fail before this change and applies the rewrite afterwards?

    The actual logic seems legit and correct but I'd feel better with a test showing it working.

    Sergio Solano

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Daniel Angulo
    • Stephen Nusko
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I95913a8f276cb659e13d49410ce05773e0282116
      Gerrit-Change-Number: 7830660
      Gerrit-PatchSet: 2
      Gerrit-Owner: Sergio Solano <sergio...@google.com>
      Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
      Gerrit-Reviewer: Sergio Solano <sergio...@google.com>
      Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
      Gerrit-CC: Bryan Enrique Gonzalez <bryanen...@google.com>
      Gerrit-CC: Hans Wennborg <ha...@chromium.org>
      Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
      Gerrit-Attention: Daniel Angulo <angd...@google.com>
      Gerrit-Comment-Date: Fri, 08 May 2026 18:57:30 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Stephen Nusko <nus...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Daniel Angulo (Gerrit)

      unread,
      8:00 AM (5 hours ago) 8:00 AM
      to Sergio Solano, Bryan Enrique Gonzalez, Stephen Nusko, Chromium LUCI CQ, chromium...@chromium.org, Hans Wennborg
      Attention needed from Sergio Solano and Stephen Nusko

      Daniel Angulo added 1 comment

      File tools/clang/scripts/apply_edits.py
      Line 72, Patchset 2 (Latest): if os.path.exists(os.path.join(curr, '.git')):
      Daniel Angulo . unresolved

      does this match for only for files or directories?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Sergio Solano
      • Stephen Nusko
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I95913a8f276cb659e13d49410ce05773e0282116
        Gerrit-Change-Number: 7830660
        Gerrit-PatchSet: 2
        Gerrit-Owner: Sergio Solano <sergio...@google.com>
        Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
        Gerrit-Reviewer: Sergio Solano <sergio...@google.com>
        Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
        Gerrit-CC: Bryan Enrique Gonzalez <bryanen...@google.com>
        Gerrit-CC: Hans Wennborg <ha...@chromium.org>
        Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
        Gerrit-Attention: Sergio Solano <sergio...@google.com>
        Gerrit-Comment-Date: Sun, 10 May 2026 12:00:24 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages