git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: eero.aaltonen@vaisala.com, Jonathan Tan <jonathantanmy@google.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Behavior of 'git fetch' for commit hashes
Date: Mon, 19 Jun 2017 08:50:34 -0700	[thread overview]
Message-ID: <CAGZ79kbFeptKOfpaZ23yK=Zw9mJ0_evqPstHKkD1HSCaP_pC5g@mail.gmail.com> (raw)
In-Reply-To: <14e804c6-0798-8bbd-b182-66c3cd2b870c@vaisala.com>

+cc Jonathan who did some work in the area.

On Mon, Jun 19, 2017 at 5:09 AM,  <eero.aaltonen@vaisala.com> wrote:
> Hello,
>
> I am seeing greatly different behavior for 'git fetch' commands on
> version 2.7.4 and 2.13.1 when the argument to fetch is a commit hash.
>
> I am working on a custom Continuous Integration (CI) system. The
> projects have dependencies that are simply fetched as repositories to a
> project subdirectory.
>
> In order to prevent a race condition in updating branches, I want to
> checkout the actual commit that was built in a previous job.
>
> Environment
> ===========
> Problem occurs with Git clients
> - 2.7.4
> - 2.13.1
>
> and Git server
> - Atlassian Bitbucket v4.14.3
> - git version 2.12.0
>
>
> The problem can be reproduced as follows, with
> - <authoritativeUrl> = URL to primary repository
> - <forkUrl> = URL to fork of the primary
> - <sha1> commit hash in a recent branch
>
> 1. git clone <authoritativeUrl>
> 2. cd resulting_directory
> 3. git fetch <forkUrl> <sha1>
>
> For version 2.7.4
> =================
> Git exits with exit code 1.
>
> However, if I first do 'git fetch <branch>', then 'git fetch <sha1> will
> also work
>
>  * branch   <sha1> -> FETCH_HEAD
>
> For version 2.13.3
> ==================
> Git exits with exit code 128 and message
> fatal: Couldn't find remote ref
>
> However, the workaround for descbibed abot for git version 2.7.4 no
> longer works. The result is always
> fatal: Couldn't find remote ref
>
> Desired result
> ==============
> Commit is in .git/FETCH_HEAD and can be checked out.
>
>
> I want to checkout a specific commit without creating any extra named
> remotes in the local git clone.
>
> Finally,
> What is the expected behavior for 'git fetch' in this case?
> Is there some other way I can achieve my goals?
>
> --
> Best regards,
> Eero Aaltonen

  reply	other threads:[~2017-06-19 15:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-19 12:09 Behavior of 'git fetch' for commit hashes eero.aaltonen
2017-06-19 15:50 ` Stefan Beller [this message]
2017-06-19 17:49 ` Jonathan Tan
2017-06-19 22:26   ` Jonathan Tan
2017-06-20 11:32     ` eero.aaltonen

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGZ79kbFeptKOfpaZ23yK=Zw9mJ0_evqPstHKkD1HSCaP_pC5g@mail.gmail.com' \
    --to=sbeller@google.com \
    --cc=eero.aaltonen@vaisala.com \
    --cc=git@vger.kernel.org \
    --cc=jonathantanmy@google.com \
    /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.
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).