git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Tim Visher <tim.visher@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Print last time and committer a file was touched by for a whole  repo
Date: Sat, 3 Jul 2010 11:13:32 +0200	[thread overview]
Message-ID: <201007031113.33231.jnareb@gmail.com> (raw)
In-Reply-To: <AANLkTil2Riz3_iKEREjsERVsBkSZdZ9wa9ujOahxjs4Y@mail.gmail.com>

On Fri, 2 July 2010, Tim Visher wrote:
> Thanks everyone who responded.  I ended up doing
> 
>     find . -path "./.git*" -prune -o -print -exec git log -n 1 -- '{}'
> \;> assets.txt
> 
> Little roundabout but seems effective.

Sidenote: you might want to use '--follow' on place of '--', just in rare
case you would hit file rename (or copy).

See also: https://git.wiki.kernel.org/index.php/ExampleScripts#Finding_which_commits_last_touched_the_files

> On Thu, Jul 1, 2010 at 4:12 PM, Jakub Narebski <jnareb@gmail.com> wrote:
>> Tim Visher <tim.visher@gmail.com> writes:
>>
>>> I need to get a listing of the entire contents of my current repo (as
>>> in, I don't need deleted files or anything like that, just the current
>>> snapshot) with the time the file was committed and who committed it.
>>>
>>> Thoughts on how to do that?
>>
>> There does not exist a single git command that would do what you want.
>> You would need to use 'git log -1 --follow' for each file in current
>> snapshot ('git ls-tree -r HEAD').  IIRC there is some example how to
>> do that in GitFaq or GitTips on git wiki (http://git.wiki.kernel.org).
>>
>> Perhaps in the future 'git blame <directory>' would provide such
>> output, or its equivalent (tree blame).
> 
> That'd be cool.

I am currently working on prototype in Perl, using 'git cat-file --batch'
and 'git diff-tree --stdin', as I don't know git C code/API enought to
write it in C; it is planned to be converted to C after proof of concept
works.
 
>> By the way, what do you ned this for?  Git versions whole project at
>> once, not individual files.  Is it some legacy from CVS?
> 
> Ummm...  Little embarrassing but this is apparently a requirement for
> my company.  Every few years they ask for a 'listing of all software
> assets, when they were last touched, who last touched them, and what
> version of software they were touched for.'  Generous assumptions is
> that they're probing us for how effectively we can lay our hands on
> this information.  Cynics would say that someone somewhere decided one
> day that it would be a good idea to have an __Excel Spreadsheet__
> (yep, that's what it goes into) listing every file that every software
> project everywhere in the company has, and that now people do it
> because it's on a check list.
> 
> Anywho... Hooray for `find -exec`.

Why the _files_ granularity, rather than _project_ (repository) 
granularity?  Unless you have post-CVS / post-Subversion one mega-repo
containing all projects squashed together (yuck!).

IMHVO better solution would be list, for each repository/(sub)project,
list date of last commit on master branch (when it was last touched),
list date of last signed tag / of tagged release (when it was last 
released), and shortlog or blame-based or diffstat based statistics
of code authorship (replacement of 'who last touched them').  Note
that any code metric / software kwalitee metric is subject to abuse
(numerous examples can be found at TheDailyWTF, and IIRC Joel Spolsky
and Jeff Atwood both described such dangers on their blogs).

-- 
Jakub Narebski
Poland

  reply	other threads:[~2010-07-03  9:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-01 19:05 Print last time and committer a file was touched by for a whole repo Tim Visher
2010-07-01 19:45 ` Eric Raible
2010-07-01 20:05 ` Jonathan Nieder
2010-07-01 21:40   ` Eric Wong
2010-07-02  3:37     ` Jonathan Nieder
2010-07-01 20:12 ` Jakub Narebski
2010-07-02 11:55   ` Tim Visher
2010-07-03  9:13     ` Jakub Narebski [this message]
2010-07-05  9:53       ` Jakub Narebski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201007031113.33231.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=tim.visher@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).