From 292839077488d7ccb46bc2cc25b515a1ebd25f8f Mon Sep 17 00:00:00 2001
From: "Luck, Tony" <tony.luck@intel.com>
Date: Tue, 21 Mar 2006 15:28:06 -0800
Subject: [PATCH 1/4] fix field width/precision warnings in blame.c

Using "size_t" values for printf field width/precision upsets gcc, it
wants to see an "int".

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 blame.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/blame.c b/blame.c
index 9c97aeca451..7e88833a37f 100644
--- a/blame.c
+++ b/blame.c
@@ -748,7 +748,7 @@ int main(int argc, const char **argv)
 	struct commit_info ci;
 	const char *buf;
 	int max_digits;
-	size_t longest_file, longest_author;
+	int longest_file, longest_author;
 	int found_rename;
 
 	const char* prefix = setup_git_directory();

From 8c9e7947c2a76fb21bda11816c544d50e271156d Mon Sep 17 00:00:00 2001
From: Junio C Hamano <junkio@cox.net>
Date: Tue, 21 Mar 2006 15:49:05 -0800
Subject: [PATCH 2/4] http-push.c: squelch C90 warnings.

If you write code after declarations in a block, gcc scolds you
with "warning: ISO C90 forbids mixed declarations and code".

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 http-push.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/http-push.c b/http-push.c
index b35d400ee1a..21c5289cde1 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1863,6 +1863,7 @@ static void one_remote_ref(char *refname)
 	struct ref *ref;
 	unsigned char remote_sha1[20];
 	struct object *obj;
+	int len = strlen(refname) + 1;
 
 	if (fetch_ref(refname, remote_sha1) != 0) {
 		fprintf(stderr,
@@ -1884,7 +1885,6 @@ static void one_remote_ref(char *refname)
 		}
 	}
 
-	int len = strlen(refname) + 1;
 	ref = xcalloc(1, sizeof(*ref) + len);
 	memcpy(ref->old_sha1, remote_sha1, 20);
 	memcpy(ref->name, refname, len);
@@ -2313,6 +2313,8 @@ int main(int argc, char **argv)
 	int objects_to_send;
 	int rc = 0;
 	int i;
+	int new_refs;
+	struct ref *ref;
 
 	setup_git_directory();
 	setup_ident();
@@ -2347,8 +2349,8 @@ int main(int argc, char **argv)
 			}
 		}
 		if (!remote->url) {
-			remote->url = arg;
 			char *path = strstr(arg, "//");
+			remote->url = arg;
 			if (path) {
 				path = index(path+2, '/');
 				if (path)
@@ -2421,10 +2423,13 @@ int main(int argc, char **argv)
 		return 0;
 	}
 
-	int new_refs = 0;
-	struct ref *ref;
+	new_refs = 0;
 	for (ref = remote_refs; ref; ref = ref->next) {
 		char old_hex[60], *new_hex;
+		const char *commit_argv[4];
+		int commit_argc;
+		char *new_sha1_hex, *old_sha1_hex;
+
 		if (!ref->peer_ref)
 			continue;
 		if (!memcmp(ref->old_sha1, ref->peer_ref->new_sha1, 20)) {
@@ -2482,10 +2487,9 @@ int main(int argc, char **argv)
 		}
 
 		/* Set up revision info for this refspec */
-		const char *commit_argv[4];
-		int commit_argc = 3;
-		char *new_sha1_hex = strdup(sha1_to_hex(ref->new_sha1));
-		char *old_sha1_hex = NULL;
+		commit_argc = 3;
+		new_sha1_hex = strdup(sha1_to_hex(ref->new_sha1));
+		old_sha1_hex = NULL;
 		commit_argv[1] = "--objects";
 		commit_argv[2] = new_sha1_hex;
 		if (!push_all && !is_zero_sha1(ref->old_sha1)) {

From 3103cf9e1e09b0045a60542f24a2a1e4ed7b1237 Mon Sep 17 00:00:00 2001
From: Junio C Hamano <junkio@cox.net>
Date: Wed, 22 Mar 2006 00:21:07 -0800
Subject: [PATCH 3/4] git-apply: do not barf when updating an originally empty
 file.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 apply.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/apply.c b/apply.c
index 179b3bbd00f..2da225a8eca 100644
--- a/apply.c
+++ b/apply.c
@@ -834,7 +834,7 @@ static int parse_fragment(char *line, unsigned long size, struct patch *patch, s
 			patch->new_name = NULL;
 	}
 
-	if (patch->is_new != !oldlines)
+	if (patch->is_new && oldlines)
 		return error("new file depends on old contents");
 	if (patch->is_delete != !newlines) {
 		if (newlines)

From dc68c4fff4cd007d840193ebb11ef1f31a779c75 Mon Sep 17 00:00:00 2001
From: Junio C Hamano <junkio@cox.net>
Date: Wed, 22 Mar 2006 00:22:00 -0800
Subject: [PATCH 4/4] rev-list --timestamp

This prefixes the raw commit timestamp to the output.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 rev-list.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/rev-list.c b/rev-list.c
index 812d237f472..441c4378554 100644
--- a/rev-list.c
+++ b/rev-list.c
@@ -40,13 +40,18 @@ static int bisect_list = 0;
 static int verbose_header = 0;
 static int abbrev = DEFAULT_ABBREV;
 static int show_parents = 0;
+static int show_timestamp = 0;
 static int hdr_termination = 0;
 static const char *commit_prefix = "";
 static enum cmit_fmt commit_format = CMIT_FMT_RAW;
 
 static void show_commit(struct commit *commit)
 {
-	printf("%s%s", commit_prefix, sha1_to_hex(commit->object.sha1));
+	if (show_timestamp)
+		printf("%lu ", commit->date);
+	if (commit_prefix[0])
+		fputs(commit_prefix, stdout);
+	fputs(sha1_to_hex(commit->object.sha1), stdout);
 	if (show_parents) {
 		struct commit_list *parents = commit->parents;
 		while (parents) {
@@ -335,6 +340,10 @@ int main(int argc, const char **argv)
 			show_parents = 1;
 			continue;
 		}
+		if (!strcmp(arg, "--timestamp")) {
+			show_timestamp = 1;
+			continue;
+		}
 		if (!strcmp(arg, "--bisect")) {
 			bisect_list = 1;
 			continue;