Git development
 help / color / mirror / Atom feed
* [PATCH] Rename usage and error message strings + rpull/rpush commands
From: Jonas Fonseca @ 2005-04-30  1:49 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git

[ Sorry for the resend. Forgot to sign off and CC the ML. ]

Don't know if renaming the program identification strings are desirable.
However, the remote command used by rpull/rpush should probably be
changed.

 cat-file.c         |   10 +++++-----
 commit-tree.c      |    2 +-
 convert-cache.c    |    2 +-
 diff-cache.c       |    2 +-
 diff-files.c       |    2 +-
 diff-tree-helper.c |    2 +-
 diff-tree.c        |    4 ++--
 fsck-cache.c       |    4 ++--
 http-pull.c        |    2 +-
 ls-tree.c          |    2 +-
 merge-base.c       |    2 +-
 merge-cache.c      |    8 ++++----
 read-tree.c        |    2 +-
 rev-list.c         |    2 +-
 rev-tree.c         |    4 ++--
 rpull.c            |    4 ++--
 rpush.c            |    4 ++--
 show-files.c       |    2 +-
 tar-tree.c         |   10 +++++-----
 unpack-file.c      |    2 +-
 20 files changed, 36 insertions(+), 36 deletions(-)

Index: cat-file.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/cat-file.c  (mode:100644 sha1:3c47d79a16305d326a65768fe9f37ee25928510b)
+++ uncommitted/cat-file.c  (mode:100644)
@@ -13,17 +13,17 @@
 	unsigned long size;
 
 	if (argc != 3 || get_sha1_hex(argv[2], sha1))
-		usage("cat-file [-t | tagname] <sha1>");
+		usage("git-cat-file [-t | tagname] <sha1>");
 	buf = read_sha1_file(sha1, type, &size);
 	if (!buf)
-		die("cat-file %s: bad file", argv[2]);
+		die("git-cat-file %s: bad file", argv[2]);
 	if (!strcmp("-t", argv[1])) {
 		buf = type;
 		size = strlen(type);
 		type[size] = '\n';
 		size++;
 	} else if (strcmp(type, argv[1])) {
-		die("cat-file %s: bad tag", argv[2]);
+		die("git-cat-file %s: bad tag", argv[2]);
 	}
 
 	while (size > 0) {
@@ -34,9 +34,9 @@
 			/* Ignore epipe */
 			if (errno == EPIPE)
 				break;
-			die("cat-file: %s", strerror(errno));
+			die("git-cat-file: %s", strerror(errno));
 		} else if (!ret) {
-			die("cat-file: disk full?");
+			die("git-cat-file: disk full?");
 		}
 		size -= ret;
 		buf += ret;
Index: commit-tree.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/commit-tree.c  (mode:100644 sha1:23de13361944ad7ba7c5320cf7cdd04e81842c60)
+++ uncommitted/commit-tree.c  (mode:100644)
@@ -240,7 +240,7 @@
  */
 #define MAXPARENT (16)
 
-static char *commit_tree_usage = "commit-tree <sha1> [-p <sha1>]* < changelog";
+static char *commit_tree_usage = "git-commit-tree <sha1> [-p <sha1>]* < changelog";
 
 int main(int argc, char **argv)
 {
Index: convert-cache.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/convert-cache.c  (mode:100644 sha1:631d1aa910e7328c99642495f93908c749074f91)
+++ uncommitted/convert-cache.c  (mode:100644)
@@ -304,7 +304,7 @@
 	struct entry *entry;
 
 	if (argc != 2 || get_sha1_hex(argv[1], sha1))
-		usage("convert-cache <sha1>");
+		usage("git-convert-cache <sha1>");
 
 	entry = convert_entry(sha1);
 	printf("new sha1: %s\n", sha1_to_hex(entry->new_sha1));
Index: diff-cache.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/diff-cache.c  (mode:100644 sha1:899e37361e5d34a38e4746b3cd290d9b96a6c8f8)
+++ uncommitted/diff-cache.c  (mode:100644)
@@ -143,7 +143,7 @@
 }
 
 static char *diff_cache_usage =
-"diff-cache [-r] [-z] [-p] [--cached] <tree sha1>";
+"git-diff-cache [-r] [-z] [-p] [--cached] <tree sha1>";
 
 int main(int argc, char **argv)
 {
Index: diff-files.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/diff-files.c  (mode:100644 sha1:fdd7dd4b0cc8c92a18ddaf0bcf8c9675fcab303b)
+++ uncommitted/diff-files.c  (mode:100644)
@@ -7,7 +7,7 @@
 #include "diff.h"
 
 static const char *show_diff_usage =
-"show-diff [-p] [-q] [-r] [-z] [paths...]";
+"git-show-diff [-p] [-q] [-r] [-z] [paths...]";
 
 static int generate_patch = 0;
 static int line_termination = '\n';
Index: diff-tree-helper.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/diff-tree-helper.c  (mode:100644 sha1:282b649f318cf3fa19c7f01da94ba590126f5443)
+++ uncommitted/diff-tree-helper.c  (mode:100644)
@@ -104,7 +104,7 @@
 }
 
 static const char *diff_tree_helper_usage =
-"diff-tree-helper [-R] [-z] paths...";
+"git-diff-tree-helper [-R] [-z] paths...";
 
 int main(int ac, const char **av) {
 	struct strbuf sb;
Index: diff-tree.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/diff-tree.c  (mode:100644 sha1:e7a5b7cc76f5d80e602184f1ef12f502d53a552b)
+++ uncommitted/diff-tree.c  (mode:100644)
@@ -227,7 +227,7 @@
 			update_tree_entry(&tree2, &size2);
 			continue;
 		}
-		die("diff-tree: internal error");
+		die("git-diff-tree: internal error");
 	}
 	return 0;
 }
@@ -250,7 +250,7 @@
 	return retval;
 }
 
-static char *diff_tree_usage = "diff-tree [-r] [-z] <tree sha1> <tree sha1>";
+static char *diff_tree_usage = "git-diff-tree [-r] [-z] <tree sha1> <tree sha1>";
 
 int main(int argc, char **argv)
 {
Index: fsck-cache.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/fsck-cache.c  (mode:100644 sha1:280a104050b665515418c00c33af8e6b0b0e2101)
+++ uncommitted/fsck-cache.c  (mode:100644)
@@ -51,7 +51,7 @@
 static int fsck_tree(struct tree *item)
 {
 	if (item->has_full_path) {
-		fprintf(stderr, "warning: fsck-cache: tree %s "
+		fprintf(stderr, "warning: git-fsck-cache: tree %s "
 			"has full pathnames in it\n", 
 			sha1_to_hex(item->object.sha1));
 	}
@@ -156,7 +156,7 @@
 			continue;
 		}
 		if (*arg == '-')
-			usage("fsck-cache [--tags] [[--unreachable] <head-sha1>*]");
+			usage("git-fsck-cache [--tags] [[--unreachable] <head-sha1>*]");
 	}
 
 	sha1_dir = getenv(DB_ENVIRONMENT) ? : DEFAULT_DB_ENVIRONMENT;
Index: http-pull.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/http-pull.c  (mode:100644 sha1:192dcc370dee47c52c72915394bb6f2a79f64e12)
+++ uncommitted/http-pull.c  (mode:100644)
@@ -180,7 +180,7 @@
 		arg++;
 	}
 	if (argc < arg + 2) {
-		usage("http-pull [-c] [-t] [-a] commit-id url");
+		usage("git-http-pull [-c] [-t] [-a] commit-id url");
 		return 1;
 	}
 	commit_id = argv[arg];
Index: ls-tree.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/ls-tree.c  (mode:100644 sha1:d2ab02e3484efaf851c50574e603c785d713bc87)
+++ uncommitted/ls-tree.c  (mode:100644)
@@ -80,7 +80,7 @@
 	return 0;
 }
 
-static const char *ls_tree_usage = "ls-tree [-r] [-z] <key>";
+static const char *ls_tree_usage = "git-ls-tree [-r] [-z] <key>";
 
 int main(int argc, char **argv)
 {
Index: merge-base.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/merge-base.c  (mode:100644 sha1:2c40881302e586366f03ae6ac6e7c0035847e2f0)
+++ uncommitted/merge-base.c  (mode:100644)
@@ -60,7 +60,7 @@
 	if (argc != 3 ||
 	    get_sha1_hex(argv[1], rev1key) ||
 	    get_sha1_hex(argv[2], rev2key)) {
-		usage("merge-base <commit-id> <commit-id>");
+		usage("git-merge-base <commit-id> <commit-id>");
 	}
 	rev1 = lookup_commit(rev1key);
 	rev2 = lookup_commit(rev2key);
Index: merge-cache.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/merge-cache.c  (mode:100644 sha1:11079b1cda9c50856a636a19bc41204903f1b522)
+++ uncommitted/merge-cache.c  (mode:100644)
@@ -33,7 +33,7 @@
 	int found;
 	
 	if (pos >= active_nr)
-		die("merge-cache: %s not in the cache", path);
+		die("git-merge-cache: %s not in the cache", path);
 	arguments[0] = pgm;
 	arguments[1] = "";
 	arguments[2] = "";
@@ -58,7 +58,7 @@
 		arguments[stage + 4] = ownbuf[stage];
 	} while (++pos < active_nr);
 	if (!found)
-		die("merge-cache: %s not in the cache", path);
+		die("git-merge-cache: %s not in the cache", path);
 	run_program();
 	return found;
 }
@@ -91,7 +91,7 @@
 	int i, force_file = 0;
 
 	if (argc < 3)
-		usage("merge-cache <merge-program> (-a | <filename>*)");
+		usage("git-merge-cache <merge-program> (-a | <filename>*)");
 
 	read_cache();
 
@@ -107,7 +107,7 @@
 				merge_all();
 				continue;
 			}
-			die("merge-cache: unknown option %s", arg);
+			die("git-merge-cache: unknown option %s", arg);
 		}
 		merge_file(arg);
 	}
Index: read-tree.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/read-tree.c  (mode:100644 sha1:604884a983e087e25afccc1c52beff3883036e58)
+++ uncommitted/read-tree.c  (mode:100644)
@@ -156,7 +156,7 @@
 	}
 }
 
-static char *read_tree_usage = "read-tree (<sha> | -m <sha1> [<sha2> <sha3>])";
+static char *read_tree_usage = "git-read-tree (<sha> | -m <sha1> [<sha2> <sha3>])";
 
 int main(int argc, char **argv)
 {
Index: rev-list.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/rev-list.c  (mode:100644 sha1:77bfc29db1aad08ba9d7d87ce08d33d4a88e74e3)
+++ uncommitted/rev-list.c  (mode:100644)
@@ -8,7 +8,7 @@
 	struct commit *commit;
 
 	if (argc != 2 || get_sha1_hex(argv[1], sha1))
-		usage("rev-list <commit-id>");
+		usage("git-rev-list <commit-id>");
 
 	commit = lookup_commit(sha1);
 	if (!commit || parse_commit(commit) < 0)
Index: rev-tree.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/rev-tree.c  (mode:100644 sha1:03c900f459c0e6ae7fc9455589be00375f44eac8)
+++ uncommitted/rev-tree.c  (mode:100644)
@@ -69,7 +69,7 @@
 }
 
 /*
- * Usage: rev-tree [--edges] [--cache <cache-file>] <commit-id> [<commit-id2>]
+ * Usage: git-rev-tree [--edges] [--cache <cache-file>] <commit-id> [<commit-id2>]
  *
  * The cache-file can be quite important for big trees. This is an
  * expensive operation if you have to walk the whole chain of
@@ -103,7 +103,7 @@
 			basemask |= 1<<nr;
 		}
 		if (nr >= MAX_COMMITS || get_sha1_hex(arg, sha1[nr]))
-			usage("rev-tree [--edges] [--cache <cache-file>] <commit-id> [<commit-id>]");
+			usage("git-rev-tree [--edges] [--cache <cache-file>] <commit-id> [<commit-id>]");
 		process_commit(sha1[nr]);
 		nr++;
 	}
Index: rpull.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/rpull.c  (mode:100644 sha1:c27af2c2464de28732b8ad1fff3ed8a0804250d6)
+++ uncommitted/rpull.c  (mode:100644)
@@ -108,13 +108,13 @@
 		arg++;
 	}
 	if (argc < arg + 2) {
-		usage("rpull [-c] [-t] [-a] commit-id url");
+		usage("git-rpull [-c] [-t] [-a] commit-id url");
 		return 1;
 	}
 	commit_id = argv[arg];
 	url = argv[arg + 1];
 
-	if (setup_connection(&fd_in, &fd_out, "rpush", url, arg, argv + 1))
+	if (setup_connection(&fd_in, &fd_out, "git-rpush", url, arg, argv + 1))
 		return 1;
 
 	get_sha1_hex(commit_id, sha1);
Index: rpush.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/rpush.c  (mode:100644 sha1:0293a1a46311d7e20b13177143741ab9d6d0d201)
+++ uncommitted/rpush.c  (mode:100644)
@@ -56,12 +56,12 @@
                 arg++;
         }
         if (argc < arg + 2) {
-                usage("rpush [-c] [-t] [-a] commit-id url");
+                usage("git-rpush [-c] [-t] [-a] commit-id url");
                 return 1;
         }
 	commit_id = argv[arg];
 	url = argv[arg + 1];
-	if (setup_connection(&fd_in, &fd_out, "rpull", url, arg, argv + 1))
+	if (setup_connection(&fd_in, &fd_out, "git-rpull", url, arg, argv + 1))
 		return 1;
 
 	service(fd_in, fd_out);
Index: show-files.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/show-files.c  (mode:100644 sha1:d4061f83031447aa9ee8ad16544e7bc084908838)
+++ uncommitted/show-files.c  (mode:100644)
@@ -207,7 +207,7 @@
 }
 
 static const char *show_files_usage =
-	"show-files [-z] (--[cached|deleted|others|stage|unmerged])* "
+	"git-show-files [-z] (--[cached|deleted|others|stage|unmerged])* "
 	"[ --ignored [--exclude=<pattern>] [--exclude-from=<file>) ]";
 
 int main(int argc, char **argv)
Index: tar-tree.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/tar-tree.c  (mode:100644 sha1:5cc7cfef6db1269d81589b82255537fb64ba02fa)
+++ uncommitted/tar-tree.c  (mode:100644)
@@ -4,7 +4,7 @@
 #define RECORDSIZE	(512)
 #define BLOCKSIZE	(RECORDSIZE * 20)
 
-static const char *tar_tree_usage = "tar-tree <key> [basedir]";
+static const char *tar_tree_usage = "git-tar-tree <key> [basedir]";
 
 static char block[BLOCKSIZE];
 static unsigned long offset;
@@ -27,9 +27,9 @@
 				continue;
 			if (errno == EPIPE)
 				exit(0);
-			die("tar-tree: %s", strerror(errno));
+			die("git-tar-tree: %s", strerror(errno));
 		} else if (!ret) {
-			die("tar-tree: disk full?");
+			die("git-tar-tree: disk full?");
 		}
 		size -= ret;
 		buf += ret;
@@ -176,7 +176,7 @@
 	if (size > 99)
 		size++;
 	if (size > RECORDSIZE)
-		die("tar-tree: extended header too big, wtf?");
+		die("git-tar-tree: extended header too big, wtf?");
 	write_header(NULL, NULL, NULL, headerfilename, 0100600, size);
 
 	records = block + offset;
@@ -202,7 +202,7 @@
 
 	namelen = path_len(S_ISDIR(mode), basepath, prefix, path);
 	if (namelen > 500) {
-		die("tar-tree: name too log of object %s\n", sha1_to_hex(sha1));
+		die("git-tar-tree: name too log of object %s\n", sha1_to_hex(sha1));
 	} else if (namelen > 100) {
 		char *sha1_hex = sha1_to_hex(sha1);
 		char headerfilename[51];
Index: unpack-file.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/unpack-file.c  (mode:100644 sha1:6ff3d51c182627f42b104932ecea9b95d6225a5d)
+++ uncommitted/unpack-file.c  (mode:100644)
@@ -27,7 +27,7 @@
 	unsigned char sha1[20];
 
 	if (argc != 2 || get_sha1_hex(argv[1], sha1))
-		usage("unpack-file.c <sha1>");
+		usage("git-unpack-file <sha1>");
 
 	puts(create_temp_file(sha1));
 	return 0;
-- 
Jonas Fonseca

^ permalink raw reply

* Re: [PATCH] GIT: Create tar archives of tree on the fly
From: Rene Scharfe @ 2005-04-30  1:22 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.58.0504291522250.18901@ppc970.osdl.org>

On Fri, Apr 29, 2005 at 03:26:14PM -0700, Linus Torvalds wrote:
> 
> 
> Having just done the git-0.7.tar.gz file with git-tar-tree, I started 
> wondering if there is some nice way to encode the commit version that got 
> tarred up into the tar archive itself.

... and here is the patch that changes git-tar-tree to add the commit ID
as a comment in a global pax header to the tar file.  Archivers ignore
this field.  A little sample program is included to read the ID from a
previously prepared archive.

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

Write commit ID to global extended pax header at the beginning of the tar
file, if possible.  get-tar-commit-id.c is an example program to get the
ID back out of such a tar archive.

---
commit 716d21c45ba1c329fb88febf4704a4ab629a3933
tree 72f4d42eac2cd9099a663c16cb8201f90a8ff9c9
parent 0fc65a4572625405ff6dd9d8c16d835f2b1ebd49
author Rene Scharfe <rene.scharfe@lsrfire.ath.cx> 1114812895 +0200
committer Rene Scharfe <rene.scharfe@lsrfire.ath.cx> 1114812895 +0200

Index: get-tar-commit-id.c
===================================================================
--- /dev/null  (tree:c1546808797f6a3c4e6ae82069cee3dc316fbf24)
+++ 72f4d42eac2cd9099a663c16cb8201f90a8ff9c9/get-tar-commit-id.c  (mode:100644 sha1:a1a17e53d29136df431d2a128292d7aefefaea41)
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#define HEADERSIZE	1024
+
+int main(int argc, char **argv)
+{
+	char buffer[HEADERSIZE];
+	ssize_t n;
+
+	n = read(0, buffer, HEADERSIZE);
+	if (n < HEADERSIZE) {
+		fprintf(stderr, "read error\n");
+		return 3;
+	}
+	if (buffer[156] != 'g')
+		return 1;
+	if (memcmp(&buffer[512], "52 comment=", 11))
+		return 1;
+	n = write(1, &buffer[523], 41);
+	if (n < 41) {
+		fprintf(stderr, "write error\n");
+		return 2;
+	}
+	return 0;
+}
Index: tar-tree.c
===================================================================
--- c1546808797f6a3c4e6ae82069cee3dc316fbf24/tar-tree.c  (mode:100644 sha1:5cc7cfef6db1269d81589b82255537fb64ba02fa)
+++ 72f4d42eac2cd9099a663c16cb8201f90a8ff9c9/tar-tree.c  (mode:100644 sha1:ea7ea91add54532c38dde9e343efe34d56805341)
@@ -160,7 +160,7 @@
 	return len;
 }
 
-static void write_header(const char *, const char *, struct path_prefix *,
+static void write_header(const char *, char, const char *, struct path_prefix *,
                          const char *, unsigned int, unsigned long);
 
 /* stores a pax extended header directly in the block buffer */
@@ -169,7 +169,7 @@
                                   struct path_prefix *prefix,
                                   const char *path, unsigned int namelen)
 {
-	char *records, *p;
+	char *p;
 	unsigned int size = 1 + 6 + namelen + 1;
 	if (size > 9)
 		size++;
@@ -177,12 +177,10 @@
 		size++;
 	if (size > RECORDSIZE)
 		die("tar-tree: extended header too big, wtf?");
-	write_header(NULL, NULL, NULL, headerfilename, 0100600, size);
-
-	records = block + offset;
-	memset(records, 0, RECORDSIZE);
+	write_header(NULL, 'x', NULL, NULL, headerfilename, 0100600, size);
+	p = block + offset;
+	memset(p, 0, RECORDSIZE);
 	offset += RECORDSIZE;
-	p = records;
 	append_long(&p, size);
 	append_string(&p, " path=");
 	append_path(&p, is_dir, basepath, prefix, path);
@@ -190,8 +188,22 @@
 	write_if_needed();
 }
 
+static void write_global_extended_header(const char *sha1)
+{
+	char *p;
+	write_header(NULL, 'g', NULL, NULL, "pax_global_header", 0, 52);
+	p = block + offset;
+	memset(p, 0, RECORDSIZE);
+	offset += RECORDSIZE;
+	append_long(&p, 52);	/* 2 + 9 + 40 + 1 */
+	append_string(&p, " comment=");
+	append_string(&p, sha1_to_hex(sha1));
+	append_char(&p, '\n');
+	write_if_needed();
+}
+
 /* stores a ustar header directly in the block buffer */
-static void write_header(const char *sha1, const char *basepath,
+static void write_header(const char *sha1, char typeflag, const char *basepath,
                          struct path_prefix *prefix, const char *path,
                          unsigned int mode, unsigned long size)
 {
@@ -236,11 +248,7 @@
 	sprintf(&header[124], "%011lo", S_ISDIR(mode) ? 0 : size);
 	sprintf(&header[136], "%011lo", archive_time);
 
-	/* typeflag */
-	if (!sha1)
-		header[156] = 'x';	/* extended header */
-	else
-		header[156] = S_ISDIR(mode) ? '5' : '0';
+	header[156] = typeflag;
 
 	memcpy(&header[257], "ustar", 6);
 	memcpy(&header[263], "00", 2);
@@ -279,7 +287,8 @@
 		eltbuf = read_sha1_file(sha1, elttype, &eltsize);
 		if (!eltbuf)
 			die("cannot read %s", sha1_to_hex(sha1));
-		write_header(sha1, basedir, prefix, path, mode, eltsize);
+		write_header(sha1, S_ISDIR(mode) ? '5' : '0', basedir,
+		             prefix, path, mode, eltsize);
 		if (!strcmp(elttype, "tree")) {
 			this_prefix.name = path;
 			traverse_tree(eltbuf, eltsize, &this_prefix);
@@ -320,6 +329,7 @@
 int main(int argc, char **argv)
 {
 	unsigned char sha1[20];
+	unsigned char commit_sha1[20];
 	void *buffer;
 	unsigned long size;
 
@@ -339,8 +349,9 @@
 	if (!sha1_file_directory)
 		sha1_file_directory = DEFAULT_DB_ENVIRONMENT;
 
-	buffer = read_object_with_reference(sha1, "commit", &size, NULL);
+	buffer = read_object_with_reference(sha1, "commit", &size, commit_sha1);
 	if (buffer) {
+		write_global_extended_header(commit_sha1);
 		archive_time = commit_time(buffer, size);
 		free(buffer);
 	}
@@ -351,7 +362,7 @@
 	if (!archive_time)
 		archive_time = time(NULL);
 	if (basedir)
-		write_header("0", NULL, NULL, basedir, 040755, 0);
+		write_header("0", '5', NULL, NULL, basedir, 040755, 0);
 	traverse_tree(buffer, size, NULL);
 	free(buffer);
 	write_trailer();

^ permalink raw reply

* Linus' directory is gone?!
From: Horst von Brand @ 2005-04-30  0:41 UTC (permalink / raw)
  To: git

rsync://rsync.kernel.org/pub/linux/kernel/people/torvalds looks empty...
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

^ permalink raw reply

* Re: Linus' directory is gone?!
From: Jonas Fonseca @ 2005-04-30  1:21 UTC (permalink / raw)
  To: Horst von Brand; +Cc: git
In-Reply-To: <200504300041.j3U0fkpV003901@laptop11.inf.utfsm.cl>

Horst von Brand <vonbrand@inf.utfsm.cl> wrote Fri, Apr 29, 2005:
> rsync://rsync.kernel.org/pub/linux/kernel/people/torvalds looks empty...

Moved to rsync://www.kernel.org/pub/scm/git/git.git as mentioned in
another thread.

-- 
Jonas Fonseca

^ permalink raw reply

* questions about cg-update, cg-pull, and cg-clone.
From: Zack Brown @ 2005-04-30  0:53 UTC (permalink / raw)
  To: Git Mailing List

Hi,

I'm trying to figure out the new Cogito syntax. What is the difference between
cg-update and cg-pull? Here is my take so far, please correct me:

'cg-update branch-name' grabs any new changes from the upstream repository and
merges them into my local repository. If I've been editing files in my local
repository, the update attempts to merge the changes cleanly.

Now, if the update is clean, a cg-commit is invoked automatically, and if the
update is not clean, I then have to resolve any conflicts and give the cg-commit
command by hand. But: what is the significance of either of these cg-commit
commands? Why should I have to write a changelog entry recording this merge? All
I'm doing is updating my tree to be current. Why should I have to 'commit' that
update?

Now I look at 'cg-pull'. What does this do? The readme says something about
printing two ids, and being useful for diffs. But can't I do a diff after a
cg-update and get the same result? I'm very confused about cg-pull right now.

Also, the README says that cg-clone and cg-init are identical, except that
cg-clone creates a new directory for the repository. Is that really the only
difference? Why do we have cg-clone then?

Be well,
Zack

-- 
Zack Brown

^ permalink raw reply

* [PATCH] git-fsck-cache: Gracefully handle non-commit IDs
From: Jonas Fonseca @ 2005-04-30  0:28 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git

Gracefully handle non-commit IDs instead of segfaulting.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

--- 09465be469eef9711e93b583f4cd1092baa58f90/fsck-cache.c  (mode:100644 sha1:280a104050b665515418c00c33af8e6b0b0e2101)
+++ uncommitted/fsck-cache.c  (mode:100644)
@@ -174,7 +216,14 @@
 			continue;
 
 		if (!get_sha1_hex(arg, head_sha1)) {
-			struct object *obj = &lookup_commit(head_sha1)->object;
+			struct commit *commit = lookup_commit(head_sha1);
+			struct object *obj;
+
+			/* Error is printed by lookup_commit(). */
+			if (!commit)
+				continue;
+
+			obj = &commit->object;
 			obj->used = 1;
 			mark_reachable(obj, REACHABLE);
 			heads++;
-- 
Jonas Fonseca

^ permalink raw reply

* Re: How to get bash to shut up about SIGPIPE?
From: Paul Jackson @ 2005-04-30  0:22 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git, pasky
In-Reply-To: <Pine.LNX.4.58.0504281121430.18901@ppc970.osdl.org>

> bash is being an ass about SIGPIPE

You have a multiprocessor, don't you.

The following silly little shell script will provoke the bash SIGPIPE
complaint reliably on a multiprocessor.  It writes a big file, twice,
from a for-loop in a separate bash subshell through a pipe to a command
that exits after seeing one line.

Code Sample 1:

    #!/bin/bash
    for x in 1 2
    do
        cat /etc/termcap	# a big text file
    done | sed 1q

Adding a right trap _inside_ the shell loop that is _before_ the pipe
will reduce the verbosity of the complaint substantially (not show the
line number and text for each command inside the loop that is killed by
the SIGPIPE; rather just show the simple "Broken pipe" error message):

Code Sample 2:

    #!/bin/bash
    for x in 1 2
    do
	trap continue PIPE	# reduce broken pipe screeching
	cat /etc/termcap	# a big text file
    done | sed 1q

Then wrapping the entire pipeline (now that the bogus output is a
constant "Broken pipe" string) in the following manner will filter out
just that noise, leaving whatever else was on stdout and/or stderr
unscathed:

Code Sample 3:

    #!/bin/bash
    ( ( (
	for x in 1 2
	do
		trap continue PIPE      # reduce broken pipe screeching
		cat /etc/termcap        # a big text file
	done | sed 1q
    ) 1>&3 ) 2>&1 | grep -vxF 'Broken pipe' 1>&2 ) 3>&1

The following patch to bash jobs.c will enable "Code Sample 2" to do the
right thing, without depending (so much) on the DONT_REPORT_SIGPIPE
compile time flag.  With this patch, you don't have to go all the way to
the baroque code in "Code Sample 3" to shut bash up.  Just a well placed
trap is sufficient.

Whether or not this is actually worth persuing (or was even worth
reading ;) I don't know.

--- jobs.c.orig 2001-03-26 10:08:24.000000000 -0800
+++ jobs.c      2005-04-29 17:09:44.294763496 -0700
@@ -2686,11 +2686,8 @@ notify_of_job_status ()
                }
              else if (IS_FOREGROUND (job))
                {
-#if !defined (DONT_REPORT_SIGPIPE)
-                 if (termsig && WIFSIGNALED (s) && termsig != SIGINT)
-#else
-                 if (termsig && WIFSIGNALED (s) && termsig != SIGINT && termsig != SIGPIPE)
-#endif
+                 if (termsig && WIFSIGNALED (s) && termsig != SIGINT &&
+                   (termsig != SIGPIPE || signal_is_trapped (termsig) == 0))
                    {
                      fprintf (stderr, "%s", strsignal (termsig));



-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <pj@engr.sgi.com> 1.650.933.1373, 1.925.600.0401

^ permalink raw reply

* Re: Trying to use AUTHOR_DATE
From: tony.luck @ 2005-04-30  0:21 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: git
In-Reply-To: <4272C4DE.8090806@zytor.com>

> There was a time-parsing bug somewhere, where mktime() got invoked on a 
> UTC date.  I proposed changing it to curl_gettime() instead.

Here's a patch to switch to using curl_getdate():

Signed-off-by: Tony Luck <tony.luck@intel.com>

---

 Makefile      |    1 
 commit-tree.c |  143 ++++------------------------------------------------------
 2 files changed, 11 insertions(+), 133 deletions(-)

Makefile: d73bea1cbb9451a89b03d6066bf2ed7fec32fd31
--- k/Makefile
+++ l/Makefile
@@ -92,6 +92,7 @@ $(LIB_FILE): $(LIB_OBJS)
 rpush: rsh.c
 rpull: rsh.c
 http-pull: LIBS += -lcurl
+commit-tree: LIBS += -lcurl
 
 
 ifneq (,$(wildcard .git))
commit-tree.c: 23de13361944ad7ba7c5320cf7cdd04e81842c60
--- k/commit-tree.c
+++ l/commit-tree.c
@@ -10,6 +10,7 @@
 #include <string.h>
 #include <ctype.h>
 #include <time.h>
+#include <curl/curl.h>
 
 #define BLOCKING (1ul << 14)
 
@@ -80,146 +81,22 @@ static void remove_special(char *p)
 	}
 }
 
-static const char *month_names[] = {
-        "Jan", "Feb", "Mar", "Apr", "May", "Jun",
-        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-};
-
-static const char *weekday_names[] = {
-        "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
-};
-
-
-static char *skipfws(char *str)
-{
-	while (isspace(*str))
-		str++;
-	return str;
-}
-
-	
 /* Gr. strptime is crap for this; it doesn't have a way to require RFC2822
    (i.e. English) day/month names, and it doesn't work correctly with %z. */
-static void parse_rfc2822_date(char *date, char *result, int maxlen)
+static void parse_date(char *date, time_t *now, char *result, int maxlen)
 {
-	struct tm tm;
 	char *p;
-	int i, offset;
 	time_t then;
 
-	memset(&tm, 0, sizeof(tm));
-
-	/* Skip day-name */
-	p = skipfws(date);
-	if (!isdigit(*p)) {
-		for (i=0; i<7; i++) {
-			if (!strncmp(p,weekday_names[i],3) && p[3] == ',') {
-				p = skipfws(p+4);
-				goto day;
-			}
-		}
-		return;
-	}					
-
-	/* day */
- day:
-	tm.tm_mday = strtoul(p, &p, 10);
-
-	if (tm.tm_mday < 1 || tm.tm_mday > 31)
-		return;
-
-	if (!isspace(*p))
-		return;
-
-	p = skipfws(p);
-
-	/* month */
-
-	for (i=0; i<12; i++) {
-		if (!strncmp(p, month_names[i], 3) && isspace(p[3])) {
-			tm.tm_mon = i;
-			p = skipfws(p+strlen(month_names[i]));
-			goto year;
-		}
-	}
-	return; /* Error -- bad month */
-
-	/* year */
- year:	
-	tm.tm_year = strtoul(p, &p, 10);
-
-	if (!tm.tm_year && !isspace(*p))
-		return;
-
-	if (tm.tm_year > 1900)
-		tm.tm_year -= 1900;
-		
-	p=skipfws(p);
-
-	/* hour */
-	if (!isdigit(*p))
-		return;
-	tm.tm_hour = strtoul(p, &p, 10);
-	
-	if (!tm.tm_hour > 23)
-		return;
-
-	if (*p != ':')
-		return; /* Error -- bad time */
-	p++;
-
-	/* minute */
-	if (!isdigit(*p))
-		return;
-	tm.tm_min = strtoul(p, &p, 10);
-	
-	if (!tm.tm_min > 59)
+	if ((then = curl_getdate(date, now)) == 0)
 		return;
 
-	if (isspace(*p))
-		goto zone;
-
-	if (*p != ':')
-		return; /* Error -- bad time */
-	p++;
-
-	/* second */
-	if (!isdigit(*p))
-		return;
-	tm.tm_sec = strtoul(p, &p, 10);
-	
-	if (!tm.tm_sec > 59)
-		return;
-
-	if (!isspace(*p))
-		return;
-
- zone:
-	p = skipfws(p);
-
-	if (*p == '-')
-		offset = -60;
-	else if (*p == '+')
-		offset = 60;
-	else
-	       return;
-
-	if (!isdigit(p[1]) || !isdigit(p[2]) || !isdigit(p[3]) || !isdigit(p[4]))
-		return;
-
-	i = strtoul(p+1, NULL, 10);
-	offset *= ((i % 100) + ((i / 100) * 60));
-
-	if (*(skipfws(p + 5)))
-		return;
-
-	then = mktime(&tm); /* mktime appears to ignore the GMT offset, stupidly */
-	if (then == -1)
-		return;
-
-	then -= offset;
-
-	snprintf(result, maxlen, "%lu %5.5s", then, p);
+	/* find the timezone at the end */
+	p = date + strlen(date);
+	while (p > date && isdigit(*--p))
+		;
+	if ((*p == '+' || *p == '-') && strlen(p) == 5)
+		snprintf(result, maxlen, "%lu %5.5s", then, p);
 }
 
 static void check_valid(unsigned char *sha1, const char *expect)
@@ -298,7 +175,7 @@ int main(int argc, char **argv)
 	email = getenv("AUTHOR_EMAIL") ? : realemail;
 	audate = getenv("AUTHOR_DATE");
 	if (audate)
-		parse_rfc2822_date(audate, date, sizeof(date));
+		parse_date(audate, &now, date, sizeof(date));
 
 	remove_special(gecos); remove_special(realgecos); remove_special(commitgecos);
 	remove_special(email); remove_special(realemail); remove_special(commitemail);

^ permalink raw reply

* description
From: H. Peter Anvin @ 2005-04-30  0:14 UTC (permalink / raw)
  To: Git Mailing List

I guess this is technically speaking complete nonstandard addition to 
git :) but I have added the following to the script that generates 
http://www.kernel.org/git/:

If there is a plain text file called "description" in the .git 
directory, it will appear on that webpage.

	-hpa

^ permalink raw reply

* Re: [PATCH] GIT: Create tar archives of tree on the fly
From: Rene Scharfe @ 2005-04-30  0:13 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.58.0504291522250.18901@ppc970.osdl.org>

Linus Torvalds schrieb:
> 
> Having just done the git-0.7.tar.gz file with git-tar-tree, I started
>  wondering if there is some nice way to encode the commit version
> that got tarred up into the tar archive itself.

The pax archive format allows for comments; you can store the commit ID
in a (archive-)global comment.  Archivers are supposed to ignore it and
GNU tar at least does so.  You can extract the ID with

   $ dd bs=1 skip=523 count=41 2>/dev/null < TARFILE

because it would always end up at that position at the start of the archive.

Rene

^ permalink raw reply

* Re: The big git command renaming..
From: H. Peter Anvin @ 2005-04-29 23:42 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Dave Jones, Git Mailing List
In-Reply-To: <Pine.LNX.4.58.0504291638260.18901@ppc970.osdl.org>

Linus Torvalds wrote:
> 
> On Fri, 29 Apr 2005, H. Peter Anvin wrote:
> 
>>If you have any other non-kernel git projects, just let me know and I'll 
>>make directories for them.
> 
> 
> The others are small and specialized (sparse, and the "git-tools" thing,
> and the latter is so much smaler than my BK tools used to be that I
> suspect I should just move it into git as the "apply mbox" import thing it
> is)
> 

I created /pub/scm/devel/sparse to go along with 
/pub/software/devel/sparse.  I agree with git-tools; just put it in the 
git directory (after all, you can have more than one dir.git underneath it.)

	-hpa

^ permalink raw reply

* Re: The big git command renaming..
From: Linus Torvalds @ 2005-04-29 23:39 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Dave Jones, Git Mailing List
In-Reply-To: <4272BE9C.7090906@zytor.com>



On Fri, 29 Apr 2005, H. Peter Anvin wrote:
> 
> If you have any other non-kernel git projects, just let me know and I'll 
> make directories for them.

The others are small and specialized (sparse, and the "git-tools" thing,
and the latter is so much smaler than my BK tools used to be that I
suspect I should just move it into git as the "apply mbox" import thing it
is)

> P.S. Are you still updating the trees in 
> /pub/linux/kernel/people/torvalds/?  They still show up on our change 
> reports, and cause problems for the mirrors.  Perhaps you could replace 
> those trees with symlinks into /pub/scm.

Fixed.

		Linus

^ permalink raw reply

* Re: Trying to use AUTHOR_DATE
From: H. Peter Anvin @ 2005-04-29 23:35 UTC (permalink / raw)
  To: tony.luck; +Cc: git
In-Reply-To: <200504292314.j3TNE1P23342@unix-os.sc.intel.com>

tony.luck@intel.com wrote:
> I'm using cogito-0.8 (036bb73c6dd1871101ca19557298684ab9832f81) and trying
> to set AUTHOR_DATE based on the "Date:" from the patch e-mail.  But, it
> appears that commit-tree is munging this based on my timezone.
> 
> Here's what I set in the environment before invoking cg-commit:
> 
>   AUTHOR_DATE="29 Apr 2005 02:02:00 -0700"
> 
> and here's what cg-log reports on the "author" line:
> 
>   Fri, 29 Apr 2005 10:02:00 -0700
> 
> My /etc/localtime is set for "US/Pacific" ... which is where the 8 hours
> comes from (I think).  If I set "TZ=GMT0BST" as well in the environment of
> cg-commit to override /etc/localtime, then the author time comes out ok,
> but then the "committer" time gets messed up.
> 

There was a time-parsing bug somewhere, where mktime() got invoked on a 
UTC date.  I proposed changing it to curl_gettime() instead.

	-hpa

^ permalink raw reply

* Trying to use AUTHOR_DATE
From: tony.luck @ 2005-04-29 23:14 UTC (permalink / raw)
  To: git

I'm using cogito-0.8 (036bb73c6dd1871101ca19557298684ab9832f81) and trying
to set AUTHOR_DATE based on the "Date:" from the patch e-mail.  But, it
appears that commit-tree is munging this based on my timezone.

Here's what I set in the environment before invoking cg-commit:

  AUTHOR_DATE="29 Apr 2005 02:02:00 -0700"

and here's what cg-log reports on the "author" line:

  Fri, 29 Apr 2005 10:02:00 -0700

My /etc/localtime is set for "US/Pacific" ... which is where the 8 hours
comes from (I think).  If I set "TZ=GMT0BST" as well in the environment of
cg-commit to override /etc/localtime, then the author time comes out ok,
but then the "committer" time gets messed up.

-Tony

^ permalink raw reply

* Re: The big git command renaming..
From: H. Peter Anvin @ 2005-04-29 23:09 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Dave Jones, Git Mailing List
In-Reply-To: <Pine.LNX.4.58.0504291511410.18901@ppc970.osdl.org>

Linus Torvalds wrote:
> 
> Sure. 
> 
> Just a quick question: what are the "rules" for /pub/scm/git? 
> 
> Should I put just git in it, or is it meant for any "git project", and
> should I also copy the 2.6.x kernel home from
> 
> 	/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
> 
> to
> 
> 	/pub/scm/git/linux-2.6.git
> 
> or what?
> 
> Me, I can do either or both, I just don't know what the intent was..

/pub/scm/git I created for your git project; don't move the kernel in there.

If you have any other non-kernel git projects, just let me know and I'll 
make directories for them.

	-hpa

P.S. Are you still updating the trees in 
/pub/linux/kernel/people/torvalds/?  They still show up on our change 
reports, and cause problems for the mirrors.  Perhaps you could replace 
those trees with symlinks into /pub/scm.

	-hpa



^ permalink raw reply

* Re: Mercurial 0.4b vs git patchbomb benchmark
From: Andrea Arcangeli @ 2005-04-29 22:47 UTC (permalink / raw)
  To: Olivier Galibert, Sean, Matt Mackall, Linus Torvalds,
	linux-kernel, git
In-Reply-To: <20050429223052.GD28540@dspnet.fr.eu.org>

On Sat, Apr 30, 2005 at 12:30:52AM +0200, Olivier Galibert wrote:
> Nothing a little caching can't solve.  Given that git's objects are
> immutable caching is especially easy to do, you can have the delta
> reference indexes in the filename.

Rather than creating delta reference indexes we can as well use
mercurial that uses them as primary storage.

git is the _storage_ filesystem, if we can't use it but we've to create
another different representation to do efficient network download, we
can as well the more efficient representation instead of git, that's
what mercurial does AFIK.

^ permalink raw reply

* [PATCH] leftover bits for git rename
From: Junio C Hamano @ 2005-04-29 22:42 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git

  commit 2d280e1c5e6fdcf5428e60219eae14a2c6629c51
  parent aed7a5a9dab96d1a17be4fadf7685086047178cc
  author Linus Torvalds <torvalds@ppc970.osdl.org> Fri Apr 29 15:02:43 2005
  committer Linus Torvalds <torvalds@ppc970.osdl.org> Fri Apr 29 15:02:43 2005

    Update the merge scripts for the big git rename.

    Let's see what else I forgot..

Not that many, but here they are.

Signed-off-by: Junio C Hamano <junkio@cox.net>
----

git-merge-one-file-script |    6 +++---
git-prune-script          |    2 +-
git-tag-script            |    2 +-

cd /opt/packrat/playpen/public/in-place/git/git.linus/
jit-snap -v 0
# - [PATCH] Makefile: The big git command renaming fallout fix.
# + working tree
--- k/git-merge-one-file-script  (mode:100755)
+++ l/git-merge-one-file-script  (mode:100755)
@@ -9,7 +9,7 @@
 #
 #
 # Handle some trivial cases.. The _really_ trivial cases have
-# been handled already by read-tree, but that one doesn't
+# been handled already by git-read-tree, but that one doesn't
 # do any merges that migth change the tree layout
 #
 
@@ -41,7 +41,7 @@ case "${1:-.}${2:-.}${3:-.}" in
 #
 ".$2." | "..$3" )
 	echo "Adding $4 with perm $6$7"
-	mv $(unpack-file "$2$3") $4
+	mv $(git-unpack-file "$2$3") $4
 	chmod "$6$7" $4
 	git-update-cache --add -- $4
 	exit 0
@@ -55,7 +55,7 @@ case "${1:-.}${2:-.}${3:-.}" in
 		exit 1
 	fi
 	echo "Adding $4 with perm $6"
-	mv $(unpack-file "$2") $4
+	mv $(git-unpack-file "$2") $4
 	chmod "$6" $4
 	git-update-cache --add -- $4
 	exit 0;;
--- k/git-prune-script  (mode:100755)
+++ l/git-prune-script  (mode:100755)
@@ -1,2 +1,2 @@
 #!/bin/sh
-fsck-cache --unreachable $(cat .git/HEAD ) | grep unreachable | cut -d' ' -f3 | sed 's:^\(..\):.git/objects/\1/:' | xargs rm
+git-fsck-cache --unreachable $(cat .git/HEAD ) | grep unreachable | cut -d' ' -f3 | sed 's:^\(..\):.git/objects/\1/:' | xargs rm
--- k/git-tag-script  (mode:100755)
+++ l/git-tag-script  (mode:100755)
@@ -1,6 +1,6 @@
 #!/bin/sh
 object=${2:-$(cat .git/HEAD)}
-type=$(cat-file -t $object) || exit 1
+type=$(git-cat-file -t $object) || exit 1
 ( echo -e "object $object\ntype $type\ntag $1\n"; cat ) > .tmp-tag
 rm -f .tmp-tag.asc
 gpg -bsa .tmp-tag && cat .tmp-tag.asc >> .tmp-tag



^ permalink raw reply

* Re: Mercurial 0.4b vs git patchbomb benchmark
From: Olivier Galibert @ 2005-04-29 22:30 UTC (permalink / raw)
  To: Andrea Arcangeli; +Cc: Sean, Matt Mackall, Linus Torvalds, linux-kernel, git
In-Reply-To: <20050429201957.GJ17379@opteron.random>

On Fri, Apr 29, 2005 at 10:19:57PM +0200, Andrea Arcangeli wrote:
> such a system might fall apart under load, converting on the fly from
> git to network-optimized format sound quite expensive operation, even
> ignorign the initial decompression of the payload.

Nothing a little caching can't solve.  Given that git's objects are
immutable caching is especially easy to do, you can have the delta
reference indexes in the filename.

  OG.


^ permalink raw reply

* Re: [PATCH] GIT: Create tar archives of tree on the fly
From: Linus Torvalds @ 2005-04-29 22:26 UTC (permalink / raw)
  To: Rene Scharfe; +Cc: git
In-Reply-To: <20050426144222.GA12035@lsrfire.ath.cx>



Having just done the git-0.7.tar.gz file with git-tar-tree, I started 
wondering if there is some nice way to encode the commit version that got 
tarred up into the tar archive itself.

There are various obvious ways, like creating a fake zero-sized file 
called <base>/.git-version-<commit-id>, and maybe that's the right thing 
to do. But maybe the tar archive format (and no, I don't even want to know 
details) has some nice way to hide off a keyname even _without_ having to 
create a file.

Would people like to have such a file for later? Obviously there would be 
a need to suppress it with a command line flag if you don't want it (or 
have a cmd line flag to enable it in the first place), what do people 
think? Rene?

		Linus

^ permalink raw reply

* Re: [PATCH] Make cg-clone handle local directories as sources
From: Ryan Anderson @ 2005-04-29 22:17 UTC (permalink / raw)
  To: Ryan Anderson; +Cc: git
In-Reply-To: <20050429215928.GF1233@mythryan2.michonline.com>

cg-clone is described as only being used with remote repositories, but
it has the nice feature of creating the destination directory for you.

This patch adds two features:
        1. A destination directory can (optionally) be specified.
        2. The source directory can be in the local file system.

The following, for example, now works:

        cg-clone rsync://rsync.kernel.org/pub/scm/cogito/cogito.git
        mkdir test ; cd test
        cg-clone ../cogito ../cogito2/

(This version of the patch actually doesn't break existing
functionality.)

Index: cg-clone
===================================================================
--- c3aa1e6b53cc59d5fbe261f3f859584904ae3a63/cg-clone  (mode:100755 sha1:4ee0685c358e094c5350b3968d013105da6ddf7e)
+++ 3dc3edca08f66f90147d0cb2240274072fa8644a/cg-clone  (mode:100755 sha1:e42237e0408bc3f34cc70a956c29df1251bd1571)
@@ -11,13 +11,25 @@
 . cg-Xlib
 
 location=$1
-[ "$location" ] || die "usage: cg-clone SOURCE_LOC"
+[ "$location" ] || die "usage: cg-clone SOURCE_LOC [DEST_LOC]"
 location=${location%/}
 
-dir=${location##*/}; dir=${dir%.git}
+if [ "$2" == "" ]; then
+	dir=${location##*/}; dir=${dir%.git}
+else
+	dir=$2
+fi
+
+pwd=$(pwd)
+if ! echo "$location" | grep -q ":" ; then
+	relative_location=$(echo "$location" | sed -e "s#^[^/]#$pwd\/&#")
+else
+	relative_location="$location"
+fi
+
 [ -e "$dir" ] && die "$dir/ already exists"
 mkdir "$dir"
 cd "$dir"
 
-cg-init $location || exit $?
+cg-init "$relative_location" || exit $?
 echo "Cloned to $dir/ (origin $location available as branch \"origin\")"

^ permalink raw reply

* Re: The big git command renaming..
From: Linus Torvalds @ 2005-04-29 22:14 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Dave Jones, Git Mailing List
In-Reply-To: <4272AE05.2070202@zytor.com>



On Fri, 29 Apr 2005, H. Peter Anvin wrote:
> 
> Oh yes, and can that tarball please be put in /pub/software/scm/git, and 
> the associated git tree be moved to /pub/scm/git?

Sure. 

Just a quick question: what are the "rules" for /pub/scm/git? 

Should I put just git in it, or is it meant for any "git project", and
should I also copy the 2.6.x kernel home from

	/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

to

	/pub/scm/git/linux-2.6.git

or what?

Me, I can do either or both, I just don't know what the intent was..

		Linus


^ permalink raw reply

* Re: [PATCh] jit-trackdown
From: Junio C Hamano @ 2005-04-29 22:09 UTC (permalink / raw)
  To: Daniel Barkalow; +Cc: David Greaves, GIT Mailing Lists
In-Reply-To: <Pine.LNX.4.21.0504291730000.30848-100000@iabervon.org>

>>>>> "DB" == Daniel Barkalow <barkalow@iabervon.org> writes:

DB> I've made a proposal like the following:

DB> .git/
DB>   objects/    (traditional)
DB>   refs/       Directories of hex SHA1 + newline files
DB>     heads/    Commits which are heads of various sorts
DB>     tags/     Tags, by the tag name (or some local renaming of it)
DB>   info/       Other shared information
DB>     remotes
DB>   ...         Everything else isn't shared
DB>   HEAD        Symlink to refs/heads/<something>

Thank you for clear description.

I agree with Linus that plumbing does not need to know anything
but objects/.  What the porcelain passes fsck-cache to implement
prune/garbage-collect does not concern it.  Of course it matters
to the users and that is the reason why I asked.


^ permalink raw reply

* Re: [PATCH] Make cg-clone handle local directories as sources
From: Ryan Anderson @ 2005-04-29 22:08 UTC (permalink / raw)
  To: Ryan Anderson; +Cc: git
In-Reply-To: <20050429215928.GF1233@mythryan2.michonline.com>

Ignore this, I did something stupid - new patch to follow in a minute.

On Fri, Apr 29, 2005 at 05:59:29PM -0400, Ryan Anderson wrote:
> 
> cg-clone is described as only being used with remote repositories, but
> it has the nice feature of creating the destination directory for you.
> 
> This patch adds two features:
> 	1. A destination directory can (optionally) be specified.
> 	2. The source directory can be in the local file system.
> 
> The following, for example, now works:
> 
> 	cg-clone rsync://rsync.kernel.org/pub/scm/cogito/cogito.git
> 	mkdir test ; cd test
> 	cg-clone ../cogito ../cogito2/
> 
> Index: cg-clone
> ===================================================================
> --- c3aa1e6b53cc59d5fbe261f3f859584904ae3a63/cg-clone  (mode:100755 sha1:4ee0685c358e094c5350b3968d013105da6ddf7e)
> +++ uncommitted/cg-clone  (mode:100755)
> @@ -11,13 +11,22 @@
>  . cg-Xlib
>  
>  location=$1
> -[ "$location" ] || die "usage: cg-clone SOURCE_LOC"
> +[ "$location" ] || die "usage: cg-clone SOURCE_LOC [DEST_LOC]"
>  location=${location%/}
>  
> -dir=${location##*/}; dir=${dir%.git}
> +if [ "$2" == "" ]; then
> +	dir=${location##*/}; dir=${dir%.git}
> +else
> +	dir=$2
> +fi
> +
> +pwd=$(pwd)
> +relative_location=$(echo "$location" | sed -e "s#^[^/]#$pwd\/&#")
> +
>  [ -e "$dir" ] && die "$dir/ already exists"
>  mkdir "$dir"
>  cd "$dir"
>  
> -cg-init $location || exit $?
> +echo "cg-init $relative_location"
> +cg-init $relative_location || exit $?
>  echo "Cloned to $dir/ (origin $location available as branch \"origin\")"
> 
> 
> -- 
> 
> Ryan Anderson
>   sometimes Pug Majere
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 

Ryan Anderson
  sometimes Pug Majere

^ permalink raw reply

* Re: More problems...
From: Junio C Hamano @ 2005-04-29 22:01 UTC (permalink / raw)
  To: Daniel Barkalow
  Cc: Linus Torvalds, Ryan Anderson, Petr Baudis, Russell King, git
In-Reply-To: <Pine.LNX.4.21.0504291717360.30848-100000@iabervon.org>

>>>>> "DB" == Daniel Barkalow <barkalow@iabervon.org> writes:

DB> If someone does this, they should make a pull.c out of http-pull and
DB> rpull; the logic for determining what you need to copy, given what you
DB> have and what the user wants to have, should be shared.

I agree with your analysis.  I was hoping that that someone
would be you, knowing where http-pull originated ;-).


^ permalink raw reply

* [PATCH] Make cg-clone handle local directories as sources
From: Ryan Anderson @ 2005-04-29 21:59 UTC (permalink / raw)
  To: git


cg-clone is described as only being used with remote repositories, but
it has the nice feature of creating the destination directory for you.

This patch adds two features:
	1. A destination directory can (optionally) be specified.
	2. The source directory can be in the local file system.

The following, for example, now works:

	cg-clone rsync://rsync.kernel.org/pub/scm/cogito/cogito.git
	mkdir test ; cd test
	cg-clone ../cogito ../cogito2/

Index: cg-clone
===================================================================
--- c3aa1e6b53cc59d5fbe261f3f859584904ae3a63/cg-clone  (mode:100755 sha1:4ee0685c358e094c5350b3968d013105da6ddf7e)
+++ uncommitted/cg-clone  (mode:100755)
@@ -11,13 +11,22 @@
 . cg-Xlib
 
 location=$1
-[ "$location" ] || die "usage: cg-clone SOURCE_LOC"
+[ "$location" ] || die "usage: cg-clone SOURCE_LOC [DEST_LOC]"
 location=${location%/}
 
-dir=${location##*/}; dir=${dir%.git}
+if [ "$2" == "" ]; then
+	dir=${location##*/}; dir=${dir%.git}
+else
+	dir=$2
+fi
+
+pwd=$(pwd)
+relative_location=$(echo "$location" | sed -e "s#^[^/]#$pwd\/&#")
+
 [ -e "$dir" ] && die "$dir/ already exists"
 mkdir "$dir"
 cd "$dir"
 
-cg-init $location || exit $?
+echo "cg-init $relative_location"
+cg-init $relative_location || exit $?
 echo "Cloned to $dir/ (origin $location available as branch \"origin\")"


-- 

Ryan Anderson
  sometimes Pug Majere

^ 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