2

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.

mstrap
  • 16,808
  • 10
  • 56
  • 86

1 Answers1

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):

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