On Sat, 01 Jul 2023 22:28:01 +0200, Reiner Herrmann wrote:
I sometimes use the salsa tool from devscripts to clone repositories from salsa. It uses "gbp clone --all" to do that. I noticed that I have branches named "origin" that were created by gbp (they don't exist in the remote repository).
Same here (with dpt-checkout, which also uses "gbp clone --all").
For example: $ gbp clone --all -v https://salsa.debian.org/reiner/deheader gbp:debug: ['git', 'rev-parse', '--show-cdup'] gbp:info: Cloning from 'https://salsa.debian.org/reiner/deheader' gbp:debug: ['git', 'clone', '--quiet', 'https://salsa.debian.org/reiner/deheader'] gbp:debug: ['git', 'rev-parse', '--show-cdup'] gbp:debug: ['git', 'rev-parse', '--is-bare-repository'] gbp:debug: ['git', 'rev-parse', '--git-dir'] gbp:debug: ['git', 'rev-parse', '--show-cdup'] gbp:debug: ['git', 'rev-parse', '--is-bare-repository'] gbp:debug: ['git', 'rev-parse', '--git-dir'] gbp:debug: ['git', 'for-each-ref', '--format=%(refname:short)', 'refs/remotes/'] gbp:debug: ['git', 'show-ref', '--verify', 'refs/heads/origin'] gbp:debug: ['git', 'branch', 'origin', 'origin'] gbp:debug: ['git', 'show-ref', '--verify', 'refs/heads/master'] gbp:debug: ['git', 'show-ref', '--verify', 'refs/heads/pristine-tar'] gbp:debug: ['git', 'branch', 'pristine-tar', 'origin/pristine-tar'] gbp:debug: ['git', 'show-ref', '--verify', 'refs/heads/upstream'] gbp:debug: ['git', 'branch', 'upstream', 'origin/upstream'] gbp:debug: ['git', 'show-ref', '--verify', 'refs/remotes/master'] gbp:debug: ['git', 'ls-tree', '-z', '-r', '-l', 'HEAD', '--'] $ cd deheader/ $ git branch * master origin pristine-tar upstream $ git for-each-ref '--format=%(refname:short)' 'refs/remotes/' origin/HEAD origin/master origin/pristine-tar origin/upstream
I untangled the debug output a bit more to see where the "origin" is coming from:
% git clone --verbose '[email protected]:perl-team/modules/packages/libconfig-model-tkui-perl.git' Cloning into 'libconfig-model-tkui-perl'... remote: Enumerating objects: 6932, done. remote: Total 6932 (delta 0), reused 0 (delta 0), pack-reused 6932 (from 1) Receiving objects: 100% (6932/6932), 2.67 MiB | 2.60 MiB/s, done. Resolving deltas: 100% (3964/3964), done. % cd libconfig-model-tkui-perl % git branch --all --verbose * master 5b3a9a6 Update changelog for 1.381-1 release remotes/origin/HEAD -> origin/master remotes/origin/experimental 40f43d2 Update changelog for 1.374-1 release remotes/origin/master 5b3a9a6 Update changelog for 1.381-1 release remotes/origin/pristine-tar 4df6a36 pristine-tar data for libconfig-model-tkui-perl_1.379.orig.tar.gz remotes/origin/upstream 9739302 v1.381 % git for-each-ref --format="%(refname:short)" refs/remotes/origin origin/experimental
origin/master origin/pristine-tar origin/upstream Aha!And then the for-each-ref loop seen above runs, inter alia, `git branch origin origin'. Et voila …
Maybe the pattern in the git-for-each-ref could be tightened a bit? Random try, probably too tight:
% git for-each-ref --format="%(refname:short)" "refs/remotes/origin/[a-z]*" origin/experimental origin/master origin/pristine-tar origin/upstream Cheers, gregor -- .''`. https://info.comodo.priv.at -- Debian Developer https://www.debian.org : :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D 85FA BB3A 6801 8649 AA06 `. `' Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe`-
signature.asc
Description: Digital Signature

