{"thread":{"id":"8","subject":"[ANNOUNCE] git-pasky-0.4","startedAt":"2005-04-14T00:19:38Z","lastAt":"2005-04-14T10:33:33Z","messageCount":2,"participants":["Petr Baudis","Russell King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"26","messageId":"20050414001938.GR25711@pasky.ji.cz","threadId":"8","inReplyTo":null,"subject":"[ANNOUNCE] git-pasky-0.4","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-04-14T00:19:38Z","receivedAt":"2005-04-14T00:19:38Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"  Hello,\n\n  I'm happy to announce git-pasky-0.4, my set of scripts upon Linus\nTorvald's git, which aims to provide a humanly usable interface, to a\ndegree similar to a SCM tool. You can get it at\n\n\thttp://pasky.or.cz/~pasky/dev/git/\n\n  See the READMEs etc for some introduction.\n\n  It is difficult to sum up the changes, since so much has changed,\nincluding almost the complete tree history, which was cleaned up and\nsanitized. Things should be faster, better, less buggy and generally\nsmoother.\n\n  My immediate plans are to support several working trees connected to a\nsingle object database. The scenes are set, prepared, and it should be\neasy. Then, supporting merges in a separate temporary tree will be a\nbreeze. ;-)\n\n  Have fun,\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"64","messageId":"20050414113333.A3904@flint.arm.linux.org.uk","threadId":"8","inReplyTo":"20050414001938.GR25711@pasky.ji.cz","subject":"Re: [ANNOUNCE] git-pasky-0.4","fromName":"Russell King","fromEmail":"rmk@arm.linux.org.uk","sentAt":"2005-04-14T10:33:33Z","receivedAt":"2005-04-14T10:33:33Z","isPatch":false,"sender":{"key":"rmk@arm.linux.org.uk","avatar":null},"body":"On Thu, Apr 14, 2005 at 02:19:38AM +0200, Petr Baudis wrote:\n>   I'm happy to announce git-pasky-0.4, my set of scripts upon Linus\n> Torvald's git, which aims to provide a humanly usable interface, to a\n> degree similar to a SCM tool.\n\nHere's my updated patch, against latest git-pasky.  Now using\nhton*/ntoh* directly rather than wrapping them.  Enjoy.\n\n--- cache.h\n+++ cache.h\tThu Apr 14 11:27:22 2005\n@@ -14,6 +14,8 @@\n #include <openssl/sha.h>\n #include <zlib.h>\n \n+#include <netinet/in.h>\n+\n /*\n  * Basic data structures for the directory cache\n  *\n@@ -67,7 +69,7 @@\n #define DEFAULT_DB_ENVIRONMENT \".git/objects\"\n \n #define cache_entry_size(len) ((offsetof(struct cache_entry,name) + (len) + 8) & ~7)\n-#define ce_size(ce) cache_entry_size((ce)->namelen)\n+#define ce_size(ce) cache_entry_size(ntohs((ce)->namelen))\n \n #define alloc_nr(x) (((x)+16)*3/2)\n \n--- checkout-cache.c\n+++ checkout-cache.c\tThu Apr 14 11:25:40 2005\n@@ -77,7 +77,7 @@\n \t\treturn error(\"checkout-cache: unable to read sha1 file of %s (%s)\",\n \t\t\tce->name, sha1_to_hex(ce->sha1));\n \t}\n-\tfd = create_file(ce->name, ce->st_mode);\n+\tfd = create_file(ce->name, ntohl(ce->st_mode));\n \tif (fd < 0) {\n \t\tfree(new);\n \t\treturn error(\"checkout-cache: unable to create %s (%s)\",\n--- read-cache.c\n+++ read-cache.c\tThu Apr 14 11:25:40 2005\n@@ -288,27 +288,34 @@\n \t/* nsec seems unreliable - not all filesystems support it, so\n \t * as long as it is in the inode cache you get right nsec\n \t * but after it gets flushed, you get zero nsec. */\n-\tif (ce->mtime.sec  != (unsigned int)st->st_mtim.tv_sec\n+#if 0\n+\tif (ntohl(ce->mtime.sec)  != (unsigned int)st->st_mtim.tv_sec\n #ifdef NSEC\n-\t    || ce->mtime.nsec != (unsigned int)st->st_mtim.tv_nsec\n+\t    || ntohl(ce->mtime.nsec) != (unsigned int)st->st_mtim.tv_nsec\n #endif\n \t    )\n \t\tchanged |= MTIME_CHANGED;\n-\tif (ce->ctime.sec  != (unsigned int)st->st_ctim.tv_sec\n+\tif (ntohl(ce->ctime.sec)  != (unsigned int)st->st_ctim.tv_sec\n #ifdef NSEC\n-\t    || ce->ctime.nsec != (unsigned int)st->st_ctim.tv_nsec\n+\t    || ntohl(ce->ctime.nsec) != (unsigned int)st->st_ctim.tv_nsec\n #endif\n \t    )\n \t\tchanged |= CTIME_CHANGED;\n-\tif (ce->st_uid != (unsigned int)st->st_uid ||\n-\t    ce->st_gid != (unsigned int)st->st_gid)\n+#else\n+\tif (ntohl(ce->mtime.sec)  != (unsigned int)st->st_mtime)\n+\t\tchanged |= MTIME_CHANGED;\n+\tif (ntohl(ce->ctime.sec)  != (unsigned int)st->st_ctime)\n+\t\tchanged |= CTIME_CHANGED;\n+#endif\n+\tif (ntohl(ce->st_uid) != (unsigned int)st->st_uid ||\n+\t    ntohl(ce->st_gid) != (unsigned int)st->st_gid)\n \t\tchanged |= OWNER_CHANGED;\n-\tif (ce->st_mode != (unsigned int)st->st_mode)\n+\tif (ntohl(ce->st_mode) != (unsigned int)st->st_mode)\n \t\tchanged |= MODE_CHANGED;\n-\tif (ce->st_dev != (unsigned int)st->st_dev ||\n-\t    ce->st_ino != (unsigned int)st->st_ino)\n+\tif (ntohl(ce->st_dev) != (unsigned int)st->st_dev ||\n+\t    ntohl(ce->st_ino) != (unsigned int)st->st_ino)\n \t\tchanged |= INODE_CHANGED;\n-\tif (ce->st_size != (unsigned int)st->st_size)\n+\tif (ntohl(ce->st_size) != (unsigned int)st->st_size)\n \t\tchanged |= DATA_CHANGED;\n \treturn changed;\n }\n@@ -337,7 +344,7 @@\n \twhile (last > first) {\n \t\tint next = (last + first) >> 1;\n \t\tstruct cache_entry *ce = active_cache[next];\n-\t\tint cmp = cache_name_compare(name, namelen, ce->name, ce->namelen);\n+\t\tint cmp = cache_name_compare(name, namelen, ce->name, ntohs(ce->namelen));\n \t\tif (!cmp)\n \t\t\treturn next;\n \t\tif (cmp < 0) {\n@@ -364,7 +371,7 @@\n {\n \tint pos;\n \n-\tpos = cache_name_pos(ce->name, ce->namelen);\n+\tpos = cache_name_pos(ce->name, ntohs(ce->namelen));\n \n \t/* existing match? Just replace it */\n \tif (pos >= 0) {\n@@ -395,9 +402,9 @@\n \tSHA_CTX c;\n \tunsigned char sha1[20];\n \n-\tif (hdr->signature != CACHE_SIGNATURE)\n+\tif (hdr->signature != htonl(CACHE_SIGNATURE))\n \t\treturn error(\"bad signature\");\n-\tif (hdr->version != 1)\n+\tif (hdr->version != htonl(1))\n \t\treturn error(\"bad version\");\n \tSHA1_Init(&c);\n \tSHA1_Update(&c, hdr, offsetof(struct cache_header, sha1));\n@@ -445,12 +452,12 @@\n \tif (verify_hdr(hdr, size) < 0)\n \t\tgoto unmap;\n \n-\tactive_nr = hdr->entries;\n+\tactive_nr = ntohl(hdr->entries);\n \tactive_alloc = alloc_nr(active_nr);\n \tactive_cache = calloc(active_alloc, sizeof(struct cache_entry *));\n \n \toffset = sizeof(*hdr);\n-\tfor (i = 0; i < hdr->entries; i++) {\n+\tfor (i = 0; i < ntohl(hdr->entries); i++) {\n \t\tstruct cache_entry *ce = map + offset;\n \t\toffset = offset + ce_size(ce);\n \t\tactive_cache[i] = ce;\n@@ -469,9 +476,9 @@\n \tstruct cache_header hdr;\n \tint i;\n \n-\thdr.signature = CACHE_SIGNATURE;\n-\thdr.version = 1;\n-\thdr.entries = entries;\n+\thdr.signature = htonl(CACHE_SIGNATURE);\n+\thdr.version = htonl(1);\n+\thdr.entries = htonl(entries);\n \n \tSHA1_Init(&c);\n \tSHA1_Update(&c, &hdr, offsetof(struct cache_header, sha1));\n--- read-tree.c\n+++ read-tree.c\tThu Apr 14 11:25:11 2005\n@@ -13,8 +13,8 @@\n \n \tmemset(ce, 0, size);\n \n-\tce->st_mode = mode;\n-\tce->namelen = baselen + len;\n+\tce->st_mode = htonl(mode);\n+\tce->namelen = htons(baselen + len);\n \tmemcpy(ce->name, base, baselen);\n \tmemcpy(ce->name + baselen, pathname, len+1);\n \tmemcpy(ce->sha1, sha1, 20);\n--- show-diff.c\n+++ show-diff.c\tThu Apr 14 11:25:28 2005\n@@ -90,7 +90,7 @@\n \t\tchanged = cache_match_stat(ce, &st);\n \t\tif (!changed)\n \t\t\tcontinue;\n-\t\tprintf(\"%.*s:  \", ce->namelen, ce->name);\n+\t\tprintf(\"%.*s:  \", ntohs(ce->namelen), ce->name);\n \t\tfor (n = 0; n < 20; n++)\n \t\t\tprintf(\"%02x\", ce->sha1[n]);\n \t\tprintf(\"\\n\");\n--- update-cache.c\n+++ update-cache.c\tThu Apr 14 11:30:07 2005\n@@ -68,18 +68,18 @@\n  */\n static void fill_stat_cache_info(struct cache_entry *ce, struct stat *st)\n {\n-\tce->ctime.sec = st->st_ctime;\n+\tce->ctime.sec = htonl(st->st_ctime);\n #ifdef NSEC\n-\tce->ctime.nsec = st->st_ctim.tv_nsec;\n+\tce->ctime.nsec = htonl(st->st_ctim.tv_nsec);\n #endif\n-\tce->mtime.sec = st->st_mtime;\n+\tce->mtime.sec = htonl(st->st_mtime);\n #ifdef NSEC\n-\tce->mtime.nsec = st->st_mtim.tv_nsec;\n+\tce->mtime.nsec = htonl(st->st_mtim.tv_nsec);\n #endif\n-\tce->st_dev = st->st_dev;\n-\tce->st_ino = st->st_ino;\n-\tce->st_uid = st->st_uid;\n-\tce->st_gid = st->st_gid;\n+\tce->st_dev = htonl(st->st_dev);\n+\tce->st_ino = htonl(st->st_ino);\n+\tce->st_uid = htonl(st->st_uid);\n+\tce->st_gid = htonl(st->st_gid);\n }\n \n static int add_file_to_cache(char *path)\n@@ -107,9 +107,9 @@\n \tmemset(ce, 0, size);\n \tmemcpy(ce->name, path, namelen);\n \tfill_stat_cache_info(ce, &st);\n-\tce->st_mode = st.st_mode;\n-\tce->st_size = st.st_size;\n-\tce->namelen = namelen;\n+\tce->st_mode = htonl(st.st_mode);\n+\tce->st_size = htonl(st.st_size);\n+\tce->namelen = htons(namelen);\n \n \tif (index_fd(path, namelen, ce, fd, &st) < 0)\n \t\treturn -1;\n@@ -190,7 +190,7 @@\n \tupdated = malloc(size);\n \tmemcpy(updated, ce, size);\n \tfill_stat_cache_info(updated, &st);\n-\tupdated->st_size = st.st_size;\n+\tupdated->st_size = htonl(st.st_size);\n \treturn updated;\n }\n \n--- write-tree.c\n+++ write-tree.c\tThu Apr 14 11:25:40 2005\n@@ -45,7 +45,7 @@\n \tdo {\n \t\tstruct cache_entry *ce = cachep[nr];\n \t\tconst char *pathname = ce->name, *filename, *dirname;\n-\t\tint pathlen = ce->namelen, entrylen;\n+\t\tint pathlen = ntohs(ce->namelen), entrylen;\n \t\tunsigned char *sha1;\n \t\tunsigned int mode;\n \n@@ -54,7 +54,7 @@\n \t\t\tbreak;\n \n \t\tsha1 = ce->sha1;\n-\t\tmode = ce->st_mode;\n+\t\tmode = ntohl(ce->st_mode);\n \n \t\t/* Do we have _further_ subdirectories? */\n \t\tfilename = pathname + baselen;\n\n-- \nRussell King\n\n"}]}