From: Johannes Sixt <j.sixt@viscovery.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Todd Zullinger <tmz@pobox.com>,
Rafael Darder Calvo <rdarder@spiralti.com>
Subject: Re: [PATCH v2] Make sure objects/pack exists before creating a new pack
Date: Thu, 26 Feb 2009 10:19:59 +0100 [thread overview]
Message-ID: <49A65EBF.10307@viscovery.net> (raw)
In-Reply-To: <7vocwrc7oe.fsf_-_@gitster.siamese.dyndns.org>
Junio C Hamano schrieb:
> @@ -795,22 +794,24 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
>
> if (keep_msg) {
> int keep_fd, keep_msg_len = strlen(keep_msg);
> - if (!keep_name) {
> - snprintf(name, sizeof(name), "%s/pack/pack-%s.keep",
> - get_object_directory(), sha1_to_hex(sha1));
> - keep_name = name;
You should not have removed this line...
> - }
> - keep_fd = open(keep_name, O_RDWR|O_CREAT|O_EXCL, 0600);
> +
> + if (!keep_name)
> + keep_fd = odb_pack_keep(name, sizeof(name), sha1);
> + else
> + keep_fd = open(keep_name, O_RDWR|O_CREAT|O_EXCL, 0600);
> +
> if (keep_fd < 0) {
> if (errno != EEXIST)
> - die("cannot write keep file");
> + die("cannot write keep file '%s' (%s)",
> + keep_name, strerror(errno));
... we need keep_name for this error message.
Warning: I did not test the failure path; but I made sure that these
tests pass on Windows:
cd t && make *fetch* *pack* *index* *pull*
-- snip --
From: Johannes Sixt <j6t@kdbg.org>
Subject: [PATCH] index-pack: Set keep_name if a new keep file was allocated
6e180cdc (Make sure objects/pack exists before creating a new pack,
2009-02-25) simplified the code in this area, but it also extended an
error message to include the file name that caused the error. However,
one code path did not set file name correctly.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
index-pack.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/index-pack.c b/index-pack.c
index 7fee872..93a09c6 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -794,9 +794,10 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
if (keep_msg) {
int keep_fd, keep_msg_len = strlen(keep_msg);
- if (!keep_name)
+ if (!keep_name) {
keep_fd = odb_pack_keep(name, sizeof(name), sha1);
- else
+ keep_name = name;
+ } else
keep_fd = open(keep_name, O_RDWR|O_CREAT|O_EXCL, 0600);
if (keep_fd < 0) {
--
1.6.2.rc2.1005.gb0117
next prev parent reply other threads:[~2009-02-26 9:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-24 17:04 git-push error: Cannot write keep file Rafael Darder Calvo
2009-02-24 17:31 ` Junio C Hamano
2009-02-24 21:21 ` Rafael Darder Calvo
2009-02-25 7:11 ` [PATCH v2] Make sure objects/pack exists before creating a new pack Junio C Hamano
2009-02-25 7:15 ` Junio C Hamano
2009-02-26 9:19 ` Johannes Sixt [this message]
2009-02-26 11:19 ` Mike Ralphson
2009-02-26 15:31 ` Johannes Sixt
2009-02-26 15:54 ` Mike Ralphson
2009-02-26 17:07 ` 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=49A65EBF.10307@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=rdarder@spiralti.com \
--cc=tmz@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).