From: Jim Hill <gjthill@gmail.com>
To: Junio Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: [PATCH 2/2] remove hold_lock_file_for_append
Date: Sun, 31 May 2015 11:15:23 -0700 [thread overview]
Message-ID: <1433096123-14420-3-git-send-email-gjthill@gmail.com> (raw)
In-Reply-To: <1433096123-14420-1-git-send-email-gjthill@gmail.com>
No uses of hold_lock_file_for_append remain, so remove it.
hold_lock_file_for_append copies its target file internally. This makes
it too heavyweight for logging and too limited for anything else. It
shouldn't be used.
Signed-off-by: Jim Hill <gjthill@gmail.com>
---
lockfile.c | 38 --------------------------------------
1 file changed, 38 deletions(-)
diff --git a/lockfile.c b/lockfile.c
index 9889277..1467778 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -187,44 +187,6 @@ int hold_lock_file_for_update(struct lock_file *lk, const char *path, int flags)
return fd;
}
-int hold_lock_file_for_append(struct lock_file *lk, const char *path, int flags)
-{
- int fd, orig_fd;
-
- fd = lock_file(lk, path, flags);
- if (fd < 0) {
- if (flags & LOCK_DIE_ON_ERROR)
- unable_to_lock_die(path, errno);
- return fd;
- }
-
- orig_fd = open(path, O_RDONLY);
- if (orig_fd < 0) {
- if (errno != ENOENT) {
- int save_errno = errno;
-
- if (flags & LOCK_DIE_ON_ERROR)
- die("cannot open '%s' for copying", path);
- rollback_lock_file(lk);
- error("cannot open '%s' for copying", path);
- errno = save_errno;
- return -1;
- }
- } else if (copy_fd(orig_fd, fd)) {
- int save_errno = errno;
-
- if (flags & LOCK_DIE_ON_ERROR)
- exit(128);
- close(orig_fd);
- rollback_lock_file(lk);
- errno = save_errno;
- return -1;
- } else {
- close(orig_fd);
- }
- return fd;
-}
-
FILE *fdopen_lock_file(struct lock_file *lk, const char *mode)
{
if (!lk->active)
--
2.4.1.4.gfc728c2
next prev parent reply other threads:[~2015-05-31 18:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-31 18:15 [PATCH 0/2] don't add duplicate paths to info/alternates Jim Hill
2015-05-31 18:15 ` [PATCH 1/2] add_to_alternates_file: don't add duplicate paths Jim Hill
2015-06-01 10:51 ` Jeff King
2015-05-31 18:15 ` Jim Hill [this message]
2015-06-01 10:53 ` [PATCH 0/2] don't add duplicate paths to info/alternates Jeff King
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=1433096123-14420-3-git-send-email-gjthill@gmail.com \
--to=gjthill@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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).