{"thread":{"id":"752","subject":"[PATCH Cogito] Make cg-Xnormid use $_git and $_git_objects","startedAt":"2005-05-29T01:00:57Z","lastAt":"2005-05-29T01:00:57Z","messageCount":1,"participants":["Jonas Fonseca"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"4149","messageId":"20050529010057.GA7520@diku.dk","threadId":"752","inReplyTo":null,"subject":"[PATCH Cogito] Make cg-Xnormid use $_git and $_git_objects","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2005-05-29T01:00:57Z","receivedAt":"2005-05-29T01:00:57Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"The recently introduced cg-Xnormid accesses .git and .git/objects\ndirectly which is not consistent with the current behavior so source\ncg-Xlib to get access to the $_git and $_git_objects variables.\n\nSigned-off-by: Jonas Fonseca <fonseca@diku.dk>\n\n---\n\nBTW, both commit-id and tree-id needs to be patched to find the\ninstalled cg-Xnormid.\n\n\t-normid=$(cg-Xnormid \"$id\") || exit 1\n\t+normid=$(${COGITO_LIB}cg-Xnormid \"$id\") || exit 1\n \n--- c8e987e5e4608c1144293cd3f852210d70b572cb/cg-Xnormid  (mode:100755)\n+++ uncommitted/cg-Xnormid  (mode:100755)\n@@ -13,16 +13,18 @@\n #\n # Takes the ID to normalize and returns the normalized ID.\n \n+. ${COGITO_LIB}cg-Xlib\n+\n id=\"$1\"\n \n if [ ! \"$id\" ] || [ \"$id\" = \"this\" ] || [ \"$id\" = \"HEAD\" ]; then\n-\tread id < .git/HEAD\n+\tread id < \"$_git/HEAD\"\n \n-elif [ -r \".git/refs/tags/$id\" ]; then\n-\tread id < \".git/refs/tags/$id\"\n+elif [ -r \"$_git/refs/tags/$id\" ]; then\n+\tread id < \"$_git/refs/tags/$id\"\n \n-elif [ -r \".git/refs/heads/$id\" ]; then\n-\tread id < \".git/refs/heads/$id\"\n+elif [ -r \"$_git/refs/heads/$id\" ]; then\n+\tread id < \"$_git/refs/heads/$id\"\n \n # Short id's must be lower case and at least 4 digits.\n elif [[ \"$id\" == [0-9a-z][0-9a-z][0-9a-z][0-9a-z]* ]]; then\n@@ -30,10 +32,10 @@\n \tidpost=${id:2}\n \n \t# Assign array elements to matching names\n-\tidmatch=(.git/objects/$idpref/$idpost*)\n+\tidmatch=($_git_objects/$idpref/$idpost*)\n \n \tif [ ${#idmatch[*]} -eq 1 ] && [ -r \"$idmatch\" ]; then\n-\t\tid=$idpref${idmatch#.git/objects/$idpref/}\n+\t\tid=$idpref${idmatch#$_git_objects/$idpref/}\n \telif [ ${#idmatch[*]} -gt 1 ]; then\n \t\techo \"Ambiguous id: $id\" >&2\n \t\texit 1\n@@ -41,7 +43,7 @@\n fi\n \n # If we don't have a 40-char ID by now, it's an error\n-if [ ${#id} -ne 40 ] || [ ! -f .git/objects/${id:0:2}/${id:2} ]; then\n+if [ ${#id} -ne 40 ] || [ ! -f $_git_objects/${id:0:2}/${id:2} ]; then\n \techo \"Invalid id: $id\" >&2\n \texit 1\n fi\n-- \nJonas Fonseca\n"}]}