* Re: [PATCH] MSVC: Enable OpenSSL, and translate -lcrypto
From: Marius Storm-Olsen @ 2009-10-03 20:08 UTC (permalink / raw)
To: Erik Faye-Lund; +Cc: git, msysgit
In-Reply-To: <40aa078e0910031305u38cfaf4aua72d4c7af2a470b2@mail.gmail.com>
Erik Faye-Lund said the following on 03.10.2009 22:05:
> On Sat, Oct 3, 2009 at 1:00 PM, Marius Storm-Olsen <mstormo@gmail.com> wrote:
>> This patch was actually sent using the MSVC
>> git-imap-send.exe to my GMail account.
>> D:\msvc\git>cat
>> 0001-MSVC-Enable-OpenSSL-and-translate-lcrypto.patch |
>> git-imap-send.exe
>> Resolving imap.gmail.com... ok
>> Connecting to 74.125.79.109:993... ok
>> Logging in...
>> sending 1 message
>> 100% (1/1) done
>> :)
>
> Awesome :)
Yup, only sad to see that GMail dropped the In-reply-to when sending :-/
>> diff --git a/Makefile b/Makefile
>> index 8818f0f..c4b91d8 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -881,7 +881,6 @@ ifdef MSVC
>> GIT_VERSION := $(GIT_VERSION).MSVC
>> pathsep = ;
>> NO_PREAD = YesPlease
>> - NO_OPENSSL = YesPlease
>> NO_LIBGEN_H = YesPlease
>> NO_SYMLINK_HEAD = YesPlease
>> NO_IPV6 = YesPlease
>
> Didn't my 7/7 already do this hunk?
Not for MSVC. It has it's own section above the MinGW part. Besides, the
-lcrypto 'translation' is critical for it to link.
--
.marius
^ permalink raw reply
* Re: [PATCH] MSVC: Enable OpenSSL, and translate -lcrypto
From: Erik Faye-Lund @ 2009-10-03 20:05 UTC (permalink / raw)
To: Marius Storm-Olsen; +Cc: git, msysgit
In-Reply-To: <18cd41840910031300i32c74b15t74eb9eee23ff8469@mail.gmail.com>
On Sat, Oct 3, 2009 at 1:00 PM, Marius Storm-Olsen <mstormo@gmail.com> wrote:
> This patch was actually sent using the MSVC
> git-imap-send.exe to my GMail account.
> D:\msvc\git>cat
> 0001-MSVC-Enable-OpenSSL-and-translate-lcrypto.patch |
> git-imap-send.exe
> Resolving imap.gmail.com... ok
> Connecting to 74.125.79.109:993... ok
> Logging in...
> sending 1 message
> 100% (1/1) done
> :)
Awesome :)
> diff --git a/Makefile b/Makefile
> index 8818f0f..c4b91d8 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -881,7 +881,6 @@ ifdef MSVC
> GIT_VERSION := $(GIT_VERSION).MSVC
> pathsep = ;
> NO_PREAD = YesPlease
> - NO_OPENSSL = YesPlease
> NO_LIBGEN_H = YesPlease
> NO_SYMLINK_HEAD = YesPlease
> NO_IPV6 = YesPlease
Didn't my 7/7 already do this hunk?
--
Erik "kusma" Faye-Lund
kusmabite@gmail.com
(+47) 986 59 656
^ permalink raw reply
* [PATCH] MSVC: Enable OpenSSL, and translate -lcrypto
From: Marius Storm-Olsen @ 2009-10-03 20:00 UTC (permalink / raw)
To: git; +Cc: kusmabite, msysgit
We don't use crypto, but rather require libeay32 and
ssleay32. handle it in both the Makefile msvc linker
script, and the buildsystem generator.
Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
---
Requires Erik Faye-Lund's MinGW patches for imap-send
ontop of git.git master.
This patch was actually sent using the MSVC
git-imap-send.exe to my GMail account.
D:\msvc\git>cat
0001-MSVC-Enable-OpenSSL-and-translate-lcrypto.patch |
git-imap-send.exe
Resolving imap.gmail.com... ok
Connecting to 74.125.79.109:993... ok
Logging in...
sending 1 message
100% (1/1) done
:)
Makefile | 1 -
compat/vcbuild/scripts/clink.pl | 3 +++
contrib/buildsystems/engine.pl | 3 +++
3 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 8818f0f..c4b91d8 100644
--- a/Makefile
+++ b/Makefile
@@ -881,7 +881,6 @@ ifdef MSVC
GIT_VERSION := $(GIT_VERSION).MSVC
pathsep = ;
NO_PREAD = YesPlease
- NO_OPENSSL = YesPlease
NO_LIBGEN_H = YesPlease
NO_SYMLINK_HEAD = YesPlease
NO_IPV6 = YesPlease
diff --git a/compat/vcbuild/scripts/clink.pl b/compat/vcbuild/scripts/clink.pl
index 0ffd59f..fce1e24 100644
--- a/compat/vcbuild/scripts/clink.pl
+++ b/compat/vcbuild/scripts/clink.pl
@@ -29,6 +29,9 @@ while (@ARGV) {
push(@args, "zlib.lib");
} elsif ("$arg" eq "-liconv") {
push(@args, "iconv.lib");
+ } elsif ("$arg" eq "-lcrypto") {
+ push(@args, "libeay32.lib");
+ push(@args, "ssleay32.lib");
} elsif ("$arg" =~ /^-L/ && "$arg" ne "-LTCG") {
$arg =~ s/^-L/-LIBPATH:/;
push(@args, $arg);
diff --git a/contrib/buildsystems/engine.pl b/contrib/buildsystems/engine.pl
index 20bd061..d506717 100644
--- a/contrib/buildsystems/engine.pl
+++ b/contrib/buildsystems/engine.pl
@@ -315,6 +315,9 @@ sub handleLinkLine
$appout = shift @parts;
} elsif ("$part" eq "-lz") {
push(@libs, "zlib.lib");
+ } elsif ("$part" eq "-lcrypto") {
+ push(@libs, "libeay32.lib");
+ push(@libs, "ssleay32.lib");
} elsif ($part =~ /^-/) {
push(@lflags, $part);
} elsif ($part =~ /\.(a|lib)$/) {
--
1.6.3.msysgit.0.18.gef407
^ permalink raw reply related
* Re: [PATCH/RFC 5/7] imap-send: provide fall-back random-source
From: Erik Faye-Lund @ 2009-10-03 18:59 UTC (permalink / raw)
To: Jeff King; +Cc: msysgit, git
In-Reply-To: <40aa078e0910031145l2849697ftd2da2f5aaa28d957@mail.gmail.com>
On Sat, Oct 3, 2009 at 11:45 AM, Erik Faye-Lund
<kusmabite@googlemail.com> wrote:
> I CC'ed Mike McCormack, who initially added imap-send (including the
> arc4 code), as he *might* have more insight on this. It's a long-shot
> though, considering that this appears to be code adapted around 3.5
> years ago.
OK, it seems the e-mail address he used for the commit isn't valid any
more, and I can't easily find another address for him. So I guess
we're out of luck on that front.
--
Erik "kusma" Faye-Lund
kusmabite@gmail.com
(+47) 986 59 656
^ permalink raw reply
* Re: [PATCH/RFC 5/7] imap-send: provide fall-back random-source
From: Erik Faye-Lund @ 2009-10-03 18:45 UTC (permalink / raw)
To: Jeff King; +Cc: msysgit, git, mike
In-Reply-To: <20091003095811.GB17873@coredump.intra.peff.net>
On Sat, Oct 3, 2009 at 2:58 AM, Jeff King <peff@peff.net> wrote:
>
> Hmm. It looks like this arc4 RNG is used just for generating a unique
> "X-TUID" header. Which seems to be used in isync (from which imap-send
> is derived) to be to avoid duplicates in synchronization. But imap-send
> doesn't actually use it for anything, as it just blindly pushes the
> messages.
>
> In other words, should all of this TUID code (and the arc4 code) simply
> be ripped out?
Possibly. I must admit that I didn't dig far on this one - I just
added some randomness, and saw that things worked for me.
I tried to trace this a little bit, but I got lost a bit in the
callback-stuff. However, it looks to me like it might get sent to the
server: it gets injected into cb.data in imap_store_msg(), and in
v_issue_imap_cmd() it gets sent to the server if the LITERALPLUS
capability is supported. I might be wrong though, as I find this code
quite confusing.
I CC'ed Mike McCormack, who initially added imap-send (including the
arc4 code), as he *might* have more insight on this. It's a long-shot
though, considering that this appears to be code adapted around 3.5
years ago.
--
Erik "kusma" Faye-Lund
kusmabite@gmail.com
(+47) 986 59 656
^ permalink raw reply
* Re: [PATCH/RFC 1/7] imap-send: use separate read and write fds
From: Erik Faye-Lund @ 2009-10-03 18:44 UTC (permalink / raw)
To: Jeff King; +Cc: msysgit, git
In-Reply-To: <20091003094049.GA17873@coredump.intra.peff.net>
On Sat, Oct 3, 2009 at 2:40 AM, Jeff King <peff@peff.net> wrote:
> On Sat, Oct 03, 2009 at 12:39:39AM +0000, Erik Faye-Lund wrote:
>
>> Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
>
> Why? Given its presence in this series, I can only assume it has to do
> with windows portability, but it would be helpful to give a little bit
> of the reasoning in the commit message.
>
> -Peff
>
Yeah, this is about Windows portability.
I'll add something like "This is a patch that enables us to use the
run-command API, which is supported on Windows." to the commit-message
in the next round. Is that enough?
I also guess I should have made a cover letter for this series, making
it apparent to reviewers that:
- This patch series is about supporting imap-send on Windows
- It needs some additional patching to get tunnelling support working
on Windows, because we can't exec "/bin/sh" there. Changing it to
"c:\\msysgit\\bin\\sh.exe" makes tunneling work for me, but isn't
exactly portable across installations.
I'll write one up for the next round.
--
Erik "kusma" Faye-Lund
kusmabite@gmail.com
(+47) 986 59 656
^ permalink raw reply
* [PATCH 5/6] This assertion is valid for both loose and packed objects
From: Hervé Cauwelier @ 2009-10-03 18:10 UTC (permalink / raw)
To: git; +Cc: Hervé Cauwelier
In-Reply-To: <1254593401-18801-5-git-send-email-herve@itaapy.com>
Signed-off-by: Hervé Cauwelier <herve@itaapy.com>
---
src/odb.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/odb.c b/src/odb.c
index bc26cf7..dd3c142 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -1149,11 +1149,10 @@ void git_odb_close(git_odb *db)
free(db);
}
-int git_odb_read(
- git_obj *out,
- git_odb *db,
- const git_oid *id)
+int git_odb_read(git_obj *out, git_odb *db, const git_oid *id)
{
+ assert(out && db && id);
+
attempt:
if (!git_odb__read_packed(out, db, id))
return GIT_SUCCESS;
@@ -1171,8 +1170,6 @@ int git_odb__read_loose(git_obj *out, git_odb *db, const git_oid *id)
char file[GIT_PATH_MAX];
gitfo_buf obj = GITFO_BUF_INIT;
- assert(out && db && id);
-
out->data = NULL;
out->len = 0;
out->type = GIT_OBJ_BAD;
--
1.6.4.4
^ permalink raw reply related
* [PATCH 6/6] Read an object from a pack file
From: Hervé Cauwelier @ 2009-10-03 18:10 UTC (permalink / raw)
To: git; +Cc: Hervé Cauwelier
In-Reply-To: <1254593401-18801-6-git-send-email-herve@itaapy.com>
Signed-off-by: Hervé Cauwelier <herve@itaapy.com>
---
src/odb.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/odb.c b/src/odb.c
index dd3c142..a712d71 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -1263,13 +1263,16 @@ static int read_packed(git_obj *out, git_pack *p, const git_oid *id)
if (pack_openidx(p))
return GIT_ERROR;
+ if (pack_openpack(p)) {
+ pack_decidx(p);
+ return GIT_ERROR;
+ }
res = p->idx_search(&pos, p, id);
pack_decidx(p);
+ assert(pos < p->pack_map.len);
- if (!res) {
- /* TODO unpack object at pos */
- res = GIT_ERROR;
- }
+ if (res == GIT_SUCCESS)
+ return inflate_pack_obj(out, p, pos);
return res;
}
--
1.6.4.4
^ permalink raw reply related
* [PATCH 3/6] Allow zlib to read a pack buffer longer than the actual data
From: Hervé Cauwelier @ 2009-10-03 18:09 UTC (permalink / raw)
To: git; +Cc: Hervé Cauwelier
In-Reply-To: <1254593401-18801-3-git-send-email-herve@itaapy.com>
As we don't know where the compressed data end, only the size of the
uncompressed data.
Signed-off-by: Hervé Cauwelier <herve@itaapy.com>
---
src/odb.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/odb.c b/src/odb.c
index 3cfc932..89ee1f2 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -432,7 +432,7 @@ static int inflate_buffer(void *in, size_t inlen, void *out, size_t outlen)
inflateEnd(&zs);
- if ((status != Z_STREAM_END) || (zs.avail_in != 0))
+ if (status != Z_STREAM_END)
return GIT_ERROR;
if (zs.total_out != outlen)
--
1.6.4.4
^ permalink raw reply related
* [PATCH 4/6] Inflate an object from a pack file
From: Hervé Cauwelier @ 2009-10-03 18:09 UTC (permalink / raw)
To: git; +Cc: Hervé Cauwelier
In-Reply-To: <1254593401-18801-4-git-send-email-herve@itaapy.com>
Support delta objects too.
Signed-off-by: Hervé Cauwelier <herve@itaapy.com>
---
src/odb.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 68 insertions(+), 1 deletions(-)
diff --git a/src/odb.c b/src/odb.c
index 89ee1f2..bc26cf7 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -28,6 +28,7 @@
#include "git/zlib.h"
#include "fileops.h"
#include "hash.h"
+#include "delta-apply.h"
#include "odb.h"
#define GIT_PACK_NAME_MAX (5 + 40 + 1)
@@ -232,7 +233,7 @@ static int is_zlib_compressed_data(unsigned char *data)
unsigned int w;
w = ((unsigned int)(data[0]) << 8) + data[1];
- return data[0] == 0x78 && !(w %31);
+ return data[0] == 0x78 && !(w % 31);
}
static size_t get_binary_object_header(obj_hdr *hdr, gitfo_buf *obj)
@@ -1192,6 +1193,72 @@ int git_odb__read_loose(git_obj *out, git_odb *db, const git_oid *id)
return GIT_SUCCESS;
}
+static int inflate_pack_obj(git_obj *out, git_pack *p, off_t offset)
+{
+ obj_hdr hdr;
+ gitfo_buf buf;
+ size_t used;
+ void *data;
+ git_obj base;
+
+ /* Cast the map to a gitfo_buf */
+ buf.data = (unsigned char *)p->pack_map.data + offset;
+ buf.len = p->pack_map.len - offset;
+
+ /*
+ * Read the object header, which is an (uncompressed)
+ * binary encoding of the object type and size.
+ */
+ if (!(used = get_binary_object_header(&hdr, &buf)))
+ return GIT_ERROR;
+
+ /*
+ * Read the object data as a zlib compressed data
+ */
+ buf.data += used;
+ buf.len -= used;
+ assert(is_zlib_compressed_data(buf.data));
+
+ if (!(data = git__malloc(hdr.size + 1)))
+ return GIT_ERROR;
+ if (inflate_buffer(buf.data, buf.len, data, hdr.size))
+ goto inflate_fail;
+
+ switch (hdr.type) {
+ case GIT_OBJ_COMMIT:
+ case GIT_OBJ_TREE:
+ case GIT_OBJ_BLOB:
+ case GIT_OBJ_TAG:
+ out->data = data;
+ out->len = hdr.size;
+ out->type = hdr.type;
+ return GIT_SUCCESS;
+ case GIT_OBJ_OFS_DELTA:
+ offset -= hdr.base_offset;
+ if (inflate_pack_obj(&base, p, offset))
+ goto inflate_fail;
+ if (git__delta_apply(out, base.data, base.len, data, hdr.size))
+ goto inflate_fail;
+ out->type = base.type;
+ return GIT_SUCCESS;
+ case GIT_OBJ_REF_DELTA:
+ if (p->idx_search(&offset, p, &hdr.base_name))
+ goto inflate_fail;
+ if (inflate_pack_obj(&base, p, offset))
+ goto inflate_fail;
+ if (git__delta_apply(out, base.data, base.len, data, hdr.size))
+ goto inflate_fail;
+ out->type = base.type;
+ return GIT_SUCCESS;
+ default:
+ goto inflate_fail;
+ }
+
+inflate_fail:
+ free(data);
+ return GIT_ERROR;
+}
+
static int read_packed(git_obj *out, git_pack *p, const git_oid *id)
{
off_t pos;
--
1.6.4.4
^ permalink raw reply related
* [PATCH 2/6] Read the base offset or name of delta objects
From: Hervé Cauwelier @ 2009-10-03 18:09 UTC (permalink / raw)
To: git; +Cc: Hervé Cauwelier
In-Reply-To: <1254593401-18801-2-git-send-email-herve@itaapy.com>
Signed-off-by: Hervé Cauwelier <herve@itaapy.com>
---
src/cc-compat.h | 3 +++
src/odb.c | 28 ++++++++++++++++++++++++++--
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/src/cc-compat.h b/src/cc-compat.h
index 8997caa..8dd6774 100644
--- a/src/cc-compat.h
+++ b/src/cc-compat.h
@@ -30,6 +30,9 @@
# define GIT_TYPEOF(x)
#endif
+#define bitsizeof(x) (CHAR_BIT * sizeof(x))
+#define MSB(x, bits) ((x) & GIT_TYPEOF(x)(~0ULL << (bitsizeof(x) - (bits))))
+
/*
* Does our compiler/platform support the C99 <inttypes.h> and
* <stdint.h> header files. (C99 requires that <inttypes.h>
diff --git a/src/odb.c b/src/odb.c
index a562a19..3cfc932 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -97,8 +97,10 @@ struct git_odb {
};
typedef struct { /* object header data */
- git_otype type; /* object type */
- size_t size; /* object size */
+ git_otype type; /* object type */
+ size_t size; /* object size */
+ off_t base_offset; /* delta base offset (GIT_OBJ_OFS_DELTA) */
+ git_oid base_name; /* delta base name (GIT_OBJ_REF_DELTA) */
} obj_hdr;
static struct {
@@ -238,6 +240,7 @@ static size_t get_binary_object_header(obj_hdr *hdr, gitfo_buf *obj)
unsigned char c;
unsigned char *data = obj->data;
size_t shift, size, used = 0;
+ off_t base_offset;
if (obj->len == 0)
return 0;
@@ -258,6 +261,27 @@ static size_t get_binary_object_header(obj_hdr *hdr, gitfo_buf *obj)
}
hdr->size = size;
+ hdr->base_offset = 0;
+ hdr->base_name.id[0] = '\0';
+
+ if (hdr->type == GIT_OBJ_OFS_DELTA) {
+ c = data[used++];
+ base_offset = c & 127;
+ while (c & 128) {
+ base_offset++;
+ if (!base_offset || MSB(base_offset, 7))
+ return 0; /* overflow */
+ c = data[used++];
+ base_offset = (base_offset << 7) + (c & 127);
+ }
+ assert(base_offset > 0);
+ hdr->base_offset = base_offset;
+ }
+ else if (hdr->type == GIT_OBJ_REF_DELTA) {
+ git_oid_mkraw(&hdr->base_name, data + used);
+ used += 20;
+ }
+
return used;
}
--
1.6.4.4
^ permalink raw reply related
* [PATCH 1/6] Open the pack file and keep a map on it.
From: Hervé Cauwelier @ 2009-10-03 18:09 UTC (permalink / raw)
To: git; +Cc: Hervé Cauwelier
In-Reply-To: <1254593401-18801-1-git-send-email-herve@itaapy.com>
On the same model than the idx file.
Signed-off-by: Hervé Cauwelier <herve@itaapy.com>
---
src/odb.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
src/odb.h | 5 ++-
2 files changed, 68 insertions(+), 4 deletions(-)
diff --git a/src/odb.c b/src/odb.c
index 6d646a4..a562a19 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -64,6 +64,10 @@ struct git_pack {
/** Name of the pack file(s), without extension ("pack-abc"). */
char pack_name[GIT_PACK_NAME_MAX];
+
+ /** The .pack file, mapped into memory. */
+ git_file pack_fd;
+ git_map pack_map;
};
typedef struct git_pack git_pack;
@@ -782,7 +786,7 @@ static int pack_openidx(git_pack *p)
goto invalid_fail;
data = p->idx_map.data;
- if (decode32(&data[0]) == PACK_TOC) {
+ if (decode32(&data[0]) == IDX_TOC) {
switch (decode32(&data[1])) {
case 2:
if (pack_openidx_v2(p))
@@ -809,6 +813,59 @@ unlock_fail:
return GIT_ERROR;
}
+static int pack_openpack_map(git_pack *p)
+{
+ char pb[GIT_PATH_MAX];
+ off_t len;
+
+ if (git__fmt(pb, sizeof(pb), "%s/pack/%s.pack",
+ p->db->objects_dir,
+ p->pack_name) < 0)
+ return GIT_ERROR;
+
+ if ((p->pack_fd = gitfo_open(pb, O_RDONLY)) < 0)
+ return GIT_ERROR;
+
+ if ((len = gitfo_size(p->pack_fd)) < 0
+ || !git__is_sizet(len)
+ || gitfo_map_ro(&p->pack_map, p->pack_fd, 0, (size_t)len)) {
+ gitfo_close(p->pack_fd);
+ return GIT_ERROR;
+ }
+
+ return GIT_SUCCESS;
+}
+
+static int pack_openpack(git_pack *p)
+{
+ gitlck_lock(&p->lock);
+ if (p->invalid)
+ goto unlock_fail;
+ if (p->pack_fd < 0) {
+ uint32_t *data;
+
+ if (pack_openpack_map(p))
+ goto invalid_fail;
+ data = p->pack_map.data;
+
+ if (decode32(&data[0]) != PACK_TOC)
+ goto unmap_fail;
+ }
+ gitlck_unlock(&p->lock);
+ return GIT_SUCCESS;
+
+unmap_fail:
+ gitfo_free_map(&p->pack_map);
+
+invalid_fail:
+ p->invalid = 1;
+ p->pack_fd = -1;
+
+unlock_fail:
+ gitlck_unlock(&p->lock);
+ return GIT_ERROR;
+}
+
static void pack_decidx(git_pack *p)
{
gitlck_lock(&p->lock);
@@ -830,6 +887,11 @@ static void pack_dec(git_pack *p)
gitfo_close(p->idx_fd);
free(p->im_fanout);
}
+ if (p->pack_fd >= 0) {
+ gitfo_free_map(&p->pack_map);
+ gitfo_close(p->pack_fd);
+ p->pack_fd = -1;
+ }
gitlck_free(&p->lock);
free(p);
@@ -861,6 +923,7 @@ static git_pack *alloc_pack(const char *pack_name)
gitlck_init(&p->lock);
strcpy(p->pack_name, pack_name);
p->refcnt = 1;
+ p->pack_fd = -1;
return p;
}
@@ -895,7 +958,7 @@ static int scan_one_pack(void *state, char *name)
r->next = *ret;
*ret = r;
- return 0;
+ return GIT_SUCCESS;
}
static git_packlist* scan_packs(git_odb *db)
diff --git a/src/odb.h b/src/odb.h
index 2f205b2..0311d78 100644
--- a/src/odb.h
+++ b/src/odb.h
@@ -11,9 +11,10 @@
* uint32_t *fanout = ... the file data at offset 0 ...
* ntohl(fanout[0]) < ntohl(fanout[1])
*
- * The value chosen here for PACK_TOC is such that the above
+ * The value chosen here for IDX_TOC is such that the above
* cannot be true for an idx v1 file.
*/
-#define PACK_TOC 0xff744f63 /* -1tOc */
+#define IDX_TOC 0xff744f63 /* -1tOc */
+#define PACK_TOC 0x5041434b /* PACK */
#endif
--
1.6.4.4
^ permalink raw reply related
* Patches for libgit2
From: Hervé Cauwelier @ 2009-10-03 18:09 UTC (permalink / raw)
To: git
Hi,
Please find patches for libgit2. They allowed me to read the history of a
repository with only 75 patches but hacked by an history shortening.
Commits were both in a 5 GB pack file and loose objects. So I had to add
support for pack files. Hopefully, reading idx files was already there so I
followed the same model.
Patches can also be cloned at "git://git.hforge.org/libgit2.git".
There is a Python wrapper on the next side, forking from the existing
libgit2-python [1]. They bring the same functionnalities but the patches are
not slick yet.
[1] http://code.istique.net/gitweb/?p=libgit2-python.git;a=summary
One thing that would miss is unit tests, but I lack experience on testing C
code, and it would require having a small but exhaustive pack file with
different types of object, including ofs and ref deltas. Help on this part is
welcome.
Next step would be decoding raw objects to commits, trees, blobs and tags.
There is already the start of a commit structure. I'll be starting from that.
Regards,
Hervé
^ permalink raw reply
* [PATCH] Reserve a slot for argv[0] in default_arg.
From: Petter Urkedal @ 2009-10-03 13:29 UTC (permalink / raw)
To: git; +Cc: Petter Urkedal
Setting "av" to one slot before the allocated "default_arg" array causes
glibc abort with "free(): invalid next size (normal)" in some
configurations (Gentoo, glibc-2.9_p20081201-r2, gcc-5.3.2 with PIE).
---
builtin-show-branch.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index 3510a86..3ab72b7 100644
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
@@ -568,6 +568,9 @@ static int git_show_branch_config(const char *var, const char *value, void *cb)
if (default_alloc <= default_num + 1) {
default_alloc = default_alloc * 3 / 2 + 20;
default_arg = xrealloc(default_arg, sizeof *default_arg * default_alloc);
+ if (!default_num)
+ /* One unused position for argv[0]. */
+ default_arg[default_num++] = NULL;
}
default_arg[default_num++] = xstrdup(value);
default_arg[default_num] = NULL;
@@ -692,8 +695,8 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
/* If nothing is specified, try the default first */
if (ac == 1 && default_num) {
- ac = default_num + 1;
- av = default_arg - 1; /* ick; we would not address av[0] */
+ ac = default_num;
+ av = default_arg;
}
ac = parse_options(ac, av, prefix, builtin_show_branch_options,
--
1.6.4.4
^ permalink raw reply related
* Re: [PATCH] Fix '--relative-date'
From: Johan Sageryd @ 2009-10-03 11:18 UTC (permalink / raw)
To: Jeff King; +Cc: git
In-Reply-To: <20091003100615.GC17873@coredump.intra.peff.net>
> I've picked up your patch in my tree with the following test squashed
> in:
>
> diff --git a/t/t0006-date.sh b/t/t0006-date.sh
> index a4d8fa8..75b02af 100755
> --- a/t/t0006-date.sh
> +++ b/t/t0006-date.sh
> @@ -24,6 +24,7 @@ check_show 13000000 '5 months ago'
> check_show 37500000 '1 year, 2 months ago'
> check_show 55188000 '1 year, 9 months ago'
> check_show 630000000 '20 years ago'
> +check_show 31449600 '12 months ago'
>
> check_parse() {
> echo "$1 -> $2" >expect
Thank you!
/Johan
^ permalink raw reply
* Automatic merge of local modifications in submodules?
From: Josef Wolf @ 2009-10-03 11:30 UTC (permalink / raw)
To: git
Hello,
I am trying to explore gti's submodule functionality. Since I'm used to
svn:externals, I am missing the automatic merge of local modifications.
So I'd like to do something like:
(cd submodule; git stash)
git submodule update
(cd submodule; git stash pop)
The problem with this command sequence is that it is not atomic. So if it
is automatically executed from a script (e.g cron or post-update-hook), it
will cause damage.
Any ideas how to properly auto-merge local modifications on submodule
update? git-submodule don't seem to have an option to do that.
^ permalink raw reply
* Re: [PATCH] Fix '--relative-date'
From: Jeff King @ 2009-10-03 10:06 UTC (permalink / raw)
To: Johan Sageryd; +Cc: git
In-Reply-To: <1254543618-3772-1-git-send-email-j416@1616.se>
On Sat, Oct 03, 2009 at 01:20:18PM +0900, Johan Sageryd wrote:
> This fixes '--relative-date' so that it does not give '0 year, 12
> months', for the interval 360 <= diff < 365.
Thanks. I think this was a regression introduced recently when we fixed
the rounding on how years are printed (it used to just say "1 year"
because we were close, but now we always round down, so our boundary for
"1 year" must match exactly).
I've picked up your patch in my tree with the following test squashed
in:
diff --git a/t/t0006-date.sh b/t/t0006-date.sh
index a4d8fa8..75b02af 100755
--- a/t/t0006-date.sh
+++ b/t/t0006-date.sh
@@ -24,6 +24,7 @@ check_show 13000000 '5 months ago'
check_show 37500000 '1 year, 2 months ago'
check_show 55188000 '1 year, 9 months ago'
check_show 630000000 '20 years ago'
+check_show 31449600 '12 months ago'
check_parse() {
echo "$1 -> $2" >expect
-Peff
^ permalink raw reply related
* Re: [PATCH/RFC 5/7] imap-send: provide fall-back random-source
From: Jeff King @ 2009-10-03 9:58 UTC (permalink / raw)
To: Erik Faye-Lund; +Cc: msysgit, git
In-Reply-To: <1254530385-2824-5-git-send-email-kusmabite@gmail.com>
On Sat, Oct 03, 2009 at 12:39:43AM +0000, Erik Faye-Lund wrote:
> Since some systems (at least Windows) does not have
> /dev/random nor friends, we need another random-source.
>
> This patch uses the C-runtime's rand()-function as a
> poor-mans random-source.
Hmm. It looks like this arc4 RNG is used just for generating a unique
"X-TUID" header. Which seems to be used in isync (from which imap-send
is derived) to be to avoid duplicates in synchronization. But imap-send
doesn't actually use it for anything, as it just blindly pushes the
messages.
In other words, should all of this TUID code (and the arc4 code) simply
be ripped out?
-Peff
^ permalink raw reply
* Re: [PATCH/RFC 1/7] imap-send: use separate read and write fds
From: Jeff King @ 2009-10-03 9:40 UTC (permalink / raw)
To: Erik Faye-Lund; +Cc: msysgit, git
In-Reply-To: <1254530385-2824-1-git-send-email-kusmabite@gmail.com>
On Sat, Oct 03, 2009 at 12:39:39AM +0000, Erik Faye-Lund wrote:
> Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Why? Given its presence in this series, I can only assume it has to do
with windows portability, but it would be helpful to give a little bit
of the reasoning in the commit message.
-Peff
^ permalink raw reply
* Re: [PATCH 2/2] allow mangling short options which take integer arguments
From: Clemens Buchacher @ 2009-10-03 9:23 UTC (permalink / raw)
To: Jeff King; +Cc: Johannes Schindelin, Shawn O. Pearce, git
In-Reply-To: <20091002075012.GB27664@coredump.intra.peff.net>
On Fri, Oct 02, 2009 at 03:50:12AM -0400, Jeff King wrote:
> On Fri, Oct 02, 2009 at 09:43:17AM +0200, Clemens Buchacher wrote:
>
> > On Thu, Oct 01, 2009 at 11:55:03PM +0200, Johannes Schindelin wrote:
> >
> > > And this patch looks even more straight-forward than 1/2, _but_... what
> > > about cases where there are short options that are digits?
> >
> > Could you point me to one of those? I did not find any during my
> > non-exhaustive search. We should be able to handle them easily by adding
> > PARSE_OPT_MANY.
>
> The one that comes readily to mind is "git log -1", but that is actually
> parsed by the revision options parser, which doesn't use parseopt. But
> there are a few done by parseopt:
>
> $ git grep "OPT_.*'[0-9]'"
> archive.c: OPT__COMPR('1', &compression_level, "compress faster", 1),
> archive.c: OPT__COMPR_HIDDEN('2', &compression_level, 2),
> archive.c: OPT__COMPR_HIDDEN('3', &compression_level, 3),
> archive.c: OPT__COMPR_HIDDEN('4', &compression_level, 4),
> archive.c: OPT__COMPR_HIDDEN('5', &compression_level, 5),
> archive.c: OPT__COMPR_HIDDEN('6', &compression_level, 6),
> archive.c: OPT__COMPR_HIDDEN('7', &compression_level, 7),
> archive.c: OPT__COMPR_HIDDEN('8', &compression_level, 8),
> archive.c: OPT__COMPR('9', &compression_level, "compress better", 9),
> builtin-checkout.c: OPT_SET_INT('2', "ours", &opts.writeout_stage, "stage",
> builtin-checkout.c: OPT_SET_INT('3', "theirs", &opts.writeout_stage, "stage",
Those are not affected by this patch series. They can be cuddled with other
short options just like before, since they don't take arguments.
^ permalink raw reply
* [PATCH] Fix '--relative-date'
From: Johan Sageryd @ 2009-10-03 4:20 UTC (permalink / raw)
To: git; +Cc: Johan Sageryd
This fixes '--relative-date' so that it does not give '0 year, 12 months', for the interval 360 <= diff < 365.
Signed-off-by: Johan Sageryd <j416@1616.se>
---
date.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/date.c b/date.c
index e9ee4aa..5d05ef6 100644
--- a/date.c
+++ b/date.c
@@ -123,7 +123,7 @@ const char *show_date_relative(unsigned long time, int tz,
return timebuf;
}
/* Say months for the past 12 months or so */
- if (diff < 360) {
+ if (diff < 365) {
snprintf(timebuf, timebuf_size, "%lu months ago", (diff + 15) / 30);
return timebuf;
}
--
1.6.4.4
^ permalink raw reply related
* [PATCH/RFC 7/7] mingw: enable OpenSSL
From: Erik Faye-Lund @ 2009-10-03 0:39 UTC (permalink / raw)
To: msysgit; +Cc: git
In-Reply-To: <1254530385-2824-6-git-send-email-kusmabite@gmail.com>
Since we have OpenSSL in msysgit now, enable it to support SSL
encryption for imap-send.
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
---
Makefile | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 8ba789a..8818f0f 100644
--- a/Makefile
+++ b/Makefile
@@ -933,7 +933,6 @@ else
ifneq (,$(findstring MINGW,$(uname_S)))
pathsep = ;
NO_PREAD = YesPlease
- NO_OPENSSL = YesPlease
NO_LIBGEN_H = YesPlease
NO_SYMLINK_HEAD = YesPlease
NO_IPV6 = YesPlease
--
1.6.5.rc2.7.g4f8d3
^ permalink raw reply related
* [PATCH/RFC 6/7] mingw: wrap SSL_set_(w|r)fd to call _get_osfhandle
From: Erik Faye-Lund @ 2009-10-03 0:39 UTC (permalink / raw)
To: msysgit; +Cc: git
In-Reply-To: <1254530385-2824-5-git-send-email-kusmabite@gmail.com>
SSL_set_fd (and friends) expects a OS file handle on Windows, not
a file descriptor as on UNIX(-ish).
This patch makes the Windows version of SSL_set_fd behave like the
UNIX versions, by calling _get_osfhandle on it's input.
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
---
compat/mingw.h | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/compat/mingw.h b/compat/mingw.h
index 5b5258b..6907345 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -124,6 +124,27 @@ static inline int waitpid(pid_t pid, int *status, unsigned options)
return -1;
}
+#ifndef NO_OPENSSL
+#include <openssl/ssl.h>
+static inline int mingw_SSL_set_fd(SSL *ssl, int fd)
+{
+ return SSL_set_fd(ssl, _get_osfhandle(fd));
+}
+#define SSL_set_fd mingw_SSL_set_fd
+
+static inline int mingw_SSL_set_rfd(SSL *ssl, int fd)
+{
+ return SSL_set_rfd(ssl, _get_osfhandle(fd));
+}
+#define SSL_set_rfd mingw_SSL_set_rfd
+
+static inline int mingw_SSL_set_wfd(SSL *ssl, int fd)
+{
+ return SSL_set_wfd(ssl, _get_osfhandle(fd));
+}
+#define SSL_set_wfd mingw_SSL_set_wfd
+#endif
+
/*
* implementations of missing functions
*/
--
1.6.5.rc2.7.g4f8d3
^ permalink raw reply related
* [PATCH/RFC 5/7] imap-send: provide fall-back random-source
From: Erik Faye-Lund @ 2009-10-03 0:39 UTC (permalink / raw)
To: msysgit; +Cc: git
In-Reply-To: <1254530385-2824-4-git-send-email-kusmabite@gmail.com>
Since some systems (at least Windows) does not have
/dev/random nor friends, we need another random-source.
This patch uses the C-runtime's rand()-function as a
poor-mans random-source.
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
---
imap-send.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/imap-send.c b/imap-send.c
index 8338717..dda7b7f 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -511,14 +511,17 @@ static void arc4_init(void)
unsigned char j, si, dat[128];
if ((fd = open("/dev/urandom", O_RDONLY)) < 0 && (fd = open("/dev/random", O_RDONLY)) < 0) {
- fprintf(stderr, "Fatal: no random number source available.\n");
- exit(3);
- }
- if (read_in_full(fd, dat, 128) != 128) {
- fprintf(stderr, "Fatal: cannot read random number source.\n");
- exit(3);
+ /* poor-mans random-source */
+ srand(clock());
+ for (i = 0; i < 128; ++i)
+ dat[i] = rand() & 0xFF;
+ } else {
+ if (read_in_full(fd, dat, 128) != 128) {
+ fprintf(stderr, "Fatal: cannot read random number source.\n");
+ exit(3);
+ }
+ close(fd);
}
- close(fd);
for (i = 0; i < 256; i++)
rs.s[i] = i;
--
1.6.5.rc2.7.g4f8d3
^ permalink raw reply related
* [PATCH/RFC 4/7] imap-send: build imap-send on Windows
From: Erik Faye-Lund @ 2009-10-03 0:39 UTC (permalink / raw)
To: msysgit; +Cc: git
In-Reply-To: <1254530385-2824-3-git-send-email-kusmabite@gmail.com>
Since the POSIX-specific tunneling code has been replaced
by the run-command API (and a compile-error has been
cleaned away), we can now enable imap-send on Windows
builds.
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
---
Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 12defd4..8ba789a 100644
--- a/Makefile
+++ b/Makefile
@@ -361,6 +361,7 @@ PROGRAMS += git-show-index$X
PROGRAMS += git-unpack-file$X
PROGRAMS += git-upload-pack$X
PROGRAMS += git-var$X
+PROGRAMS += git-imap-send$X
# List built-in command $C whose implementation cmd_$C() is not in
# builtin-$C.o but is linked in as part of some other command.
@@ -1056,7 +1057,6 @@ EXTLIBS += -lz
ifndef NO_POSIX_ONLY_PROGRAMS
PROGRAMS += git-daemon$X
- PROGRAMS += git-imap-send$X
endif
ifndef NO_OPENSSL
OPENSSL_LIBSSL = -lssl
--
1.6.5.rc2.7.g4f8d3
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox