git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* diff-tree -r and new directories
@ 2008-04-10  6:29 Johannes Sixt
  2008-04-10  6:52 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Sixt @ 2008-04-10  6:29 UTC (permalink / raw)
  To: Git Mailing List

In one of my scriptlets I have this:

   git diff-tree -r --name-only --diff-filter=AM -z "$rev" HEAD --

and I had assumed that only files would ever be listed because of the -r
switch. But this is not true: If there is a new directory, it lists only
the directory's name instead of the files. Is this the intent? Is it worth
changing?

-- Hannes

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: diff-tree -r and new directories
  2008-04-10  6:29 diff-tree -r and new directories Johannes Sixt
@ 2008-04-10  6:52 ` Junio C Hamano
  2008-04-10  7:24   ` Johannes Sixt
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2008-04-10  6:52 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Git Mailing List

Johannes Sixt <j.sixt@viscovery.net> writes:

> In one of my scriptlets I have this:
>
>    git diff-tree -r --name-only --diff-filter=AM -z "$rev" HEAD --
>
> and I had assumed that only files would ever be listed because of the -r
> switch. But this is not true: If there is a new directory, it lists only
> the directory's name instead of the files. Is this the intent? Is it worth
> changing?

Hmm. you would need a better reproduction recipe than that.

    $ git init
    Initialized empty Git repository in .git/
    $ >file
    $ git add file
    $ git commit -a -m initial
    Created initial commit 2f9da65: initial
     0 files changed, 0 insertions(+), 0 deletions(-)
     create mode 100644 file
    $ mkdir new
    $ >new/file
    $ git add new/file
    $ git commit -a -m second
    Created commit a1fa8fb: second
     0 files changed, 0 insertions(+), 0 deletions(-)
     create mode 100644 new/file
    $ git diff-tree -r --name-only --diff-filter=AM -z HEAD^ HEAD |
      tr '\0' '\n'
    new/file
    $ git diff-tree --name-only --diff-filter=AM -z HEAD^ HEAD |
      tr '\0' '\n'
    new

Perhaps you somehow did not have "-r" even though you thought you had?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: diff-tree -r and new directories
  2008-04-10  6:52 ` Junio C Hamano
@ 2008-04-10  7:24   ` Johannes Sixt
  0 siblings, 0 replies; 3+ messages in thread
From: Johannes Sixt @ 2008-04-10  7:24 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

Junio C Hamano schrieb:
> Johannes Sixt <j.sixt@viscovery.net> writes:
> 
>> In one of my scriptlets I have this:
>>
>>    git diff-tree -r --name-only --diff-filter=AM -z "$rev" HEAD --
>>
>> and I had assumed that only files would ever be listed because of the -r
>> switch. But this is not true: If there is a new directory, it lists only
>> the directory's name instead of the files. Is this the intent? Is it worth
>> changing?
> 
> Hmm. you would need a better reproduction recipe than that.

Heh. It turns out that the questionable directory is actually versioned by
git. My scriptlets have added it as a submodule while I looked in the
other direction:

  $ git diff --summary $rev.. -- . | cat
  create mode 160000 D/Project/foo

:-) Problem solved. Thank you.

-- Hannes

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-04-10  7:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-10  6:29 diff-tree -r and new directories Johannes Sixt
2008-04-10  6:52 ` Junio C Hamano
2008-04-10  7:24   ` Johannes Sixt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).