From: Christian Halstrick <christian.halstrick@gmail.com>
To: Git <git@vger.kernel.org>
Subject: Can I fetch an arbitrary commit by sha1?
Date: Thu, 2 Oct 2014 15:57:45 +0200 [thread overview]
Message-ID: <CAENte7htO13s91UJFNzW4aBhsGxE=LpnvaZfce+vqQU5+a-cYg@mail.gmail.com> (raw)
I always though during fetch I have to specify a refspec and that a
sha1 would not be accepted as a ref. Firing some like 'git fetch
origin <sha1>' should be forbidden. But in fact I see that such a
fetch command succeeds if you already have that object in your local
repo.
My question: is it allowed to fetch sha1's? Shouldn't fetch fail if you try it?
See here:
> git clone -q https://github.com/chalstrick/dondalfi.git
> cd dondalfi
> git ls-remote
From https://github.com/chalstrick/dondalfi.git
ce08dcc41104383f3cca2b95bd41e9054a957f5b HEAD
af00f4c39bcc8dc29ed8f59a47066d5993c279e4 refs/foo/b1
...
> git show af00f4c39bcc8dc29ed8f59a47066d5993c279e4
fatal: bad object af00f4c39bcc8dc29ed8f59a47066d5993c279e4
> git fetch origin af00f4c39bcc8dc29ed8f59a47066d5993c279e4
error: no such remote ref af00f4c39bcc8dc29ed8f59a47066d5993c279e4
> git fetch origin refs/foo/b1
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From https://github.com/chalstrick/dondalfi
* branch refs/foo/b1 -> FETCH_HEAD
> git fetch origin af00f4c39bcc8dc29ed8f59a47066d5993c279e4
From https://github.com/chalstrick/dondalfi
* branch af00f4c39bcc8dc29ed8f59a47066d5993c279e4 -> FETCH_HEAD
Ciao
Chris
next reply other threads:[~2014-10-02 13:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-02 13:57 Christian Halstrick [this message]
2014-10-02 14:22 ` Can I fetch an arbitrary commit by sha1? Dan Johnson
2014-10-02 16:10 ` Jeff King
2014-10-02 17:35 ` Jonathan Nieder
2014-10-05 20:49 ` Christian Halstrick
2014-10-06 18:25 ` Patrick Donnelly
2014-10-06 18:28 ` David Lang
2014-10-07 12:34 ` Duy Nguyen
2014-10-07 13:12 ` Duy Nguyen
2014-10-07 16:52 ` Junio C Hamano
2014-10-08 13:30 ` Duy Nguyen
2014-10-09 18:08 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAENte7htO13s91UJFNzW4aBhsGxE=LpnvaZfce+vqQU5+a-cYg@mail.gmail.com' \
--to=christian.halstrick@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).