From: Alex Riesen <raa.lkml@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: [PATCH] Improve error message about fetch into current branch
Date: Sun, 22 Mar 2009 23:07:33 +0100 [thread overview]
Message-ID: <20090322220732.GA6736@blimp.localdomain> (raw)
Otherwise, it is hard to guess why the fetch failed.
Make sure we at least mention that the repository must be bare.
Also the current branch is printed.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
In particular, a repository not marked bare with core.bare is, for
some reason, considered non-bare even if there is no work tree nor
index. I found about the message while trying to run git remote,
in an essentially bare repository without core.bare set. Funny,
git --bare fetch worked properly, but git --bare remote update failed:
$ GIT_TRACE=1 ~/projects/git/git --bare remote -v update
trace: built-in: git 'remote' '-v' 'update'
Updating origin
trace: run_command: 'fetch' '-v' 'origin'
trace: exec: 'git' 'fetch' '-v' 'origin'
trace: built-in: git 'fetch' '-v' 'origin'
fatal: Refusing to fetch into current branch refs/heads/master
error: Could not fetch origin
$ git --bare fetch -v origin
From git://git.kernel.org/pub/scm/linux/hotplug/udev
= [up to date] master -> master
$
Looks like --bare is lost somewhere.
builtin-fetch.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/builtin-fetch.c b/builtin-fetch.c
index 7fb35fc..7293146 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -544,7 +544,8 @@ static void check_not_current_branch(struct ref *ref_map)
for (; ref_map; ref_map = ref_map->next)
if (ref_map->peer_ref && !strcmp(current_branch->refname,
ref_map->peer_ref->name))
- die("Refusing to fetch into current branch");
+ die("Refusing to fetch into current branch %s "
+ "of non-bare repository", current_branch->refname);
}
static int do_fetch(struct transport *transport,
--
1.6.2.1.316.g4241
reply other threads:[~2009-03-22 22:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20090322220732.GA6736@blimp.localdomain \
--to=raa.lkml@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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.
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).