git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git fetch --dry-run changes the local repo and transfers data
@ 2022-12-26 17:21 Tim Hockin
  2022-12-27 12:52 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Hockin @ 2022-12-26 17:21 UTC (permalink / raw)
  To: git

I'm trying to test if a remote repo has a given SHA. `ls-remote` does
not work for this unless it is a tag or a HEAD (which is not
guaranteed for this case).

`git fetch --dry-run $remote $rev` SEEMS to fit the bill, except it
changes local state. For example:

```
$ git cat-file -t f80f1b23b4cab2a295a091c623bb4746d188bd4a
fatal: git cat-file: could not get object info

$ git rev-parse FETCH_HEAD
42d21cf12aab73ac8bc6245cc74ac9850bdf6989

$ git fetch --dry-run file:///tmp/e2e.2527526915/repo
f80f1b23b4cab2a295a091c623bb4746d188bd4a
remote: Enumerating objects: 20, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 18 (delta 6), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (18/18), 415.91 KiB | 84.00 KiB/s, done.
From file:///tmp/e2e.2527526915/repo
 * branch            f80f1b23b4cab2a295a091c623bb4746d188bd4a -> FETCH_HEAD

$ git cat-file -t f80f1b23b4cab2a295a091c623bb4746d188bd4a
commit

$ git rev-parse FETCH_HEAD
42d21cf12aab73ac8bc6245cc74ac9850bdf6989
```

FETCH_HEAD was not updated (good) but the rev in question is now
present locally (bad), further tested by making a very large commit
and watching the fetch be very slow.  Also the same on non file://
repo (I tried https)

Am I using --dry-run wrong (or misunderstanding its purpose)?

Tim

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-03 11:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-26 17:21 git fetch --dry-run changes the local repo and transfers data Tim Hockin
2022-12-27 12:52 ` Junio C Hamano
2022-12-27 18:42   ` Tim Hockin
2023-01-03 11:07     ` Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).