summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9656153)
raw | patch | inline | side by side (parent: 9656153)
author | Junio C Hamano <gitster@pobox.com> | |
Thu, 30 Aug 2007 06:12:38 +0000 (23:12 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 30 Aug 2007 06:12:38 +0000 (23:12 -0700) |
This is most visible when you do "git commit Makefile Makefile"; it
may be a stupid request, but that is not a reason to fail the command.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
may be a stupid request, but that is not a reason to fail the command.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-ls-files.c | patch | blob | history |
diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index d36181a75541df10c5dc1595ccca5a6fc429591f..cce17b5ced173ff7ecc1348eb3163609b15982ca 100644 (file)
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
*/
int num, errors = 0;
for (num = 0; pathspec[num]; num++) {
+ int other, found_dup;
+
if (ps_matched[num])
continue;
+ /*
+ * The caller might have fed identical pathspec
+ * twice. Do not barf on such a mistake.
+ */
+ for (found_dup = other = 0;
+ !found_dup && pathspec[other];
+ other++) {
+ if (other == num || !ps_matched[other])
+ continue;
+ if (!strcmp(pathspec[other], pathspec[num]))
+ /*
+ * Ok, we have a match already.
+ */
+ found_dup = 1;
+ }
+ if (found_dup)
+ continue;
+
error("pathspec '%s' did not match any file(s) known to git.",
pathspec[num] + prefix_offset);
errors++;