threads / discuss / 9267

git diff with add/modified codes

Subject: git diff with add/modified codes

## tl;dr

9 messages between Jul 27, 2007 and Jul 29, 2007.

replies: 8people: 5as markdown or json

Jon Smirl· Jul 27, 2007, 22:05 UTC · lore

Is there a magic git diff incantation that will add file status codes (Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R)) to the --stat output? I can't see how to get this info on any diff output without doing multiple diffs with --diff-filter.

-- 
Jon Smirl
jonsmirl@gmail.com
Jon Smirl· Jul 28, 2007, 00:17 UTC · re: Junio C Hamano · lore

Re: git diff with add/modified codes

On 7/27/07, Junio C Hamano <gitster@pobox.com> wrote:
> Would --stat --summary be satisfactory?

That's not what I want. I'm looking a report that indicates new files vs modified ones in a single list. These old patches I am working with often create 100 files and modify another 200.

Adding a code like (Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R)) to --stat would be perfect.

-- 
Jon Smirl
jonsmirl@gmail.com
Jeff King· Jul 28, 2007, 04:39 UTC · re: Jon Smirl · lore

Re: git diff with add/modified codes

On Fri, Jul 27, 2007 at 08:17:54PM -0400, Jon Smirl wrote:
Show 6 quoted lines
> That's not what I want. I'm looking a report that indicates new files
> vs modified ones in a single list. These old patches I am working with
> often create 100 files and modify another 200.
> 
> Adding a code like (Added (A), Copied (C), Deleted (D), Modified (M),
> Renamed (R))  to --stat would be perfect.
How about --name-status?
-Peff
Jakub Narebski· Jul 28, 2007, 15:26 UTC · re: Jeff King · lore

Re: git diff with add/modified codes

Jeff King wrote:
Show 10 quoted lines
> On Fri, Jul 27, 2007 at 08:17:54PM -0400, Jon Smirl wrote:
> 
>> That's not what I want. I'm looking a report that indicates new files
>> vs modified ones in a single list. These old patches I am working with
>> often create 100 files and modify another 200.
>> 
>> Adding a code like (Added (A), Copied (C), Deleted (D), Modified (M),
>> Renamed (R))  to --stat would be perfect.
> 
> How about --name-status?
Or -r --name-status?
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Jon Smirl· Jul 28, 2007, 18:07 UTC · re: Jakub Narebski · lore

Re: git diff with add/modified codes

On 7/28/07, Jakub Narebski <jnareb@gmail.com> wrote:
Show 14 quoted lines
> Jeff King wrote:
>
> > On Fri, Jul 27, 2007 at 08:17:54PM -0400, Jon Smirl wrote:
> >
> >> That's not what I want. I'm looking a report that indicates new files
> >> vs modified ones in a single list. These old patches I am working with
> >> often create 100 files and modify another 200.
> >>
> >> Adding a code like (Added (A), Copied (C), Deleted (D), Modified (M),
> >> Renamed (R))  to --stat would be perfect.
> >
> > How about --name-status?
>
> Or -r --name-status?

-r is not in the git diff doc but it is used in the examples. http://www.kernel.org/pub/software/scm/git/docs/git-diff.html

-- 
Jon Smirl
jonsmirl@gmail.com
Jakub Narebski· Jul 29, 2007, 21:36 UTC · re: Jon Smirl · lore

Re: git diff with add/modified codes

On Sat, 28 July 2007, Jon Smirl wrote:
Show 18 quoted lines
> On 7/28/07, Jakub Narebski <jnareb@gmail.com> wrote:
>> Jeff King wrote:
>>
>>> On Fri, Jul 27, 2007 at 08:17:54PM -0400, Jon Smirl wrote:
>>>
>>>> That's not what I want. I'm looking a report that indicates new files
>>>> vs modified ones in a single list. These old patches I am working with
>>>> often create 100 files and modify another 200.
>>>>
>>>> Adding a code like (Added (A), Copied (C), Deleted (D), Modified (M),
>>>> Renamed (R))  to --stat would be perfect.
>>>
>>> How about --name-status?
>>
>> Or -r --name-status?
> 
> -r is not in the git diff doc but it is used in the examples.
> http://www.kernel.org/pub/software/scm/git/docs/git-diff.html
<quote>
  <2> show only names and the nature of change, but not actual
  diff output.  --name-status disables usual patch generation
  which in turn also disables recursive behavior, so without -r
  you would only see the directory name if there is a change in a
  file in a subdirectory.
</quote>

"Of course" one knows that "git diff <tree-ish> <tree-ish>" is git-diff-tree in disguise, and accepts git-diff-tree options.

By the way, I was thinking about extending --numstat output to include also status. Current --numstat output is ill fitted to deal with renames and copies, at least ill fitted for machine consumption of renames output; it uses "old_name => new_name" as a filename for renames. While it would be fairly easy to put pre- and after-rename names separated by TAB, and quoted if needed (including embedded TAB character in the filename, which would be quoted as \t instead) without breaking anu current --numstat output parsers (although I don't think any of them uses -M/-C), it would be hard to do the same for --numstat -z output. A solution (not best, I admit) would be to use NUL NUL to separate pre- and post-image filename, but I think it would be best to add new --numstat-extended format to git-diff.

P.S. Is binary diff output described somewhere?
-- 
Jakub Narebski
Poland
Jon Smirl· Jul 28, 2007, 00:54 UTC · re: Johannes Schindelin · lore

Re: git diff with add/modified codes

On 7/27/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 7 quoted lines
> Hi,
>
> On Fri, 27 Jul 2007, Junio C Hamano wrote:
>
> > Would --stat --summary be satisfactory?
>
> Or does "--raw" do the job?

Raw is much closer. Combine the file stats from --raw with --stat and it would be perfect.

Show 5 quoted lines
>
> Ciao,
> Dscho
>
>
-- 
Jon Smirl
jonsmirl@gmail.com

← back to recent threads