Git development
 help / color / mirror / Atom feed
* Re: Change in git-svn dcommit semantics?
From: Johannes Schindelin @ 2006-12-19 23:57 UTC (permalink / raw)
  To: Brian Gernhardt; +Cc: Seth Falcon, git
In-Reply-To: <94FF72E0-F8BD-4773-803E-F179754BF0ED@silverinsanity.com>

Hi,

On Tue, 19 Dec 2006, Brian Gernhardt wrote:

> Mine also has a few variables like "COLLISION_CHECK=paranoid" and my own 
> prefix.

Just to wake sleeping tigers: have you done a "grep COLLISION_CHECK *" 
recently (where recently means any date after May 3rd, 2005)?

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH] git-cvsserver: fix breakage when calling git merge-file
From: Johannes Schindelin @ 2006-12-19 23:59 UTC (permalink / raw)
  To: Eric Wong; +Cc: git
In-Reply-To: <20061219225820.GA6418@soma>

Hi,

On Tue, 19 Dec 2006, Eric Wong wrote:

> In the same vein as 8336afa563fbeff35e531396273065161181f04c, this fixes 
> the the RCS merge to git-merge-file conversion in commit e2b70087.

Ooops. I should have checked after reading 8336afa if there are more 
offenders. Alas, I checked now, and there seem none to be left. But 
everybody can see now why I try to get an all-C Git: I suck at perl.

Ciao,
Dscho

^ permalink raw reply

* Bug: git-svn fails on Mediawiki SVN repo r2992
From: Thomas Bleher @ 2006-12-19 23:53 UTC (permalink / raw)
  To: git

There is some problem between git-svn (v1.4.4.1.gad0c3) and MediaWiki
SVN when cloning their repo.

I just did
$ git-svn init http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3
$ git-svn fetch -r 2991:3122
and git-svn went into an endless loop, repeatedly downloading and adding
the same files from r2992 over and over again.

The bad revision can be viewed here:
http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=2992
It adds ~1000 files (mostly small images).
I can check out this revision just fine using the svn command line
client.

I found this problem while cloning this repo a while ago, using a
slightly older version of git (probably 1.4.3, don't remember exactly).
In this repo, some directories appeared in the latest revisions which
were deleted a long time ago.

You can temporarily browse this repo here:
http://misc.j-crew.de/cgi-bin/gitweb.cgi?p=mediawiki.git
HEAD contains the dir Smarty-2.6.2, which was removed in SVN r3122.
Strangely, my repo misses all commits between r2991 and r3822.
You can see the gap at
http://misc.j-crew.de/cgi-bin/gitweb.cgi?p=mediawiki.git;a=shortlog;h=49e761ba51ee0d0a698999451134acbf2e078c03

I didn't notice any strange errors while cloning, but I had to abort and
restart git-svn a few times, so maybe there was some error there?

Anyway, I figured I didn't need the _whole_ history, so this is nothing
urgent, but I thought I should report it.


^ permalink raw reply

* [PATCH] rev-list: Add a new option --skip.
From: Robert Fitzsimons @ 2006-12-20  0:29 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <em9oi5$72t$1@sea.gmane.org>

Added a new option --skip=<N> which is used to allow the caller to
specify how many commit items to skip before displaying the commit
output.  This option is most useful for programs which want to display
fixed length pages of commit items, i.e. gitweb.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
---

> I'm also for --skip (not --start-count), although... --start-count with
> --max-count seems more natural; one place it can be confusing is that we
> count skipped commits or not? I.e. we use --start-count=10 --max-count=20
> to get second 10 of commits, or --skip=10 --max-count=10 to get second 10
> of commits?

Here's the patch with the renamed option.  It also does not count
skipped commits, so --skip=10 --max-count=10 will display 10 items.

Robert


 Documentation/git-rev-list.txt |    5 +++++
 builtin-rev-list.c             |   17 +++++++++++++++++
 list-objects.c                 |    8 ++++++--
 revision.c                     |    1 +
 revision.h                     |    1 +
 5 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
index ec43c0b..7c86abc 100644
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -12,6 +12,7 @@ SYNOPSIS
 'git-rev-list' [ \--max-count=number ]
 	     [ \--max-age=timestamp ]
 	     [ \--min-age=timestamp ]
+	     [ \--skip=number ]
 	     [ \--sparse ]
 	     [ \--no-merges ]
 	     [ \--remove-empty ]
@@ -151,6 +152,10 @@ limiting may be applied.
 
 	Limit the commits output to specified time range.
 
+--skip='number'::
+
+	Skip 'number' commits before starting to display commit output.
+
 --author='pattern', --committer='pattern'::
 
 	Limit the commits output to ones with author/committer
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index fb7fc92..432f901 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -20,6 +20,7 @@ static const char rev_list_usage[] =
 "    --max-count=nr\n"
 "    --max-age=epoch\n"
 "    --min-age=epoch\n"
+"    --skip=nr\n"
 "    --sparse\n"
 "    --no-merges\n"
 "    --remove-empty\n"
@@ -219,6 +220,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
 	struct commit_list *list;
 	int i;
 	int read_from_stdin = 0;
+	int skip = -1;
 
 	init_revisions(&revs, prefix);
 	revs.abbrev = 0;
@@ -246,6 +248,10 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
 			read_revisions_from_stdin(&revs);
 			continue;
 		}
+		if (!strncmp(arg, "--skip=", 7)) {
+			skip = atoi(arg + 7);
+			continue;
+		}
 		usage(rev_list_usage);
 
 	}
@@ -261,6 +267,17 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
 		/* Only --header was specified */
 		revs.commit_format = CMIT_FMT_RAW;
 
+	/*
+	 * If a skip value is specified set start_count appropriately,
+	 * and if max_count is set it should be adjusted to account
+	 * for the skip value.
+	 */
+	if (skip > 0) {
+		revs.start_count = skip;
+		if (revs.max_count > 0)
+			revs.max_count += skip;
+	}
+
 	list = revs.commits;
 
 	if ((!list &&
diff --git a/list-objects.c b/list-objects.c
index f1fa21c..d96c8bf 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -108,8 +108,12 @@ void traverse_commit_list(struct rev_info *revs,
 	struct object_array objects = { 0, 0, NULL };
 
 	while ((commit = get_revision(revs)) != NULL) {
-		process_tree(revs, commit->tree, &objects, NULL, "");
-		show_commit(commit);
+		if (revs->start_count <= 0) {
+			process_tree(revs, commit->tree, &objects, NULL, "");
+			show_commit(commit);
+		} else {
+			revs->start_count--;
+		}
 	}
 	for (i = 0; i < revs->pending.nr; i++) {
 		struct object_array_entry *pending = revs->pending.objects + i;
diff --git a/revision.c b/revision.c
index 993bb66..70f4861 100644
--- a/revision.c
+++ b/revision.c
@@ -524,6 +524,7 @@ void init_revisions(struct rev_info *revs, const char *prefix)
 	revs->prefix = prefix;
 	revs->max_age = -1;
 	revs->min_age = -1;
+	revs->start_count = -1;
 	revs->max_count = -1;
 
 	revs->prune_fn = NULL;
diff --git a/revision.h b/revision.h
index 3adab95..c2dce8c 100644
--- a/revision.h
+++ b/revision.h
@@ -75,6 +75,7 @@ struct rev_info {
 	struct grep_opt	*grep_filter;
 
 	/* special limits */
+	int start_count;
 	int max_count;
 	unsigned long max_age;
 	unsigned long min_age;
-- 
1.4.4.2.g80fef-dirty

^ permalink raw reply related

* Re: [PATCH] index-pack usage of mmap() is unacceptably slower on many OSes other than Linux
From: Junio C Hamano @ 2006-12-20  0:30 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Nicolas Pitre, Linus Torvalds, Randal L. Schwartz, git
In-Reply-To: <4588453A.3060904@garzik.org>

Jeff Garzik <jeff@garzik.org> writes:

> If you are going to do this, you have to audit -every- file, to make
> sure git-compat-util.h is -always- the first header.

Will do.

^ permalink raw reply

* Re: [PATCH 2/2] git reflog expire
From: Junio C Hamano @ 2006-12-20  0:34 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Shawn Pearce, git
In-Reply-To: <Pine.LNX.4.64.0612191524180.6766@woody.osdl.org>

Linus Torvalds <torvalds@osdl.org> writes:

> (Things that are really fast on Linux: VM manipulation, and filename path 
> lookup. Those are both ops that Linux _really_ shines on. It may not sound 
> like much, but when you do millions of them, it's the difference between 
> seconds and hours).
>
> 		Linus

... and both have been _heavily_ used in/assumed to be fast by
git implementation.

Linus, your userland programming skills are _spoiled_ by Linux
;-).

^ permalink raw reply

* Re: [PATCH] git-cvsserver: fix breakage when calling git merge-file
From: Junio C Hamano @ 2006-12-20  0:38 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, Eric Wong
In-Reply-To: <Pine.LNX.4.63.0612200058280.19693@wbgn013.biozentrum.uni-wuerzburg.de>

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> On Tue, 19 Dec 2006, Eric Wong wrote:
>
>> In the same vein as 8336afa563fbeff35e531396273065161181f04c, this fixes 
>> the the RCS merge to git-merge-file conversion in commit e2b70087.
>
> Ooops. I should have checked after reading 8336afa if there are more 
> offenders. Alas, I checked now, and there seem none to be left. But 
> everybody can see now why I try to get an all-C Git: I suck at perl.

Well, I should have been more careful to begin with.  My
apologies.

And thanks both.

^ permalink raw reply

* Re: Change in git-svn dcommit semantics?
From: Brian Gernhardt @ 2006-12-20  0:38 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Seth Falcon, git
In-Reply-To: <Pine.LNX.4.63.0612200053550.19693@wbgn013.biozentrum.uni-wuerzburg.de>


On Dec 19, 2006, at 6:57 PM, Johannes Schindelin wrote:

>> Mine also has a few variables like "COLLISION_CHECK=paranoid" and  
>> my own
>> prefix.
>
> Just to wake sleeping tigers: have you done a "grep COLLISION_CHECK *"
> recently (where recently means any date after May 3rd, 2005)?

Oh, well, that's cute.  It's a configuration option that doesn't  
touch any code at all...  Not that I really cared about the check, I  
just thought it was a nice paranoid thing to activate and I like a  
certain amount of paranoia in my SCMs.  But maybe the description  
should be removed from the Makefile then?  Or better yet, collision  
checking could be put back in?

And is there an easier way to find these things than "git rev-list  
HEAD | git diff-tree -r -s --stdin -SCOLLISION | xargs git show"?  I  
cobbled that together from poking around inside gitk (which mostly  
works in OS X, but has some issues that make me prefer the command  
line).


^ permalink raw reply

* Re: [PATCH] index-pack usage of mmap() is unacceptably slower on many OSes other than Linux
From: Linus Torvalds @ 2006-12-20  0:40 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff Garzik, Nicolas Pitre, Randal L. Schwartz, git
In-Reply-To: <7vzm9jo1df.fsf@assigned-by-dhcp.cox.net>



On Tue, 19 Dec 2006, Junio C Hamano wrote:

> Jeff Garzik <jeff@garzik.org> writes:
> 
> > If you are going to do this, you have to audit -every- file, to make
> > sure git-compat-util.h is -always- the first header.
> 
> Will do.

Well, since any cases where it isn't (and where we'd care) will  show up 
as just a compiler warning, I doubt we really even need to. We can fix 
things up as they get reported too..


^ permalink raw reply

* Re: Question on rerere
From: Junio C Hamano @ 2006-12-20  0:41 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.63.0612200045490.19693@wbgn013.biozentrum.uni-wuerzburg.de>

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> IIUC then each conflict hunk is handled _separately_ like this: the 
> lexicographically smaller between the two file sections is displayed 
> first, regardless if a previous hunk had a different order. Not that it 
> matters most of the time, but isn't this dangerous?

You are probably right.  Probably the right thing would be to
use the first hunk to determine the flipping order and stick to
that for the rest.

Not that I've seen problems with the current behaviour, though.

^ permalink raw reply

* Re: Change in git-svn dcommit semantics?
From: Jakub Narebski @ 2006-12-20  0:52 UTC (permalink / raw)
  To: git
In-Reply-To: <C2881A17-27F7-467C-B353-189BB7DBFD1E@silverinsanity.com>

Brian Gernhardt wrote:

> And is there an easier way to find these things than "git rev-list  
> HEAD | git diff-tree -r -s --stdin -SCOLLISION | xargs git show"?  I  
> cobbled that together from poking around inside gitk (which mostly  
> works in OS X, but has some issues that make me prefer the command  
> line).

git log -p -SCOLLISIONS ? 

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git


^ permalink raw reply

* Re: [PATCH] index-pack usage of mmap() is unacceptably slower on many OSes other than Linux
From: Jeff Garzik @ 2006-12-20  0:50 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Junio C Hamano, Nicolas Pitre, Randal L. Schwartz, git
In-Reply-To: <Pine.LNX.4.64.0612191640010.6766@woody.osdl.org>

Linus Torvalds wrote:
> 
> On Tue, 19 Dec 2006, Junio C Hamano wrote:
> 
>> Jeff Garzik <jeff@garzik.org> writes:
>>
>>> If you are going to do this, you have to audit -every- file, to make
>>> sure git-compat-util.h is -always- the first header.
>> Will do.
> 
> Well, since any cases where it isn't (and where we'd care) will  show up 
> as just a compiler warning, I doubt we really even need to. We can fix 
> things up as they get reported too..

I wouldn't assume that is always the case.  Mostly true, I would 
suppose.  But some of those defines turn on and off 64-bit file 
size/offset gadgets for example.

	Jeff


^ permalink raw reply

* Re: [RFC] Possible optimization for gitweb
From: Robert Fitzsimons @ 2006-12-20  0:52 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <em9mcs$moo$1@sea.gmane.org>

> P.P.S. Do you have any comments to latest "[RFC] gitweb wishlist and TODO
> list" series?

I'll have another read through them tomorrow and see what I come up
with.  I've already done a bit of reading up on mod_perl.

Robert

^ permalink raw reply

* Re: [PATCH 2/2] git reflog expire
From: Linus Torvalds @ 2006-12-20  0:58 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Shawn Pearce, git
In-Reply-To: <7vvek7o15v.fsf@assigned-by-dhcp.cox.net>



On Tue, 19 Dec 2006, Junio C Hamano wrote:
>
> Linus, your userland programming skills are _spoiled_ by Linux
> ;-).

Maybe. On the other hand, there's definitely a bit of just my programming 
style involved: the things I care most about are the kinds of things I'd 
personally use in programming. So I claim that one of the reasons Linux 
does pathname lookup well is simply that every single program I've ever 
done that cared about performance of either open() or stat() or both. And 
yes, I tend to have a tendency to mmap() rather than read. So I optimize 
stuff I do.

That said, Linux does a lot of _other_ things well too, so it's not like 
it's just the things I do.


^ permalink raw reply

* git-merge-recursive segmentation error
From: Luben Tuikov @ 2006-12-20  1:00 UTC (permalink / raw)
  To: git

So, I'm merging Linux master into my own dev tree and
here is what I get in syslog:

Dec 19 16:56:38 lion kernel: [ 1704.395478] git-merge-recur[12030] general protection rip:4285ef
rsp:7ffff727bf40 error:0

and on the command line:
...
Auto-merging init/Kconfig
Auto-merging init/version.c
/home/luben/bin/git-merge: line 394: 12030 Segmentation fault      git-merge-$strategy $common --
"$head_arg" "$@"
Merge with strategy recursive failed.

I'm running "next".

Are the people aware of this issue?

It is 100% reproducible on my trees.

Anyone has a patch?

     Luben



^ permalink raw reply

* Re: [PATCH] rev-list: Add a new option --skip.
From: Junio C Hamano @ 2006-12-20  1:09 UTC (permalink / raw)
  To: Robert Fitzsimons; +Cc: git
In-Reply-To: <20061220002906.GB17864@localhost>

Robert Fitzsimons <robfitz@273k.net> writes:

> diff --git a/builtin-rev-list.c b/builtin-rev-list.c
> index fb7fc92..432f901 100644
> --- a/builtin-rev-list.c
> +++ b/builtin-rev-list.c
> @@ -246,6 +248,10 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
>  			read_revisions_from_stdin(&revs);
>  			continue;
>  		}
> +		if (!strncmp(arg, "--skip=", 7)) {
> +			skip = atoi(arg + 7);
> +			continue;
> +		}
>  		usage(rev_list_usage);
>  
>  	}

Hmph....

I am having a hard time convincing myself that this is a feature
that is a narrow special case for rev-list and does not belong
to the generic revision traversal machinery.

That is, would people expect that 'log' family allow the to say:

	$ git log --skip=10 -4 master

Declaring this as a special case for rev-list is certainly safer
(no risk to harm the revision machinery which is quite central
part of git), but if you define and initialize the new field
next to max_count, it makes me feel that it should somehow be
handled at the same layer.

In other words,...

---

 revision.c |   46 ++++++++++++++++++++++++++++++++--------------
 revision.h |    1 +
 2 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/revision.c b/revision.c
index 993bb66..aa63d10 100644
--- a/revision.c
+++ b/revision.c
@@ -524,6 +524,7 @@ void init_revisions(struct rev_info *revs, const char *prefix)
 	revs->prefix = prefix;
 	revs->max_age = -1;
 	revs->min_age = -1;
+	revs->skip_count = -1;
 	revs->max_count = -1;
 
 	revs->prune_fn = NULL;
@@ -760,6 +761,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
 				revs->max_count = atoi(arg + 12);
 				continue;
 			}
+			if (!strncmp(arg, "--skip=", 7)) {
+				revs->skip_count = atoi(arg + 7);
+				continue;
+			}
 			/* accept -<digit>, like traditional "head" */
 			if ((*arg == '-') && isdigit(arg[1])) {
 				revs->max_count = atoi(arg + 1);
@@ -1123,23 +1128,11 @@ static int commit_match(struct commit *commit, struct rev_info *opt)
 			   commit->buffer, strlen(commit->buffer));
 }
 
-struct commit *get_revision(struct rev_info *revs)
+static struct commit *get_revision_1(struct rev_info *revs)
 {
-	struct commit_list *list = revs->commits;
-
-	if (!list)
+	if (!revs->commits)
 		return NULL;
 
-	/* Check the max_count ... */
-	switch (revs->max_count) {
-	case -1:
-		break;
-	case 0:
-		return NULL;
-	default:
-		revs->max_count--;
-	}
-
 	do {
 		struct commit_list *entry = revs->commits;
 		struct commit *commit = entry->item;
@@ -1206,3 +1199,28 @@ struct commit *get_revision(struct rev_info *revs)
 	} while (revs->commits);
 	return NULL;
 }
+
+struct commit *get_revision(struct rev_info *revs)
+{
+	struct commit *c = NULL;
+
+	if (0 < revs->skip_count) {
+		while ((c = get_revision_1(revs)) != NULL) {
+			if (revs->skip_count-- <= 0)
+				break;
+		}
+	}
+
+	/* Check the max_count ... */
+	switch (revs->max_count) {
+	case -1:
+		break;
+	case 0:
+		return NULL;
+	default:
+		revs->max_count--;
+	}
+	if (c)
+		return c;
+	return get_revision_1(revs);
+}
diff --git a/revision.h b/revision.h
index 3adab95..81f522c 100644
--- a/revision.h
+++ b/revision.h
@@ -75,6 +75,7 @@ struct rev_info {
 	struct grep_opt	*grep_filter;
 
 	/* special limits */
+	int skip_count;
 	int max_count;
 	unsigned long max_age;
 	unsigned long min_age;

^ permalink raw reply related

* Re: git-merge-recursive segmentation error
From: Linus Torvalds @ 2006-12-20  1:10 UTC (permalink / raw)
  To: Luben Tuikov; +Cc: git
In-Reply-To: <693577.67723.qm@web31813.mail.mud.yahoo.com>



On Tue, 19 Dec 2006, Luben Tuikov wrote:
>
> /home/luben/bin/git-merge: line 394: 12030 Segmentation fault      git-merge-$strategy $common -- "$head_arg" "$@"
> Merge with strategy recursive failed.

Can you run that by hand under gdb and get a backtrace?


^ permalink raw reply

* Re: [PATCH] index-pack usage of mmap() is unacceptably slower on many OSes other than Linux
From: Junio C Hamano @ 2006-12-20  1:12 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Linus Torvalds, Nicolas Pitre, Randal L. Schwartz, git
In-Reply-To: <Pine.LNX.4.64.0612191640010.6766@woody.osdl.org>

Linus Torvalds <torvalds@osdl.org> writes:

> On Tue, 19 Dec 2006, Junio C Hamano wrote:
>
>> Jeff Garzik <jeff@garzik.org> writes:
>> 
>> > If you are going to do this, you have to audit -every- file, to make
>> > sure git-compat-util.h is -always- the first header.
>> 
>> Will do.
>
> Well, since any cases where it isn't (and where we'd care) will  show up 
> as just a compiler warning, I doubt we really even need to. We can fix 
> things up as they get reported too..

True, but I've done it already, so... 

Test compile especially on non Linux boxes are appreciated (I'll
do one on an OpenBSD bochs tomorrow myself anyway, though).

-- >8 --
[PATCH] simplify inclusion of system header files.

This is a mechanical clean-up of the way *.c files include
system header files.

 (1) sources under compat/, platform sha-1 implementations, and
     xdelta code are exempt from the following rules;

 (2) the first #include must be "git-compat-util.h" or one of
     our own header file that includes it first (e.g. config.h,
     builtin.h, pkt-line.h);

 (3) system headers that are included in "git-compat-util.h"
     need not be included in individual C source files.

 (4) "git-compat-util.h" does not have to include subsystem
     specific header files (e.g. expat.h).

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 archive-tar.c            |    1 -
 archive-zip.c            |    1 -
 blob.c                   |    1 -
 builtin-add.c            |    2 --
 builtin-apply.c          |    1 -
 builtin-archive.c        |    1 -
 builtin-blame.c          |    4 ----
 builtin-branch.c         |    2 +-
 builtin-for-each-ref.c   |    1 -
 builtin-grep.c           |    3 ---
 builtin-log.c            |    2 --
 builtin-ls-files.c       |    2 --
 builtin-mailinfo.c       |    9 ---------
 builtin-mailsplit.c      |    7 -------
 builtin-mv.c             |    2 --
 builtin-name-rev.c       |    1 -
 builtin-pack-objects.c   |    2 --
 builtin-repo-config.c    |    1 -
 builtin-runstatus.c      |    2 +-
 builtin-shortlog.c       |    1 -
 builtin-show-branch.c    |    2 --
 builtin-stripspace.c     |    3 ---
 builtin-tar-tree.c       |    1 -
 builtin-unpack-objects.c |    2 --
 builtin-upload-archive.c |    3 ---
 color.c                  |    5 +----
 compat/mmap.c            |    4 ----
 compat/setenv.c          |    3 +--
 compat/strlcpy.c         |    2 +-
 compat/unsetenv.c        |    3 +--
 config.c                 |    1 -
 connect.c                |    6 ------
 convert-objects.c        |    4 ----
 daemon.c                 |   16 +++-------------
 date.c                   |    3 ---
 diff-delta.c             |    5 +----
 diff.c                   |    3 ---
 diffcore-order.c         |    1 -
 diffcore-pickaxe.c       |    2 --
 dir.c                    |    3 ---
 entry.c                  |    2 --
 fetch-pack.c             |    1 -
 fetch.c                  |    3 +--
 fsck-objects.c           |    3 ---
 git-compat-util.h        |   23 +++++++++++++++++++++++
 git.c                    |   14 +-------------
 grep.c                   |    1 -
 help.c                   |    3 +--
 ident.c                  |    3 ---
 imap-send.c              |    7 -------
 interpolate.c            |    2 --
 lockfile.c               |    1 -
 merge-base.c             |    1 -
 merge-index.c            |    4 ----
 merge-recursive.c        |    7 -------
 path-list.c              |    1 -
 path.c                   |    1 -
 receive-pack.c           |    1 -
 refs.c                   |    4 +---
 revision.c               |    1 -
 rsh.c                    |    6 +-----
 run-command.c            |    1 -
 ssh-upload.c             |    2 --
 strbuf.c                 |    4 +---
 test-date.c              |    3 ---
 test-delta.c             |    8 +-------
 tree.c                   |    1 -
 unpack-trees.c           |    2 --
 upload-pack.c            |    3 ---
 var.c                    |    3 ---
 wt-status.c              |    2 +-
 71 files changed, 41 insertions(+), 195 deletions(-)

diff --git a/archive-tar.c b/archive-tar.c
index ff0f6e2..af47fdc 100644
--- a/archive-tar.c
+++ b/archive-tar.c
@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2005, 2006 Rene Scharfe
  */
-#include <time.h>
 #include "cache.h"
 #include "commit.h"
 #include "strbuf.h"
diff --git a/archive-zip.c b/archive-zip.c
index 36e922a..f31b8ed 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2006 Rene Scharfe
  */
-#include <time.h>
 #include "cache.h"
 #include "commit.h"
 #include "blob.h"
diff --git a/blob.c b/blob.c
index d1af2e6..9776bea 100644
--- a/blob.c
+++ b/blob.c
@@ -1,6 +1,5 @@
 #include "cache.h"
 #include "blob.h"
-#include <stdlib.h>
 
 const char *blob_type = "blob";
 
diff --git a/builtin-add.c b/builtin-add.c
index b3f9206..c8a114f 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -3,8 +3,6 @@
  *
  * Copyright (C) 2006 Linus Torvalds
  */
-#include <fnmatch.h>
-
 #include "cache.h"
 #include "builtin.h"
 #include "dir.h"
diff --git a/builtin-apply.c b/builtin-apply.c
index 436d9e1..1c35837 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -6,7 +6,6 @@
  * This applies patches on top of some (arbitrary) version of the SCM.
  *
  */
-#include <fnmatch.h>
 #include "cache.h"
 #include "cache-tree.h"
 #include "quote.h"
diff --git a/builtin-archive.c b/builtin-archive.c
index a8a1f07..391cf43 100644
--- a/builtin-archive.c
+++ b/builtin-archive.c
@@ -2,7 +2,6 @@
  * Copyright (c) 2006 Franck Bui-Huu
  * Copyright (c) 2006 Rene Scharfe
  */
-#include <time.h>
 #include "cache.h"
 #include "builtin.h"
 #include "archive.h"
diff --git a/builtin-blame.c b/builtin-blame.c
index a250724..9bf6ec9 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -15,10 +15,6 @@
 #include "revision.h"
 #include "xdiff-interface.h"
 
-#include <time.h>
-#include <sys/time.h>
-#include <regex.h>
-
 static char blame_usage[] =
 "git-blame [-c] [-l] [-t] [-f] [-n] [-p] [-L n,m] [-S <revs-file>] [-M] [-C] [-C] [commit] [--] file\n"
 "  -c, --compatibility Use the same output mode as git-annotate (Default: off)\n"
diff --git a/builtin-branch.c b/builtin-branch.c
index 560309c..515330c 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -5,8 +5,8 @@
  * Based on git-branch.sh by Junio C Hamano.
  */
 
-#include "color.h"
 #include "cache.h"
+#include "color.h"
 #include "refs.h"
 #include "commit.h"
 #include "builtin.h"
diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c
index 227aa3c..af72a12 100644
--- a/builtin-for-each-ref.c
+++ b/builtin-for-each-ref.c
@@ -6,7 +6,6 @@
 #include "tree.h"
 #include "blob.h"
 #include "quote.h"
-#include <fnmatch.h>
 
 /* Quoting styles */
 #define QUOTE_NONE 0
diff --git a/builtin-grep.c b/builtin-grep.c
index 9873e3d..3b1b1cb 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -10,10 +10,7 @@
 #include "tag.h"
 #include "tree-walk.h"
 #include "builtin.h"
-#include <regex.h>
 #include "grep.h"
-#include <fnmatch.h>
-#include <sys/wait.h>
 
 /*
  * git grep pathspecs are somewhat different from diff-tree pathspecs;
diff --git a/builtin-log.c b/builtin-log.c
index 17014f7..8df3c13 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -11,8 +11,6 @@
 #include "log-tree.h"
 #include "builtin.h"
 #include "tag.h"
-#include <time.h>
-#include <sys/time.h>
 
 static int default_show_root = 1;
 
diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index bc79ce4..21c2a6e 100644
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
@@ -5,8 +5,6 @@
  *
  * Copyright (C) Linus Torvalds, 2005
  */
-#include <fnmatch.h>
-
 #include "cache.h"
 #include "quote.h"
 #include "dir.h"
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index b8d7dbc..e647229 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -2,15 +2,6 @@
  * Another stupid program, this one parsing the headers of an
  * email to figure out authorship and subject
  */
-#define _GNU_SOURCE
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#ifndef NO_ICONV
-#include <iconv.h>
-#endif
-#include "git-compat-util.h"
 #include "cache.h"
 #include "builtin.h"
 
diff --git a/builtin-mailsplit.c b/builtin-mailsplit.c
index 91a699d..3bca855 100644
--- a/builtin-mailsplit.c
+++ b/builtin-mailsplit.c
@@ -4,13 +4,6 @@
  * It just splits a mbox into a list of files: "0001" "0002" ..
  * so you can process them further from there.
  */
-#include <unistd.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <stdio.h>
 #include "cache.h"
 #include "builtin.h"
 
diff --git a/builtin-mv.c b/builtin-mv.c
index d14a4a7..737af35 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -3,8 +3,6 @@
  *
  * Copyright (C) 2006 Johannes Schindelin
  */
-#include <fnmatch.h>
-
 #include "cache.h"
 #include "builtin.h"
 #include "dir.h"
diff --git a/builtin-name-rev.c b/builtin-name-rev.c
index 618aa31..b4f15cc 100644
--- a/builtin-name-rev.c
+++ b/builtin-name-rev.c
@@ -1,4 +1,3 @@
-#include <stdlib.h>
 #include "builtin.h"
 #include "cache.h"
 #include "commit.h"
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index a2dc7d1..807be8c 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -12,8 +12,6 @@
 #include "diff.h"
 #include "revision.h"
 #include "list-objects.h"
-#include <sys/time.h>
-#include <signal.h>
 
 static const char pack_usage[] = "\
 git-pack-objects [{ -q | --progress | --all-progress }] \n\
diff --git a/builtin-repo-config.c b/builtin-repo-config.c
index a38099a..a7ab4ce 100644
--- a/builtin-repo-config.c
+++ b/builtin-repo-config.c
@@ -1,6 +1,5 @@
 #include "builtin.h"
 #include "cache.h"
-#include <regex.h>
 
 static const char git_config_set_usage[] =
 "git-repo-config [ --global ] [ --bool | --int ] [--get | --get-all | --get-regexp | --replace-all | --add | --unset | --unset-all] name [value [value_regex]] | --rename-section old_name new_name | --list";
diff --git a/builtin-runstatus.c b/builtin-runstatus.c
index 0b63037..4b489b1 100644
--- a/builtin-runstatus.c
+++ b/builtin-runstatus.c
@@ -1,5 +1,5 @@
-#include "wt-status.h"
 #include "cache.h"
+#include "wt-status.h"
 
 extern int wt_status_use_color;
 
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index 3fc43dd..edb4042 100644
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
@@ -4,7 +4,6 @@
 #include "diff.h"
 #include "path-list.h"
 #include "revision.h"
-#include <string.h>
 
 static const char shortlog_usage[] =
 "git-shortlog [-n] [-s] [<commit-id>... ]";
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index a38ac34..b9d9781 100644
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
@@ -1,5 +1,3 @@
-#include <stdlib.h>
-#include <fnmatch.h>
 #include "cache.h"
 #include "commit.h"
 #include "refs.h"
diff --git a/builtin-stripspace.c b/builtin-stripspace.c
index 09cc910..f0d4d9e 100644
--- a/builtin-stripspace.c
+++ b/builtin-stripspace.c
@@ -1,6 +1,3 @@
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
 #include "builtin.h"
 
 /*
diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c
index 4d4cfec..11e62fc 100644
--- a/builtin-tar-tree.c
+++ b/builtin-tar-tree.c
@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2005, 2006 Rene Scharfe
  */
-#include <time.h>
 #include "cache.h"
 #include "commit.h"
 #include "tar.h"
diff --git a/builtin-unpack-objects.c b/builtin-unpack-objects.c
index e6d7574..d351e02 100644
--- a/builtin-unpack-objects.c
+++ b/builtin-unpack-objects.c
@@ -8,8 +8,6 @@
 #include "tag.h"
 #include "tree.h"
 
-#include <sys/time.h>
-
 static int dry_run, quiet, recover, has_errors;
 static const char unpack_usage[] = "git-unpack-objects [-n] [-q] [-r] < pack-file";
 
diff --git a/builtin-upload-archive.c b/builtin-upload-archive.c
index 45c92e1..e4156f8 100644
--- a/builtin-upload-archive.c
+++ b/builtin-upload-archive.c
@@ -1,9 +1,6 @@
 /*
  * Copyright (c) 2006 Franck Bui-Huu
  */
-#include <time.h>
-#include <sys/wait.h>
-#include <sys/poll.h>
 #include "cache.h"
 #include "builtin.h"
 #include "archive.h"
diff --git a/color.c b/color.c
index d8c8399..09d82ee 100644
--- a/color.c
+++ b/color.c
@@ -1,8 +1,5 @@
-#include "color.h"
 #include "cache.h"
-#include "git-compat-util.h"
-
-#include <stdarg.h>
+#include "color.h"
 
 #define COLOR_RESET "\033[m"
 
diff --git a/compat/mmap.c b/compat/mmap.c
index a4d2e50..0fd46e7 100644
--- a/compat/mmap.c
+++ b/compat/mmap.c
@@ -1,7 +1,3 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
 #include "../git-compat-util.h"
 
 void *gitfakemmap(void *start, size_t length, int prot , int flags, int fd, off_t offset)
diff --git a/compat/setenv.c b/compat/setenv.c
index b7d7678..3a22ea7 100644
--- a/compat/setenv.c
+++ b/compat/setenv.c
@@ -1,5 +1,4 @@
-#include <stdlib.h>
-#include <string.h>
+#include "../git-compat-util.h"
 
 int gitsetenv(const char *name, const char *value, int replace)
 {
diff --git a/compat/strlcpy.c b/compat/strlcpy.c
index b66856a..4024c36 100644
--- a/compat/strlcpy.c
+++ b/compat/strlcpy.c
@@ -1,4 +1,4 @@
-#include <string.h>
+#include "../git-compat-util.h"
 
 size_t gitstrlcpy(char *dest, const char *src, size_t size)
 {
diff --git a/compat/unsetenv.c b/compat/unsetenv.c
index 3a5e4ec..eb29f5e 100644
--- a/compat/unsetenv.c
+++ b/compat/unsetenv.c
@@ -1,5 +1,4 @@
-#include <stdlib.h>
-#include <string.h>
+#include "../git-compat-util.h"
 
 void gitunsetenv (const char *name)
 {
diff --git a/config.c b/config.c
index 663993f..913509f 100644
--- a/config.c
+++ b/config.c
@@ -6,7 +6,6 @@
  *
  */
 #include "cache.h"
-#include <regex.h>
 
 #define MAXNAME (256)
 
diff --git a/connect.c b/connect.c
index f7edba8..66daa11 100644
--- a/connect.c
+++ b/connect.c
@@ -3,12 +3,6 @@
 #include "pkt-line.h"
 #include "quote.h"
 #include "refs.h"
-#include <sys/wait.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <signal.h>
 
 static char *server_capabilities;
 
diff --git a/convert-objects.c b/convert-objects.c
index 8812583..a630132 100644
--- a/convert-objects.c
+++ b/convert-objects.c
@@ -1,7 +1,3 @@
-#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
-#define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
-#define _GNU_SOURCE
-#include <time.h>
 #include "cache.h"
 #include "blob.h"
 #include "commit.h"
diff --git a/daemon.c b/daemon.c
index e66bb80..b129b83 100644
--- a/daemon.c
+++ b/daemon.c
@@ -1,20 +1,10 @@
-#include <signal.h>
-#include <sys/wait.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/poll.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <syslog.h>
-#include <pwd.h>
-#include <grp.h>
-#include <limits.h>
-#include "pkt-line.h"
 #include "cache.h"
+#include "pkt-line.h"
 #include "exec_cmd.h"
 #include "interpolate.h"
 
+#include <syslog.h>
+
 #ifndef HOST_NAME_MAX
 #define HOST_NAME_MAX 256
 #endif
diff --git a/date.c b/date.c
index 1825922..7acb8cb 100644
--- a/date.c
+++ b/date.c
@@ -4,9 +4,6 @@
  * Copyright (C) Linus Torvalds, 2005
  */
 
-#include <time.h>
-#include <sys/time.h>
-
 #include "cache.h"
 
 static time_t my_mktime(struct tm *tm)
diff --git a/diff-delta.c b/diff-delta.c
index fa16d06..9f998d0 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -18,11 +18,8 @@
  *  licensing gets turned into GPLv2 within this project.
  */
 
-#include <stdlib.h>
-#include <string.h>
-#include "delta.h"
-
 #include "git-compat-util.h"
+#include "delta.h"
 
 /* maximum hash entry list for the same hash bucket */
 #define HASH_LIMIT 64
diff --git a/diff.c b/diff.c
index 9974435..61889d7 100644
--- a/diff.c
+++ b/diff.c
@@ -1,9 +1,6 @@
 /*
  * Copyright (C) 2005 Junio C Hamano
  */
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <signal.h>
 #include "cache.h"
 #include "quote.h"
 #include "diff.h"
diff --git a/diffcore-order.c b/diffcore-order.c
index aef6da6..7ad0946 100644
--- a/diffcore-order.c
+++ b/diffcore-order.c
@@ -4,7 +4,6 @@
 #include "cache.h"
 #include "diff.h"
 #include "diffcore.h"
-#include <fnmatch.h>
 
 static char **order;
 static int order_cnt;
diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
index cfcce31..de44ada 100644
--- a/diffcore-pickaxe.c
+++ b/diffcore-pickaxe.c
@@ -5,8 +5,6 @@
 #include "diff.h"
 #include "diffcore.h"
 
-#include <regex.h>
-
 static unsigned int contains(struct diff_filespec *one,
 			     const char *needle, unsigned long len,
 			     regex_t *regexp)
diff --git a/dir.c b/dir.c
index e6a61ee..16401d8 100644
--- a/dir.c
+++ b/dir.c
@@ -5,9 +5,6 @@
  * Copyright (C) Linus Torvalds, 2005-2006
  *		 Junio Hamano, 2005-2006
  */
-#include <dirent.h>
-#include <fnmatch.h>
-
 #include "cache.h"
 #include "dir.h"
 
diff --git a/entry.c b/entry.c
index b2ea0ef..88df713 100644
--- a/entry.c
+++ b/entry.c
@@ -1,5 +1,3 @@
-#include <sys/types.h>
-#include <dirent.h>
 #include "cache.h"
 #include "blob.h"
 
diff --git a/fetch-pack.c b/fetch-pack.c
index 743eab7..92322cf 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -5,7 +5,6 @@
 #include "tag.h"
 #include "exec_cmd.h"
 #include "sideband.h"
-#include <sys/wait.h>
 
 static int keep_pack;
 static int quiet;
diff --git a/fetch.c b/fetch.c
index 663b4b2..f69be82 100644
--- a/fetch.c
+++ b/fetch.c
@@ -1,6 +1,5 @@
-#include "fetch.h"
-
 #include "cache.h"
+#include "fetch.h"
 #include "commit.h"
 #include "tree.h"
 #include "tree-walk.h"
diff --git a/fsck-objects.c b/fsck-objects.c
index 46b628c..409aea0 100644
--- a/fsck-objects.c
+++ b/fsck-objects.c
@@ -1,6 +1,3 @@
-#include <sys/types.h>
-#include <dirent.h>
-
 #include "cache.h"
 #include "commit.h"
 #include "tree.h"
diff --git a/git-compat-util.h b/git-compat-util.h
index 0272d04..87fde99 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -11,6 +11,10 @@
 
 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
 
+#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
+#define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
+#define _GNU_SOURCE
+
 #include <unistd.h>
 #include <stdio.h>
 #include <sys/stat.h>
@@ -25,6 +29,25 @@
 #include <netinet/in.h>
 #include <sys/types.h>
 #include <dirent.h>
+#include <sys/time.h>
+#include <time.h>
+#include <signal.h>
+#include <sys/wait.h>
+#include <fnmatch.h>
+#include <sys/poll.h>
+#include <sys/socket.h>
+#include <assert.h>
+#include <regex.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <pwd.h>
+#include <grp.h>
+
+#ifndef NO_ICONV
+#include <iconv.h>
+#endif
 
 /* On most systems <limits.h> would have given us this, but
  * not on some systems (e.g. GNU/Hurd).
diff --git a/git.c b/git.c
index 016ee8a..73cf4d4 100644
--- a/git.c
+++ b/git.c
@@ -1,20 +1,8 @@
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdarg.h>
-#include "git-compat-util.h"
+#include "builtin.h"
 #include "exec_cmd.h"
 #include "cache.h"
 #include "quote.h"
 
-#include "builtin.h"
-
 const char git_usage_string[] =
 	"git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate] [--bare] [--git-dir=GIT_DIR] [--help] COMMAND [ARGS]";
 
diff --git a/grep.c b/grep.c
index 0fc078e..fcc6762 100644
--- a/grep.c
+++ b/grep.c
@@ -1,5 +1,4 @@
 #include "cache.h"
-#include <regex.h>
 #include "grep.h"
 
 void append_grep_pattern(struct grep_opt *opt, const char *pat,
diff --git a/help.c b/help.c
index 0824c25..341b9e3 100644
--- a/help.c
+++ b/help.c
@@ -3,12 +3,11 @@
  *
  * Builtin help-related commands (help, usage, version)
  */
-#include <sys/ioctl.h>
 #include "cache.h"
 #include "builtin.h"
 #include "exec_cmd.h"
 #include "common-cmds.h"
-
+#include <sys/ioctl.h>
 
 /* most GUI terminals set COLUMNS (although some don't export it) */
 static int term_columns(void)
diff --git a/ident.c b/ident.c
index d7faba6..6ad8fed 100644
--- a/ident.c
+++ b/ident.c
@@ -7,9 +7,6 @@
  */
 #include "cache.h"
 
-#include <pwd.h>
-#include <netdb.h>
-
 static char git_default_date[50];
 
 static void copy_gecos(struct passwd *w, char *name, int sz)
diff --git a/imap-send.c b/imap-send.c
index a6a6568..894cbbd 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -24,13 +24,6 @@
 
 #include "cache.h"
 
-#include <assert.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#include <netdb.h>
-
 typedef struct store_conf {
 	char *name;
 	const char *path; /* should this be here? its interpretation is driver-specific */
diff --git a/interpolate.c b/interpolate.c
index 5d9d188..f992ef7 100644
--- a/interpolate.c
+++ b/interpolate.c
@@ -2,8 +2,6 @@
  * Copyright 2006 Jon Loeliger
  */
 
-#include <string.h>
-
 #include "git-compat-util.h"
 #include "interpolate.h"
 
diff --git a/lockfile.c b/lockfile.c
index 2a2fea3..261baff 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2005, Junio C Hamano
  */
-#include <signal.h>
 #include "cache.h"
 
 static struct lock_file *lock_file_list;
diff --git a/merge-base.c b/merge-base.c
index 009caf8..385f4ba 100644
--- a/merge-base.c
+++ b/merge-base.c
@@ -1,4 +1,3 @@
-#include <stdlib.h>
 #include "cache.h"
 #include "commit.h"
 
diff --git a/merge-index.c b/merge-index.c
index 646d090..a9983dd 100644
--- a/merge-index.c
+++ b/merge-index.c
@@ -1,7 +1,3 @@
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <signal.h>
-
 #include "cache.h"
 
 static const char *pgm;
diff --git a/merge-recursive.c b/merge-recursive.c
index 6dd6e2e..1de273e 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -3,13 +3,6 @@
  * Fredrik Kuivinen.
  * The thieves were Alex Riesen and Johannes Schindelin, in June/July 2006
  */
-#include <stdarg.h>
-#include <string.h>
-#include <assert.h>
-#include <sys/wait.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <time.h>
 #include "cache.h"
 #include "cache-tree.h"
 #include "commit.h"
diff --git a/path-list.c b/path-list.c
index f8800f8..caaa5cc 100644
--- a/path-list.c
+++ b/path-list.c
@@ -1,4 +1,3 @@
-#include <stdio.h>
 #include "cache.h"
 #include "path-list.h"
 
diff --git a/path.c b/path.c
index d2c076d..066f621 100644
--- a/path.c
+++ b/path.c
@@ -11,7 +11,6 @@
  * which is what it's designed for.
  */
 #include "cache.h"
-#include <pwd.h>
 
 static char bad_path[] = "/bad-path/";
 
diff --git a/receive-pack.c b/receive-pack.c
index 5e5510b..59b682c 100644
--- a/receive-pack.c
+++ b/receive-pack.c
@@ -6,7 +6,6 @@
 #include "exec_cmd.h"
 #include "commit.h"
 #include "object.h"
-#include <sys/wait.h>
 
 static const char receive_pack_usage[] = "git-receive-pack <git-dir>";
 
diff --git a/refs.c b/refs.c
index d911b9e..a101ff3 100644
--- a/refs.c
+++ b/refs.c
@@ -1,10 +1,8 @@
-#include "refs.h"
 #include "cache.h"
+#include "refs.h"
 #include "object.h"
 #include "tag.h"
 
-#include <errno.h>
-
 /* ISSYMREF=01 and ISPACKED=02 are public interfaces */
 #define REF_KNOWS_PEELED 04
 
diff --git a/revision.c b/revision.c
index 993bb66..7b6f91f 100644
--- a/revision.c
+++ b/revision.c
@@ -6,7 +6,6 @@
 #include "diff.h"
 #include "refs.h"
 #include "revision.h"
-#include <regex.h>
 #include "grep.h"
 
 static char *path_name(struct name_path *path, const char *name)
diff --git a/rsh.c b/rsh.c
index f34409e..5754a23 100644
--- a/rsh.c
+++ b/rsh.c
@@ -1,10 +1,6 @@
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-
+#include "cache.h"
 #include "rsh.h"
 #include "quote.h"
-#include "cache.h"
 
 #define COMMAND_SIZE 4096
 
diff --git a/run-command.c b/run-command.c
index 6190868..492ad3e 100644
--- a/run-command.c
+++ b/run-command.c
@@ -1,6 +1,5 @@
 #include "cache.h"
 #include "run-command.h"
-#include <sys/wait.h>
 #include "exec_cmd.h"
 
 int run_command_v_opt(int argc, const char **argv, int flags)
diff --git a/ssh-upload.c b/ssh-upload.c
index 20b15ea..0b52ae1 100644
--- a/ssh-upload.c
+++ b/ssh-upload.c
@@ -12,8 +12,6 @@
 #include "rsh.h"
 #include "refs.h"
 
-#include <string.h>
-
 static unsigned char local_version = 1;
 static unsigned char remote_version;
 
diff --git a/strbuf.c b/strbuf.c
index 9d9d8be..7f14b0f 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -1,7 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include "strbuf.h"
 #include "cache.h"
+#include "strbuf.h"
 
 void strbuf_init(struct strbuf *sb) {
 	sb->buf = NULL;
diff --git a/test-date.c b/test-date.c
index 93e8027..62e8f23 100644
--- a/test-date.c
+++ b/test-date.c
@@ -1,6 +1,3 @@
-#include <stdio.h>
-#include <time.h>
-
 #include "cache.h"
 
 int main(int argc, char **argv)
diff --git a/test-delta.c b/test-delta.c
index 1be8ee0..795aa08 100644
--- a/test-delta.c
+++ b/test-delta.c
@@ -8,13 +8,7 @@
  * published by the Free Software Foundation.
  */
 
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
+#include "git-compat-util.h"
 #include "delta.h"
 
 static const char usage[] =
diff --git a/tree.c b/tree.c
index ea386e5..b6f02fe 100644
--- a/tree.c
+++ b/tree.c
@@ -4,7 +4,6 @@
 #include "commit.h"
 #include "tag.h"
 #include "tree-walk.h"
-#include <stdlib.h>
 
 const char *tree_type = "tree";
 
diff --git a/unpack-trees.c b/unpack-trees.c
index b8689eb..2e2232c 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1,5 +1,3 @@
-#include <signal.h>
-#include <sys/time.h>
 #include "cache.h"
 #include "dir.h"
 #include "tree.h"
diff --git a/upload-pack.c b/upload-pack.c
index 4572fff..32b06b2 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -1,6 +1,3 @@
-#include <signal.h>
-#include <sys/wait.h>
-#include <sys/poll.h>
 #include "cache.h"
 #include "refs.h"
 #include "pkt-line.h"
diff --git a/var.c b/var.c
index a57a33b..39977b9 100644
--- a/var.c
+++ b/var.c
@@ -4,9 +4,6 @@
  * Copyright (C) Eric Biederman, 2005
  */
 #include "cache.h"
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
 
 static const char var_usage[] = "git-var [-l | <variable>]";
 
diff --git a/wt-status.c b/wt-status.c
index cface6c..db42738 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1,6 +1,6 @@
+#include "cache.h"
 #include "wt-status.h"
 #include "color.h"
-#include "cache.h"
 #include "object.h"
 #include "dir.h"
 #include "commit.h"
-- 
1.4.4.2.g205bf


^ permalink raw reply related

* Re: Change in git-svn dcommit semantics?
From: Junio C Hamano @ 2006-12-20  1:17 UTC (permalink / raw)
  To: Brian Gernhardt; +Cc: Johannes Schindelin, Seth Falcon, git
In-Reply-To: <C2881A17-27F7-467C-B353-189BB7DBFD1E@silverinsanity.com>

Brian Gernhardt <benji@silverinsanity.com> writes:

> And is there an easier way to find these things than "git rev-list
> HEAD | git diff-tree -r -s --stdin -SCOLLISION | xargs git show"?  I
> cobbled that together from poking around inside gitk (which mostly
> works in OS X, but has some issues that make me prefer the command
> line).

I typically do:

	git log --full-diff -p -SCOLLISION

The --full-diff option helps because it shows the diff for other
files (that do not have different number of substring COLLISION
in the pre and postimage) in the same commit as well.


^ permalink raw reply

* Re: git-merge-recursive segmentation error
From: Johannes Schindelin @ 2006-12-20  1:18 UTC (permalink / raw)
  To: Luben Tuikov; +Cc: git
In-Reply-To: <693577.67723.qm@web31813.mail.mud.yahoo.com>

Hi,

On Tue, 19 Dec 2006, Luben Tuikov wrote:

> Auto-merging init/version.c
> /home/luben/bin/git-merge: line 394: 12030 
> Segmentation fault git-merge-$strategy $common -- "$head_arg" "$@"

Do you have any pointers how to get the two branches you try to merge? I'd 
be most grateful to have the sha1's of both heads, too...

Ciao,
Dscho

^ permalink raw reply

* Re: Question on rerere
From: Junio C Hamano @ 2006-12-20  1:29 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git
In-Reply-To: <7vk60no0ua.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano <junkio@cox.net> writes:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
>> IIUC then each conflict hunk is handled _separately_ like this: the 
>> lexicographically smaller between the two file sections is displayed 
>> first, regardless if a previous hunk had a different order. Not that it 
>> matters most of the time, but isn't this dangerous?
>
> You are probably right.  Probably the right thing would be to
> use the first hunk to determine the flipping order and stick to
> that for the rest.
>
> Not that I've seen problems with the current behaviour, though.

Well, come to think of it, I think the current behaviour makes
more sense.

Suppose you start from an original file "OO".  You have two
branches that change it to "AO" and "BO", and another pair of
branches that change it to "OC" and "OD".  Let's call these
branches A, B, C, and D.

By merging A and C, you will get "AC"; you can get "AD", "BC"
and "BD" the same way.

Now suppose you are on "AC" and merged "BD".  You would get
"<A=B><C=D>".

If you were on "BD" and merged "AC" you would get "<B=A><D=C>".
If you were on "AD" and merged "BC" you would get "<A=B><D=C>".

You got the idea?






^ permalink raw reply

* Re: Bug: git-svn fails on Mediawiki SVN repo r2992
From: Eric Wong @ 2006-12-20  1:36 UTC (permalink / raw)
  To: git, bleher
In-Reply-To: <20061219235312.GB12756@thorium2.jmh.mhn.de>

Thomas Bleher <bleher@informatik.uni-muenchen.de> wrote:
> There is some problem between git-svn (v1.4.4.1.gad0c3) and MediaWiki
> SVN when cloning their repo.
> 
> I just did
> $ git-svn init http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3
> $ git-svn fetch -r 2991:3122
> and git-svn went into an endless loop, repeatedly downloading and adding
> the same files from r2992 over and over again.

I'm not sure that it was 'endless', just unnecesarily repeating itself.
commit 6173c197c9a23fa8594f18fd2c856407d4af31c1 (included in 1.4.4.2)
should have fixed your problem...

> The bad revision can be viewed here:
> http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=2992
> It adds ~1000 files (mostly small images).
> I can check out this revision just fine using the svn command line
> client.

The latest git-svn in git.git now bundles all the changed files into a
delta on the server side; and is significantly faster over most network
connections as a result.

> I found this problem while cloning this repo a while ago, using a
> slightly older version of git (probably 1.4.3, don't remember exactly).
> In this repo, some directories appeared in the latest revisions which
> were deleted a long time ago.
> 
> You can temporarily browse this repo here:
> http://misc.j-crew.de/cgi-bin/gitweb.cgi?p=mediawiki.git
> HEAD contains the dir Smarty-2.6.2, which was removed in SVN r3122.
> Strangely, my repo misses all commits between r2991 and r3822.
> You can see the gap at
> http://misc.j-crew.de/cgi-bin/gitweb.cgi?p=mediawiki.git;a=shortlog;h=49e761ba51ee0d0a698999451134acbf2e078c03
> 
> I didn't notice any strange errors while cloning, but I had to abort and
> restart git-svn a few times, so maybe there was some error there?

Hmm, it looks like you ran something like:

	git-svn fetch -r0:2991

and then something along the lines of:

	git-svn fetch -r3822:HEAD

Is that what happened?

Looking at the pre-delta git-svn code, it seems that using -r with fetch
at any time other than the initial fetch will result in botched
history...

-- 

^ permalink raw reply

* Re: Average size of git bookkeeping data (related to Using git as a  general backup mechanism)
From: David Lang @ 2006-12-20  1:20 UTC (permalink / raw)
  To: David Tweed; +Cc: git
In-Reply-To: <20061213193149.43284.qmail@web86909.mail.ukl.yahoo.com>

On Wed, 13 Dec 2006, David Tweed wrote:

> How big is the "metadata" or "bookeeping data" in git related to a commit? (Eg, "around x bytes per changed file"
> or "around x bytes per file being tracked (whether changed in the commit or not)" )
>
> [I'm trying to get a feel for, if I switched to git, how much overhead would come from having a cron job automatically doing
> a snapshot every hour (if anything has changed), plus manual snapshots at points where I want to feel "safeguarded".
> I'm currently using my own simple, hacked together system for combined versioning/backups that does
> this. Using naive tools that don't account for wastes space due to disk block size effects the data being
> tracked is currently just under 9 months of acitvity on  2016 filenames with
> 17457599 bytes of data (ie, compressed version of their contents at various times) and 7838546 bytes
> is "metadata", ie, 30 percent of the stored data is metadata. This is in a format using 6 bytes to associate a single blob of
> contents to a filename (whether changed since last snapshot or not).]

if nothing has changed it will take the space of the commit tag, as the tree 
will remain the same (and you should be able to script detection of this case 
and make it zero overhead)

if something has changed you will have the new tree and the changed object

in a tree each object is ~28 bytes (IIRC from what Linus mentioned in the last 
week or two)

a loose object is compressed, and if you repack it will delta against prior 
versions for even more space savings

look at the size of the mozilla tree and the kernel tree and you will see that 
when packed git is about as efficiant as any other option you have (and more 
efficiant than most)


^ permalink raw reply

* Re: Question on rerere
From: Johannes Schindelin @ 2006-12-20  1:40 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vy7p3mk1i.fsf@assigned-by-dhcp.cox.net>

Hi,

On Tue, 19 Dec 2006, Junio C Hamano wrote:

> Junio C Hamano <junkio@cox.net> writes:
> 
> > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> >
> >> IIUC then each conflict hunk is handled _separately_ like this: the 
> >> lexicographically smaller between the two file sections is displayed 
> >> first, regardless if a previous hunk had a different order. Not that it 
> >> matters most of the time, but isn't this dangerous?
> >
> > You are probably right.  Probably the right thing would be to
> > use the first hunk to determine the flipping order and stick to
> > that for the rest.
> >
> > Not that I've seen problems with the current behaviour, though.
> 
> Well, come to think of it, I think the current behaviour makes
> more sense.
> 
> Suppose you start from an original file "OO".  You have two
> branches that change it to "AO" and "BO", and another pair of
> branches that change it to "OC" and "OD".  Let's call these
> branches A, B, C, and D.
> 
> By merging A and C, you will get "AC"; you can get "AD", "BC"
> and "BD" the same way.
> 
> Now suppose you are on "AC" and merged "BD".  You would get
> "<A=B><C=D>".
> 
> If you were on "BD" and merged "AC" you would get "<B=A><D=C>".
> If you were on "AD" and merged "BC" you would get "<A=B><D=C>".
> 
> You got the idea?

Yes. Thanks!

Ciao,
Dscho

^ permalink raw reply

* Re: cloning the kernel - why long time in "Resolving 313037 deltas"
From: Shawn Pearce @ 2006-12-20  1:54 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Theodore Tso, Nicolas Pitre, Randal L. Schwartz, git
In-Reply-To: <Pine.LNX.4.64.0612190855300.3479@woody.osdl.org>

Linus Torvalds <torvalds@osdl.org> wrote:
> On Tue, 19 Dec 2006, Theodore Tso wrote:
> > 
> > So the main reason to use mamp, as Linus puts it, is if the management
> > overhead of needing to read lots of small bits of the file makes the
> > use of malloc/read to be a pain in the *ss, then go for it.
> 
> An example of this in git is the regular pack-file accesses. We're MUCH 
> better off just mmap'ing the whole pack-file (or at least big chunks of 
> it) and not having to maintain difficult structures of "this is where I 
> read that part of the file into memory", or read _big_ chunks when 
> quite often we just use a few kB of it.
> 
> So mmap for pack-files does make sense, but probably only when you can 
> mmap big chunks, and are going to access much smaller (random) parts of 
> it.

Yes, exactly.

git-fast-import mmaps the pack file for this very reason.  It every
so often needs to go back and reread a tree object which has expired
from its own in-memory LRU cache.  This usually doesn't happen
very often, but when it does we don't know where we are going to
jump to get data from.  mmaping a huge segment of the pack file
(or the whole thing if its reasonably small) works for this case as
the OS buffer cache can just take care of it for us.  But as Linus
pointed out mmap and write() aren't safe on some systems.  Arrrgh.

However git-fast-import would probably work just as well (or maybe
slightly better) with pread().  I really should port that code
forward to current Git, use pread() instead, and submit the patch
to Junio.  But nobody really showed a lot of interest.


My sliding window pack-file access implementation (that I'm currently
rewriting on top of current Git) tries to work in very large chunks,
by default its 32 MiB per chunk, but its user/repository configurable
so kernel hackers may just set it to 256 MiB and continue to get
one large mmap for quite some time to come.  Of course I would
also like to get that to autoselect the window size rather than
just hardcode it.  :-)

The implementation would prefer a very small number (<8) of very
large chunks (>32 MiB), but is designed to more gracefully degrade
on huge packs on limited address space systems (e.g. Windows 32 bit)
then the current code does.

-- 

^ permalink raw reply


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