{"thread":{"id":"1198","subject":"[PATCH 0/4] add write-tree --missing OK, fix cogito -N options","startedAt":"2005-07-11T03:53:15Z","lastAt":"2005-07-11T03:53:55Z","messageCount":5,"participants":["Bryan Larsen"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"5929","messageId":"20050711035305.22229.87752.sendpatchset@bryan-larsens-ibook-g4.local","threadId":"1198","inReplyTo":null,"subject":"[PATCH 0/4] add write-tree --missing OK, fix cogito -N options","fromName":"Bryan Larsen","fromEmail":"bryanlarsen@yahoo.com","sentAt":"2005-07-11T03:53:15Z","receivedAt":"2005-07-11T03:53:15Z","isPatch":true,"sender":{"key":"bryan@larsen.st","avatar":"https://avatars.githubusercontent.com/u/32073?v=4"},"body":"All of my patches have been applied to git and cogito except for the\nfirst one, the patch that adds the --no-check option to\ngit-write-tree.  This is problematic because one of the patches that\nPetr applied to cogito requires git-write-tree --no-check.\n\nAs well, there are two bugs in cg-init:  the one that Joel Becker\nfound, plus the -N option needs to be passed to cg-commit.\n\nFinally, Junio suggested that the --no-check option be renamed to\n--missing-ok.\n\nThese patches fix the situation up.\n\n1/4: bugfix for cg-init ARGV\n2/4: bugfix for cg-init.\n3/4: add --missing-ok option to git-write-tree.\n4/4: change cg-commit to use --missing-ok instead of --no-check.\n"},{"id":"5930","messageId":"20050711035316.22229.64951.sendpatchset@bryan-larsens-ibook-g4.local","threadId":"1198","inReplyTo":"20050711035305.22229.87752.sendpatchset@bryan-larsens-ibook-g4.local","subject":"[PATCH 1/4] bugfix for cg-init: ARGV","fromName":"Bryan Larsen","fromEmail":"bryanlarsen@yahoo.com","sentAt":"2005-07-11T03:53:24Z","receivedAt":"2005-07-11T03:53:24Z","isPatch":true,"sender":{"key":"bryan@larsen.st","avatar":"https://avatars.githubusercontent.com/u/32073?v=4"},"body":"Bugfix: nasty typo (ARGV instead of ARGS) in my last patch to cg-init.\n\nSigned off by: Bryan Larsen <bryan.larsen@gmail.com>\n---\n\ndiff --git a/cg-init b/cg-init\n--- a/cg-init\n+++ b/cg-init\n@@ -33,7 +33,7 @@ while optparse; do\n \tfi\n done\n \n-uri=$ARGV\n+uri=$ARGS\n \n [ -e $_git ] && die \"$_git already exists\"\n \n"},{"id":"5933","messageId":"20050711035327.22229.20563.sendpatchset@bryan-larsens-ibook-g4.local","threadId":"1198","inReplyTo":"20050711035305.22229.87752.sendpatchset@bryan-larsens-ibook-g4.local","subject":"[PATCH 2/4] bugfix for cg-init -N: pass -N to cg-commit","fromName":"Bryan Larsen","fromEmail":"bryanlarsen@yahoo.com","sentAt":"2005-07-11T03:53:36Z","receivedAt":"2005-07-11T03:53:36Z","isPatch":true,"sender":{"key":"bryan@larsen.st","avatar":"https://avatars.githubusercontent.com/u/32073?v=4"},"body":"Bugfix for cg-init -N:  the -N option needs to be passed down into cg-commit as well.\n\nSigned-off-by: Bryan Larsen <bryan.larsen@gmail.com>\n---\n\ndiff --git a/cg-init b/cg-init\n--- a/cg-init\n+++ b/cg-init\n@@ -56,7 +56,7 @@ if [ \"$uri\" ]; then\n else\n \tgit-read-tree # Seed the dircache\n \tfind * \\( -type f -o -type l \\) -print0 | xargs -0r cg-add ${infoonly}\n-\tcg-commit -C -m\"Initial commit\" -E\n+\tcg-commit -C -m\"Initial commit\" -E ${infoonly}\n fi\n \n trap \"\" SIGTERM EXIT\n"},{"id":"5931","messageId":"20050711035338.22229.47651.sendpatchset@bryan-larsens-ibook-g4.local","threadId":"1198","inReplyTo":"20050711035305.22229.87752.sendpatchset@bryan-larsens-ibook-g4.local","subject":"[PATCH 3/4] add --missing-ok option to write-tree","fromName":"Bryan Larsen","fromEmail":"bryanlarsen@yahoo.com","sentAt":"2005-07-11T03:53:44Z","receivedAt":"2005-07-11T03:53:44Z","isPatch":true,"sender":{"key":"bryan@larsen.st","avatar":"https://avatars.githubusercontent.com/u/32073?v=4"},"body":"Add --missing-ok option to git-write.tree.  This option allows a write-tree even if the referenced objects are not in the database.\n\nSigned-off-by: Bryan Larsen <bryan.larsen@gmail.com>\n---\n\ndiff --git a/Documentation/git-write-tree.txt b/Documentation/git-write-tree.txt\n--- a/Documentation/git-write-tree.txt\n+++ b/Documentation/git-write-tree.txt\n@@ -10,6 +10,7 @@ git-write-tree - Creates a tree from the\n SYNOPSIS\n --------\n 'git-write-tree'\n+\t\t[--missing-ok]\n \n DESCRIPTION\n -----------\n@@ -23,7 +24,11 @@ In order to have that match what is actu\n now, you need to have done a \"git-update-cache\" phase before you did the\n \"git-write-tree\".\n \n-\n+OPTIONS\n+-------\n+--missing-ok::\n+\tNormally \"git-write-tree\" ensures that the objects referenced by the\n+\tdirectory exist in the object database.  This option disables this check.\n \n \n ////////////////////////////////////////////////////////////////\ndiff --git a/write-tree.c b/write-tree.c\n--- a/write-tree.c\n+++ b/write-tree.c\n@@ -5,6 +5,8 @@\n  */\n #include \"cache.h\"\n \n+static int missing_ok = 0;\n+\n static int check_valid_sha1(unsigned char *sha1)\n {\n \tint ret;\n@@ -61,7 +63,7 @@ static int write_tree(struct cache_entry\n \t\t\tsha1 = subdir_sha1;\n \t\t}\n \n-\t\tif (check_valid_sha1(sha1) < 0)\n+\t\tif (!missing_ok && check_valid_sha1(sha1) < 0)\n \t\t\texit(1);\n \n \t\tentrylen = pathlen - baselen;\n@@ -86,6 +88,16 @@ int main(int argc, char **argv)\n \tint i, funny;\n \tint entries = read_cache();\n \tunsigned char sha1[20];\n+\t\n+\tif (argc==2) {\n+\t\tif (!strcmp(argv[1], \"--missing-ok\"))\n+\t\t\tmissing_ok = 1;\n+\t\telse\n+\t\t\tdie(\"unknown option %s\", argv[1]);\n+\t}\n+\t\n+\tif (argc>2)\n+\t\tdie(\"too many options\");\n \n \tif (entries < 0)\n \t\tdie(\"git-write-tree: error reading cache\");\n"},{"id":"5932","messageId":"20050711035349.22229.2989.sendpatchset@bryan-larsens-ibook-g4.local","threadId":"1198","inReplyTo":"20050711035305.22229.87752.sendpatchset@bryan-larsens-ibook-g4.local","subject":"[PATCH 4/4] switch cg-commit -N to use --missing-ok instead of --no-check","fromName":"Bryan Larsen","fromEmail":"bryanlarsen@yahoo.com","sentAt":"2005-07-11T03:53:55Z","receivedAt":"2005-07-11T03:53:55Z","isPatch":true,"sender":{"key":"bryan@larsen.st","avatar":"https://avatars.githubusercontent.com/u/32073?v=4"},"body":"Make cg-commit aware of the rename of git-write-tree --no-check to --missing-ok.\n\nSigned-off-by: Bryan Larsen <bryan.larsen@gmail.com>\n---\n\ndiff --git a/cg-commit b/cg-commit\n--- a/cg-commit\n+++ b/cg-commit\n@@ -111,13 +111,13 @@ forceeditor=\n ignorecache=\n infoonly=\n commitalways=\n-nocheck=\n+missingok=\n msgs=()\n while optparse; do\n \tif optparse -C; then\n \t\tignorecache=1\n \telif optparse -N; then\n-\t\tnocheck=--no-check\n+\t\tmissingok=--missing-ok\n \t\tinfoonly=--info-only\n \telif optparse -e; then\n \t\tforceeditor=1\n@@ -311,7 +311,7 @@ if [ -s \"$_git/HEAD\" ]; then\n \toldheadstr=\"-p $oldhead\"\n fi\n \n-treeid=$(git-write-tree ${nocheck})\n+treeid=$(git-write-tree ${missingok})\n [ \"$treeid\" ] || die \"git-write-tree failed\"\n if [ ! \"$force\" ] && [ ! \"$merging\" ] && [ \"$oldhead\" ] &&\n    [ \"$treeid\" = \"$(tree-id)\" ]; then\n"}]}