Re: [PATCH] scripts/bash_aliases, scripts/modified_pages.sh: Move scripts/modified_pages.sh to a function man_gitstaged()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey Jakub,

On 2/22/21 3:58 PM, Jakub Wilk wrote:
* Alejandro Colomar <alx.manpages@xxxxxxxxx>, 2021-02-22, 15:03:
+    git status                            \
+    |sed '/Changes not staged for commit:/q'            \
+    |grep -E '^\s*(modified|deleted|new file):'            \

"git status" (without further options) is not suitable for scripting: "The default, long format, is designed to be human readable, verbose and descriptive. Its contents and format are subject to change at any time." > You could use "git status --porcelain" instead, which has stable and (supposedly) easy to parse format. Or, better, you could use "git diff --staged --name-only".


I know I shouldn't script around 'git status'; actually I found out that yesterday. When I read that, I tried to script around 'git status --porcelain', but it's more complex (at least to me, at first glance), and I gave up.

However, 'git diff --staged --name-only' is exactly what I need! I'll prepare a patch with that in a few minutes.

Michael, so that git can follow the code movement relatively easily, I'll write that patch on top of this one, so you can already apply this one.

Thanks a lot!!

Alex

--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux