Git development
 help / color / mirror / Atom feed
* Re: Figured out how to get Mozilla into git
From: Linus Torvalds @ 2006-06-18 19:26 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: Martin Langhoff, Jon Smirl, git
In-Reply-To: <Pine.LNX.4.64.0606111747110.2703@localhost.localdomain>



On Sun, 11 Jun 2006, Nicolas Pitre wrote:
> 
> Then I used git-repack -a -f --window=20 --depth=20 which produced a 
> nice 468MB pack file along with the invariant 45MB index file for a 
> grand total of 535MB for the whole repo (the .git/refs/ directory alone 
> still occupies 17MB on disk).

Btw, can others with that mozilla repo confirm that a mozilla repository 
that has been repacked seems to be entirely fine, but git-fsck-objects 
(with "--full", of course) will report

	error: Packfile .git/objects/pack/pack-06389c21fc3c4312cbc9a4ddde087c907c1a840b.pack SHA1 mismatch with itself

for me (the fsck then completes with no other errors what-so-ever, so the 
contents are actually fine).

Or is it just me?

		Linus

^ permalink raw reply

* Re: Remove "refs" field from "struct object"
From: Linus Torvalds @ 2006-06-18 18:57 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List
In-Reply-To: <Pine.LNX.4.64.0606181137380.5498@g5.osdl.org>



On Sun, 18 Jun 2006, Linus Torvalds wrote:
>
> The "refs" field, which is really needed only for fsck, is maintained in
> a separate hashed lookup-table, allowing all normal users to totally
> ignore it.

Btw, in case people wondered: the cost to git-fsck-objects seems to be 
zero and sometimes apparently even negative.

In order to remove "refs" from "struct object", I had to add it to the 
object_refs structure instead, and so you'd think that the memory usage 
for git-fsck-objects (which needs the object refs) should be unchanged, 
while the hashed lookup should be more expensive than just the direct 
pointer lookup.

Actually testing it, though, implies that isn't the case. Lots of objects 
(every single blob object, in fact) have no refs at all, and for that case 
we don't create any "object_refs" structure at all, so we don't actually 
end up with a 1:1 relationship, and we win a small amount of memory.

And the hashing seems to be effective enough that it's no costlier than 
looking up the ref pointer directly from the object. There's probably 
some bad cache behaviour from the hashing, but it didn't show up in the 
benchmarking I did (ie fsck took as long before as it did afterwards, 
both for git and for the kernel archive).

It may be (probably is) that the reachability analysis is just a very 
small portion of the overall costs, and it's just not very noticeable. It 
may also be that whatever bad cache behaviours you get from the extra hash 
lookup are just balanced out by the objects themselves being slightly 
denser and better in the cache (although that is probably partly hidden 
again by the extra malloc padding).

Regardless, there doesn't really seem to be any downsides, but I didn't 
test it _that_ exhaustively.

		Linus

^ permalink raw reply

* Remove "refs" field from "struct object"
From: Linus Torvalds @ 2006-06-18 18:45 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List


This shrinks "struct object" to the absolutely minimal size possible.
It now contains /only/ the object flags and the SHA1 hash name of the
object.

The "refs" field, which is really needed only for fsck, is maintained in
a separate hashed lookup-table, allowing all normal users to totally
ignore it.

This helps memory usage, although not as much as I hoped: it looks like 
the allocation overhead of malloc (and the alignment constraints in 
particular) means that while the structure size shrinks, the actual 
allocation overhead mostly does not.

[ That said: memory usage is actually down, but not as much as it should
  be: I suspect just one of the object types actually ended up shrinking
  its effective allocation size.

  To get to the next level, we probably need specialized allocators that
  don't pad the allocation more than necessary. ]

The separation makes for some code cleanup, though, and makes the ref
tracking that fsck wants a clearly separate thing.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---

It turns out that removing the refs member wasn't as hard as I 
anticipated: the refs usage by git-fsck-objects was very well defined, and 
the actual patch to do this all is mostly the addition of the hashed 
lookup and insertion (same logic as for the objects themselves), and some 
very small cosmetic changes to anything that set/read the object->refs 
field.

Half of the patch is moving the refs-related code to a file of its own.

I'd like to clean up some things later (make the object re-hashing be as 
clean and simple as the refs re-hashing is), but wanted to keep this patch 
fairly minimal and do just the refs-related changes.

The alignment problem is because the objects actually need just 4-byte 
alignment on 32-bit architectures, but "malloc()" will return 8- or 
16-byte aligned allocations, so we will have totally unnecessary overhead 
there. 

This patch will be necessary regardless - the alloction alignment is a 
separate issue that just hides much of the shrinkage win.

 Makefile       |    2 -
 fsck-objects.c |    5 +-
 object-refs.c  |  142 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 object.c       |   70 ----------------------------
 object.h       |    4 +-
 5 files changed, 149 insertions(+), 74 deletions(-)

diff --git a/Makefile b/Makefile
index 2a1e639..244a4d1 100644
--- a/Makefile
+++ b/Makefile
@@ -212,7 +212,7 @@ LIB_OBJS = \
 	blob.o commit.o connect.o csum-file.o cache-tree.o base85.o \
 	date.o diff-delta.o entry.o exec_cmd.o ident.o lockfile.o \
 	object.o pack-check.o patch-delta.o path.o pkt-line.o \
-	quote.o read-cache.o refs.o run-command.o dir.o \
+	quote.o read-cache.o refs.o run-command.o dir.o object-refs.o \
 	server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
 	tag.o tree.o usage.o config.o environment.o ctype.o copy.o \
 	fetch-clone.o revision.o pager.o tree-walk.o xdiff-interface.o \
diff --git a/fsck-objects.c b/fsck-objects.c
index 2b1aab4..769bb2a 100644
--- a/fsck-objects.c
+++ b/fsck-objects.c
@@ -64,6 +64,7 @@ static void check_connectivity(void)
 
 	/* Look up all the requirements, warn about missing objects.. */
 	for (i = 0; i < obj_allocs; i++) {
+		const struct object_refs *refs;
 		struct object *obj = objs[i];
 
 		if (!obj)
@@ -78,8 +79,8 @@ static void check_connectivity(void)
 			continue;
 		}
 
-		if (obj->refs) {
-			const struct object_refs *refs = obj->refs;
+		refs = lookup_object_refs(obj);
+		if (refs) {
 			unsigned j;
 			for (j = 0; j < refs->count; j++) {
 				struct object *ref = refs->ref[j];
diff --git a/object-refs.c b/object-refs.c
new file mode 100644
index 0000000..8afa227
--- /dev/null
+++ b/object-refs.c
@@ -0,0 +1,142 @@
+#include "cache.h"
+#include "object.h"
+
+int track_object_refs = 0;
+
+static unsigned int refs_hash_size, nr_object_refs;
+static struct object_refs **refs_hash;
+
+static unsigned int hash_obj(struct object *obj, unsigned int n)
+{
+	unsigned int hash = *(unsigned int *)obj->sha1;
+	return hash % n;
+}
+
+static void grow_refs_hash(void)
+{
+	int i;
+	int new_hash_size = (refs_hash_size + 1000) * 3 / 2;
+	struct object_refs **new_hash;
+
+	new_hash = calloc(new_hash_size, sizeof(struct object_refs *));
+	for (i = 0; i < refs_hash_size; i++) {
+		int j;
+		struct object_refs *ref = refs_hash[i];
+		if (!ref)
+			continue;
+		j = hash_obj(ref->base, new_hash_size);
+		new_hash[j] = ref;
+	}
+	free(refs_hash);
+	refs_hash = new_hash;
+	refs_hash_size = new_hash_size;
+}
+
+static void insert_ref_hash(struct object_refs *ref)
+{
+	int j = hash_obj(ref->base, refs_hash_size);
+
+	while (refs_hash[j]) {
+		j++;
+		if (j >= refs_hash_size)
+			j = 0;
+	}
+	refs_hash[j] = ref;
+}
+
+static void add_object_refs(struct object *obj, struct object_refs *ref)
+{
+	int nr = nr_object_refs + 1;
+
+	if (nr > refs_hash_size * 2 / 3)
+		grow_refs_hash();
+	ref->base = obj;
+	insert_ref_hash(ref);
+	nr_object_refs = nr;
+}
+
+struct object_refs *lookup_object_refs(struct object *obj)
+{
+	int j = hash_obj(obj, refs_hash_size);
+	struct object_refs *ref;
+
+	while ((ref = refs_hash[j]) != NULL) {
+		if (ref->base == obj)
+			break;
+		j++;
+		if (j >= refs_hash_size)
+			j = 0;
+	}
+	return ref;
+}
+
+struct object_refs *alloc_object_refs(unsigned count)
+{
+	struct object_refs *refs;
+	size_t size = sizeof(*refs) + count*sizeof(struct object *);
+
+	refs = xcalloc(1, size);
+	refs->count = count;
+	return refs;
+}
+
+static int compare_object_pointers(const void *a, const void *b)
+{
+	const struct object * const *pa = a;
+	const struct object * const *pb = b;
+	if (*pa == *pb)
+		return 0;
+	else if (*pa < *pb)
+		return -1;
+	else
+		return 1;
+}
+
+void set_object_refs(struct object *obj, struct object_refs *refs)
+{
+	unsigned int i, j;
+
+	/* Do not install empty list of references */
+	if (refs->count < 1) {
+		free(refs);
+		return;
+	}
+
+	/* Sort the list and filter out duplicates */
+	qsort(refs->ref, refs->count, sizeof(refs->ref[0]),
+	      compare_object_pointers);
+	for (i = j = 1; i < refs->count; i++) {
+		if (refs->ref[i] != refs->ref[i - 1])
+			refs->ref[j++] = refs->ref[i];
+	}
+	if (j < refs->count) {
+		/* Duplicates were found - reallocate list */
+		size_t size = sizeof(*refs) + j*sizeof(struct object *);
+		refs->count = j;
+		refs = xrealloc(refs, size);
+	}
+
+	for (i = 0; i < refs->count; i++)
+		refs->ref[i]->used = 1;
+	add_object_refs(obj, refs);
+}
+
+void mark_reachable(struct object *obj, unsigned int mask)
+{
+	const struct object_refs *refs;
+
+	if (!track_object_refs)
+		die("cannot do reachability with object refs turned off");
+	/* If we've been here already, don't bother */
+	if (obj->flags & mask)
+		return;
+	obj->flags |= mask;
+	refs = lookup_object_refs(obj);
+	if (refs) {
+		unsigned i;
+		for (i = 0; i < refs->count; i++)
+			mark_reachable(refs->ref[i], mask);
+	}
+}
+
+
diff --git a/object.c b/object.c
index 0f70890..e26e319 100644
--- a/object.c
+++ b/object.c
@@ -13,8 +13,6 @@ const char *type_names[] = {
 	"none", "blob", "tree", "commit", "bad"
 };
 
-int track_object_refs = 0;
-
 static int hashtable_index(const unsigned char *sha1)
 {
 	unsigned int i;
@@ -55,7 +53,6 @@ void created_object(const unsigned char 
 	obj->parsed = 0;
 	memcpy(obj->sha1, sha1, 20);
 	obj->type = TYPE_NONE;
-	obj->refs = NULL;
 	obj->used = 0;
 
 	if (obj_allocs - 1 <= nr_objs * 2) {
@@ -84,73 +81,6 @@ void created_object(const unsigned char 
 	nr_objs++;
 }
 
-struct object_refs *alloc_object_refs(unsigned count)
-{
-	struct object_refs *refs;
-	size_t size = sizeof(*refs) + count*sizeof(struct object *);
-
-	refs = xcalloc(1, size);
-	refs->count = count;
-	return refs;
-}
-
-static int compare_object_pointers(const void *a, const void *b)
-{
-	const struct object * const *pa = a;
-	const struct object * const *pb = b;
-	if (*pa == *pb)
-		return 0;
-	else if (*pa < *pb)
-		return -1;
-	else
-		return 1;
-}
-
-void set_object_refs(struct object *obj, struct object_refs *refs)
-{
-	unsigned int i, j;
-
-	/* Do not install empty list of references */
-	if (refs->count < 1) {
-		free(refs);
-		return;
-	}
-
-	/* Sort the list and filter out duplicates */
-	qsort(refs->ref, refs->count, sizeof(refs->ref[0]),
-	      compare_object_pointers);
-	for (i = j = 1; i < refs->count; i++) {
-		if (refs->ref[i] != refs->ref[i - 1])
-			refs->ref[j++] = refs->ref[i];
-	}
-	if (j < refs->count) {
-		/* Duplicates were found - reallocate list */
-		size_t size = sizeof(*refs) + j*sizeof(struct object *);
-		refs->count = j;
-		refs = xrealloc(refs, size);
-	}
-
-	for (i = 0; i < refs->count; i++)
-		refs->ref[i]->used = 1;
-	obj->refs = refs;
-}
-
-void mark_reachable(struct object *obj, unsigned int mask)
-{
-	if (!track_object_refs)
-		die("cannot do reachability with object refs turned off");
-	/* If we've been here already, don't bother */
-	if (obj->flags & mask)
-		return;
-	obj->flags |= mask;
-	if (obj->refs) {
-		const struct object_refs *refs = obj->refs;
-		unsigned i;
-		for (i = 0; i < refs->count; i++)
-			mark_reachable(refs->ref[i], mask);
-	}
-}
-
 struct object *lookup_object_type(const unsigned char *sha1, const char *type)
 {
 	if (!type) {
diff --git a/object.h b/object.h
index f4ee2e5..c537b4b 100644
--- a/object.h
+++ b/object.h
@@ -9,6 +9,7 @@ struct object_list {
 
 struct object_refs {
 	unsigned count;
+	struct object *base;
 	struct object *ref[FLEX_ARRAY]; /* more */
 };
 
@@ -28,7 +29,6 @@ struct object {
 	unsigned type : TYPE_BITS;
 	unsigned flags : FLAG_BITS;
 	unsigned char sha1[20];
-	struct object_refs *refs;
 };
 
 extern int track_object_refs;
@@ -41,6 +41,8 @@ static inline const char *typename(unsig
 	return type_names[type > TYPE_TAG ? TYPE_BAD : type];
 }
 
+extern struct object_refs *lookup_object_refs(struct object *);
+
 /** Internal only **/
 struct object *lookup_object(const unsigned char *sha1);
 

^ permalink raw reply related

* Re: What's in git.git
From: Johannes Schindelin @ 2006-06-18 18:43 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Junio C Hamano, git
In-Reply-To: <20060618130837.GN2609@pasky.or.cz>

Hi,

On Sun, 18 Jun 2006, Petr Baudis wrote:

> Dear diary, on Sun, Jun 18, 2006 at 02:26:14PM CEST, I got a letter
> where Johannes Schindelin <Johannes.Schindelin@gmx.de> said that...
> > There is one thing I don't like about Pasky's approach: You can change the 
> > config file name to whatever you like, even if no program will read it. 
> > That is why I decided to have a flag instead of an option: to prevent 
> > pilot-errors.
> 
> I'm lost here, admittelly not getting your argument. :-(

Okay, the point I was driving at:

GIT_CONFIG_FILE=~/.gitrc git repo-config blabla.blibli bloblo

_will_ succeed, but to the user it will be non-obvious that the git 
commands do not pick up on it (because ~/.gitconfig is read instead of 
~/.gitrc), whereas

git repo-config --user blabla.blibli bloblo

is pretty obvious, and _has_ the intended effect.

> > I cobbled together a patch, which turned out to be rather messy, 
> > introducing "--config-file <file>" to git-repo-config. If people are 
> > interested, I'll clean it up and post it. But then, if you already know 
> > you want to use another config file, you are probably better of just 
> > exporting GIT_CONFIG_FILE and be done with it.
> 
> $GIT_CONFIG_FILE feels nicer since any other git tool can use it as
> well, it's not git-repo-config-specific. But the current intent indeed
> is to simply override the location for git-repo-config, thus for the
> current purposes if we will have --config-file instead of
> GIT_CONFIG_FILE, I will not weep; whatever does the job.

Yes, that is true. Forget about my --config-file patch, please.

> > Note that this issue is orthogonal to the need for a user-specific config 
> > file. I still think that this one should go in.
> 
> I agree as well.

Ciao,
Dscho

^ permalink raw reply

* Re: Is there such a thing as a git:// proxy?
From: Linus Torvalds @ 2006-06-18 17:02 UTC (permalink / raw)
  To: linux; +Cc: git
In-Reply-To: <20060618124250.15471.qmail@science.horizon.com>



On Sun, 18 Jun 2006, linux@horizon.com wrote:
> 
> Has anyone put together something that can automatically check
> upstream for updates when someone fetches from it?

Well, there's actually a much easier solution: just add a "pre-pull" hook 
to "git-send-objects", and then have that hook check the real remote.

Does anybody see any problems with that?

		Linus

^ permalink raw reply

* Re: [PATCH] Fix git to be (more) ANSI C99 compliant.
From: Linus Torvalds @ 2006-06-18 16:50 UTC (permalink / raw)
  To: Florian Forster; +Cc: git
In-Reply-To: <1150609831500-git-send-email-octo@verplant.org>



On Sun, 18 Jun 2006, Florian Forster wrote:
>
> Using this patch I was able to build git with
> $ make CFLAGS="-Wall -Werror -ansi -pedantic -std=c99 -D_XOPEN_SOURCE=500 -D_BSD_SOURCE"

"-ansi -pedantic" is really not useful.

> While most of this patch fixes void-pointer arithmetic

This one I disagree with. Doing arithmetic on "void *" is _really_ useful, 
and I think most compilers end up supporting it either to be compatible 
with gcc, or just because it's hard to not do it.

It makes code a _lot_ cleaner.

In general, explicit casts are a sign of bad programming, and "void *" is 
there exactly to avoid it. And doing arithmetic on pointers is useful and 
fairly common, and if you accept void-pointer arithmetic, it avoids a lot 
of ugly and useless casts.

> @@ -301,9 +301,9 @@ static void fill_line_map(struct commit 
>  				if (DEBUG)
>  					printf("map: i1: %d %d %p i2: %d %d %p\n",
>  					       i1, map[i1],
> -					       i1 != -1 ? blame_lines[map[i1]] : NULL,
> +					       (void *) (i1 != -1 ? blame_lines[map[i1]] : NULL),
>  					       i2, map2[i2],
> -					       i2 != -1 ? blame_lines[map2[i2]] : NULL);
> +					       (void *) (i2 != -1 ? blame_lines[map2[i2]] : NULL));

Gaah. This is another case of casting that I'm sure is technically 
correct, but that I wonder whether there is any machine that actually 
cares..

But at least in that case I suspect the cast _may_ be required due to 
different pointer representations.

		Linus

^ permalink raw reply

* Re: git 1.4.0 usability problem
From: Ryan Anderson @ 2006-06-18 16:43 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Git Mailing List
In-Reply-To: <449557B6.1080907@garzik.org>

On Sun, Jun 18, 2006 at 09:40:06AM -0400, Jeff Garzik wrote:
> Now that kernel 2.6.17 is out, I updated all my repositories to be based 
> against that kernel.  And for each repository I updated, my merge was 
> rejected, due to an error similar to:
> 
> >fatal: Untracked working tree file '.gitignore' would be overwritten by 
> >merge.
> 
> I am only able to merge if I delete files in the working directory, so 
> that git stops complaining on merge.
> 
> This behavior is new with git 1.4.0, which Fedora Extras just added.  I 
> verified that merges work as expected in git 1.3.3, the last version 
> Fedora Extras shipped prior to 1.4.0.
> 
> This behavior is a definite regression, that impacts workflow :(
> 
> Here is how to reproduce:
> 
> git clone -l $url/torvalds/linux-2.6.git tmp-2.6

At this point you have master checked out, and recorded properly in the
index.

> cd tmp-2.6
> cp .git/refs/tags/v2.6.12 .git/refs/heads/tmp
> git checkout -f tmp

Here, you throw that index away, ignore the contents of the working
tree, and checkout tmp.

> git pull . master
> # watch OBVIOUS FAST-FORWARD MERGE complain about untracked
> # working tree files

At this point, you have a working tree containing files leftover from
the checkout of master, but which are totally unknown to the 2.6.12
tree, and so are untracked.  The fast-forward is trying hard not to
overwrite things it shouldn't be messing with, and so complains.

The fix is to drop the "-f" from git checkout, and things should work
correctly.  ("-f" should really not be a normal thing to use. For
switching branches, "git checkout" should be sufficient, and should
result ina working tree that doesn't contain nearly as many potential
conflict sources.

-- 

Ryan Anderson
  sometimes Pug Majere

^ permalink raw reply

* [PATCH 3/7] Don't instantiate structures with FAMs.
From: Florian Forster @ 2006-06-18 15:18 UTC (permalink / raw)
  To: git; +Cc: Florian Forster
In-Reply-To: <11506438893796-git-send-email-octo@verplant.org>

Since structures with `flexible array members' are an incomplete datatype ANSI
C99 forbids creating instances of them. This patch removes such an instance
from `diff-lib.c' and replaces it with a pointer to a `struct
combine_diff_path'. Since all neccessary memory is allocated at once the number
of calls to `xmalloc' is not increased.

Signed-off-by: Florian Forster <octo@verplant.org>


---

 diff-lib.c |   41 ++++++++++++++++++++++-------------------
 1 files changed, 22 insertions(+), 19 deletions(-)

c163a36f0bd0e07ffb9ee7d4bfb22f1cbb38eef8
diff --git a/diff-lib.c b/diff-lib.c
index 2183b41..fdc1173 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -34,21 +34,23 @@ int run_diff_files(struct rev_info *revs
 			continue;
 
 		if (ce_stage(ce)) {
-			struct {
-				struct combine_diff_path p;
-				struct combine_diff_parent filler[5];
-			} combine;
+			struct combine_diff_path *dpath;
 			int num_compare_stages = 0;
+			size_t path_len;
 
-			combine.p.next = NULL;
-			combine.p.len = ce_namelen(ce);
-			combine.p.path = xmalloc(combine.p.len + 1);
-			memcpy(combine.p.path, ce->name, combine.p.len);
-			combine.p.path[combine.p.len] = 0;
-			combine.p.mode = 0;
-			memset(combine.p.sha1, 0, 20);
-			memset(&combine.p.parent[0], 0,
-			       sizeof(combine.filler));
+			path_len = ce_namelen(ce);
+
+			dpath = xmalloc (combine_diff_path_size (5, path_len));
+			dpath->path = (char *) &(dpath->parent[5]);
+
+			dpath->next = NULL;
+			dpath->len = path_len;
+			memcpy(dpath->path, ce->name, path_len);
+			dpath->path[path_len] = '\0';
+			dpath->mode = 0;
+			memset(dpath->sha1, 0, 20);
+			memset(&(dpath->parent[0]), 0,
+					sizeof(struct combine_diff_parent)*5);
 
 			while (i < entries) {
 				struct cache_entry *nce = active_cache[i];
@@ -64,11 +66,11 @@ int run_diff_files(struct rev_info *revs
 				if (2 <= stage) {
 					int mode = ntohl(nce->ce_mode);
 					num_compare_stages++;
-					memcpy(combine.p.parent[stage-2].sha1,
+					memcpy(dpath->parent[stage-2].sha1,
 					       nce->sha1, 20);
-					combine.p.parent[stage-2].mode =
+					dpath->parent[stage-2].mode =
 						canon_mode(mode);
-					combine.p.parent[stage-2].status =
+					dpath->parent[stage-2].status =
 						DIFF_STATUS_MODIFIED;
 				}
 
@@ -83,13 +85,14 @@ int run_diff_files(struct rev_info *revs
 			i--;
 
 			if (revs->combine_merges && num_compare_stages == 2) {
-				show_combined_diff(&combine.p, 2,
+				show_combined_diff(dpath, 2,
 						   revs->dense_combined_merges,
 						   revs);
-				free(combine.p.path);
+				free(dpath);
 				continue;
 			}
-			free(combine.p.path);
+			free(dpath);
+			dpath = NULL;
 
 			/*
 			 * Show the diff for the 'ce' if we found the one
-- 
1.3.3

^ permalink raw reply related

* [PATCH 6/7] Change types used in bitfields to be `int's.
From: Florian Forster @ 2006-06-18 15:18 UTC (permalink / raw)
  To: git; +Cc: Florian Forster
In-Reply-To: <11506438893544-git-send-email-octo@verplant.org>

According to ANSI C99 bitfields are only defined for `signed int' and `unsigned
int'. This patch corrects the bitfield in the `msg_data_t' type from
`imap-send.c'.

Signed-off-by: Florian Forster <octo@verplant.org>


---

 imap-send.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

471838c5e32b83bc8b84584343daeb1174d0e968
diff --git a/imap-send.c b/imap-send.c
index 285ad29..94e39cd 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -93,7 +93,7 @@ typedef struct {
 	char *data;
 	int len;
 	unsigned char flags;
-	unsigned char crlf:1;
+	unsigned int crlf:1;
 } msg_data_t;
 
 #define DRV_OK          0
-- 
1.3.3

^ permalink raw reply related

* [PATCH 7/7] Remove all void-pointer arithmetic.
From: Florian Forster @ 2006-06-18 15:18 UTC (permalink / raw)
  To: git; +Cc: Florian Forster
In-Reply-To: <1150643889961-git-send-email-octo@verplant.org>

ANSI C99 doesn't allow void-pointer arithmetic. This patch fixes this in
various ways. Usually the strategy that required the least changes was used.

Signed-off-by: Florian Forster <octo@verplant.org>


---

 builtin-apply.c    |    6 +++---
 builtin-tar-tree.c |    6 +++---
 convert-objects.c  |   22 +++++++++++-----------
 csum-file.c        |    4 ++--
 diff-delta.c       |    2 +-
 diff.c             |    2 +-
 diffcore-order.c   |    2 +-
 http-fetch.c       |    2 +-
 http-push.c        |    2 +-
 http.c             |    4 ++--
 pack-check.c       |    6 +++---
 pack-objects.c     |    4 ++--
 pack-redundant.c   |   16 ++++++++--------
 patch-delta.c      |    4 ++--
 pkt-line.c         |    4 ++--
 read-cache.c       |   13 +++++++------
 sha1_file.c        |   27 ++++++++++++++-------------
 ssh-fetch.c        |    2 +-
 tag.c              |    4 ++--
 tree-walk.c        |   11 ++++++-----
 20 files changed, 73 insertions(+), 70 deletions(-)

13941d158a5f53456cc095b1a4893c177c7224c0
diff --git a/builtin-apply.c b/builtin-apply.c
index e113c74..6dd0472 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -148,7 +148,7 @@ static void *read_patch_file(int fd, uns
 			buffer = xrealloc(buffer, alloc);
 			nr = alloc - size;
 		}
-		nr = xread(fd, buffer + size, nr);
+		nr = xread(fd, (char *) buffer + size, nr);
 		if (!nr)
 			break;
 		if (nr < 0)
@@ -164,7 +164,7 @@ static void *read_patch_file(int fd, uns
 	 */
 	if (alloc < size + SLOP)
 		buffer = xrealloc(buffer, size + SLOP);
-	memset(buffer + size, 0, SLOP);
+	memset((char *) buffer + size, 0, SLOP);
 	return buffer;
 }
 
@@ -1194,7 +1194,7 @@ static int read_old_data(struct stat *st
 			return error("unable to open %s", path);
 		got = 0;
 		for (;;) {
-			int ret = xread(fd, buf + got, size - got);
+			int ret = xread(fd, (char *) buf + got, size - got);
 			if (ret <= 0)
 				break;
 			got += ret;
diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c
index f6310b9..c8527a3 100644
--- a/builtin-tar-tree.c
+++ b/builtin-tar-tree.c
@@ -34,7 +34,7 @@ static void reliable_write(void *buf, un
 			die("git-tar-tree: disk full?");
 		}
 		size -= ret;
-		buf += ret;
+		buf = (char *) buf + ret;
 	}
 }
 
@@ -87,13 +87,13 @@ static void write_blocked(void *buf, uns
 		memcpy(block + offset, buf, chunk);
 		size -= chunk;
 		offset += chunk;
-		buf += chunk;
+		buf = (char *) buf + chunk;
 		write_if_needed();
 	}
 	while (size >= BLOCKSIZE) {
 		reliable_write(buf, BLOCKSIZE);
 		size -= BLOCKSIZE;
-		buf += BLOCKSIZE;
+		buf = (char *) buf + BLOCKSIZE;
 	}
 	if (size) {
 		memcpy(block + offset, buf, size);
diff --git a/convert-objects.c b/convert-objects.c
index a67d6b4..0fabd89 100644
--- a/convert-objects.c
+++ b/convert-objects.c
@@ -103,12 +103,12 @@ static int write_subdirectory(void *buff
 		if (!slash) {
 			newlen += sprintf(new + newlen, "%o %s", mode, path);
 			new[newlen++] = '\0';
-			memcpy(new + newlen, buffer + len - 20, 20);
+			memcpy(new + newlen, (char *) buffer + len - 20, 20);
 			newlen += 20;
 
 			used += len;
 			size -= len;
-			buffer += len;
+			buffer = (char *) buffer + len;
 			continue;
 		}
 
@@ -121,7 +121,7 @@ static int write_subdirectory(void *buff
 
 		used += len;
 		size -= len;
-		buffer += len;
+		buffer = (char *) buffer + len;
 	}
 
 	write_sha1_file(new, newlen, tree_type, result_sha1);
@@ -137,13 +137,13 @@ static void convert_tree(void *buffer, u
 	while (size) {
 		int len = 1+strlen(buffer);
 
-		convert_binary_sha1(buffer + len);
+		convert_binary_sha1((char *) buffer + len);
 
 		len += 20;
 		if (len > size)
 			die("corrupt tree object");
 		size -= len;
-		buffer += len;
+		buffer = (char *) buffer + len;
 	}
 
 	write_subdirectory(orig_buffer, orig_size, "", 0, result_sha1);
@@ -244,14 +244,14 @@ static void convert_date(void *buffer, u
 	// "tree <sha1>\n"
 	memcpy(new + newlen, buffer, 46);
 	newlen += 46;
-	buffer += 46;
+	buffer = (char *) buffer + 46;
 	size -= 46;
 
 	// "parent <sha1>\n"
 	while (!memcmp(buffer, "parent ", 7)) {
 		memcpy(new + newlen, buffer, 48);
 		newlen += 48;
-		buffer += 48;
+		buffer = (char *) buffer + 48;
 		size -= 48;
 	}
 
@@ -275,11 +275,11 @@ static void convert_commit(void *buffer,
 
 	if (memcmp(buffer, "tree ", 5))
 		die("Bad commit '%s'", (char*) buffer);
-	convert_ascii_sha1(buffer+5);
-	buffer += 46;    /* "tree " + "hex sha1" + "\n" */
+	convert_ascii_sha1((char *) buffer + 5);
+	buffer = (char *) buffer + 46;    /* "tree " + "hex sha1" + "\n" */
 	while (!memcmp(buffer, "parent ", 7)) {
-		convert_ascii_sha1(buffer+7);
-		buffer += 48;
+		convert_ascii_sha1((char *) buffer + 7);
+		buffer = (char *) buffer + 48;
 	}
 	convert_date(orig_buffer, orig_size, result_sha1);
 }
diff --git a/csum-file.c b/csum-file.c
index 5f9249a..ebaad03 100644
--- a/csum-file.c
+++ b/csum-file.c
@@ -17,7 +17,7 @@ static int sha1flush(struct sha1file *f,
 	for (;;) {
 		int ret = xwrite(f->fd, buf, count);
 		if (ret > 0) {
-			buf += ret;
+			buf = (char *) buf + ret;
 			count -= ret;
 			if (count)
 				continue;
@@ -57,7 +57,7 @@ int sha1write(struct sha1file *f, void *
 		memcpy(f->buffer + offset, buf, nr);
 		count -= nr;
 		offset += nr;
-		buf += nr;
+		buf = (char *) buf + nr;
 		left -= nr;
 		if (!left) {
 			SHA1_Update(&f->ctx, f->buffer, offset);
diff --git a/diff-delta.c b/diff-delta.c
index 74486b1..8b9172a 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -284,7 +284,7 @@ create_delta(const struct delta_index *i
 	ref_data = index->src_buf;
 	ref_top = ref_data + index->src_size;
 	data = trg_buf;
-	top = trg_buf + trg_size;
+	top = (const unsigned char *) trg_buf + trg_size;
 
 	outpos++;
 	val = 0;
diff --git a/diff.c b/diff.c
index 9e9cfc8..fb1411c 100644
--- a/diff.c
+++ b/diff.c
@@ -515,7 +515,7 @@ static void emit_binary_diff(mmfile_t *o
 		else
 			line[0] = bytes - 26 + 'a' - 1;
 		encode_85(line + 1, cp, bytes);
-		cp += bytes;
+		cp = (char *) cp + bytes;
 		puts(line);
 	}
 	printf("\n");
diff --git a/diffcore-order.c b/diffcore-order.c
index 0bc2b22..aef6da6 100644
--- a/diffcore-order.c
+++ b/diffcore-order.c
@@ -30,7 +30,7 @@ static void prepare_order(const char *or
 	close(fd);
 	if (map == MAP_FAILED)
 		return;
-	endp = map + st.st_size;
+	endp = (char *) map + st.st_size;
 	for (pass = 0; pass < 2; pass++) {
 		cnt = 0;
 		cp = map;
diff --git a/http-fetch.c b/http-fetch.c
index 3a2cb5e..2b63d89 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -123,7 +123,7 @@ static size_t fwrite_sha1_file(void *ptr
 	struct object_request *obj_req = (struct object_request *)data;
 	do {
 		ssize_t retval = write(obj_req->local,
-				       ptr + posn, size - posn);
+				       (char *) ptr + posn, size - posn);
 		if (retval < 0)
 			return posn;
 		posn += retval;
diff --git a/http-push.c b/http-push.c
index 364ab76..0684e46 100644
--- a/http-push.c
+++ b/http-push.c
@@ -196,7 +196,7 @@ static size_t fwrite_sha1_file(void *ptr
 	struct transfer_request *request = (struct transfer_request *)data;
 	do {
 		ssize_t retval = write(request->local_fileno,
-				       ptr + posn, size - posn);
+				       (char *) ptr + posn, size - posn);
 		if (retval < 0)
 			return posn;
 		posn += retval;
diff --git a/http.c b/http.c
index 08769cc..6c1937b 100644
--- a/http.c
+++ b/http.c
@@ -34,7 +34,7 @@ size_t fread_buffer(void *ptr, size_t el
 	size_t size = eltsize * nmemb;
 	if (size > buffer->size - buffer->posn)
 		size = buffer->size - buffer->posn;
-	memcpy(ptr, buffer->buffer + buffer->posn, size);
+	memcpy(ptr, (char *) buffer->buffer + buffer->posn, size);
 	buffer->posn += size;
 	return size;
 }
@@ -49,7 +49,7 @@ size_t fwrite_buffer(const void *ptr, si
 			buffer->size = buffer->posn + size;
 		buffer->buffer = xrealloc(buffer->buffer, buffer->size);
 	}
-	memcpy(buffer->buffer + buffer->posn, ptr, size);
+	memcpy((char *) buffer->buffer + buffer->posn, ptr, size);
 	buffer->posn += size;
 	data_received++;
 	return size;
diff --git a/pack-check.c b/pack-check.c
index e575879..3a62e1b 100644
--- a/pack-check.c
+++ b/pack-check.c
@@ -29,10 +29,10 @@ static int verify_packfile(struct packed
 	pack_base = p->pack_base;
 	SHA1_Update(&ctx, pack_base, pack_size - 20);
 	SHA1_Final(sha1, &ctx);
-	if (memcmp(sha1, pack_base + pack_size - 20, 20))
+	if (memcmp(sha1, (char *) pack_base + pack_size - 20, 20))
 		return error("Packfile %s SHA1 mismatch with itself",
 			     p->pack_name);
-	if (memcmp(sha1, index_base + index_size - 40, 20))
+	if (memcmp(sha1, (char *) index_base + index_size - 40, 20))
 		return error("Packfile %s SHA1 mismatch with idx",
 			     p->pack_name);
 
@@ -135,7 +135,7 @@ int verify_pack(struct packed_git *p, in
 	SHA1_Init(&ctx);
 	SHA1_Update(&ctx, index_base, index_size - 20);
 	SHA1_Final(sha1, &ctx);
-	if (memcmp(sha1, index_base + index_size - 20, 20))
+	if (memcmp(sha1, (char *) index_base + index_size - 20, 20))
 		ret = error("Packfile index for %s SHA1 mismatch",
 			    p->pack_name);
 
diff --git a/pack-objects.c b/pack-objects.c
index 179560f..ba6525d 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -156,7 +156,7 @@ static void prepare_pack_revindex(struct
 
 	rix->revindex = xmalloc(sizeof(unsigned long) * (num_ent + 1));
 	for (i = 0; i < num_ent; i++) {
-		unsigned int hl = *((unsigned int *)(index + 24 * i));
+		unsigned int hl = *((unsigned int *)((char *) index + 24*i));
 		rix->revindex[i] = ntohl(hl);
 	}
 	/* This knows the pack format -- the 20-byte trailer
@@ -300,7 +300,7 @@ static unsigned long write_object(struct
 		use_packed_git(p);
 
 		datalen = find_packed_object_size(p, entry->in_pack_offset);
-		buf = p->pack_base + entry->in_pack_offset;
+		buf = (char *) p->pack_base + entry->in_pack_offset;
 		sha1write(f, buf, datalen);
 		unuse_packed_git(p);
 		hdrlen = 0; /* not really */
diff --git a/pack-redundant.c b/pack-redundant.c
index cd81f5a..4864a2b 100644
--- a/pack-redundant.c
+++ b/pack-redundant.c
@@ -246,12 +246,12 @@ static struct pack_list * pack_list_diff
 static void cmp_two_packs(struct pack_list *p1, struct pack_list *p2)
 {
 	int p1_off, p2_off;
-	void *p1_base, *p2_base;
+	unsigned char *p1_base, *p2_base;
 	struct llist_item *p1_hint = NULL, *p2_hint = NULL;
 	
 	p1_off = p2_off = 256 * 4 + 4;
-	p1_base = (void *)p1->pack->index_base;
-	p2_base = (void *)p2->pack->index_base;
+	p1_base = (unsigned char *) p1->pack->index_base;
+	p2_base = (unsigned char *) p2->pack->index_base;
 
 	while (p1_off <= p1->pack->index_size - 3 * 20 &&
 	       p2_off <= p2->pack->index_size - 3 * 20)
@@ -351,11 +351,11 @@ static size_t sizeof_union(struct packed
 {
 	size_t ret = 0;
 	int p1_off, p2_off;
-	void *p1_base, *p2_base;
+	char *p1_base, *p2_base;
 
 	p1_off = p2_off = 256 * 4 + 4;
-	p1_base = (void *)p1->index_base;
-	p2_base = (void *)p2->index_base;
+	p1_base = (char *)p1->index_base;
+	p2_base = (char *)p2->index_base;
 
 	while (p1_off <= p1->index_size - 3 * 20 &&
 	       p2_off <= p2->index_size - 3 * 20)
@@ -534,7 +534,7 @@ static struct pack_list * add_pack(struc
 {
 	struct pack_list l;
 	size_t off;
-	void *base;
+	unsigned char *base;
 
 	if (!p->pack_local && !(alt_odb || verbose))
 		return NULL;
@@ -543,7 +543,7 @@ static struct pack_list * add_pack(struc
 	llist_init(&l.all_objects);
 
 	off = 256 * 4 + 4;
-	base = (void *)p->index_base;
+	base = (unsigned char *)p->index_base;
 	while (off <= p->index_size - 3 * 20) {
 		llist_insert_back(l.all_objects, base + off);
 		off += 24;
diff --git a/patch-delta.c b/patch-delta.c
index 8f318ed..e3a1d42 100644
--- a/patch-delta.c
+++ b/patch-delta.c
@@ -25,7 +25,7 @@ void *patch_delta(const void *src_buf, u
 		return NULL;
 
 	data = delta_buf;
-	top = delta_buf + delta_size;
+	top = (const unsigned char *) delta_buf + delta_size;
 
 	/* make sure the orig file size matches what we expect */
 	size = get_delta_hdr_size(&data, top);
@@ -56,7 +56,7 @@ void *patch_delta(const void *src_buf, u
 			    cp_off + cp_size > src_size ||
 			    cp_size > size)
 				goto bad;
-			memcpy(out, src_buf + cp_off, cp_size);
+			memcpy(out, (char *) src_buf + cp_off, cp_size);
 			out += cp_size;
 			size -= cp_size;
 		} else if (cmd) {
diff --git a/pkt-line.c b/pkt-line.c
index bb3bab0..44d4296 100644
--- a/pkt-line.c
+++ b/pkt-line.c
@@ -21,7 +21,7 @@ static void safe_write(int fd, const voi
 	while (n) {
 		int ret = xwrite(fd, buf, n);
 		if (ret > 0) {
-			buf += ret;
+			buf = (char *) buf + ret;
 			n -= ret;
 			continue;
 		}
@@ -66,7 +66,7 @@ static void safe_read(int fd, void *buff
 	int n = 0;
 
 	while (n < size) {
-		int ret = xread(fd, buffer + n, size - n);
+		int ret = xread(fd, (char *) buffer + n, size - n);
 		if (ret < 0)
 			die("read error (%s)", strerror(errno));
 		if (!ret)
diff --git a/read-cache.c b/read-cache.c
index c499c51..3c32aae 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -706,7 +706,7 @@ static int verify_hdr(struct cache_heade
 	SHA1_Init(&c);
 	SHA1_Update(&c, hdr, size - 20);
 	SHA1_Final(sha1, &c);
-	if (memcmp(sha1, (void *)hdr + size - 20, 20))
+	if (memcmp(sha1, (char *) hdr + size - 20, 20))
 		return error("bad index file sha1 signature");
 	return 0;
 }
@@ -770,7 +770,7 @@ int read_cache(void)
 
 	offset = sizeof(*hdr);
 	for (i = 0; i < active_nr; i++) {
-		struct cache_entry *ce = map + offset;
+		struct cache_entry *ce = (struct cache_entry *) ((char *) map + offset);
 		offset = offset + ce_size(ce);
 		active_cache[i] = ce;
 	}
@@ -783,10 +783,11 @@ int read_cache(void)
 		 * in 4-byte network byte order.
 		 */
 		unsigned long extsize;
-		memcpy(&extsize, map + offset + 4, 4);
+		memcpy(&extsize, (char *) map + offset + 4, 4);
 		extsize = ntohl(extsize);
-		if (read_index_extension(map + offset,
-					 map + offset + 8, extsize) < 0)
+		if (read_index_extension(((const char *) map) + offset,
+					 (char *) map + offset + 8,
+					 extsize) < 0)
 			goto unmap;
 		offset += 8;
 		offset += extsize;
@@ -820,7 +821,7 @@ static int ce_write(SHA_CTX *context, in
 		}
 		write_buffer_len = buffered;
 		len -= partial;
-		data += partial;
+		data = (char *) data + partial;
  	}
  	return 0;
 }
diff --git a/sha1_file.c b/sha1_file.c
index b4ff233..3c001d7 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -486,7 +486,8 @@ int use_packed_git(struct packed_git *p)
 		 * this is cheap.
 		 */
 		if (memcmp((char*)(p->index_base) + p->index_size - 40,
-			   p->pack_base + p->pack_size - 20, 20)) {
+			   (char *) p->pack_base + p->pack_size - 20,
+			   20)) {
 			      
 			die("packfile %s does not match index.", p->pack_name);
 		}
@@ -701,7 +702,7 @@ static void *unpack_sha1_rest(z_stream *
 	int bytes = strlen(buffer) + 1;
 	unsigned char *buf = xmalloc(1+size);
 
-	memcpy(buf, buffer + bytes, stream->total_out - bytes);
+	memcpy(buf, (char *) buffer + bytes, stream->total_out - bytes);
 	bytes = stream->total_out - bytes;
 	if (bytes < size) {
 		stream->next_out = buf + bytes;
@@ -853,7 +854,7 @@ static unsigned long unpack_object_heade
 	if (offset >= p->pack_size)
 		die("object offset outside of pack file");
 
-	pack =  p->pack_base + offset;
+	pack =  (unsigned char *) p->pack_base + offset;
 	c = *pack++;
 	offset++;
 	*type = (c >> 4) & 7;
@@ -883,7 +884,7 @@ int check_reuse_pack_delta(struct packed
 	ptr = unpack_object_header(p, ptr, kindp, sizep);
 	if (*kindp != OBJ_DELTA)
 		goto done;
-	memcpy(base, p->pack_base + ptr, 20);
+	memcpy(base, (char *) p->pack_base + ptr, 20);
 	status = 0;
  done:
 	unuse_packed_git(p);
@@ -903,7 +904,7 @@ void packed_object_info_detail(struct pa
 	enum object_type kind;
 
 	offset = unpack_object_header(p, e->offset, &kind, size);
-	pack = p->pack_base + offset;
+	pack = (unsigned char *) p->pack_base + offset;
 	if (kind != OBJ_DELTA)
 		*delta_chain_length = 0;
 	else {
@@ -919,7 +920,7 @@ void packed_object_info_detail(struct pa
 			find_pack_entry_one(pack, &base_ent, p);
 			offset = unpack_object_header(p, base_ent.offset,
 						      &kind, &junk);
-			pack = p->pack_base + offset;
+			pack = (unsigned char *) p->pack_base + offset;
 			chain_length++;
 		} while (kind == OBJ_DELTA);
 		*delta_chain_length = chain_length;
@@ -957,7 +958,7 @@ static int packed_object_info(struct pac
 		die("cannot map packed file");
 
 	offset = unpack_object_header(p, entry->offset, &kind, &size);
-	pack = p->pack_base + offset;
+	pack = (unsigned char *) p->pack_base + offset;
 	left = p->pack_size - offset;
 
 	switch (kind) {
@@ -1096,7 +1097,7 @@ void *unpack_entry_gently(struct pack_en
 	void *retval;
 
 	offset = unpack_object_header(p, entry->offset, &kind, &size);
-	pack = p->pack_base + offset;
+	pack = (unsigned char *) p->pack_base + offset;
 	left = p->pack_size - offset;
 	switch (kind) {
 	case OBJ_DELTA:
@@ -1134,7 +1135,7 @@ int nth_packed_object_sha1(const struct 
 	void *index = p->index_base + 256;
 	if (n < 0 || num_packed_objects(p) <= n)
 		return -1;
-	memcpy(sha1, (index + 24 * n + 4), 20);
+	memcpy(sha1, (char *) index + (24 * n) + 4, 20);
 	return 0;
 }
 
@@ -1148,9 +1149,9 @@ int find_pack_entry_one(const unsigned c
 
 	do {
 		int mi = (lo + hi) / 2;
-		int cmp = memcmp(index + 24 * mi + 4, sha1, 20);
+		int cmp = memcmp((char *) index + (24 * mi) + 4, sha1, 20);
 		if (!cmp) {
-			e->offset = ntohl(*((unsigned int *)(index + 24 * mi)));
+			e->offset = ntohl(*((unsigned int *) ((char *) index + (24 * mi))));
 			memcpy(e->sha1, sha1, 20);
 			e->p = p;
 			return 1;
@@ -1290,7 +1291,7 @@ void *read_object_with_reference(const u
 		ref_length = strlen(ref_type);
 
 		if (memcmp(buffer, ref_type, ref_length) ||
-		    get_sha1_hex(buffer + ref_length, actual_sha1)) {
+		    get_sha1_hex((char *) buffer + ref_length, actual_sha1)) {
 			free(buffer);
 			return NULL;
 		}
@@ -1408,7 +1409,7 @@ static int write_buffer(int fd, const vo
 			return error("file write error (%s)", strerror(errno));
 		}
 		len -= size;
-		buf += size;
+		buf = (char *) buf + size;
 	}
 	return 0;
 }
diff --git a/ssh-fetch.c b/ssh-fetch.c
index e3067b8..1e59cd2 100644
--- a/ssh-fetch.c
+++ b/ssh-fetch.c
@@ -24,7 +24,7 @@ static ssize_t force_write(int fd, void 
 {
 	ssize_t ret = 0;
 	while (ret < length) {
-		ssize_t size = write(fd, buffer + ret, length - ret);
+		ssize_t size = write(fd, (char *) buffer + ret, length - ret);
 		if (size < 0) {
 			return size;
 		}
diff --git a/tag.c b/tag.c
index f390ee7..13c364d 100644
--- a/tag.c
+++ b/tag.c
@@ -47,10 +47,10 @@ int parse_tag_buffer(struct tag *item, v
 
 	if (size < 64)
 		return -1;
-	if (memcmp("object ", data, 7) || get_sha1_hex(data + 7, object))
+	if (memcmp("object ", data, 7) || get_sha1_hex((char *) data + 7, object))
 		return -1;
 
-	type_line = data + 48;
+	type_line = (char *) data + 48;
 	if (memcmp("\ntype ", type_line-1, 6))
 		return -1;
 
diff --git a/tree-walk.c b/tree-walk.c
index 297c697..3f83e98 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -43,7 +43,7 @@ void update_tree_entry(struct tree_desc 
 
 	if (size < len)
 		die("corrupt tree file");
-	desc->buf = buf + len;
+	desc->buf = (char *) buf + len;
 	desc->size = size - len;
 }
 
@@ -66,7 +66,7 @@ const unsigned char *tree_entry_extract(
 	const void *tree = desc->buf;
 	unsigned long size = desc->size;
 	int len = strlen(tree)+1;
-	const unsigned char *sha1 = tree + len;
+	const unsigned char *sha1 = (unsigned char *) tree + len;
 	const char *path;
 	unsigned int mode;
 
@@ -80,7 +80,8 @@ const unsigned char *tree_entry_extract(
 
 int tree_entry(struct tree_desc *desc, struct name_entry *entry)
 {
-	const void *tree = desc->buf, *path;
+	const void *tree = desc->buf;
+	const char *path;
 	unsigned long len, size = desc->size;
 
 	if (!size)
@@ -95,10 +96,10 @@ int tree_entry(struct tree_desc *desc, s
 	entry->pathlen = len;
 
 	path += len + 1;
-	entry->sha1 = path;
+	entry->sha1 = (const unsigned char *) path;
 
 	path += 20;
-	len = path - tree;
+	len = path - (char *) tree;
 	if (len > size)
 		die("corrupt tree file");
 
-- 
1.3.3

^ permalink raw reply related

* [PATCH 1/7] Remove ranges from switch statements.
From: Florian Forster @ 2006-06-18 15:18 UTC (permalink / raw)
  To: git; +Cc: Florian Forster
In-Reply-To: <11506438892865-git-send-email-octo@verplant.org>

Though very nice and readable, the "case 'a'...'z':" construct is not ANSI C99
compliant. This patch unfolds the range in `quote.c' and substitutes the
switch-statement with an if-statement in `http-fetch.c' and `http-push.c'.

Signed-off-by: Florian Forster <octo@verplant.org>


---

 http-fetch.c |   13 +++++++------
 http-push.c  |   13 +++++++------
 quote.c      |    9 ++++++++-
 3 files changed, 22 insertions(+), 13 deletions(-)

d90149c5b4e91938329120bdde609e5f6d9b03e8
diff --git a/http-fetch.c b/http-fetch.c
index da1a7f5..3a2cb5e 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -1136,13 +1136,14 @@ int fetch(unsigned char *sha1)
 
 static inline int needs_quote(int ch)
 {
-	switch (ch) {
-	case '/': case '-': case '.':
-	case 'A'...'Z':	case 'a'...'z':	case '0'...'9':
+	if (((ch >= 'A') && (ch <= 'Z'))
+			|| ((ch >= 'a') && (ch <= 'z'))
+			|| ((ch >= '0') && (ch <= '9'))
+			|| (ch == '/')
+			|| (ch == '-')
+			|| (ch == '.'))
 		return 0;
-	default:
-		return 1;
-	}
+	return 1;
 }
 
 static inline int hex(int v)
diff --git a/http-push.c b/http-push.c
index 2d9441e..364ab76 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1077,13 +1077,14 @@ static int fetch_indices(void)
 
 static inline int needs_quote(int ch)
 {
-	switch (ch) {
-	case '/': case '-': case '.':
-	case 'A'...'Z':	case 'a'...'z':	case '0'...'9':
+	if (((ch >= 'A') && (ch <= 'Z'))
+			|| ((ch >= 'a') && (ch <= 'z'))
+			|| ((ch >= '0') && (ch <= '9'))
+			|| (ch == '/')
+			|| (ch == '-')
+			|| (ch == '.'))
 		return 0;
-	default:
-		return 1;
-	}
+	return 1;
 }
 
 static inline int hex(int v)
diff --git a/quote.c b/quote.c
index 06792d4..dcc2326 100644
--- a/quote.c
+++ b/quote.c
@@ -206,7 +206,14 @@ #define EMIT(c) (outp ? (*outp++ = (c)) 
 				case '\\': case '"':
 					break; /* verbatim */
 
-				case '0'...'7':
+				case '0':
+				case '1':
+				case '2':
+				case '3':
+				case '4':
+				case '5':
+				case '6':
+				case '7':
 					/* octal */
 					ac = ((ch - '0') << 6);
 					if ((ch = *sp++) < '0' || '7' < ch)
-- 
1.3.3

^ permalink raw reply related

* [PATCH 4/7] Cast pointers to `void *' when used in a format.
From: Florian Forster @ 2006-06-18 15:18 UTC (permalink / raw)
  To: git; +Cc: Florian Forster
In-Reply-To: <11506438892551-git-send-email-octo@verplant.org>

ANSI C99 requires void-pointers when using the `%p' format. This patch adds the
neccessary cast in `blame.c'.

Signed-off-by: Florian Forster <octo@verplant.org>


---

 blame.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

372bb52dd567d39c3e64919e100ae9bd8af603ca
diff --git a/blame.c b/blame.c
index 25d3bcf..51eab2e 100644
--- a/blame.c
+++ b/blame.c
@@ -301,9 +301,9 @@ static void fill_line_map(struct commit 
 				if (DEBUG)
 					printf("map: i1: %d %d %p i2: %d %d %p\n",
 					       i1, map[i1],
-					       i1 != -1 ? blame_lines[map[i1]] : NULL,
+					       (void *) (i1 != -1 ? blame_lines[map[i1]] : NULL),
 					       i2, map2[i2],
-					       i2 != -1 ? blame_lines[map2[i2]] : NULL);
+					       (void *) (i2 != -1 ? blame_lines[map2[i2]] : NULL));
 				if (map2[i2] != -1 &&
 				    blame_lines[map[i1]] &&
 				    !blame_lines[map2[i2]])
-- 
1.3.3

^ permalink raw reply related

* [PATCH 2/7] Initialize FAMs using `FLEX_ARRAY'.
From: Florian Forster @ 2006-06-18 15:18 UTC (permalink / raw)
  To: git; +Cc: Florian Forster
In-Reply-To: <1150643889264-git-send-email-octo@verplant.org>

When initializing a `flexible array member' the macro `FLEX_ARRAY' should be
used. This was forgotten in `diff-delta.c'.

Signed-off-by: Florian Forster <octo@verplant.org>


---

 diff-delta.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

e587fd59510f2ed8326d280054d78cfb78d482dc
diff --git a/diff-delta.c b/diff-delta.c
index 25a798d..74486b1 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -22,6 +22,7 @@ #include <stdlib.h>
 #include <string.h>
 #include "delta.h"
 
+#include "git-compat-util.h"
 
 /* maximum hash entry list for the same hash bucket */
 #define HASH_LIMIT 64
@@ -131,7 +132,7 @@ struct delta_index {
 	const void *src_buf;
 	unsigned long src_size;
 	unsigned int hash_mask;
-	struct index_entry *hash[0];
+	struct index_entry *hash[FLEX_ARRAY];
 };
 
 struct delta_index * create_delta_index(const void *buf, unsigned long bufsize)
-- 
1.3.3

^ permalink raw reply related

* [PATCH 5/7] Don't use empty structure initializers.
From: Florian Forster @ 2006-06-18 15:18 UTC (permalink / raw)
  To: git; +Cc: Florian Forster
In-Reply-To: <11506438893167-git-send-email-octo@verplant.org>

Empty initializers for structures are not allowed in ANSI C99. This patch
removes such an initializer from `builtin-read-tree.c'. Since the struct was
static (and is therefore implicitely initialized to zero anyway) it wasn't
actually needed.

Signed-off-by: Florian Forster <octo@verplant.org>


---

 builtin-read-tree.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

91df4330d35f1f1670dd04af0a14f1ca84a72b2b
diff --git a/builtin-read-tree.c b/builtin-read-tree.c
index bb50fbd..fdd6706 100644
--- a/builtin-read-tree.c
+++ b/builtin-read-tree.c
@@ -30,8 +30,7 @@ static int merge_size = 0;
 
 static struct object_list *trees = NULL;
 
-static struct cache_entry df_conflict_entry = {
-};
+static struct cache_entry df_conflict_entry;
 
 struct tree_entry_list {
 	struct tree_entry_list *next;
-- 
1.3.3

^ permalink raw reply related

* [PATCH 0/7] Improve ANSI C99 compliance
From: Florian Forster @ 2006-06-18 15:18 UTC (permalink / raw)
  To: git
In-Reply-To: <20060618083502.GB1331@verplant.org>

Hi,

as promised I've split up the changes into several smaller patches. The changes
are grouped by type of problem they fix, as requested. The patches should not
depend on each other, but I didn't actually test that.

Regards,
-octo

^ permalink raw reply

* Is there such a thing as a git:// proxy?
From: linux @ 2006-06-18 12:42 UTC (permalink / raw)
  To: git

I have several machines tracking kernel.org, and I've been moving away
from downloading patch files periodically (cached very nicely by squid)
to just doing "git pull".

But it seems silly to be sucking four copies of the same data from
kernel.org.

Now, one obvious solution is to have one master copy track kernel.org
and have all the other local machines track that.  But then I have to
manually pull the local master every time.

Has anyone put together something that can automatically check
upstream for updates when someone fetches from it?

Ultimately desirable features would, I suppose include:
- Pulling over ssh as well (using auth agent forwarding to pull
  from upstream)
- Support for arbitrary projects (so the cache server can handle
  "git clone" requests), if I develop a desire to pull an -mm or
  -libata-dev or whatever kernel, it will also work.
- Using a single shared object pool for the above.
- Cache cleanup if a project hasn't been used in long enough.
  (You'd probably just time out the heads and let git-prune get
  rid of the objects.)
- Recycling the pack from the upstream server rather than regenerating it.
- Progress reporting on the upstream fetch (since the point is that
  the upstream server pipe is narrower).
- Transparent proxy support

... but I'll settle for the simple solution to start.  Perhaps it could
be as simple as a pre-upload hook invoked by git-upload-pack?

This hasn't gotten itchy enough for me to start scratching it myself,
but I figured I'd mention it and see if anyone was interested.

^ permalink raw reply

* Re: [PATCH] auto-detect changed $prefix in Makefile and properly rebuild to avoid broken install
From: Karl Hasselström @ 2006-06-18 14:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Santi, git
In-Reply-To: <7vzmga1y9k.fsf@assigned-by-dhcp.cox.net>

On 2006-06-18 04:47:19 -0700, Junio C Hamano wrote:

> Thanks for the explanation.
>
> If that's the case, I think it makes the original problem Santi
> brought up a non-issue. In this sequence:
>
>         make prefix=/home/santi/usr
>         make install prefix=/home/santi/usr/stow/git
>         cd /home/santi/usr/stow/
>         stow -v git
>
> the building phase could have used the same prefix as the install
> phase uses, and git can find its subprograms in gitexecdir (=
> ~/usr/stow/git/bin) just fine. It probably is even slightly more
> efficient since it does not have to go through the symlink stow
> installs.

Yes, exactly. I've always built git like this:

  $ make prefix=/usr/local/stow/git
  $ sudo make prefix=/usr/local/stow/git install
  $ cd /usr/local/stow
  $ sudo stow git

It works for all other programs I've tried too (most of which only
require me to specify the prefix once, with ./configure --prefix=...).
The programs never need to know about the symlinks; they're only there
for when other programs need to access them (via PATH, etc.).

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply

* git 1.4.0 usability problem
From: Jeff Garzik @ 2006-06-18 13:40 UTC (permalink / raw)
  To: Git Mailing List

Now that kernel 2.6.17 is out, I updated all my repositories to be based 
against that kernel.  And for each repository I updated, my merge was 
rejected, due to an error similar to:

> fatal: Untracked working tree file '.gitignore' would be overwritten by merge.

I am only able to merge if I delete files in the working directory, so 
that git stops complaining on merge.

This behavior is new with git 1.4.0, which Fedora Extras just added.  I 
verified that merges work as expected in git 1.3.3, the last version 
Fedora Extras shipped prior to 1.4.0.

This behavior is a definite regression, that impacts workflow :(

Here is how to reproduce:

git clone -l $url/torvalds/linux-2.6.git tmp-2.6
cd tmp-2.6
cp .git/refs/tags/v2.6.12 .git/refs/heads/tmp
git checkout -f tmp
git pull . master
# watch OBVIOUS FAST-FORWARD MERGE complain about untracked
# working tree files

Regards,

	Jeff

^ permalink raw reply

* Re: [PATCH] auto-detect changed $prefix in Makefile and properly rebuild to avoid broken install
From: Petr Baudis @ 2006-06-18 13:31 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Yakov Lerner, git
In-Reply-To: <7vver3cxlw.fsf@assigned-by-dhcp.cox.net>

Dear diary, on Wed, Jun 14, 2006 at 10:04:43PM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
>  - we may want to make the state file a bit more visible (IOW, I
>    somewhat do mind the name being dot-git-dot-prefix).

What is the point? It is just a bit of internal build system state made
persistent and shouldn't be interesting for the user, so why give it
extra publicity in the tree?

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
A person is just about as big as the things that make them angry.

^ permalink raw reply

* [PATCH] Make release tarballs friendlier to older tar versions
From: Rene Scharfe @ 2006-06-18 13:25 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

git-tar-tree adds an extended pax header to archives if its first
parameter points to a commit.  It confuses older tars and isn't
very useful in the case of git anyway, so stop doing it.

Idea: Junio, implementation: Junio.  I just wrote it up. :-)

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>

diff --git a/Makefile b/Makefile
index 2a1e639..28517f4 100644
--- a/Makefile
+++ b/Makefile
@@ -667,7 +667,7 @@ git.spec: git.spec.in
 
 GIT_TARNAME=git-$(GIT_VERSION)
 dist: git.spec git-tar-tree
-	./git-tar-tree HEAD $(GIT_TARNAME) > $(GIT_TARNAME).tar
+	./git-tar-tree HEAD^{tree} $(GIT_TARNAME) > $(GIT_TARNAME).tar
 	@mkdir -p $(GIT_TARNAME)
 	@cp git.spec $(GIT_TARNAME)
 	@echo $(GIT_VERSION) > $(GIT_TARNAME)/version

^ permalink raw reply related

* Re: What's in git.git
From: Petr Baudis @ 2006-06-18 13:08 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, git
In-Reply-To: <Pine.LNX.4.63.0606181417090.26803@wbgn013.biozentrum.uni-wuerzburg.de>

Dear diary, on Sun, Jun 18, 2006 at 02:26:14PM CEST, I got a letter
where Johannes Schindelin <Johannes.Schindelin@gmx.de> said that...
> There is one thing I don't like about Pasky's approach: You can change the 
> config file name to whatever you like, even if no program will read it. 
> That is why I decided to have a flag instead of an option: to prevent 
> pilot-errors.

I'm lost here, admittelly not getting your argument. :-(

> I cobbled together a patch, which turned out to be rather messy, 
> introducing "--config-file <file>" to git-repo-config. If people are 
> interested, I'll clean it up and post it. But then, if you already know 
> you want to use another config file, you are probably better of just 
> exporting GIT_CONFIG_FILE and be done with it.

$GIT_CONFIG_FILE feels nicer since any other git tool can use it as
well, it's not git-repo-config-specific. But the current intent indeed
is to simply override the location for git-repo-config, thus for the
current purposes if we will have --config-file instead of
GIT_CONFIG_FILE, I will not weep; whatever does the job.

> Note that this issue is orthogonal to the need for a user-specific config 
> file. I still think that this one should go in.

I agree as well.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
A person is just about as big as the things that make them angry.

^ permalink raw reply

* Re: [PATCH 2/3] git-tar-tree: documentation update
From: Rene Scharfe @ 2006-06-18 13:06 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <11506282792065-git-send-email-rene.scharfe@lsrfire.ath.cx>

>  * add example on how to avoid adding a global extended pax header
>  * don't mention linux anymore, use git itself as an example instead
>  * update to v1.4.0 ;-)
>  * append missing :: to the examples

Oops, I forgot to mention this change:

> -git tar-tree HEAD | (cd /var/tmp/ && mkdir junk && tar Cxf junk -)::
> +git tar-tree HEAD junk | (cd /var/tmp/ && tar xf -)::
>  
>  	Create a tar archive that contains the contents of the
>  	latest commit on the current branch, and extracts it in
>  	`/var/tmp/junk` directory.

The new version features less typing and no more path duplication.

René

^ permalink raw reply

* Re: [RFD] gitweb configuration
From: Petr Baudis @ 2006-06-18 13:04 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Martin Langhoff, git
In-Reply-To: <7v64iy505x.fsf@assigned-by-dhcp.cox.net>

Dear diary, on Sun, Jun 18, 2006 at 10:38:02AM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
> "Martin Langhoff" <martin.langhoff@gmail.com> writes:
> 
> > On 6/18/06, Jakub Narebski <jnareb@gmail.com> wrote:
> >> So GIT_CONFIG would be ~/.gitconfig, and GIT_CONFIG_LOCAL would be
> >> $GIT_DIR/config or what?
> >
> > I don't quite follow why gitweb needs a GIT_CONFIG_LOCAL defined.
> > Given that it works in a CGI environment, it should read
> > $GIT_DIR/config by default, and $GIT_CONFIG if set (from httpd.conf).
> 
> I am not Pasky, but I think the intent of the patch is to run
> "git repo-config" with GIT_CONFIG pointing at /etc/gitweb.conf
> to obtain server-wide configuration (e.g. finding out where
> repositories are) and then when serving individual repository
> (i.e. after we set up GIT_DIR to point at it) run "git
> repo-config" without GIT_CONFIG to read per-repository
> configuration.  That way we can reuse the configuration parser.

Yes, if $GIT_CONFIG is set, git should be guaranteed to read _no_ config
file except $GIT_CONFIG. The intent of $GIT_LOCAL_CONFIG was to make it
possible to just override the per-repo configfile location, but it just
felt nice to have - I don't insist on it so if people think it's useless
additional complexity I'm happy to say that one goodbye.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
A person is just about as big as the things that make them angry.

^ permalink raw reply

* Re: What's in git.git
From: Johannes Schindelin @ 2006-06-18 12:26 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vpsh75lx1.fsf@assigned-by-dhcp.cox.net>

Hi,

On Sat, 17 Jun 2006, Junio C Hamano wrote:

>       Read configuration also from ~/.gitconfig
>       repo-config: learn the flag "--no-local"
> 
>    I see Pasky has proposed another config change (this time,
>    not "also from" but "alternatively from") -- I am not sure
>    which one is more appropriate.  Waiting for Johannes's
>    response to Pasky's message and hoping the list can agree on
>    a single patch series to apply to "next".

There is one thing I don't like about Pasky's approach: You can change the 
config file name to whatever you like, even if no program will read it. 
That is why I decided to have a flag instead of an option: to prevent 
pilot-errors.

But hey, that is just me.

I cobbled together a patch, which turned out to be rather messy, 
introducing "--config-file <file>" to git-repo-config. If people are 
interested, I'll clean it up and post it. But then, if you already know 
you want to use another config file, you are probably better of just 
exporting GIT_CONFIG_FILE and be done with it.

Note that this issue is orthogonal to the need for a user-specific config 
file. I still think that this one should go in.

Ciao,
Dscho

^ permalink raw reply

* [PATCH] Add renaming-rebase test.
From: Junio C Hamano @ 2006-06-18 11:48 UTC (permalink / raw)
  To: Eric Wong; +Cc: git
In-Reply-To: <1150599735483-git-send-email-normalperson@yhbt.net>

This tests Eric's "renaming rebase" patch.  It tests only very
basic cases and most of the tests except the last one passes.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 t/t3402-rebase-merge.sh |   96 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 96 insertions(+), 0 deletions(-)

diff --git a/t/t3402-rebase-merge.sh b/t/t3402-rebase-merge.sh
new file mode 100755
index 0000000..8c7a519
--- /dev/null
+++ b/t/t3402-rebase-merge.sh
@@ -0,0 +1,96 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 Junio C Hamano
+#
+
+test_description='git rebase --merge test'
+
+. ./test-lib.sh
+
+T="A quick brown fox
+jumps over the lazy dog."
+for i in 1 2 3 4 5 6 7 8 9 10
+do
+	echo "$i $T"
+done >original
+
+test_expect_success setup '
+	git add original &&
+	git commit -m"initial" &&
+	git branch side &&
+	echo "11 $T" >>original &&
+	git commit -a -m"master updates a bit." &&
+
+	echo "12 $T" >>original &&
+	git commit -a -m"master updates a bit more." &&
+
+	git checkout side &&
+	(echo "0 $T" ; cat original) >renamed &&
+	git add renamed &&
+	git update-index --force-remove original &&
+	git commit -a -m"side renames and edits." &&
+
+	tr "[a-z]" "[A-Z]" <original >newfile &&
+	git add newfile &&
+	git commit -a -m"side edits further." &&
+
+	tr "[a-m]" "[A-M]" <original >newfile &&
+	rm -f original &&
+	git commit -a -m"side edits once again." &&
+
+	git branch test-rebase side &&
+	git branch test-rebase-pick side &&
+	git branch test-reference-pick side &&
+	git checkout -b test-merge side
+'
+
+test_expect_success 'reference merge' '
+	git merge -s recursive "reference merge" HEAD master
+'
+
+test_expect_success rebase '
+	git checkout test-rebase &&
+	git rebase --merge master
+'
+
+test_expect_success 'merge and rebase should match' '
+	git diff-tree -r test-rebase test-merge >difference &&
+	if test -s difference
+	then
+		cat difference
+		(exit 1)
+	else
+		echo happy
+	fi
+'
+
+test_expect_success 'rebase the other way' '
+	git reset --hard master &&
+	git rebase --merge side
+'
+
+test_expect_success 'merge and rebase should match' '
+	git diff-tree -r test-rebase test-merge >difference &&
+	if test -s difference
+	then
+		cat difference
+		(exit 1)
+	else
+		echo happy
+	fi
+'
+
+test_expect_success 'picking rebase' '
+	git reset --hard side &&
+	git rebase --merge --onto master side^^ &&
+	mb=$(git merge-base master HEAD) &&
+	if test "$mb" = "$(git rev-parse master)"
+	then
+		echo happy
+	else
+		git show-branch
+		(exit 1)
+	fi
+'
+
+test_done
-- 
1.4.0.g1910f

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox