Re: Shallow clones vs blame/log

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

 



On Wed, Mar 02, 2011 at 08:51:27PM +0100, Piotr Krukowiecki wrote:

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

It's not just shallow copy, but any time you have limited the traversal.
So you could do "git blame v1.5.0..v1.6.0 wt-status.c", and lines that
come from v1.5.0 or before are attributed to v1.5.0 with the carat.

The magic name for this is "boundary commits". See the "-b" option for
an alternative way of viewing them.

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

Yes, we seem not to describe the regular output in very much detail at
all (nor mention the "^" syntax in the description of porcelain output),
which we probably should.

We do mention in the "specifying ranges" section that unchanged lines
will be blamed to the boundary commit. Part of the problem is that you
didn't realize you had a range because you were using a shallow clone.
But I wonder if that information would be more appropriate when
introducing shallow clones in git-clone(1).

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

Same issue. The bottom end of a shallow clone has no parents, and log's
diffs show root commits as giant creation events.

Maybe it would be nice if the log output somehow noted that it was not a
real root commit, but rather the endpoint of a shallow clone, regardless
of whether there is a diff being shown. Because it is also potentially
confusing to do "git log", scroll to the bottom, and think that is the
very first commit, when it's not (and you could deepen your repository
if you wanted).

I think all of this is due to the fact that shallow clones were tacked
on after the fact, and are not all that commonly used.

Patches welcome (for docs or for log), of course.

-Peff
--
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]