git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Shallow clones vs blame/log
@ 2011-03-02 19:51 Piotr Krukowiecki
  2011-03-02 21:58 ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: Piotr Krukowiecki @ 2011-03-02 19:51 UTC (permalink / raw)
  To: Git Mailing List

Hi,

I'd like to confirm: when doing shallow clone with --depth=n, and then
using blame,
git does know only about n last revisions. For each change that happened before
shows "^commit" where "commit" is n+1 commit ?

I wonder if this can be more clear. I was bitten by this today. I was
using blame
on a file and it showed a commit and author for a line. But the line
was not changed
in that commit. Took me a while to understand that it's caused by
shallow copy...

I could be blamed for not reading git-blame man, but luckily ^commit is not
described there ;)

Also, git-log puts all not cloned commits into last not cloned commit,
and there's no
information that it's a "fake" commit.


Example:

/tmp$ mkdir r && cd r && git init && echo a > a && git add a && git
commit -a -m first && echo b > b && git add b && git commit -a -m
second && echo aa >> a && git commit -a -m third && echo bb >> b &&
git commit -a -m fourth  && cd ..
warning: templates not found /home/piotr/share/git-core/templates
Initialized empty Git repository in /tmp/r/.git/
[master (root-commit) 890ec47] first
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 a
[master f969fda] second
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 b
[master 20c3c2c] third
 1 files changed, 1 insertions(+), 0 deletions(-)
[master 9dcd745] fourth
 1 files changed, 1 insertions(+), 0 deletions(-)

/tmp$ DIR=clone1;  git clone --depth 1 file:///tmp/r $DIR && cd $DIR
&& git log --stat --oneline
Cloning into clone1...
warning: templates not found /home/piotr/share/git-core/templates
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (4/4), done.
Receiving objects: 100% (7/7), 515 bytes, done.
remote: Total 7 (delta 0), reused 0 (delta 0)
9dcd745 fourth
 b |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
20c3c2c third
 a |    2 ++
 b |    1 +
 2 files changed, 3 insertions(+), 0 deletions(-)

/tmp/clone1$ git blame a
^20c3c2c (Piotr Krukowiecki 2011-03-02 20:42:53 +0100 1) a
^20c3c2c (Piotr Krukowiecki 2011-03-02 20:42:53 +0100 2) aa

/tmp/clone1$ git blame b
^20c3c2c (Piotr Krukowiecki 2011-03-02 20:42:53 +0100 1) b
9dcd7453 (Piotr Krukowiecki 2011-03-02 20:42:53 +0100 2) bb

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

end of thread, other threads:[~2011-03-02 21:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-02 19:51 Shallow clones vs blame/log Piotr Krukowiecki
2011-03-02 21:58 ` Jeff King

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).