git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Request feature: –no-submodule

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 3, 2021, 22:06 UTC
Message-ID
<xmqqim2u4n7n.fsf@gitster.g>
In-Reply-To
<9cc98ca3-bdc5-61bf-450a-99bb47673d6c@gmail.com>
Ilias Apostolou <ilias.apostolou.zero@gmail.com> writes:
Show 7 quoted lines
> The reason we need to list all of the true files (except submodules)
> is for code refactoring using the sed unility, for example:
>
> git ls-files | grep -Ev '(png$|ico$)' | xargs sed -i 's/\r\n/\n/'
> ...
> In my opinion, this should be a feature for "ls-files" only, since it
> would be nice to have a clean stream of true files.
Ah, then pathspec is still the right tool to use, I would think.
For example,
    git ls-files -s ':(exclude)*.png' ':(exclude)*.ico' |
    sed -n -e 's/^100[76][54][54] [0-9a-f]* 0       //p' |
    xargs sed -i 's/\r\n/\n/'
that is,
 (1) ls-files -s can be used to learn what kind of path it is.
     Regular files are either 100644 or 100755.  That way, you can
     also exclude symbolic links, which your example use case would
     probably not want to touch.  And you can filter the output to
     have 'a clean stream of true files' fairly easily Depending on
     the details of your needs, it can be tweaked into 'a clean
     stream of executable files' etc., too.
 (2) pathspec magic like ':(exclude)' can be used to lose your "we
     know png and ico are not text files".
Hope this helps.
Previous: Ilias ApostolouNext: Junio C Hamano
Message 6 of 12 in “Request feature: –no-submodule”
  1. Ilias ApostolouJun 2, 2021
  2. Taylor BlauJun 2, 2021
  3. Junio C HamanoJun 3, 2021
  4. Taylor BlauJun 3, 2021
  5. Ilias ApostolouJun 3, 2021
  6. Junio C HamanoJun 3, 2021
  7. Junio C HamanoJun 3, 2021
  8. Jeff KingJun 3, 2021
  9. Junio C HamanoJun 3, 2021
  10. Jeff KingJun 4, 2021
  11. Junio C HamanoJun 4, 2021
  12. Ilias ApostolouJun 5, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.