Hi Duy,

On Sun, Feb 17, 2013 at 3:32 PM, Duy Nguyen <pclo...@gmail.com> wrote:
> On Sun, Feb 17, 2013 at 7:29 PM, Thibault Kruse
> <tibokr...@googlemail.com> wrote:
>> git log --pretty=format:'%h-%s %d' --graph --decorate  --all
>> * 4565162-5  (foo)
>> * 20ce846-4
>> * a0615eb-3
>> * fa4131d-2
>> * f0683bd-1  (bar)
>> | * 432b5ec-m1  (HEAD, master)
>> |/
>> * 39df203-0
>> git clone repo1 repo2 --depth 1
>> cd repo2
>> git log --pretty=format:'%h-%s %d' --graph --decorate  --all
>> * 432b5ec-m1  (HEAD, origin/master, origin/HEAD, master)
>> * 39df203-0
>> # Why are branches "foo" and "bar" missing?
> --depth implies --single-branch. Without explicit --branch,
> --single-branch will fetch HEAD. You need --no-single-branch to get
> foo and bar.

Agreed, sorry. I forgot that --depth implied --single-branch. Probably
because it don't like that being a default that breaks behavior to
versions that did not have the --single-branch feature.
So this example is the only one which I agree does actually what can
be expected from the documentation (with respect to branches. --depth
also does not restrict the history length, but the example does not
show it).

>> cd ..
>> git clone repo1 repo3 --depth 1 --branch foo
>> git log --pretty=format:'%h-%s %d' --graph --decorate  --all
>> * 4565162-5  (HEAD, origin/foo, foo)
>> * 20ce846-4
>> * a0615eb-3
>> * fa4131d-2
>> * f0683bd-1
>> | * 432b5ec-m1  (origin/master, origin/HEAD)
>> |/
>> * 39df203-0
>> # Why is --depth not having effect, and why is branch bar not there,
>> yet master is?
> I'm not sure, but I can't reproduce it.

Do you mean you cannot reproduce with

So far I used ubuntu packaged versions, Here is what I got with master:
git --version
git version
# added commit m2 and m3 to master branch in repo1 to show that
--depth is not working locally
git clone repo1 repo2 --depth 1
git log --pretty=format:'%h-%s %d' --graph --decorate  --all
* 704f0c4-m3  (HEAD, origin/master, origin/HEAD, master)
* 7b90b28-m2
* 1fa92bd-m1
* 5da3517-0

So I still get the --depth not having affect locally, but I confirm
all other cases I posted work as expected with
Meaning --depth works from a remote repo, and --single-branch (implied
by depth) really just creates that branch locally.

I don't even know where to start looking for why --depth has no effect
for disk-local remotes.
I don't have the git command aliased, and in repo1, I get:
alias.pr=pull --rebase
alias.ri=rebase --interactive
alias.sa=stash apply
alias.lg=!git log --pretty=format:%h%x09%an%x09%ad%x09%s
alias.lgg=log --graph --pretty=format:'%Cred%h%Creset
-%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
--abbrev-commit --date=relative
alias.top=!eval cd $(pwd)/$(git rev-parse --show-cdup) && pwd

Not sure whether any of the "core" properties can cause this.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to