Re: git clone combined with --depth, --branch and --single-branch

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

 



Hi Duy,

On Sun, Feb 17, 2013 at 3:32 PM, Duy Nguyen <pclouds@xxxxxxxxx> wrote:
> On Sun, Feb 17, 2013 at 7:29 PM, Thibault Kruse
> <tibokruse@xxxxxxxxxxxxxx> 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 1.7.10.4?


So far I used ubuntu packaged versions, Here is what I got with master:
git --version
git version 1.8.1.3.619.g7b6e784
# 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 1.8.1.3.619.g7b6e784.
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.br=branch
alias.co=checkout
alias.ci=commit
alias.di=diff
alias.st=status
alias.mt=mergetool
alias.pr=pull --rebase
alias.ri=rebase --interactive
alias.sa=stash apply
alias.c-p=cherry-pick
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
core.excludesfile=/home/kruset/.bashconfig/gitignore.global
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true

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