{"thread":{"id":"477","subject":"[PATCH] cogito: replace \"git-* $(tree-id)\" with \"git-* HEAD\"","startedAt":"2005-05-04T17:48:07Z","lastAt":"2005-05-04T17:48:07Z","messageCount":1,"participants":["Rene Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"2585","messageId":"20050504174807.GA21145@lsrfire.ath.cx","threadId":"477","inReplyTo":null,"subject":"[PATCH] cogito: replace \"git-* $(tree-id)\" with \"git-* HEAD\"","fromName":"Rene Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2005-05-04T17:48:07Z","receivedAt":"2005-05-04T17:48:07Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"tree-id, when called without parameters, prints the tree ID in the\ncommit object whose ID is in .git/HEAD.  Both git-diff-cache and\ngit-read-tree (in general all GIT tools that use get_sha1()) can get\nthis ID from .git/HEAD themselves when they are called with \"HEAD\" as\nID parameter.  So this patch replaces occurences of \"git-* $(tree-id)\"\nwith \"git-* HEAD\".  This speeds things up a bit and also makes the\nintent of the git-* calls a bit more clear.\n\nSigned-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>\n\nIndex: cg-cancel\n===================================================================\n--- aa6233be6d1b8bf42797c409a7c23b50593afc99/cg-cancel  (mode:100755 sha1:4d1e6d9d112f050b402a454a4c04de4d4e379524)\n+++ 0ff2b865104800b6a0dbbe17093bfca6e8b52898/cg-cancel  (mode:100755 sha1:dab527132a33922901bc184a8e7dad57b757b991)\n@@ -26,7 +26,7 @@\n fi\n \n rm -f .git/blocked .git/merging .git/merging-sym .git/merge-base\n-git-read-tree -m $(tree-id) || git-read-tree $(tree-id)\n+git-read-tree -m HEAD || git-read-tree HEAD\n \n git-checkout-cache -f -a\n git-update-cache --refresh\nIndex: cg-commit\n===================================================================\n--- aa6233be6d1b8bf42797c409a7c23b50593afc99/cg-commit  (mode:100755 sha1:e80567a50e297d2a060773b5f10e193243ac340e)\n+++ 0ff2b865104800b6a0dbbe17093bfca6e8b52898/cg-commit  (mode:100755 sha1:8f2514eac77fb9a23d6eba4e2f748914162da3d8)\n@@ -37,7 +37,7 @@\n \t# be committed along automagically as well.\n \n \tif [ ! \"$ignorecache\" ]; then\n-\t\tchangedfiles=$(git-diff-cache $(tree-id) | cut -f 4-)\n+\t\tchangedfiles=$(git-diff-cache HEAD | cut -f 4-)\n \t\tcommitfiles=\"$addedfiles $remfiles $changedfiles\"\n \tfi\n \n@@ -79,7 +79,7 @@\n \t\techo $commitfiles | xargs git-update-cache --add --remove \\\n \t\t\t|| die \"update-cache failed\"\n \t\texport GIT_INDEX_FILE=$(mktemp -t gitci.XXXXXX)\n-\t\tgit-read-tree $(tree-id)\n+\t\tgit-read-tree HEAD\n \tfi\n \t# TODO: Do the proper separation of adds, removes, and changes.\n \techo $commitfiles | xargs git-update-cache --add --remove \\\nIndex: cg-init\n===================================================================\n--- aa6233be6d1b8bf42797c409a7c23b50593afc99/cg-init  (mode:100755 sha1:229b64901d7d8e67d900b9c8e558f18ceb3b8a5f)\n+++ 0ff2b865104800b6a0dbbe17093bfca6e8b52898/cg-init  (mode:100755 sha1:90a9d5497a0a70830094d2ee552d974819858ec4)\n@@ -22,7 +22,7 @@\n \tcg-pull origin || die \"pull failed\"\n \n \tcp .git/refs/heads/origin .git/refs/heads/master\n-\tgit-read-tree $(tree-id)\n+\tgit-read-tree HEAD\n \tgit-checkout-cache -a\n \tgit-update-cache --refresh\n \nIndex: cg-merge\n===================================================================\n--- aa6233be6d1b8bf42797c409a7c23b50593afc99/cg-merge  (mode:100755 sha1:8c3f68b26346ad02474f595b651be77fc8958aa5)\n+++ 0ff2b865104800b6a0dbbe17093bfca6e8b52898/cg-merge  (mode:100755 sha1:13b4dcf70dfa7f878c9599276c0d77908190b834)\n@@ -79,7 +79,7 @@\n \n \n [ \"$(git-diff-files -s)\" ] && git-update-cache --refresh\n-if [ \"$(git-diff-files -s)\" ] || [ \"$(git-diff-cache $(tree-id))\" ]; then\n+if [ \"$(git-diff-files -s)\" ] || [ \"$(git-diff-cache HEAD)\" ]; then\n \tdie \"merge blocked: local changes\"\n fi\n \n@@ -139,5 +139,5 @@\n readtree=\n cg-commit -C || { readtree=1 ; echo \"cg-merge: COMMIT FAILED, retry manually\" >&2; }\n \n-[ \"$readtree\" ] && git-read-tree -m $(tree-id)\n+[ \"$readtree\" ] && git-read-tree -m HEAD\n git-update-cache --refresh\nIndex: cg-seek\n===================================================================\n--- aa6233be6d1b8bf42797c409a7c23b50593afc99/cg-seek  (mode:100755 sha1:111f7842e5ec20a1e0714e162ca221da5e06ce33)\n+++ 0ff2b865104800b6a0dbbe17093bfca6e8b52898/cg-seek  (mode:100755 sha1:648c2b0db6e935d4768ca4820c91e7863e8487f4)\n@@ -45,7 +45,7 @@\n fi\n \n if [ \"$curcommit\" != \"$dstcommit\" ]; then\n-\tgit-read-tree -m $(tree-id)\n+\tgit-read-tree -m HEAD\n \tcg-diff -r $curcommit:$dstcommit | cg-patch\n \tgit-update-cache --refresh\n fi\n"}]}