{"thread":{"id":"23160","subject":"[PATCH 0/7] fmt-merge-msg improvements","startedAt":"2010-03-24T07:15:57Z","lastAt":"2010-04-01T20:07:30Z","messageCount":17,"participants":["Stephen Boyd","Junio C Hamano","Julian Phillips"],"isPatch":true,"patchVersion":1,"patchTotal":7},"messages":[{"id":"137686","messageId":"1269414964-9518-1-git-send-email-bebarino@gmail.com","threadId":"23160","inReplyTo":null,"subject":"[PATCH 0/7] fmt-merge-msg improvements","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-03-24T07:15:57Z","receivedAt":"2010-03-24T07:15:57Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"The first one might be considered a bug, although triggering it is\nprobably impossible. Not much of a price to pay for correctness\nthough.\n\nThe next two patches modernize and update the test a bit.\n\nThe next 3 patches try and reduce the code size by libifying(?)\nfmt-merge-msg.\n\nThe final patch is just a \"while I'm here\" thing and might be\nunnecessary if we decide to just remove the summary option.\n\nStephen Boyd (7):\n  fmt-merge-msg: be quiet if nothing to merge\n  t6200: modernize with test_tick\n  t6200: test fmt-merge-msg more\n  fmt-merge-msg: use pretty.c routines\n  string-list: add unsorted_string_list_lookup()\n  fmt-merge-msg: remove custom string_list implementation\n  fmt-merge-msg: hide summary option\n\n Documentation/technical/api-string-list.txt |    6 +-\n builtin/fmt-merge-msg.c                     |  159 ++++++++--------------\n string-list.c                               |   13 ++-\n string-list.h                               |    3 +-\n t/t6200-fmt-merge-msg.sh                    |  196 ++++++++++++++++++++++-----\n 5 files changed, 235 insertions(+), 142 deletions(-)\n"},{"id":"137687","messageId":"1269414964-9518-2-git-send-email-bebarino@gmail.com","threadId":"23160","inReplyTo":"1269414964-9518-1-git-send-email-bebarino@gmail.com","subject":"[PATCH 1/7] fmt-merge-msg: be quiet if nothing to merge","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-03-24T07:15:58Z","receivedAt":"2010-03-24T07:15:58Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"When FETCH_HEAD contains only 'not-for-merge' entries fmt-merge-msg\nstill outputs \"Merge\" (and if the branch isn't master \" into <branch>\").\nIn this case fmt-merge-msg is outputting junk and should really just\nbe quiet. Fix it.\n\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n builtin/fmt-merge-msg.c  |    3 +++\n t/t6200-fmt-merge-msg.sh |   19 +++++++++++++++++++\n 2 files changed, 22 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 9d52400..9bb2625 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -281,6 +281,9 @@ int fmt_merge_msg(int merge_summary, struct strbuf *in, struct strbuf *out) {\n \t\t\tdie (\"Error in line %d: %.*s\", i, len, p);\n \t}\n \n+\tif (!srcs.nr)\n+\t\treturn 0;\n+\n \tstrbuf_addstr(out, \"Merge \");\n \tfor (i = 0; i < srcs.nr; i++) {\n \t\tstruct src_data *src_data = srcs.payload[i];\ndiff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh\nindex 42f6fff..ade209a 100755\n--- a/t/t6200-fmt-merge-msg.sh\n+++ b/t/t6200-fmt-merge-msg.sh\n@@ -21,6 +21,8 @@ test_expect_success setup '\n \tsetdate &&\n \tgit commit -m \"Initial\" &&\n \n+\tgit clone . remote &&\n+\n \techo uno >one &&\n \techo dos >two &&\n \tgit add two &&\n@@ -240,4 +242,21 @@ test_expect_success 'merge-msg -F in subdirectory' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'merge-msg with nothing to merge' '\n+\n+\tgit config --unset-all merge.log\n+\tgit config --unset-all merge.summary\n+\tgit config merge.summary yes &&\n+\n+\t(\n+\t\tcd remote &&\n+\t\tgit checkout -b unrelated &&\n+\t\tsetdate &&\n+\t\tgit fetch origin &&\n+\t\tgit fmt-merge-msg <.git/FETCH_HEAD >../actual\n+\t) &&\n+\n+\ttest_cmp /dev/null actual\n+'\n+\n test_done\n-- \n1.7.0.3.254.g4503b\n"},{"id":"137689","messageId":"1269414964-9518-3-git-send-email-bebarino@gmail.com","threadId":"23160","inReplyTo":"1269414964-9518-1-git-send-email-bebarino@gmail.com","subject":"[PATCH 2/7] t6200: modernize with test_tick","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-03-24T07:15:59Z","receivedAt":"2010-03-24T07:15:59Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"This test defines its own version of test_tick. Get rid of it.\n\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n t/t6200-fmt-merge-msg.sh |   64 +++++++++++++++++++++-------------------------\n 1 files changed, 29 insertions(+), 35 deletions(-)\n\ndiff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh\nindex ade209a..b24c5bf 100755\n--- a/t/t6200-fmt-merge-msg.sh\n+++ b/t/t6200-fmt-merge-msg.sh\n@@ -7,18 +7,10 @@ test_description='fmt-merge-msg test'\n \n . ./test-lib.sh\n \n-datestamp=1151939923\n-setdate () {\n-\tGIT_COMMITTER_DATE=\"$datestamp +0200\"\n-\tGIT_AUTHOR_DATE=\"$datestamp +0200\"\n-\tdatestamp=`expr \"$datestamp\" + 1`\n-\texport GIT_COMMITTER_DATE GIT_AUTHOR_DATE\n-}\n-\n test_expect_success setup '\n \techo one >one &&\n \tgit add one &&\n-\tsetdate &&\n+\ttest_tick &&\n \tgit commit -m \"Initial\" &&\n \n \tgit clone . remote &&\n@@ -26,46 +18,48 @@ test_expect_success setup '\n \techo uno >one &&\n \techo dos >two &&\n \tgit add two &&\n-\tsetdate &&\n+\ttest_tick &&\n \tgit commit -a -m \"Second\" &&\n \n \tgit checkout -b left &&\n \n-\techo $datestamp >one &&\n-\tsetdate &&\n+\techo \"c1\" >one &&\n+\ttest_tick &&\n \tgit commit -a -m \"Common #1\" &&\n \n-\techo $datestamp >one &&\n-\tsetdate &&\n+\techo \"c2\" >one &&\n+\ttest_tick &&\n \tgit commit -a -m \"Common #2\" &&\n \n \tgit branch right &&\n \n-\techo $datestamp >two &&\n-\tsetdate &&\n+\techo \"l3\" >two &&\n+\ttest_tick &&\n \tgit commit -a -m \"Left #3\" &&\n \n-\techo $datestamp >two &&\n-\tsetdate &&\n+\techo \"l4\" >two &&\n+\ttest_tick &&\n \tgit commit -a -m \"Left #4\" &&\n \n-\techo $datestamp >two &&\n-\tsetdate &&\n+\techo \"l5\" >two &&\n+\ttest_tick &&\n \tgit commit -a -m \"Left #5\" &&\n+\tgit tag tag-l5 &&\n \n \tgit checkout right &&\n \n-\techo $datestamp >three &&\n+\techo \"r3\" >three &&\n \tgit add three &&\n-\tsetdate &&\n+\ttest_tick &&\n \tgit commit -a -m \"Right #3\" &&\n+\tgit tag tag-r3 &&\n \n-\techo $datestamp >three &&\n-\tsetdate &&\n+\techo \"r4\" >three &&\n+\ttest_tick &&\n \tgit commit -a -m \"Right #4\" &&\n \n-\techo $datestamp >three &&\n-\tsetdate &&\n+\techo \"r5\" >three &&\n+\ttest_tick &&\n \tgit commit -a -m \"Right #5\" &&\n \n \tgit show-branch\n@@ -115,7 +109,7 @@ test_expect_success 'merge-msg test #3-1' '\n \tgit config merge.log true &&\n \n \tgit checkout master &&\n-\tsetdate &&\n+\ttest_tick &&\n \tgit fetch . left &&\n \n \tgit fmt-merge-msg <.git/FETCH_HEAD >actual &&\n@@ -129,7 +123,7 @@ test_expect_success 'merge-msg test #3-2' '\n \tgit config merge.summary true &&\n \n \tgit checkout master &&\n-\tsetdate &&\n+\ttest_tick &&\n \tgit fetch . left &&\n \n \tgit fmt-merge-msg <.git/FETCH_HEAD >actual &&\n@@ -161,7 +155,7 @@ test_expect_success 'merge-msg test #4-1' '\n \tgit config merge.log true &&\n \n \tgit checkout master &&\n-\tsetdate &&\n+\ttest_tick &&\n \tgit fetch . left right &&\n \n \tgit fmt-merge-msg <.git/FETCH_HEAD >actual &&\n@@ -175,7 +169,7 @@ test_expect_success 'merge-msg test #4-2' '\n \tgit config merge.summary true &&\n \n \tgit checkout master &&\n-\tsetdate &&\n+\ttest_tick &&\n \tgit fetch . left right &&\n \n \tgit fmt-merge-msg <.git/FETCH_HEAD >actual &&\n@@ -189,7 +183,7 @@ test_expect_success 'merge-msg test #5-1' '\n \tgit config merge.log yes &&\n \n \tgit checkout master &&\n-\tsetdate &&\n+\ttest_tick &&\n \tgit fetch . left right &&\n \n \tgit fmt-merge-msg <.git/FETCH_HEAD >actual &&\n@@ -203,7 +197,7 @@ test_expect_success 'merge-msg test #5-2' '\n \tgit config merge.summary yes &&\n \n \tgit checkout master &&\n-\tsetdate &&\n+\ttest_tick &&\n \tgit fetch . left right &&\n \n \tgit fmt-merge-msg <.git/FETCH_HEAD >actual &&\n@@ -217,7 +211,7 @@ test_expect_success 'merge-msg -F' '\n \tgit config merge.summary yes &&\n \n \tgit checkout master &&\n-\tsetdate &&\n+\ttest_tick &&\n \tgit fetch . left right &&\n \n \tgit fmt-merge-msg -F .git/FETCH_HEAD >actual &&\n@@ -231,7 +225,7 @@ test_expect_success 'merge-msg -F in subdirectory' '\n \tgit config merge.summary yes &&\n \n \tgit checkout master &&\n-\tsetdate &&\n+\ttest_tick &&\n \tgit fetch . left right &&\n \tmkdir sub &&\n \tcp .git/FETCH_HEAD sub/FETCH_HEAD &&\n@@ -251,7 +245,7 @@ test_expect_success 'merge-msg with nothing to merge' '\n \t(\n \t\tcd remote &&\n \t\tgit checkout -b unrelated &&\n-\t\tsetdate &&\n+\t\ttest_tick &&\n \t\tgit fetch origin &&\n \t\tgit fmt-merge-msg <.git/FETCH_HEAD >../actual\n \t) &&\n-- \n1.7.0.3.254.g4503b\n"},{"id":"137690","messageId":"1269414964-9518-4-git-send-email-bebarino@gmail.com","threadId":"23160","inReplyTo":"1269414964-9518-1-git-send-email-bebarino@gmail.com","subject":"[PATCH 3/7] t6200: test fmt-merge-msg more","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-03-24T07:16:00Z","receivedAt":"2010-03-24T07:16:00Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Add some more tests so we don't break behavior upon modernizing\nfmt-merge-msg.\n\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n t/t6200-fmt-merge-msg.sh |  115 ++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 115 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh\nindex b24c5bf..42f8ece 100755\n--- a/t/t6200-fmt-merge-msg.sh\n+++ b/t/t6200-fmt-merge-msg.sh\n@@ -62,6 +62,14 @@ test_expect_success setup '\n \ttest_tick &&\n \tgit commit -a -m \"Right #5\" &&\n \n+\tgit checkout -b long &&\n+\ti=0 &&\n+\twhile test $i -lt 30\n+\tdo\n+\t\ttest_commit $i one &&\n+\t\ti=$(($i+1))\n+\tdone &&\n+\n \tgit show-branch\n '\n \n@@ -253,4 +261,111 @@ test_expect_success 'merge-msg with nothing to merge' '\n \ttest_cmp /dev/null actual\n '\n \n+cat >expected <<\\EOF\n+Merge tag 'tag-r3'\n+\n+* tag 'tag-r3':\n+  Right #3\n+  Common #2\n+  Common #1\n+EOF\n+\n+test_expect_success 'merge-msg tag' '\n+\n+\tgit config --unset-all merge.log\n+\tgit config --unset-all merge.summary\n+\tgit config merge.summary yes &&\n+\n+\tgit checkout master &&\n+\ttest_tick &&\n+\tgit fetch . tag tag-r3 &&\n+\n+\tgit fmt-merge-msg <.git/FETCH_HEAD >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+cat >expected <<\\EOF\n+Merge tags 'tag-r3' and 'tag-l5'\n+\n+* tag 'tag-r3':\n+  Right #3\n+  Common #2\n+  Common #1\n+\n+* tag 'tag-l5':\n+  Left #5\n+  Left #4\n+  Left #3\n+  Common #2\n+  Common #1\n+EOF\n+\n+test_expect_success 'merge-msg two tags' '\n+\n+\tgit config --unset-all merge.log\n+\tgit config --unset-all merge.summary\n+\tgit config merge.summary yes &&\n+\n+\tgit checkout master &&\n+\ttest_tick &&\n+\tgit fetch . tag tag-r3 tag tag-l5 &&\n+\n+\tgit fmt-merge-msg <.git/FETCH_HEAD >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+cat >expected <<\\EOF\n+Merge branch 'left', tag 'tag-r3'\n+\n+* tag 'tag-r3':\n+  Right #3\n+  Common #2\n+  Common #1\n+\n+* left:\n+  Left #5\n+  Left #4\n+  Left #3\n+  Common #2\n+  Common #1\n+EOF\n+\n+test_expect_success 'merge-msg tag and branch' '\n+\n+\tgit config --unset-all merge.log\n+\tgit config --unset-all merge.summary\n+\tgit config merge.summary yes &&\n+\n+\tgit checkout master &&\n+\ttest_tick &&\n+\tgit fetch . tag tag-r3 left &&\n+\n+\tgit fmt-merge-msg <.git/FETCH_HEAD >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+cat >expected <<\\EOF\n+Merge branch 'long'\n+\n+* long: (35 commits)\n+EOF\n+\n+test_expect_success 'merge-msg lots of commits' '\n+\n+\tgit checkout master &&\n+\ttest_tick &&\n+\tgit fetch . long &&\n+\n+\ti=29 &&\n+\twhile test $i -gt 9\n+\tdo\n+\t\techo \"  $i\" &&\n+\t\ti=$(($i-1))\n+\tdone >>expected &&\n+\techo \"  ...\" >>expected\n+\n+\tgit fmt-merge-msg <.git/FETCH_HEAD >actual &&\n+\ttest_cmp expected actual\n+'\n+\n test_done\n-- \n1.7.0.3.254.g4503b\n"},{"id":"137688","messageId":"1269414964-9518-5-git-send-email-bebarino@gmail.com","threadId":"23160","inReplyTo":"1269414964-9518-1-git-send-email-bebarino@gmail.com","subject":"[PATCH 4/7] fmt-merge-msg: use pretty.c routines","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-03-24T07:16:01Z","receivedAt":"2010-03-24T07:16:01Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"This command duplicates functionality of the '%s' pretty format.\nSimplify the code a bit by using the pretty printing routine\ninstead of open-coding it here.\n\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n builtin/fmt-merge-msg.c |   29 ++++++++---------------------\n 1 files changed, 8 insertions(+), 21 deletions(-)\n\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 9bb2625..44b74f4 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -185,6 +185,7 @@ static void shortlog(const char *name, unsigned char *sha1,\n \tstruct object *branch;\n \tstruct list subjects = { NULL, NULL, 0, 0 };\n \tint flags = UNINTERESTING | TREESAME | SEEN | SHOWN | ADDED;\n+\tstruct strbuf sb = STRBUF_INIT;\n \n \tbranch = deref_tag(parse_object(sha1), sha1_to_hex(sha1), 40);\n \tif (!branch || branch->type != OBJ_COMMIT)\n@@ -198,7 +199,7 @@ static void shortlog(const char *name, unsigned char *sha1,\n \tif (prepare_revision_walk(rev))\n \t\tdie(\"revision walk setup failed\");\n \twhile ((commit = get_revision(rev)) != NULL) {\n-\t\tchar *oneline, *bol, *eol;\n+\t\tstruct pretty_print_context ctx = {0};\n \n \t\t/* ignore merges */\n \t\tif (commit->parents && commit->parents->next)\n@@ -208,30 +209,16 @@ static void shortlog(const char *name, unsigned char *sha1,\n \t\tif (subjects.nr > limit)\n \t\t\tcontinue;\n \n-\t\tbol = strstr(commit->buffer, \"\\n\\n\");\n-\t\tif (bol) {\n-\t\t\tunsigned char c;\n-\t\t\tdo {\n-\t\t\t\tc = *++bol;\n-\t\t\t} while (isspace(c));\n-\t\t\tif (!c)\n-\t\t\t\tbol = NULL;\n-\t\t}\n+\t\tformat_commit_message(commit, \"%s\", &sb, &ctx);\n+\t\tstrbuf_ltrim(&sb);\n \n-\t\tif (!bol) {\n+\t\tif (!sb.len)\n \t\t\tappend_to_list(&subjects, xstrdup(sha1_to_hex(\n \t\t\t\t\t\t\tcommit->object.sha1)),\n \t\t\t\t\tNULL);\n-\t\t\tcontinue;\n-\t\t}\n-\n-\t\teol = strchr(bol, '\\n');\n-\t\tif (eol) {\n-\t\t\toneline = xmemdupz(bol, eol - bol);\n-\t\t} else {\n-\t\t\toneline = xstrdup(bol);\n-\t\t}\n-\t\tappend_to_list(&subjects, oneline, NULL);\n+\t\telse\n+\t\t\tappend_to_list(&subjects, strbuf_detach(&sb, NULL),\n+\t\t\t\t\tNULL);\n \t}\n \n \tif (count > limit)\n-- \n1.7.0.3.254.g4503b\n"},{"id":"137691","messageId":"1269414964-9518-6-git-send-email-bebarino@gmail.com","threadId":"23160","inReplyTo":"1269414964-9518-1-git-send-email-bebarino@gmail.com","subject":"[PATCH 5/7] string-list: add unsorted_string_list_lookup()","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-03-24T07:16:02Z","receivedAt":"2010-03-24T07:16:02Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Sometimes users need to lookup a string in an unsorted string_list. In\nthat case they should use this function instead of the version for\nsorted strings.\n\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n Documentation/technical/api-string-list.txt |    6 +++++-\n string-list.c                               |   13 ++++++++++---\n string-list.h                               |    3 ++-\n 3 files changed, 17 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/technical/api-string-list.txt b/Documentation/technical/api-string-list.txt\nindex 293bb15..6d8c24b 100644\n--- a/Documentation/technical/api-string-list.txt\n+++ b/Documentation/technical/api-string-list.txt\n@@ -104,8 +104,12 @@ write `string_list_insert(...)->util = ...;`.\n `unsorted_string_list_has_string`::\n \n \tIt's like `string_list_has_string()` but for unsorted lists.\n+\n+`unsorted_string_list_lookup`::\n+\n+\tIt's like `string_list_lookup()` but for unsorted lists.\n +\n-This function needs to look through all items, as opposed to its\n+The above two functions need to look through all items, as opposed to their\n counterpart for sorted lists, which performs a binary search.\n \n Data structures\ndiff --git a/string-list.c b/string-list.c\nindex 1ac536e..c9ad7fc 100644\n--- a/string-list.c\n+++ b/string-list.c\n@@ -168,12 +168,19 @@ void sort_string_list(struct string_list *list)\n \tqsort(list->items, list->nr, sizeof(*list->items), cmp_items);\n }\n \n-int unsorted_string_list_has_string(struct string_list *list, const char *string)\n+struct string_list_item *unsorted_string_list_lookup(struct string_list *list,\n+\t\t\t\t\t\t     const char *string)\n {\n \tint i;\n \tfor (i = 0; i < list->nr; i++)\n \t\tif (!strcmp(string, list->items[i].string))\n-\t\t\treturn 1;\n-\treturn 0;\n+\t\t\treturn list->items + i;\n+\treturn NULL;\n+}\n+\n+int unsorted_string_list_has_string(struct string_list *list,\n+\t\t\t\t    const char *string)\n+{\n+\treturn unsorted_string_list_lookup(list, string) != NULL;\n }\n \ndiff --git a/string-list.h b/string-list.h\nindex 6569cf6..63b69c8 100644\n--- a/string-list.h\n+++ b/string-list.h\n@@ -38,5 +38,6 @@ struct string_list_item *string_list_lookup(const char *string, struct string_li\n struct string_list_item *string_list_append(const char *string, struct string_list *list);\n void sort_string_list(struct string_list *list);\n int unsorted_string_list_has_string(struct string_list *list, const char *string);\n-\n+struct string_list_item *unsorted_string_list_lookup(struct string_list *list,\n+\t\t\t\t\t\t     const char *string);\n #endif /* STRING_LIST_H */\n-- \n1.7.0.3.254.g4503b\n"},{"id":"137692","messageId":"1269414964-9518-7-git-send-email-bebarino@gmail.com","threadId":"23160","inReplyTo":"1269414964-9518-1-git-send-email-bebarino@gmail.com","subject":"[PATCH 6/7] fmt-merge-msg: remove custom string_list implementation","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-03-24T07:16:03Z","receivedAt":"2010-03-24T07:16:03Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"This command uses a custom version of string list when it could\njust as easily use the string_list API. Convert it to use string_list\nand reduce the code size a bit.\n\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n\nAnyone else annoyed that string_list_append() is the only function\nthat takes doesn't take the string list as the first argument?\n\nOn another note, git-compat-util.h:115 says:\n\n  #undef _ALL_SOURCE /* AIX 5.3L defines a struct list with...\n\nwhich may be unnecessary now that struct list is gone. Need someone\non AIX 5.3L to test that though.\n\nFinally, this doesn't free some of the lists since I wanted it to be a\nstraight conversion. I'm feeling lazy right now but I'll think about it.\n\n builtin/fmt-merge-msg.c |  127 ++++++++++++++++------------------------------\n 1 files changed, 44 insertions(+), 83 deletions(-)\n\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 44b74f4..0fb4014 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -4,6 +4,7 @@\n #include \"diff.h\"\n #include \"revision.h\"\n #include \"tag.h\"\n+#include \"string-list.h\"\n \n static const char * const fmt_merge_msg_usage[] = {\n \t\"git fmt-merge-msg [--log|--no-log] [--file <file>]\",\n@@ -24,58 +25,21 @@ static int fmt_merge_msg_config(const char *key, const char *value, void *cb)\n \treturn 0;\n }\n \n-struct list {\n-\tchar **list;\n-\tvoid **payload;\n-\tunsigned nr, alloc;\n+struct src_data {\n+\tstruct string_list branch, tag, r_branch, generic;\n+\tint head_status;\n };\n \n-static void append_to_list(struct list *list, char *value, void *payload)\n-{\n-\tif (list->nr == list->alloc) {\n-\t\tlist->alloc += 32;\n-\t\tlist->list = xrealloc(list->list, sizeof(char *) * list->alloc);\n-\t\tlist->payload = xrealloc(list->payload,\n-\t\t\t\tsizeof(char *) * list->alloc);\n-\t}\n-\tlist->payload[list->nr] = payload;\n-\tlist->list[list->nr++] = value;\n-}\n-\n-static int find_in_list(struct list *list, char *value)\n-{\n-\tint i;\n-\n-\tfor (i = 0; i < list->nr; i++)\n-\t\tif (!strcmp(list->list[i], value))\n-\t\t\treturn i;\n-\n-\treturn -1;\n-}\n-\n-static void free_list(struct list *list)\n+void init_src_data(struct src_data *data)\n {\n-\tint i;\n-\n-\tif (list->alloc == 0)\n-\t\treturn;\n-\n-\tfor (i = 0; i < list->nr; i++) {\n-\t\tfree(list->list[i]);\n-\t\tfree(list->payload[i]);\n-\t}\n-\tfree(list->list);\n-\tfree(list->payload);\n-\tlist->nr = list->alloc = 0;\n+\tdata->branch.strdup_strings = 1;\n+\tdata->tag.strdup_strings = 1;\n+\tdata->r_branch.strdup_strings = 1;\n+\tdata->generic.strdup_strings = 1;\n }\n \n-struct src_data {\n-\tstruct list branch, tag, r_branch, generic;\n-\tint head_status;\n-};\n-\n-static struct list srcs = { NULL, NULL, 0, 0};\n-static struct list origins = { NULL, NULL, 0, 0};\n+static struct string_list srcs = { NULL, 0, 0, 1 };\n+static struct string_list origins = { NULL, 0, 0, 1 };\n \n static int handle_line(char *line)\n {\n@@ -83,6 +47,7 @@ static int handle_line(char *line)\n \tunsigned char *sha1;\n \tchar *src, *origin;\n \tstruct src_data *src_data;\n+\tstruct string_list_item *item;\n \tint pulling_head = 0;\n \n \tif (len < 43 || line[40] != '\\t')\n@@ -115,64 +80,62 @@ static int handle_line(char *line)\n \t\tpulling_head = 1;\n \t}\n \n-\ti = find_in_list(&srcs, src);\n-\tif (i < 0) {\n-\t\ti = srcs.nr;\n-\t\tappend_to_list(&srcs, xstrdup(src),\n-\t\t\t\txcalloc(1, sizeof(struct src_data)));\n+\titem = unsorted_string_list_lookup(&srcs, src);\n+\tif (!item) {\n+\t\titem = string_list_append(src, &srcs);\n+\t\titem->util = xcalloc(1, sizeof(struct src_data));\n+\t\tinit_src_data(item->util);\n \t}\n-\tsrc_data = srcs.payload[i];\n+\tsrc_data = item->util;\n \n \tif (pulling_head) {\n-\t\torigin = xstrdup(src);\n+\t\torigin = src;\n \t\tsrc_data->head_status |= 1;\n \t} else if (!prefixcmp(line, \"branch \")) {\n-\t\torigin = xstrdup(line + 7);\n-\t\tappend_to_list(&src_data->branch, origin, NULL);\n+\t\torigin = line + 7;\n+\t\tstring_list_append(origin, &src_data->branch);\n \t\tsrc_data->head_status |= 2;\n \t} else if (!prefixcmp(line, \"tag \")) {\n \t\torigin = line;\n-\t\tappend_to_list(&src_data->tag, xstrdup(origin + 4), NULL);\n+\t\tstring_list_append(origin + 4, &src_data->tag);\n \t\tsrc_data->head_status |= 2;\n \t} else if (!prefixcmp(line, \"remote branch \")) {\n-\t\torigin = xstrdup(line + 14);\n-\t\tappend_to_list(&src_data->r_branch, origin, NULL);\n+\t\torigin = line + 14;\n+\t\tstring_list_append(origin, &src_data->r_branch);\n \t\tsrc_data->head_status |= 2;\n \t} else {\n-\t\torigin = xstrdup(src);\n-\t\tappend_to_list(&src_data->generic, xstrdup(line), NULL);\n+\t\torigin = src;\n+\t\tstring_list_append(line, &src_data->generic);\n \t\tsrc_data->head_status |= 2;\n \t}\n \n \tif (!strcmp(\".\", src) || !strcmp(src, origin)) {\n \t\tint len = strlen(origin);\n-\t\tif (origin[0] == '\\'' && origin[len - 1] == '\\'') {\n+\t\tif (origin[0] == '\\'' && origin[len - 1] == '\\'')\n \t\t\torigin = xmemdupz(origin + 1, len - 2);\n-\t\t} else {\n-\t\t\torigin = xstrdup(origin);\n-\t\t}\n \t} else {\n \t\tchar *new_origin = xmalloc(strlen(origin) + strlen(src) + 5);\n \t\tsprintf(new_origin, \"%s of %s\", origin, src);\n \t\torigin = new_origin;\n \t}\n-\tappend_to_list(&origins, origin, sha1);\n+\tstring_list_append(origin, &origins)->util = sha1;\n \treturn 0;\n }\n \n static void print_joined(const char *singular, const char *plural,\n-\t\tstruct list *list, struct strbuf *out)\n+\t\tstruct string_list *list, struct strbuf *out)\n {\n \tif (list->nr == 0)\n \t\treturn;\n \tif (list->nr == 1) {\n-\t\tstrbuf_addf(out, \"%s%s\", singular, list->list[0]);\n+\t\tstrbuf_addf(out, \"%s%s\", singular, list->items[0].string);\n \t} else {\n \t\tint i;\n \t\tstrbuf_addstr(out, plural);\n \t\tfor (i = 0; i < list->nr - 1; i++)\n-\t\t\tstrbuf_addf(out, \"%s%s\", i > 0 ? \", \" : \"\", list->list[i]);\n-\t\tstrbuf_addf(out, \" and %s\", list->list[list->nr - 1]);\n+\t\t\tstrbuf_addf(out, \"%s%s\", i > 0 ? \", \" : \"\",\n+\t\t\t\t    list->items[i].string);\n+\t\tstrbuf_addf(out, \" and %s\", list->items[list->nr - 1].string);\n \t}\n }\n \n@@ -183,7 +146,7 @@ static void shortlog(const char *name, unsigned char *sha1,\n \tint i, count = 0;\n \tstruct commit *commit;\n \tstruct object *branch;\n-\tstruct list subjects = { NULL, NULL, 0, 0 };\n+\tstruct string_list subjects = { NULL, 0, 0, 1 };\n \tint flags = UNINTERESTING | TREESAME | SEEN | SHOWN | ADDED;\n \tstruct strbuf sb = STRBUF_INIT;\n \n@@ -213,12 +176,10 @@ static void shortlog(const char *name, unsigned char *sha1,\n \t\tstrbuf_ltrim(&sb);\n \n \t\tif (!sb.len)\n-\t\t\tappend_to_list(&subjects, xstrdup(sha1_to_hex(\n-\t\t\t\t\t\t\tcommit->object.sha1)),\n-\t\t\t\t\tNULL);\n+\t\t\tstring_list_append(sha1_to_hex(commit->object.sha1),\n+\t\t\t\t\t   &subjects);\n \t\telse\n-\t\t\tappend_to_list(&subjects, strbuf_detach(&sb, NULL),\n-\t\t\t\t\tNULL);\n+\t\t\tstring_list_append(strbuf_detach(&sb, NULL), &subjects);\n \t}\n \n \tif (count > limit)\n@@ -230,7 +191,7 @@ static void shortlog(const char *name, unsigned char *sha1,\n \t\tif (i >= limit)\n \t\t\tstrbuf_addf(out, \"  ...\\n\");\n \t\telse\n-\t\t\tstrbuf_addf(out, \"  %s\\n\", subjects.list[i]);\n+\t\t\tstrbuf_addf(out, \"  %s\\n\", subjects.items[i].string);\n \n \tclear_commit_marks((struct commit *)branch, flags);\n \tclear_commit_marks(head, flags);\n@@ -238,7 +199,7 @@ static void shortlog(const char *name, unsigned char *sha1,\n \trev->commits = NULL;\n \trev->pending.nr = 0;\n \n-\tfree_list(&subjects);\n+\tstring_list_clear(&subjects, 0);\n }\n \n int fmt_merge_msg(int merge_summary, struct strbuf *in, struct strbuf *out) {\n@@ -273,14 +234,14 @@ int fmt_merge_msg(int merge_summary, struct strbuf *in, struct strbuf *out) {\n \n \tstrbuf_addstr(out, \"Merge \");\n \tfor (i = 0; i < srcs.nr; i++) {\n-\t\tstruct src_data *src_data = srcs.payload[i];\n+\t\tstruct src_data *src_data = srcs.items[i].util;\n \t\tconst char *subsep = \"\";\n \n \t\tstrbuf_addstr(out, sep);\n \t\tsep = \"; \";\n \n \t\tif (src_data->head_status == 1) {\n-\t\t\tstrbuf_addstr(out, srcs.list[i]);\n+\t\t\tstrbuf_addstr(out, srcs.items[i].string);\n \t\t\tcontinue;\n \t\t}\n \t\tif (src_data->head_status == 3) {\n@@ -309,8 +270,8 @@ int fmt_merge_msg(int merge_summary, struct strbuf *in, struct strbuf *out) {\n \t\t\tprint_joined(\"commit \", \"commits \", &src_data->generic,\n \t\t\t\t\tout);\n \t\t}\n-\t\tif (strcmp(\".\", srcs.list[i]))\n-\t\t\tstrbuf_addf(out, \" of %s\", srcs.list[i]);\n+\t\tif (strcmp(\".\", srcs.items[i].string))\n+\t\t\tstrbuf_addf(out, \" of %s\", srcs.items[i].string);\n \t}\n \n \tif (!strcmp(\"master\", current_branch))\n@@ -329,7 +290,7 @@ int fmt_merge_msg(int merge_summary, struct strbuf *in, struct strbuf *out) {\n \t\trev.limited = 1;\n \n \t\tfor (i = 0; i < origins.nr; i++)\n-\t\t\tshortlog(origins.list[i], origins.payload[i],\n+\t\t\tshortlog(origins.items[i].string, origins.items[i].util,\n \t\t\t\t\thead, &rev, limit, out);\n \t}\n \treturn 0;\n-- \n1.7.0.3.254.g4503b\n"},{"id":"137693","messageId":"1269414964-9518-8-git-send-email-bebarino@gmail.com","threadId":"23160","inReplyTo":"1269414964-9518-1-git-send-email-bebarino@gmail.com","subject":"[PATCH 7/7] fmt-merge-msg: hide summary option","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-03-24T07:16:04Z","receivedAt":"2010-03-24T07:16:04Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"The --summary command line option has been deprecated in favor of --log.\nHide the option from the help message to further discourage the use of\nthis option.\n\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n\nWhen is this option going to be removed? It's approaching 2 years\nsince the deprecation occured in 6cd9cfe (fmt-merge-msg: add\n'--(no-)log' options and 'merge.log' config variable, 2008-04-06)\n\n builtin/fmt-merge-msg.c |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 0fb4014..379a031 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -301,7 +301,9 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n \tconst char *inpath = NULL;\n \tstruct option options[] = {\n \t\tOPT_BOOLEAN(0, \"log\",     &merge_summary, \"populate log with the shortlog\"),\n-\t\tOPT_BOOLEAN(0, \"summary\", &merge_summary, \"alias for --log\"),\n+\t\t{ OPTION_BOOLEAN, 0, \"summary\", &merge_summary, NULL,\n+\t\t  \"alias for --log (deprecated)\",\n+\t\t  PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },\n \t\tOPT_FILENAME('F', \"file\", &inpath, \"file to read from\"),\n \t\tOPT_END()\n \t};\n-- \n1.7.0.3.254.g4503b\n"},{"id":"137761","messageId":"7vaatxdt0d.fsf@alter.siamese.dyndns.org","threadId":"23160","inReplyTo":"1269414964-9518-2-git-send-email-bebarino@gmail.com","subject":"Re: [PATCH 1/7] fmt-merge-msg: be quiet if nothing to merge","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-25T02:39:30Z","receivedAt":"2010-03-25T02:39:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stephen Boyd <bebarino@gmail.com> writes:\n\n> When FETCH_HEAD contains only 'not-for-merge' entries fmt-merge-msg\n> still outputs \"Merge\" (and if the branch isn't master \" into <branch>\").\n> In this case fmt-merge-msg is outputting junk and should really just\n> be quiet. Fix it.\n\nHmm, doesn't pull fail in such a case anyway?  Is there a real damage?\n\nI am just trying asses if this is with a maint-worthy urgency.  The patch\nlooks sane.\n\nThanks.\n"},{"id":"137762","messageId":"7v4ok5dsqr.fsf@alter.siamese.dyndns.org","threadId":"23160","inReplyTo":"1269414964-9518-8-git-send-email-bebarino@gmail.com","subject":"Re: [PATCH 7/7] fmt-merge-msg: hide summary option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-25T02:45:16Z","receivedAt":"2010-03-25T02:45:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stephen Boyd <bebarino@gmail.com> writes:\n\n> When is this option going to be removed? It's approaching 2 years\n> since the deprecation occured in 6cd9cfe (fmt-merge-msg: add\n> '--(no-)log' options and 'merge.log' config variable, 2008-04-06)\n\nWe could do that sometime in this autumn timeframe if we start making\nnoises when they are used, just like we did during the 1.7.0 transition\nagainst soon-to-be-deprecated \"features\".\n\nAre there other ancient features we have been passively advertising as\ndeprecated that we should now start the removal process?\n"},{"id":"137763","messageId":"4BAADD21.2020900@gmail.com","threadId":"23160","inReplyTo":"7vaatxdt0d.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/7] fmt-merge-msg: be quiet if nothing to merge","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-03-25T03:48:49Z","receivedAt":"2010-03-25T03:48:49Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"On 03/24/2010 07:39 PM, Junio C Hamano wrote:\n>\n> Hmm, doesn't pull fail in such a case anyway?  Is there a real damage?\n>\n> I am just trying asses if this is with a maint-worthy urgency.  The patch\n> looks sane.\n\nI don't think this is ever triggered with pull so probably not\nmaint-worthy. I just ordered it that way in case you figured it as such.\n"},{"id":"137779","messageId":"4BAAF264.7050003@gmail.com","threadId":"23160","inReplyTo":"7v4ok5dsqr.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 7/7] fmt-merge-msg: hide summary option","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-03-25T05:19:32Z","receivedAt":"2010-03-25T05:19:32Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"On 03/24/2010 07:45 PM, Junio C Hamano wrote:\n> We could do that sometime in this autumn timeframe if we start making\n> noises when they are used, just like we did during the 1.7.0 transition\n> against soon-to-be-deprecated \"features\".\n\nWe already make noises when the option is used. Probably need to make\nsome noises in release notes though.\n\n> Are there other ancient features we have been passively advertising as\n> deprecated that we should now start the removal process?\n\ngrepping for deprecated shows mostly deprecated commands:\n\n    git lost-found\n    git tar-tree\n    git peek-remote (synonym to git ls-remote)\n    git init-db (synonym to git init)\n    git repo-config (synonym to git config)\n\nI'm pretty sure we don't want to remove them anytime soon though, right?\n\nThe only option of interest is 'git reset --mixed' with paths. I don't\nreally know the backstory on that but it looks like it was deprecated\nwhen the command was made into a builtin 0e5a7fa (Make \"git reset\" a\nbuiltin., 2007-09-11). Maybe it can become a die now?\n\nOh and git notes has a deprecation warning but I think we'll probably\nhave to revisit that one in a few years.\n"},{"id":"137884","messageId":"7vpr2qlw2n.fsf@alter.siamese.dyndns.org","threadId":"23160","inReplyTo":"4BAAF264.7050003@gmail.com","subject":"Re: [PATCH 7/7] fmt-merge-msg: hide summary option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-26T19:30:40Z","receivedAt":"2010-03-26T19:30:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stephen Boyd <bebarino@gmail.com> writes:\n\n> On 03/24/2010 07:45 PM, Junio C Hamano wrote:\n>> We could do that sometime in this autumn timeframe if we start making\n>> noises when they are used, just like we did during the 1.7.0 transition\n>> against soon-to-be-deprecated \"features\".\n>\n> We already make noises when the option is used. Probably need to make\n> some noises in release notes though.\n\nThen it would be one of the 1.7.2 items, I guess, as we haven't shipped\n1.7.1 yet.\n"},{"id":"138159","messageId":"7vzl1qwfno.fsf@alter.siamese.dyndns.org","threadId":"23160","inReplyTo":"1269414964-9518-7-git-send-email-bebarino@gmail.com","subject":"Re: [PATCH 6/7] fmt-merge-msg: remove custom string_list implementation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-30T05:18:51Z","receivedAt":"2010-03-30T05:18:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stephen Boyd <bebarino@gmail.com> writes:\n\n> This command uses a custom version of string list when it could\n> just as easily use the string_list API. Convert it to use string_list\n> and reduce the code size a bit.\n\nThanks, although the above is a bit unfair.  Back when 00449f9 (Make\ngit-fmt-merge-msg a builtin, 2006-07-03) was written, there was no such\nthing like string-list (nor path-list, its predecessor).\n\n> Anyone else annoyed that string_list_append() is the only function\n> that takes doesn't take the string list as the first argument?\n\nYes.\n\n> On another note, git-compat-util.h:115 says:\n>\n>   #undef _ALL_SOURCE /* AIX 5.3L defines a struct list with...\n>\n> which may be unnecessary now that struct list is gone. Need someone\n> on AIX 5.3L to test that though.\n\nYeah, finding testers for less common platforms is always the hardest\npart.\n\n> Finally, this doesn't free some of the lists since I wanted it to be a\n> straight conversion. I'm feeling lazy right now but I'll think about it.\n\nThanks.\n"},{"id":"138327","messageId":"4BB43860.8090003@gmail.com","threadId":"23160","inReplyTo":"7vzl1qwfno.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 6/7] fmt-merge-msg: remove custom string_list implementation","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-04-01T06:08:32Z","receivedAt":"2010-04-01T06:08:32Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"On 03/29/2010 10:18 PM, Junio C Hamano wrote:\n> Stephen Boyd <bebarino@gmail.com> writes:\n>   \n>> This command uses a custom version of string list when it could\n>> just as easily use the string_list API. Convert it to use string_list\n>> and reduce the code size a bit.\n>>     \n> Thanks, although the above is a bit unfair.  Back when 00449f9 (Make\n> git-fmt-merge-msg a builtin, 2006-07-03) was written, there was no such\n> thing like string-list (nor path-list, its predecessor).\n>   \n\nSorry, I didn't mean to be misleading. Maybe something like:\n\nThis command uses a custom version of string_list since back when it\nwas written 00449f9 (Make git-fmt-merge-msg a builtin, 2006-07-03)\nthere was no string_list API (nor path_list, its predecessor). Convert\nit to use string_list and reduce the code size a bit.\n"},{"id":"138329","messageId":"1270103379-3686-1-git-send-email-bebarino@gmail.com","threadId":"23160","inReplyTo":"7vzl1qwfno.fsf@alter.siamese.dyndns.org","subject":"[PATCH 8/7] Make string_list_append() consistent with everything else","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-04-01T06:29:39Z","receivedAt":"2010-04-01T06:29:39Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"string_list_append() is the only function in the string_list API which takes\nthe struct string_list as the second argument instead of the first. Swap the\nordering to make the string_list API consistent.\n\nThis was mostly done with\n\n $ git grep -lz 'string_list_append' |\n   xargs -0 perl -pi -e\n   's/string_list_append\\((.*), ([^)]+)\\)/string_list_append\\($2, $1)/'\n\nand then some minor fixups and manual verification.\n\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n\n On 03/29/2010 10:18 PM, Junio C Hamano wrote:\n > Stephen Boyd <bebarino@gmail.com> writes:\n >\n >> Anyone else annoyed that string_list_append() is the only function\n >> that takes doesn't take the string list as the first argument?\n >\n > Yes.\n\n This swaps it.\n\n Documentation/technical/api-string-list.txt |    4 +-\n builtin/apply.c                             |    2 +-\n builtin/fast-export.c                       |    4 +-\n builtin/fetch.c                             |    8 ++--\n builtin/fmt-merge-msg.c                     |   18 +++++-----\n builtin/log.c                               |   20 ++++++------\n builtin/remote.c                            |   46 +++++++++++++-------------\n builtin/rerere.c                            |    2 +-\n builtin/shortlog.c                          |    2 +-\n notes.c                                     |    6 ++--\n remote.c                                    |    2 +-\n revision.c                                  |    4 +-\n string-list.c                               |    2 +-\n string-list.h                               |    2 +-\n 14 files changed, 61 insertions(+), 61 deletions(-)\n\ndiff --git a/Documentation/technical/api-string-list.txt b/Documentation/technical/api-string-list.txt\nindex 6d8c24b..3f575bd 100644\n--- a/Documentation/technical/api-string-list.txt\n+++ b/Documentation/technical/api-string-list.txt\n@@ -38,8 +38,8 @@ struct string_list list;\n int i;\n \n memset(&list, 0, sizeof(struct string_list));\n-string_list_append(\"foo\", &list);\n-string_list_append(\"bar\", &list);\n+string_list_append(&list, \"foo\");\n+string_list_append(&list, \"bar\");\n for (i = 0; i < list.nr; i++)\n \tprintf(\"%s\\n\", list.items[i].string)\n ----\ndiff --git a/builtin/apply.c b/builtin/apply.c\nindex 7ca9047..2d02d17 100644\n--- a/builtin/apply.c\n+++ b/builtin/apply.c\n@@ -3404,7 +3404,7 @@ static void add_name_limit(const char *name, int exclude)\n {\n \tstruct string_list_item *it;\n \n-\tit = string_list_append(name, &limit_by_name);\n+\tit = string_list_append(&limit_by_name, name);\n \tit->util = exclude ? NULL : (void *) 1;\n }\n \ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex b0a4029..b353861 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -438,7 +438,7 @@ static void get_tags_and_duplicates(struct object_array *pending,\n \t\t\t/* handle nested tags */\n \t\t\twhile (tag && tag->object.type == OBJ_TAG) {\n \t\t\t\tparse_object(tag->object.sha1);\n-\t\t\t\tstring_list_append(full_name, extra_refs)->util = tag;\n+\t\t\t\tstring_list_append(extra_refs, full_name)->util = tag;\n \t\t\t\ttag = (struct tag *)tag->tagged;\n \t\t\t}\n \t\t\tif (!tag)\n@@ -464,7 +464,7 @@ static void get_tags_and_duplicates(struct object_array *pending,\n \t\t}\n \t\tif (commit->util)\n \t\t\t/* more than one name for the same object */\n-\t\t\tstring_list_append(full_name, extra_refs)->util = commit;\n+\t\t\tstring_list_append(extra_refs, full_name)->util = commit;\n \t\telse\n \t\t\tcommit->util = full_name;\n \t}\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 957be9f..e29fff0 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -745,7 +745,7 @@ static int get_one_remote_for_fetch(struct remote *remote, void *priv)\n {\n \tstruct string_list *list = priv;\n \tif (!remote->skip_default_update)\n-\t\tstring_list_append(remote->name, list);\n+\t\tstring_list_append(list, remote->name);\n \treturn 0;\n }\n \n@@ -764,8 +764,8 @@ static int get_remote_group(const char *key, const char *value, void *priv)\n \t\tint space = strcspn(value, \" \\t\\n\");\n \t\twhile (*value) {\n \t\t\tif (space > 1) {\n-\t\t\t\tstring_list_append(xstrndup(value, space),\n-\t\t\t\t\t\t   g->list);\n+\t\t\t\tstring_list_append(g->list,\n+\t\t\t\t\t\t   xstrndup(value, space));\n \t\t\t}\n \t\t\tvalue += space + (value[space] != '\\0');\n \t\t\tspace = strcspn(value, \" \\t\\n\");\n@@ -786,7 +786,7 @@ static int add_remote_or_group(const char *name, struct string_list *list)\n \t\tif (!remote_is_configured(name))\n \t\t\treturn 0;\n \t\tremote = remote_get(name);\n-\t\tstring_list_append(remote->name, list);\n+\t\tstring_list_append(list, remote->name);\n \t}\n \treturn 1;\n }\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 379a031..6012012 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -82,7 +82,7 @@ static int handle_line(char *line)\n \n \titem = unsorted_string_list_lookup(&srcs, src);\n \tif (!item) {\n-\t\titem = string_list_append(src, &srcs);\n+\t\titem = string_list_append(&srcs, src);\n \t\titem->util = xcalloc(1, sizeof(struct src_data));\n \t\tinit_src_data(item->util);\n \t}\n@@ -93,19 +93,19 @@ static int handle_line(char *line)\n \t\tsrc_data->head_status |= 1;\n \t} else if (!prefixcmp(line, \"branch \")) {\n \t\torigin = line + 7;\n-\t\tstring_list_append(origin, &src_data->branch);\n+\t\tstring_list_append(&src_data->branch, origin);\n \t\tsrc_data->head_status |= 2;\n \t} else if (!prefixcmp(line, \"tag \")) {\n \t\torigin = line;\n-\t\tstring_list_append(origin + 4, &src_data->tag);\n+\t\tstring_list_append(&src_data->tag, origin + 4);\n \t\tsrc_data->head_status |= 2;\n \t} else if (!prefixcmp(line, \"remote branch \")) {\n \t\torigin = line + 14;\n-\t\tstring_list_append(origin, &src_data->r_branch);\n+\t\tstring_list_append(&src_data->r_branch, origin);\n \t\tsrc_data->head_status |= 2;\n \t} else {\n \t\torigin = src;\n-\t\tstring_list_append(line, &src_data->generic);\n+\t\tstring_list_append(&src_data->generic, line);\n \t\tsrc_data->head_status |= 2;\n \t}\n \n@@ -118,7 +118,7 @@ static int handle_line(char *line)\n \t\tsprintf(new_origin, \"%s of %s\", origin, src);\n \t\torigin = new_origin;\n \t}\n-\tstring_list_append(origin, &origins)->util = sha1;\n+\tstring_list_append(&origins, origin)->util = sha1;\n \treturn 0;\n }\n \n@@ -176,10 +176,10 @@ static void shortlog(const char *name, unsigned char *sha1,\n \t\tstrbuf_ltrim(&sb);\n \n \t\tif (!sb.len)\n-\t\t\tstring_list_append(sha1_to_hex(commit->object.sha1),\n-\t\t\t\t\t   &subjects);\n+\t\t\tstring_list_append(&subjects,\n+\t\t\t\t\t   sha1_to_hex(commit->object.sha1));\n \t\telse\n-\t\t\tstring_list_append(strbuf_detach(&sb, NULL), &subjects);\n+\t\t\tstring_list_append(&subjects, strbuf_detach(&sb, NULL));\n \t}\n \n \tif (count > limit)\ndiff --git a/builtin/log.c b/builtin/log.c\nindex a8dd8c9..8e9be47 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -497,13 +497,13 @@ static void add_header(const char *value)\n \t\tlen--;\n \n \tif (!strncasecmp(value, \"to: \", 4)) {\n-\t\titem = string_list_append(value + 4, &extra_to);\n+\t\titem = string_list_append(&extra_to, value + 4);\n \t\tlen -= 4;\n \t} else if (!strncasecmp(value, \"cc: \", 4)) {\n-\t\titem = string_list_append(value + 4, &extra_cc);\n+\t\titem = string_list_append(&extra_cc, value + 4);\n \t\tlen -= 4;\n \t} else {\n-\t\titem = string_list_append(value, &extra_hdr);\n+\t\titem = string_list_append(&extra_hdr, value);\n \t}\n \n \titem->string[len] = '\\0';\n@@ -527,13 +527,13 @@ static int git_format_config(const char *var, const char *value, void *cb)\n \tif (!strcmp(var, \"format.to\")) {\n \t\tif (!value)\n \t\t\treturn config_error_nonbool(var);\n-\t\tstring_list_append(value, &extra_to);\n+\t\tstring_list_append(&extra_to, value);\n \t\treturn 0;\n \t}\n \tif (!strcmp(var, \"format.cc\")) {\n \t\tif (!value)\n \t\t\treturn config_error_nonbool(var);\n-\t\tstring_list_append(value, &extra_cc);\n+\t\tstring_list_append(&extra_cc, value);\n \t\treturn 0;\n \t}\n \tif (!strcmp(var, \"diff.color\") || !strcmp(var, \"color.diff\")) {\n@@ -911,7 +911,7 @@ static int to_callback(const struct option *opt, const char *arg, int unset)\n \tif (unset)\n \t\tstring_list_clear(&extra_to, 0);\n \telse\n-\t\tstring_list_append(arg, &extra_to);\n+\t\tstring_list_append(&extra_to, arg);\n \treturn 0;\n }\n \n@@ -920,7 +920,7 @@ static int cc_callback(const struct option *opt, const char *arg, int unset)\n \tif (unset)\n \t\tstring_list_clear(&extra_cc, 0);\n \telse\n-\t\tstring_list_append(arg, &extra_cc);\n+\t\tstring_list_append(&extra_cc, arg);\n \treturn 0;\n }\n \n@@ -1194,7 +1194,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t\trev.ref_message_ids = xcalloc(1, sizeof(struct string_list));\n \tif (in_reply_to) {\n \t\tconst char *msgid = clean_message_id(in_reply_to);\n-\t\tstring_list_append(msgid, rev.ref_message_ids);\n+\t\tstring_list_append(rev.ref_message_ids, msgid);\n \t}\n \trev.numbered_files = numbered_files;\n \trev.patch_suffix = fmt_patch_suffix;\n@@ -1241,8 +1241,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t\t\t\t    && (!cover_letter || rev.nr > 1))\n \t\t\t\t\tfree(rev.message_id);\n \t\t\t\telse\n-\t\t\t\t\tstring_list_append(rev.message_id,\n-\t\t\t\t\t\t\t   rev.ref_message_ids);\n+\t\t\t\t\tstring_list_append(rev.ref_message_ids,\n+\t\t\t\t\t\t\t   rev.message_id);\n \t\t\t}\n \t\t\tgen_message_id(&rev, sha1_to_hex(commit->object.sha1));\n \t\t}\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex 277765b..cc7247a 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -87,7 +87,7 @@ static int opt_parse_track(const struct option *opt, const char *arg, int not)\n \tif (not)\n \t\tstring_list_clear(list, 0);\n \telse\n-\t\tstring_list_append(arg, list);\n+\t\tstring_list_append(list, arg);\n \treturn 0;\n }\n \n@@ -149,7 +149,7 @@ static int add(int argc, const char **argv)\n \tstrbuf_addf(&buf, \"remote.%s.fetch\", name);\n \n \tif (track.nr == 0)\n-\t\tstring_list_append(\"*\", &track);\n+\t\tstring_list_append(&track, \"*\");\n \tfor (i = 0; i < track.nr; i++) {\n \t\tstruct string_list_item *item = track.items + i;\n \n@@ -247,11 +247,11 @@ static int config_read_branches(const char *key, const char *value, void *cb)\n \t\t\twhile (space) {\n \t\t\t\tchar *merge;\n \t\t\t\tmerge = xstrndup(value, space - value);\n-\t\t\t\tstring_list_append(merge, &info->merge);\n+\t\t\t\tstring_list_append(&info->merge, merge);\n \t\t\t\tvalue = abbrev_branch(space + 1);\n \t\t\t\tspace = strchr(value, ' ');\n \t\t\t}\n-\t\t\tstring_list_append(xstrdup(value), &info->merge);\n+\t\t\tstring_list_append(&info->merge, xstrdup(value));\n \t\t} else\n \t\t\tinfo->rebase = git_config_bool(orig_key, value);\n \t}\n@@ -288,14 +288,14 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat\n \tfor (ref = fetch_map; ref; ref = ref->next) {\n \t\tunsigned char sha1[20];\n \t\tif (!ref->peer_ref || read_ref(ref->peer_ref->name, sha1))\n-\t\t\tstring_list_append(abbrev_branch(ref->name), &states->new);\n+\t\t\tstring_list_append(&states->new, abbrev_branch(ref->name));\n \t\telse\n-\t\t\tstring_list_append(abbrev_branch(ref->name), &states->tracked);\n+\t\t\tstring_list_append(&states->tracked, abbrev_branch(ref->name));\n \t}\n \tstale_refs = get_stale_heads(states->remote, fetch_map);\n \tfor (ref = stale_refs; ref; ref = ref->next) {\n \t\tstruct string_list_item *item =\n-\t\t\tstring_list_append(abbrev_branch(ref->name), &states->stale);\n+\t\t\tstring_list_append(&states->stale, abbrev_branch(ref->name));\n \t\titem->util = xstrdup(ref->name);\n \t}\n \tfree_refs(stale_refs);\n@@ -344,8 +344,8 @@ static int get_push_ref_states(const struct ref *remote_refs,\n \t\t\tcontinue;\n \t\thashcpy(ref->new_sha1, ref->peer_ref->new_sha1);\n \n-\t\titem = string_list_append(abbrev_branch(ref->peer_ref->name),\n-\t\t\t\t\t  &states->push);\n+\t\titem = string_list_append(&states->push,\n+\t\t\t\t\t  abbrev_branch(ref->peer_ref->name));\n \t\titem->util = xcalloc(sizeof(struct push_info), 1);\n \t\tinfo = item->util;\n \t\tinfo->forced = ref->force;\n@@ -380,7 +380,7 @@ static int get_push_ref_states_noquery(struct ref_states *states)\n \n \tstates->push.strdup_strings = 1;\n \tif (!remote->push_refspec_nr) {\n-\t\titem = string_list_append(\"(matching)\", &states->push);\n+\t\titem = string_list_append(&states->push, \"(matching)\");\n \t\tinfo = item->util = xcalloc(sizeof(struct push_info), 1);\n \t\tinfo->status = PUSH_STATUS_NOTQUERIED;\n \t\tinfo->dest = xstrdup(item->string);\n@@ -388,11 +388,11 @@ static int get_push_ref_states_noquery(struct ref_states *states)\n \tfor (i = 0; i < remote->push_refspec_nr; i++) {\n \t\tstruct refspec *spec = remote->push + i;\n \t\tif (spec->matching)\n-\t\t\titem = string_list_append(\"(matching)\", &states->push);\n+\t\t\titem = string_list_append(&states->push, \"(matching)\");\n \t\telse if (strlen(spec->src))\n-\t\t\titem = string_list_append(spec->src, &states->push);\n+\t\t\titem = string_list_append(&states->push, spec->src);\n \t\telse\n-\t\t\titem = string_list_append(\"(delete)\", &states->push);\n+\t\t\titem = string_list_append(&states->push, \"(delete)\");\n \n \t\tinfo = item->util = xcalloc(sizeof(struct push_info), 1);\n \t\tinfo->forced = spec->force;\n@@ -416,7 +416,7 @@ static int get_head_names(const struct ref *remote_refs, struct ref_states *stat\n \tmatches = guess_remote_head(find_ref_by_name(remote_refs, \"HEAD\"),\n \t\t\t\t    fetch_map, 1);\n \tfor (ref = matches; ref; ref = ref->next)\n-\t\tstring_list_append(abbrev_branch(ref->name), &states->heads);\n+\t\tstring_list_append(&states->heads, abbrev_branch(ref->name));\n \n \tfree_refs(fetch_map);\n \tfree_refs(matches);\n@@ -480,8 +480,8 @@ static int add_branch_for_removal(const char *refname,\n \tif (prefixcmp(refname, \"refs/remotes\")) {\n \t\t/* advise user how to delete local branches */\n \t\tif (!prefixcmp(refname, \"refs/heads/\"))\n-\t\t\tstring_list_append(abbrev_branch(refname),\n-\t\t\t\t\t   branches->skipped);\n+\t\t\tstring_list_append(branches->skipped,\n+\t\t\t\t\t   abbrev_branch(refname));\n \t\t/* silently skip over other non-remote refs */\n \t\treturn 0;\n \t}\n@@ -490,7 +490,7 @@ static int add_branch_for_removal(const char *refname,\n \tif (flags & REF_ISSYMREF)\n \t\treturn unlink(git_path(\"%s\", refname));\n \n-\titem = string_list_append(refname, branches->branches);\n+\titem = string_list_append(branches->branches, refname);\n \titem->util = xmalloc(20);\n \thashcpy(item->util, sha1);\n \n@@ -515,7 +515,7 @@ static int read_remote_branches(const char *refname,\n \n \tstrbuf_addf(&buf, \"refs/remotes/%s\", rename->old);\n \tif (!prefixcmp(refname, buf.buf)) {\n-\t\titem = string_list_append(xstrdup(refname), rename->remote_branches);\n+\t\titem = string_list_append(rename->remote_branches, xstrdup(refname));\n \t\tsymref = resolve_ref(refname, orig_sha1, 1, &flag);\n \t\tif (flag & REF_ISSYMREF)\n \t\t\titem->util = xstrdup(symref);\n@@ -798,7 +798,7 @@ static int append_ref_to_tracked_list(const char *refname,\n \tmemset(&refspec, 0, sizeof(refspec));\n \trefspec.dst = (char *)refname;\n \tif (!remote_find_tracking(states->remote, &refspec))\n-\t\tstring_list_append(abbrev_branch(refspec.src), &states->tracked);\n+\t\tstring_list_append(&states->tracked, abbrev_branch(refspec.src));\n \n \treturn 0;\n }\n@@ -946,7 +946,7 @@ static int add_push_to_show_info(struct string_list_item *push_item, void *cb_da\n \t\tshow_info->width = n;\n \tif ((n = strlen(push_info->dest)) > show_info->width2)\n \t\tshow_info->width2 = n;\n-\titem = string_list_append(push_item->string, show_info->list);\n+\titem = string_list_append(show_info->list, push_item->string);\n \titem->util = push_item->util;\n \treturn 0;\n }\n@@ -1360,10 +1360,10 @@ static int get_one_entry(struct remote *remote, void *priv)\n \n \tif (remote->url_nr > 0) {\n \t\tstrbuf_addf(&url_buf, \"%s (fetch)\", remote->url[0]);\n-\t\tstring_list_append(remote->name, list)->util =\n+\t\tstring_list_append(list, remote->name)->util =\n \t\t\t\tstrbuf_detach(&url_buf, NULL);\n \t} else\n-\t\tstring_list_append(remote->name, list)->util = NULL;\n+\t\tstring_list_append(list, remote->name)->util = NULL;\n \tif (remote->pushurl_nr) {\n \t\turl = remote->pushurl;\n \t\turl_nr = remote->pushurl_nr;\n@@ -1374,7 +1374,7 @@ static int get_one_entry(struct remote *remote, void *priv)\n \tfor (i = 0; i < url_nr; i++)\n \t{\n \t\tstrbuf_addf(&url_buf, \"%s (push)\", url[i]);\n-\t\tstring_list_append(remote->name, list)->util =\n+\t\tstring_list_append(list, remote->name)->util =\n \t\t\t\tstrbuf_detach(&url_buf, NULL);\n \t}\n \ndiff --git a/builtin/rerere.c b/builtin/rerere.c\nindex 34f9ace..73610b6 100644\n--- a/builtin/rerere.c\n+++ b/builtin/rerere.c\n@@ -59,7 +59,7 @@ static void garbage_collect(struct string_list *rr)\n \t\tcutoff = (has_rerere_resolution(e->d_name)\n \t\t\t  ? cutoff_resolve : cutoff_noresolve);\n \t\tif (then < now - cutoff * 86400)\n-\t\t\tstring_list_append(e->d_name, &to_remove);\n+\t\t\tstring_list_append(&to_remove, e->d_name);\n \t}\n \tfor (i = 0; i < to_remove.nr; i++)\n \t\tunlink_rr_item(to_remove.items[i].string);\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 06320f5..e052c17 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -115,7 +115,7 @@ static void insert_one_record(struct shortlog *log,\n \t\t}\n \t}\n \n-\tstring_list_append(buffer, item->util);\n+\tstring_list_append(item->util, buffer);\n }\n \n static void read_from_stdin(struct shortlog *log)\ndiff --git a/notes.c b/notes.c\nindex e425e19..6556627 100644\n--- a/notes.c\n+++ b/notes.c\n@@ -838,7 +838,7 @@ static int string_list_add_one_ref(const char *path, const unsigned char *sha1,\n {\n \tstruct string_list *refs = cb;\n \tif (!unsorted_string_list_has_string(refs, path))\n-\t\tstring_list_append(path, refs);\n+\t\tstring_list_append(refs, path);\n \treturn 0;\n }\n \n@@ -851,7 +851,7 @@ void string_list_add_refs_by_glob(struct string_list *list, const char *glob)\n \t\tif (get_sha1(glob, sha1))\n \t\t\twarning(\"notes ref %s is invalid\", glob);\n \t\tif (!unsorted_string_list_has_string(list, glob))\n-\t\t\tstring_list_append(glob, list);\n+\t\t\tstring_list_append(list, glob);\n \t}\n }\n \n@@ -983,7 +983,7 @@ void init_display_notes(struct display_notes_opt *opt)\n \tassert(!display_notes_trees);\n \n \tif (!opt || !opt->suppress_default_notes) {\n-\t\tstring_list_append(default_notes_ref(), &display_notes_refs);\n+\t\tstring_list_append(&display_notes_refs, default_notes_ref());\n \t\tdisplay_ref_env = getenv(GIT_NOTES_DISPLAY_REF_ENVIRONMENT);\n \t\tif (display_ref_env) {\n \t\t\tstring_list_add_refs_from_colon_sep(&display_notes_refs,\ndiff --git a/remote.c b/remote.c\nindex c70181c..498bf38 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1709,7 +1709,7 @@ struct ref *get_stale_heads(struct remote *remote, struct ref *fetch_map)\n \tinfo.ref_names = &ref_names;\n \tinfo.stale_refs_tail = &stale_refs;\n \tfor (ref = fetch_map; ref; ref = ref->next)\n-\t\tstring_list_append(ref->name, &ref_names);\n+\t\tstring_list_append(&ref_names, ref->name);\n \tsort_string_list(&ref_names);\n \tfor_each_ref(get_stale_heads_cb, &info);\n \tstring_list_clear(&ref_names, 0);\ndiff --git a/revision.c b/revision.c\nindex f4b8b38..28f1c6d 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1205,8 +1205,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg\n \t\telse\n \t\t\tstrbuf_addstr(&buf, \"refs/notes/\");\n \t\tstrbuf_addstr(&buf, arg+13);\n-\t\tstring_list_append(strbuf_detach(&buf, NULL),\n-\t\t\t\t   revs->notes_opt.extra_notes_refs);\n+\t\tstring_list_append(revs->notes_opt.extra_notes_refs,\n+\t\t\t\t   strbuf_detach(&buf, NULL));\n \t} else if (!strcmp(arg, \"--no-notes\")) {\n \t\trevs->show_notes = 0;\n \t\trevs->show_notes_given = 1;\ndiff --git a/string-list.c b/string-list.c\nindex c9ad7fc..6d29187 100644\n--- a/string-list.c\n+++ b/string-list.c\n@@ -148,7 +148,7 @@ void print_string_list(const char *text, const struct string_list *p)\n \t\tprintf(\"%s:%p\\n\", p->items[i].string, p->items[i].util);\n }\n \n-struct string_list_item *string_list_append(const char *string, struct string_list *list)\n+struct string_list_item *string_list_append(struct string_list *list, const char *string)\n {\n \tALLOC_GROW(list->items, list->nr + 1, list->alloc);\n \tlist->items[list->nr].string =\ndiff --git a/string-list.h b/string-list.h\nindex 63b69c8..814bbd3 100644\n--- a/string-list.h\n+++ b/string-list.h\n@@ -35,7 +35,7 @@ struct string_list_item *string_list_insert_at_index(int insert_at,\n struct string_list_item *string_list_lookup(const char *string, struct string_list *list);\n \n /* Use these functions only on unsorted lists: */\n-struct string_list_item *string_list_append(const char *string, struct string_list *list);\n+struct string_list_item *string_list_append(struct string_list *list, const char *string);\n void sort_string_list(struct string_list *list);\n int unsorted_string_list_has_string(struct string_list *list, const char *string);\n struct string_list_item *unsorted_string_list_lookup(struct string_list *list,\n-- \n1.7.0.3.313.g87b3c\n"},{"id":"138357","messageId":"a93915db4a7615fe6b4c8e3f890db45f@212.159.54.234","threadId":"23160","inReplyTo":"1270103379-3686-1-git-send-email-bebarino@gmail.com","subject":"Re: [PATCH 8/7] Make string_list_append() consistent with everything else","fromName":"Julian Phillips","fromEmail":"julian@quantumfyre.co.uk","sentAt":"2010-04-01T20:07:30Z","receivedAt":"2010-04-01T20:07:30Z","isPatch":true,"sender":{"key":"julian@quantumfyre.co.uk","avatar":"https://avatars.githubusercontent.com/u/948888?v=4"},"body":"On Wed, 31 Mar 2010 23:29:39 -0700, Stephen Boyd <bebarino@gmail.com>\nwrote:\n> string_list_append() is the only function in the string_list API which\n> takes\n> the struct string_list as the second argument instead of the first. Swap\n> the\n> ordering to make the string_list API consistent.\n\nThe only function?  It doesn't seem that way ...\n\njp3@rayne: git(pu)>grep '(' string-list.h | grep -v '(\\(const \\)*struct\nstring_list'\nvoid print_string_list(const char *text, const struct string_list *p);\ntypedef void (*string_list_clear_func_t)(void *p, const char *str);\nint for_each_string_list(string_list_each_func_t,\nstruct string_list_item *string_list_insert(const char *string, struct\nstring_list *list);\nstruct string_list_item *string_list_insert_at_index(int insert_at,\nstruct string_list_item *string_list_lookup(const char *string, struct\nstring_list *list);\nstruct string_list_item *string_list_append(const char *string, struct\nstring_list *list);\n\nI don't think that swapping the argument order for append is wrong, but it\ndoesn't seem to be the only function that doesn't take the list as the\nfirst argument ... or am I missing something? (probably am)\n\n-- \nJulian\n"}]}