From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH 2/2] fetch: report ref storage DF errors more accurately
Date: Mon, 25 May 2009 06:40:54 -0400 [thread overview]
Message-ID: <20090525104054.GA26682@coredump.intra.peff.net> (raw)
In-Reply-To: <20090429080650.GA25227@coredump.intra.peff.net>
When we fail to store a fetched ref, we recommend that the
user try running "git prune" to remove up any old refs that
have been deleted by the remote, which would clear up any DF
conflicts. However, ref storage might fail for other
reasons (e.g., permissions problems) in which case the
advice is useless and misleading.
This patch detects when there is an actual DF situation and
only issues the advice when one is found.
Signed-off-by: Jeff King <peff@peff.net>
---
This is a followup to Ingo's bug report here:
http://thread.gmane.org/gmane.comp.version-control.git/117751
builtin-fetch.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/builtin-fetch.c b/builtin-fetch.c
index 77acabf..1eec64e 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -167,6 +167,9 @@ static struct ref *get_ref_map(struct transport *transport,
return ref_map;
}
+#define STORE_REF_ERROR_OTHER 1
+#define STORE_REF_ERROR_DF_CONFLICT 2
+
static int s_update_ref(const char *action,
struct ref *ref,
int check_old)
@@ -181,9 +184,11 @@ static int s_update_ref(const char *action,
lock = lock_any_ref_for_update(ref->name,
check_old ? ref->old_sha1 : NULL, 0);
if (!lock)
- return 2;
+ return errno == ENOTDIR ? STORE_REF_ERROR_DF_CONFLICT :
+ STORE_REF_ERROR_OTHER;
if (write_ref_sha1(lock, ref->new_sha1, msg) < 0)
- return 2;
+ return errno == ENOTDIR ? STORE_REF_ERROR_DF_CONFLICT :
+ STORE_REF_ERROR_OTHER;
return 0;
}
@@ -386,7 +391,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
}
free(url);
fclose(fp);
- if (rc & 2)
+ if (rc & STORE_REF_ERROR_DF_CONFLICT)
error("some local refs could not be updated; try running\n"
" 'git remote prune %s' to remove any old, conflicting "
"branches", remote_name);
--
1.6.3.1.250.g01b8b.dirty
next prev parent reply other threads:[~2009-05-25 10:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-28 7:31 error: Unable to append to .git/logs/refs/remotes/origin/master: Permission denied Ingo Molnar
2009-04-29 3:29 ` Jeff King
2009-04-29 4:07 ` Jeff King
2009-04-29 7:32 ` Ingo Molnar
2009-04-29 8:06 ` Jeff King
2009-05-25 10:37 ` [PATCH 1/2] lock_ref: inform callers of unavailable ref Jeff King
2009-05-25 10:40 ` Jeff King [this message]
2009-05-25 22:23 ` [PATCH 2/2] fetch: report ref storage DF errors more accurately 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=20090525104054.GA26682@coredump.intra.peff.net \
--to=peff@peff.net \
--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).