summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 74b6792)
raw | patch | inline | side by side (parent: 74b6792)
author | Nicolas Pitre <nico@cam.org> | |
Tue, 30 Oct 2007 21:06:21 +0000 (17:06 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 30 Oct 2007 23:08:40 +0000 (16:08 -0700) |
This one triggers only when git-pack-objects is called with
--all-progress and --stdout which is the combination used by
git-push.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
--all-progress and --stdout which is the combination used by
git-push.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-pack-objects.c | patch | blob | history | |
csum-file.c | patch | blob | history | |
csum-file.h | patch | blob | history |
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 52a26a28f4f84180ae74dc9b3ebce9c49afc4166..25ec65d0f0e89f795329feae2a3eac04ca96a976 100644 (file)
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
char *pack_tmp_name = NULL;
if (pack_to_stdout) {
- f = sha1fd(1, "<stdout>");
+ f = sha1fd_throughput(1, "<stdout>", progress_state);
} else {
char tmpname[PATH_MAX];
int fd;
diff --git a/csum-file.c b/csum-file.c
index 9929991deaf423510abbc1fed2faa0b78c2a55da..3729e73e19e18a78c15fb90dfc28133f541176ef 100644 (file)
--- a/csum-file.c
+++ b/csum-file.c
* able to verify hasn't been messed with afterwards.
*/
#include "cache.h"
+#include "progress.h"
#include "csum-file.h"
static void sha1flush(struct sha1file *f, unsigned int count)
for (;;) {
int ret = xwrite(f->fd, buf, count);
if (ret > 0) {
+ display_throughput(f->tp, ret);
buf = (char *) buf + ret;
count -= ret;
if (count)
}
struct sha1file *sha1fd(int fd, const char *name)
+{
+ return sha1fd_throughput(fd, name, NULL);
+}
+
+struct sha1file *sha1fd_throughput(int fd, const char *name, struct progress *tp)
{
struct sha1file *f;
unsigned len;
f->fd = fd;
f->error = 0;
f->offset = 0;
+ f->tp = tp;
f->do_crc = 0;
SHA1_Init(&f->ctx);
return f;
diff --git a/csum-file.h b/csum-file.h
index c3c792f1b56026b6a4d9d10b6ba63947c7f383cf..4d1b231292ad4cfc7996b73ea31fa74a5eff2687 100644 (file)
--- a/csum-file.h
+++ b/csum-file.h
#ifndef CSUM_FILE_H
#define CSUM_FILE_H
+struct progress;
+
/* A SHA1-protected file */
struct sha1file {
int fd, error;
unsigned int offset, namelen;
SHA_CTX ctx;
+ struct progress *tp;
char name[PATH_MAX];
int do_crc;
uint32_t crc32;
};
extern struct sha1file *sha1fd(int fd, const char *name);
+extern struct sha1file *sha1fd_throughput(int fd, const char *name, struct progress *tp);
extern int sha1close(struct sha1file *, unsigned char *, int);
extern int sha1write(struct sha1file *, void *, unsigned int);
extern void crc32_begin(struct sha1file *);