{"thread":{"id":"12560","subject":"[PATCH 2/4] Revert part of 744dacd (builtin-mv: minimum fix to avoid losing files)","startedAt":"2008-03-07T10:54:44Z","lastAt":"2008-03-07T10:54:46Z","messageCount":3,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"71328","messageId":"1204887286-32574-1-git-send-email-gitster@pobox.com","threadId":"12560","inReplyTo":null,"subject":"[PATCH 2/4] Revert part of 744dacd (builtin-mv: minimum fix to avoid losing files)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-07T10:54:44Z","receivedAt":"2008-03-07T10:54:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"When get_pathspec() was originally made absolute-path capable,\nwe botched the interface to it, without dying inside the function\nwhen given a path that is outside the work tree, and made it the\nresponsibility of callers to check the condition in a roundabout\nway.  This is made unnecessary with the previous patch.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin-mv.c |    6 +-----\n 1 files changed, 1 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin-mv.c b/builtin-mv.c\nindex 68aa2a6..94f6dd2 100644\n--- a/builtin-mv.c\n+++ b/builtin-mv.c\n@@ -19,7 +19,6 @@ static const char **copy_pathspec(const char *prefix, const char **pathspec,\n \t\t\t\t  int count, int base_name)\n {\n \tint i;\n-\tint len = prefix ? strlen(prefix) : 0;\n \tconst char **result = xmalloc((count + 1) * sizeof(const char *));\n \tmemcpy(result, pathspec, count * sizeof(const char *));\n \tresult[count] = NULL;\n@@ -33,11 +32,8 @@ static const char **copy_pathspec(const char *prefix, const char **pathspec,\n \t\t\tif (last_slash)\n \t\t\t\tresult[i] = last_slash + 1;\n \t\t}\n-\t\tresult[i] = prefix_path(prefix, len, result[i]);\n-\t\tif (!result[i])\n-\t\t\texit(1); /* error already given */\n \t}\n-\treturn result;\n+\treturn get_pathspec(prefix, result);\n }\n \n static void show_list(const char *label, struct path_list *list)\n-- \n1.5.4.3.587.g0bdd73\n\n"},{"id":"71329","messageId":"1204887286-32574-2-git-send-email-gitster@pobox.com","threadId":"12560","inReplyTo":"1204887286-32574-1-git-send-email-gitster@pobox.com","subject":"[PATCH 3/4] Revert part of 1abf095 (git-add: adjust to the get_pathspec() changes)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-07T10:54:45Z","receivedAt":"2008-03-07T10:54:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"When get_pathspec() was originally made absolute-path capable,\nwe botched the interface to it, without dying inside the function\nwhen given a path that is outside the work tree, and made it the\nresponsibility of callers to check the condition in a roundabout\nway.  This is made unnecessary with the previous patch.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin-add.c |   12 ------------\n 1 files changed, 0 insertions(+), 12 deletions(-)\n\ndiff --git a/builtin-add.c b/builtin-add.c\nindex 820110e..4a91e3e 100644\n--- a/builtin-add.c\n+++ b/builtin-add.c\n@@ -228,18 +228,6 @@ int cmd_add(int argc, const char **argv, const char *prefix)\n \t\tgoto finish;\n \t}\n \n-\tif (*argv) {\n-\t\t/* Was there an invalid path? */\n-\t\tif (pathspec) {\n-\t\t\tint num;\n-\t\t\tfor (num = 0; pathspec[num]; num++)\n-\t\t\t\t; /* just counting */\n-\t\t\tif (argc != num)\n-\t\t\t\texit(1); /* error message already given */\n-\t\t} else\n-\t\t\texit(1); /* error message already given */\n-\t}\n"},{"id":"71330","messageId":"1204887286-32574-3-git-send-email-gitster@pobox.com","threadId":"12560","inReplyTo":"1204887286-32574-2-git-send-email-gitster@pobox.com","subject":"[PATCH 4/4] Revert part of d089eba (setup: sanitize absolute and funny paths in get_pathspec())","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-07T10:54:46Z","receivedAt":"2008-03-07T10:54:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"When get_pathspec() was originally made absolute-path capable,\nwe botched the interface to it, without dying inside the function\nwhen given a path that is outside the work tree, and made it the\nresponsibility of callers to check the condition in a roundabout\nway.  This is made unnecessary with the previous patch.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin-ls-files.c |   11 +----------\n 1 files changed, 1 insertions(+), 10 deletions(-)\n\ndiff --git a/builtin-ls-files.c b/builtin-ls-files.c\nindex 25dbfb4..dc7eab8 100644\n--- a/builtin-ls-files.c\n+++ b/builtin-ls-files.c\n@@ -574,17 +574,8 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)\n \tpathspec = get_pathspec(prefix, argv + i);\n \n \t/* Verify that the pathspec matches the prefix */\n-\tif (pathspec) {\n-\t\tif (argc != i) {\n-\t\t\tint cnt;\n-\t\t\tfor (cnt = 0; pathspec[cnt]; cnt++)\n-\t\t\t\t;\n-\t\t\tif (cnt != (argc - i))\n-\t\t\t\texit(1); /* error message already given */\n-\t\t}\n+\tif (pathspec)\n \t\tprefix = verify_pathspec(prefix);\n-\t} else if (argc != i)\n-\t\texit(1); /* error message already given */\n \n \t/* Treat unmatching pathspec elements as errors */\n \tif (pathspec && error_unmatch) {\n-- \n1.5.4.3.587.g0bdd73\n\n"}]}