We are planning to use git ls-remote <repository> [<refs>…]
without any additional parameters concurrently to virtually any other Git operation. I'm looking for a confirmation that ls-remote
is read-only, so it can't break any other operation.
Asked
Active
Viewed 172 times
2

mstrap
- 16,808
- 10
- 56
- 86
1 Answers
2
Yes, it is a read-only operation.
Nothing in builtin/ls-remote.c suggests any operation modifying the local repo.
It sets as transport the TRANS_OPT_UPLOADPACK
, which is used also in two other git commands (which don't modify the remote repo):
git clone
(builtin/clone.c:919
) andgit fetch
(builtin/fetch.c:807
)/* The program to use on the remote side to send a pack */ #define TRANS_OPT_UPLOADPACK "uploadpack"
It is asking the remote repo to send packs, nothing more.

VonC
- 1,262,500
- 529
- 4,410
- 5,250
-
Thanks, VonC. I can't see why `clone` or `fetch` would be read-only (they are obviously not!?). However, ls-remote.c actually looks extremely light-weight regarding the local repository. Seems like it only requires to read `.git/config` and that's all. – mstrap Mar 06 '14 at 14:33
-
@mstrap yes, I meant two other commands which don't modify the *remote* repo. – VonC Mar 06 '14 at 14:36