On Fri, 11 Jan 2013 23:16:08 -0800 (PST)
Blind <stoycho.slept...@gmail.com> wrote:

> In other words, do you think something like:
>  ls -1 | awk '{"git log -1 --pretty=format:\"%ci %h %an\" -- "$1 |
> getline g; print g, $1; close("git log -1 --pretty=format:\"%ci %h %an
> \" -- "$1)}'
> is efficient enough, or you have better ideas?

`ls -1` is not okay as it will also list untracked filesystem objects,
on which calls to `git log` will obviously fail, so should you opt for
this implementation, better use `git ls-files` as the starting point.

As to efficiency, no, this is not terrible efficient: each call to
`git log` traverses the same history line from top to bottom; you do
this once for each filesystem object in the top-level tree.

A more sensible (though way harder to implement) approach would be to
reverse the logic and start with traversing the history, checking for
possible modifications of the objects captured in the starting revision
as you go deeper down -- see my other mail in this thread for more info.

Also I wouldn't hesitate to ask this question on the main Git list as
this question appears to be hard-core enough to warrant assisting of
someone knowledgeable about Git internals.


Reply via email to