Skip to content

Pass --no-gitmodule to scc so lines.by_language matches languages[] on fetched submodules #152

Description

@andrew

scc reads .gitmodules and excludes each listed path unless --no-gitmodule is passed. brief's own extension walk has no such skip. On a working tree with fetched submodules the two disagree:

$ git clone --depth 1 https://github.com/alexcrichton/openssl-src-rs && cd openssl-src-rs
$ git submodule update --init --depth 1
$ brief --json . | jq '[.languages[].name], .lines.by_language.C'
["C","Perl","Python","Rust","Emacs Lisp","Prolog","Ruby"]
null
$ scc --no-gitmodule --format json . | jq '.[]|select(.Name=="C").Code'
598526

detect.Engine.sccArgs (detect/detect.go) builds ["--format","json","--exclude-dir",...,path]. Appending "--no-gitmodule" there would make lines.by_language agree with languages[] whenever the caller has fetched submodules; on an unfetched tree the flag is a no-op since there is nothing under the submodule path to count.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions