{"thread":{"id":"1639","subject":"[PATCH] Fix \"prefix\" mixup in git-rev-list","startedAt":"2005-08-24T21:58:42Z","lastAt":"2005-08-24T21:58:42Z","messageCount":1,"participants":["Pavel Roskin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"7729","messageId":"1124920722.17909.9.camel@dv","threadId":"1639","inReplyTo":null,"subject":"[PATCH] Fix \"prefix\" mixup in git-rev-list","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-08-24T21:58:42Z","receivedAt":"2005-08-24T21:58:42Z","isPatch":true,"sender":{"key":"proski@gnu.org","avatar":null},"body":"Hello!\n\nRecent changes in git have broken cg-log.  git-rev-list no longer prints\n\"commit\" in front of commit hashes.  It turn out a local \"prefix\"\nvariable in main() shadows a file-scoped \"prefix\" variable.\n\nThe patch removed the local \"prefix\" variable since its value is never\nused (in the intended way, that is).  The call to setup_git_directory()\nis kept since it has useful side effects.\n\nThe file-scoped \"prefix\" variable is renamed to \"commit_prefix\" just in\ncase someone reintroduces \"prefix\" to hold the return value of\nsetup_git_directory().\n\nSigned-off-by: Pavel Roskin <proski@gnu.org>\n\ndiff --git a/rev-list.c b/rev-list.c\n--- a/rev-list.c\n+++ b/rev-list.c\n@@ -33,7 +33,7 @@ static int blob_objects = 0;\n static int verbose_header = 0;\n static int show_parents = 0;\n static int hdr_termination = 0;\n-static const char *prefix = \"\";\n+static const char *commit_prefix = \"\";\n static unsigned long max_age = -1;\n static unsigned long min_age = -1;\n static int max_count = -1;\n@@ -48,14 +48,14 @@ static void show_commit(struct commit *c\n {\n \tcommit->object.flags |= SHOWN;\n \tif (show_breaks) {\n-\t\tprefix = \"| \";\n+\t\tcommit_prefix = \"| \";\n \t\tif (commit->object.flags & DISCONTINUITY) {\n-\t\t\tprefix = \"^ \";     \n+\t\t\tcommit_prefix = \"^ \";     \n \t\t} else if (commit->object.flags & BOUNDARY) {\n-\t\t\tprefix = \"= \";\n+\t\t\tcommit_prefix = \"= \";\n \t\t} \n         }        \t\t\n-\tprintf(\"%s%s\", prefix, sha1_to_hex(commit->object.sha1));\n+\tprintf(\"%s%s\", commit_prefix, sha1_to_hex(commit->object.sha1));\n \tif (show_parents) {\n \t\tstruct commit_list *parents = commit->parents;\n \t\twhile (parents) {\n@@ -481,9 +481,9 @@ static void handle_one_commit(struct com\n int main(int argc, char **argv)\n {\n \tstruct commit_list *list = NULL;\n-\tconst char *prefix = setup_git_directory();\n \tint i, limited = 0;\n \n+\tsetup_git_directory();\n \tfor (i = 1 ; i < argc; i++) {\n \t\tint flags;\n \t\tchar *arg = argv[i];\n@@ -511,9 +511,9 @@ int main(int argc, char **argv)\n \t\t\tverbose_header = 1;\n \t\t\thdr_termination = '\\n';\n \t\t\tif (commit_format == CMIT_FMT_ONELINE)\n-\t\t\t\tprefix = \"\";\n+\t\t\t\tcommit_prefix = \"\";\n \t\t\telse\n-\t\t\t\tprefix = \"commit \";\n+\t\t\t\tcommit_prefix = \"commit \";\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strncmp(arg, \"--no-merges\", 11)) {\n\n\n-- \nRegards,\nPavel Roskin\n"}]}