Shallow clones vs blame/log

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]