{"thread":{"id":"1871","subject":"[PATCH 2/8] cogito: Fix all users of the old *-id scripts.","startedAt":"2005-09-20T02:13:11Z","lastAt":"2005-09-20T02:13:11Z","messageCount":1,"participants":["Pavel Roskin"],"isPatch":true,"patchVersion":1,"patchTotal":8},"messages":[{"id":"8947","messageId":"1127182391.31115.18.camel@dv","threadId":"1871","inReplyTo":null,"subject":"[PATCH 2/8] cogito: Fix all users of the old *-id scripts.","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-09-20T02:13:11Z","receivedAt":"2005-09-20T02:13:11Z","isPatch":true,"sender":{"key":"proski@gnu.org","avatar":null},"body":"Fix all users of the old *-id scripts.\n\nUse cg-object-id instead.\n\ndiff --git a/Documentation/make-cogito-asciidoc b/Documentation/make-cogito-asciidoc\n--- a/Documentation/make-cogito-asciidoc\n+++ b/Documentation/make-cogito-asciidoc\n@@ -123,12 +123,12 @@ COMMIT_ID, FROM_ID, TO_ID, BASE_COMMIT::\n \t- empty string, 'this' or 'HEAD' (current HEAD)\n \t- branch name (as registered with $(man 1 cg-branch-add))\n \t- tag name (as registered with $(man 1 cg-tag))\n \t- date string (as recognized by the 'date' tool)\n \t- shortcut object hash (shorted unambiguous hash lead)\n-\t- commit object hash (as returned by 'cg-commit-id')\n-\t- tree object hash (as returned by 'cg-tree-id')\n+\t- commit object hash (as returned by 'cg-object-id')\n+\t- tree object hash (as returned by 'cg-object-id -t')\n \n TAG_NAME::\n \tIndicates a free form tag name.\n \n OBJECT_TYPE::\ndiff --git a/cg-Xnormid b/cg-Xnormid\n--- a/cg-Xnormid\n+++ b/cg-Xnormid\n@@ -15,12 +15,12 @@\n . ${COGITO_LIB}cg-Xlib || exit 1\n \n id=\"$1\"\n \n if [ \"${id:(-1):1}\" = \"^\" ]; then\n-\t# cg-parent-id\n-\tid=$(cg-commit-id \"${id%^}\") || exit 1\n+\t# find parent\n+\tid=$(cg-object-id \"${id%^}\") || exit 1\n \tgit-cat-file commit \"$id\" | awk '/^parent/{print $2,\" \"};/^$/{exit}' || exit 1\n \texit\n fi\n \n if [ ! \"$id\" ] || [ \"$id\" = \"this\" ] || [ \"$id\" = \"HEAD\" ]; then\ndiff --git a/cg-admin-cat b/cg-admin-cat\n--- a/cg-admin-cat\n+++ b/cg-admin-cat\n@@ -34,11 +34,11 @@ while optparse; do\n \tfi\n done\n \n [ \"$ARGS\" ] || usage\n \n-id=$(cg-tree-id \"$rev\") || exit 1\n+id=$(cg-object-id -t \"$rev\") || exit 1\n \n git-ls-tree \"$id\" \"${ARGS[@]}\" |\n \twhile read -r mode type sha name\n \tdo\n \t\tcase \"$type\" in\ndiff --git a/cg-admin-ls b/cg-admin-ls\n--- a/cg-admin-ls\n+++ b/cg-admin-ls\n@@ -40,8 +40,8 @@ while optparse; do\n \telse\n \t\toptfail\n \tfi\n done\n \n-id=$(cg-tree-id $tree_id) || exit 1\n+id=$(cg-object-id -t $tree_id) || exit 1\n \n git-ls-tree \"$id\" \"${ARGS[@]}\"\ndiff --git a/cg-admin-uncommit b/cg-admin-uncommit\n--- a/cg-admin-uncommit\n+++ b/cg-admin-uncommit\n@@ -43,17 +43,17 @@ while optparse; do\n \t\toptfail\n \tfi\n done\n \n \n-base=$(cg-commit-id) || exit 1\n+base=$(cg-object-id) || exit 1\n \n-commit=$(cg-commit-id \"$1\") || exit 1\n+commit=$(cg-object-id \"$1\") || exit 1\n git-rev-list $base | grep -q $commit || \\\n \tdie \"$commit: not an ancestor of HEAD\"\n \n-parent=$(cg-parent-id \"$commit\") || exit 1\n+parent=$(cg-object-id -p \"$commit\") || exit 1\n [ \"$parent\" ] || die \"cannot rewind behind the initial commit\"\n \n \n echo \"Rewinding $base (HEAD) -> $parent\" >&2\n \ndiff --git a/cg-branch-add b/cg-branch-add\n--- a/cg-branch-add\n+++ b/cg-branch-add\n@@ -31,11 +31,11 @@\n # $GIT_DIR/branches/BRANCH_NAME::\n #\tContains the source location of the remote branch.\n #\n # $GIT_DIR/refs/heads/BRANCH_NAME::\n # \tContains pointer to the latest commit in a branch. It can be more\n-#\tconveniently retrieved using `cg-commit-id BRANCH_NAME`.\n+#\tconveniently retrieved using `cg-object-id BRANCH_NAME`.\n #\n # EXAMPLE USAGE\n # -------------\n # Let's say you have a repository at `git+ssh://host/path/repo.git` and you\n # want to fetch its 'testing' branch to your local repository. In that case\ndiff --git a/cg-commit b/cg-commit\n--- a/cg-commit\n+++ b/cg-commit\n@@ -156,11 +156,11 @@ while optparse; do\n \telif optparse -f; then\n \t\tforce=1\n \telif optparse -m=; then\n \t\tmsgs[${#msgs[@]}]=\"$OPTARG\"\n \telif optparse -c=; then\n-\t\tcopy_commit=\"$(cg-commit-id \"$OPTARG\")\"\n+\t\tcopy_commit=\"$(cg-object-id \"$OPTARG\")\"\n \telse\n \t\toptfail\n \tfi\n done\n \n@@ -388,11 +388,11 @@ if [ -s \"$_git/HEAD\" ]; then\n fi\n \n treeid=$(git-write-tree ${missingok})\n [ \"$treeid\" ] || die \"git-write-tree failed\"\n if [ ! \"$force\" ] && [ ! \"$merging\" ] && [ \"$oldhead\" ] &&\n-   [ \"$treeid\" = \"$(cg-tree-id)\" ]; then\n+   [ \"$treeid\" = \"$(cg-object-id -t)\" ]; then\n \techo \"Refusing to make an empty commit - the tree was not modified\" >&2\n \techo \"since the previous commit. If you really want to make the\" >&2\n \techo \"commit, pass cg-commit the -f argument.\" >&2\n \texit 2;\n fi\ndiff --git a/cg-diff b/cg-diff\n--- a/cg-diff\n+++ b/cg-diff\n@@ -125,19 +125,19 @@ while optparse; do\n done\n \n if [ \"$parent\" ]; then\n \tid2=\"$id1\"\n \tid=\"$id2\"; [ \"$id\" = \" \" ] && id=\"\"\n-\tid1=$(cg-parent-id \"$id\" | head -n 1) || exit 1\n+\tid1=$(cg-object-id -p \"$id\" | head -n 1) || exit 1\n \t[ \"$id1\" ] || exit 1\n fi\n \n if [ \"$mergebase\" ]; then\n \t[ \"$id1\" != \" \" ] || id1=\"HEAD\"\n \t[ \"$id2\" != \" \" ] || id2=\"origin\"\n-\tid1=$(cg-commit-id \"$id1\") || exit 1\n-\tid2=$(cg-commit-id \"$id2\") || exit 1\n+\tid1=$(cg-object-id \"$id1\") || exit 1\n+\tid2=$(cg-object-id \"$id2\") || exit 1\n \tid1=$(git-merge-base $id1 $id2) || exit 1\n fi\n \n \n filter=$(mktemp -t gitdiff.XXXXXX)\n@@ -146,13 +146,13 @@ for file in \"${ARGS[@]}\"; do\n \techo \"${_git_relpath}$file\" >>$filter\n done\n \n if [ \"$id2\" = \" \" ]; then\n \tif [ \"$id1\" != \" \" ]; then\n-\t\ttree=$(cg-tree-id \"$id1\") || exit 1\n+\t\ttree=$(cg-object-id -t \"$id1\") || exit 1\n \telse\n-\t\ttree=$(cg-tree-id) || exit 1\n+\t\ttree=$(cg-object-id -t) || exit 1\n \tfi\n \n \t# Ensure to only diff modified files\n \tgit-update-index --refresh >/dev/null\n \n@@ -166,12 +166,12 @@ if [ \"$id2\" = \" \" ]; then\n \t[ \"$ret\" ] && die \"no files matched\"\n \texit $ret\n fi\n \n \n-id1=$(cg-tree-id \"$id1\") || exit 1\n-id2=$(cg-tree-id \"$id2\") || exit 1\n+id1=$(cg-object-id -t \"$id1\") || exit 1\n+id2=$(cg-object-id -t \"$id2\") || exit 1\n \n [ \"$id1\" = \"$id2\" ] && exit 0\n \n cat $filter | path_xargs git-diff-tree -r -p $id1 $id2 | colorize | pager\n \ndiff --git a/cg-export b/cg-export\n--- a/cg-export\n+++ b/cg-export\n@@ -15,16 +15,16 @@ _git_requires_root=1\n \n . ${COGITO_LIB}cg-Xlib || exit 1\n \n if [ \"$1\" = \"-r\" ]; then\n \tshift\n-\t# We do not resolve to cg-tree-id since git-tar-tree can utilize some commit\n+\t# We do not resolve to tree id since git-tar-tree can utilize some commit\n \t# information.\n-\tid=\"$(cg-commit-id \"$1\" 2>/dev/null)\" || id=\"$1\"\n+\tid=\"$(cg-object-id \"$1\" 2>/dev/null)\" || id=\"$1\"\n \tshift\n else\n-\tid=\"$(cg-commit-id)\"\n+\tid=\"$(cg-object-id)\"\n fi\n \n dest=$1\n \n ([ \"$dest\" ] && [ \"$id\" ]) || usage\n@@ -50,11 +50,11 @@ case $dest in\n \t\tesac\n \t\t;;\n \t*)\n \t\tmkdir -p $dest || die \"cannot create $dest\"\n \t\texport GIT_INDEX_FILE=\"$dest/.git-index\"\n-\t\tid=\"$(cg-tree-id \"$id\")\"\n+\t\tid=\"$(cg-object-id -t \"$id\")\"\n \t\tgit-read-tree $id\n \t\tgit-checkout-index \"--prefix=$dest/\" -a\n \t\trm $GIT_INDEX_FILE\n \t;;\n esac\ndiff --git a/cg-fetch b/cg-fetch\n--- a/cg-fetch\n+++ b/cg-fetch\n@@ -392,13 +392,13 @@ if [ ! \"$orig_head\" ]; then\n \techo \"New branch: $new_head\"\n \n elif [ \"$orig_head\" != \"$new_head\" ]; then\n \techo \"Tree change: $orig_head:$new_head\"\n \tif [ \"$verbose\" ] ; then\n-\t\tgit-diff-tree -r $(cg-tree-id $orig_head) $(cg-tree-id $new_head)\n+\t\tgit-diff-tree -r $(cg-object-id -t $orig_head) $(cg-object-id -t $new_head)\n \telse\n-\t\tgit-diff-tree -r $(cg-tree-id $orig_head) $(cg-tree-id $new_head) | awk '{ print $5\" \"$6 }'\n+\t\tgit-diff-tree -r $(cg-object-id -t $orig_head) $(cg-object-id -t $new_head) | awk '{ print $5\" \"$6 }'\n \tfi\n else\n \techo \"Up to date.\"\n \texit\n fi\ndiff --git a/cg-help b/cg-help\n--- a/cg-help\n+++ b/cg-help\n@@ -101,11 +101,11 @@ These expressions can be used interchang\n \tempty string, \"this\" or \"HEAD\" (current HEAD)\n \tbranch name (as registered with cg-branch-add)\n \ttag name (as registered with cg-tag)\n \tdate string (as recognized by the date tool)\n \tshortcut hash (shorted unambiguous hash lead)\n-\tcommit object hash (as returned by cg-commit-id)\n+\tcommit object hash (as returned by cg-object-id)\n \ttree object hash (accepted only by some commands)\n \n For details on individual commands, do e.g.:\n \tcg-help cg-log\n \tcg-log --help\ndiff --git a/cg-log b/cg-log\n--- a/cg-log\n+++ b/cg-log\n@@ -283,18 +283,18 @@ done\n \n \n if [ \"$mergebase\" ]; then\n \t[ \"$log_start\" ] || log_start=\"HEAD\"\n \t[ \"$log_end\" ] || log_end=\"origin\"\n-\tid1=$(cg-commit-id \"$log_start\") || exit 1\n-\tid2=$(cg-commit-id \"$log_end\") || exit 1\n+\tid1=$(cg-object-id \"$log_start\") || exit 1\n+\tid2=$(cg-object-id \"$log_end\") || exit 1\n \tlog_start=$(git-merge-base $id1 $id2) || exit 1\n fi\n \n-id1=\"$(cg-commit-id \"$log_start\")\" || exit 1\n+id1=\"$(cg-object-id \"$log_start\")\" || exit 1\n if [ \"$log_end\" ]; then\n-\tid2=\"$(cg-commit-id \"$log_end\")\" || exit 1\n+\tid2=\"$(cg-object-id \"$log_end\")\" || exit 1\n \trevls=\"git-rev-list --pretty=raw $id2 ^$id1\"\n else\n \trevls=\"git-rev-list --pretty=raw $id1\"\n fi\n \ndiff --git a/cg-merge b/cg-merge\n--- a/cg-merge\n+++ b/cg-merge\n@@ -74,29 +74,29 @@ posthook()\n \t\t$_git/hooks/merge-post \"$branchname\" \"$base\" \"$head\" \"$branch\" \"$@\"\n \tfi\n }\n \n \n-head=$(cg-commit-id) || exit 1\n+head=$(cg-object-id) || exit 1\n \n \n careful=\n base=\n while optparse; do\n \tif optparse -c; then\n \t\tcareful=1\n \telif optparse -b=; then\n-\t\tbase=$(cg-commit-id \"$OPTARG\") || exit 1\n+\t\tbase=$(cg-object-id \"$OPTARG\") || exit 1\n \telse\n \t\toptfail\n \tfi\n done\n \n branchname=\"${ARGS[0]}\"\n [ \"$branchname\" ] || { [ -s $_git/refs/heads/origin ] && branchname=origin; }\n [ \"$branchname\" ] || die \"what to merge?\"\n-branch=$(cg-commit-id \"$branchname\") || exit 1\n+branch=$(cg-object-id \"$branchname\") || exit 1\n \n [ \"$base\" ] || base=$(git-merge-base \"$head\" \"$branch\")\n [ \"$base\" ] || die \"unable to automatically determine merge base\"\n \n \n@@ -133,11 +133,11 @@ echo \"Merging $base -> $branch\" >&2\n echo -e \"\\tto $head...\" >&2\n \n \n prehook tree\n \n-if ! git-read-tree -u -m $(cg-tree-id $base) $(cg-tree-id $head) $(cg-tree-id $branch); then\n+if ! git-read-tree -u -m $(cg-object-id -t $base) $(cg-object-id -t $head) $(cg-object-id -t $branch); then\n \techo \"cg-merge: git-read-tree failed (merge likely blocked by local changes)\" >&2\n \tposthook tree localchanges\n \texit 1\n fi\n \ndiff --git a/cg-mkpatch b/cg-mkpatch\n--- a/cg-mkpatch\n+++ b/cg-mkpatch\n@@ -127,18 +127,18 @@ while optparse; do\n done\n \n if [ \"$mergebase\" ]; then\n \t[ \"$log_start\" ] || log_start=\"HEAD\"\n \t[ \"$log_end\" ] || log_end=\"origin\"\n-\tid1=$(cg-commit-id \"$log_start\") || exit 1\n-\tid2=$(cg-commit-id \"$log_end\") || exit 1\n+\tid1=$(cg-object-id \"$log_start\") || exit 1\n+\tid2=$(cg-object-id \"$log_end\") || exit 1\n \tlog_start=$(git-merge-base $id1 $id2) || exit 1\n fi\n \n if [ \"$log_end\" ]; then\n-\tid1=$(cg-commit-id \"$log_start\") || exit 1\n-\tid2=$(cg-commit-id \"$log_end\") || exit 1\n+\tid1=$(cg-object-id \"$log_start\") || exit 1\n+\tid2=$(cg-object-id \"$log_end\") || exit 1\n \n \tif [ \"$outdir\" ]; then\n \t\tmkdir -p \"$outdir\" || die \"cannot create patch directory\"\n \t\tpnum=001\n \tfi\n@@ -169,8 +169,8 @@ if [ \"$log_end\" ]; then\n \t\tfi\n \tdone\n \n else\n \t[ \"$outdir\" ] && die \"-d makes sense only for patch series\"\n-\tid=$(cg-commit-id \"$log_start\") || exit 1\n+\tid=$(cg-object-id \"$log_start\") || exit 1\n \tshowpatch $id\n fi\ndiff --git a/cg-seek b/cg-seek\n--- a/cg-seek\n+++ b/cg-seek\n@@ -27,20 +27,20 @@ _git_requires_root=1\n dstcommit=$1\n \n \n [ -s $_git/blocked ] && grep -vq '^seeked from ' $_git/blocked && die \"action blocked: $(cat $_git/blocked)\"\n \n-curcommit=$(cg-commit-id) || exit 1\n+curcommit=$(cg-object-id) || exit 1\n \n if [ \"$dstcommit\" ] && [ \"$dstcommit\" != \"$_git_head\" ]; then\n \tseek_mode=away\n else\n \tseek_mode=back\n-\tdstcommit=$(cg-commit-id \"$_git_head\") || exit 1\n+\tdstcommit=$(cg-object-id \"$_git_head\") || exit 1\n fi\n \n-dstcommit=$(cg-commit-id \"$dstcommit\") || exit 1\n+dstcommit=$(cg-object-id \"$dstcommit\") || exit 1\n if [ \"$curcommit\" != \"$dstcommit\" ]; then\n \ttree_timewarp --no-head-update \"along\" \"please rollback\" $curcommit $dstcommit\n fi\n \n if [ \"$seek_mode\" = \"away\" ]; then\ndiff --git a/cg-upload b/cg-upload\n--- a/cg-upload\n+++ b/cg-upload\n@@ -43,18 +43,18 @@ elif echo \"$uri\" | grep -q \":\"; then\n \tdie \"uploading over rsync not supported\"\n else\n \tremgit=\"$uri\"; [ -d \"$remgit/.git\" ] && remgit=\"$remgit/.git\"\n \tif is_same_repo \"$_git_objects\" \"$remgit/objects\"; then\n \t\tremid=\"$(cat \"$remgit\"/refs/heads/$rembranch)\" || die \"$remgit: no branch $master\"\n-\t\tif [ \"$remid\" != \"$(git-merge-base \"$remid\" \"$(cg-commit-id)\")\" ]; then\n+\t\tif [ \"$remid\" != \"$(git-merge-base \"$remid\" \"$(cg-object-id)\")\" ]; then\n \t\t\techo \"ERROR: Remote '$rembranch' has some changes you don't have in your '$_git_head'\" >&2\n \t\t\techo \"Try to cg-update from it first, then upload.\" >&2\n \t\t\texit 1\n \t\tfi\n \n-\t\t[ -x \"$remgit/hooks/update\" ] && \"$remgit/hooks/update\" \"$rembranch\" \"$remid\" \"$(cg-commit-id)\"\n-\t\tcg-commit-id >\"$remgit\"/refs/heads/$rembranch\n+\t\t[ -x \"$remgit/hooks/update\" ] && \"$remgit/hooks/update\" \"$rembranch\" \"$remid\" \"$(cg-object-id)\"\n+\t\tcg-object-id >\"$remgit\"/refs/heads/$rembranch\n \t\t[ -x \"$remgit/hooks/post-update\" ] && \"$remgit/hooks/post-update\" \"$rembranch\"\n \telse\n \t\tgit-send-pack \"$uri\" $_git_head$sprembranch\n \tfi\n fi\ndiff --git a/contrib/gitfeedmaillist.sh b/contrib/gitfeedmaillist.sh\n--- a/contrib/gitfeedmaillist.sh\n+++ b/contrib/gitfeedmaillist.sh\n@@ -111,26 +111,26 @@ EOF\n \t\t\ti=$(($i+1))\n \t\tdone\n \tdone\n }\n \n-base=$(cg-commit-id $1)\n+base=$(cg-object-id $1)\n \n if [ -z $2 ]; then\n     lastmail=`cat .git/tags/MailDone`\n else\n-    lastmail=$(cg-commit-id $2)\n+    lastmail=$(cg-object-id $2)\n fi\n \n #if [ -z $3 ]; then\n #    tagname=`ls -rt .git/tags | grep -v MailDone | tail -1`\n #    release=`cat .git/tags/$tagname`\n #else\n #    release=$(gitXnormid.sh -c $3)\n #fi    \n \n-base=$(cg-commit-id $1) || exit 1\n+base=$(cg-object-id $1) || exit 1\n \n \n if [ \"$base\" != \"$lastmail\" ]; then\n     # List the commits at which we should stop following the tree, because\n     # we've come back to commits which were already in $lastmail.\n\n\n-- \nRegards,\nPavel Roskin\n"}]}