{"thread":{"id":"30498","subject":"Using git apply inside a repository but on un-tracked files","startedAt":"2012-05-10T16:46:25Z","lastAt":"2012-05-10T16:46:25Z","messageCount":1,"participants":["Orion Poplawski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"191325","messageId":"4FABF0E1.1040902@cora.nwra.com","threadId":"30498","inReplyTo":null,"subject":"Using git apply inside a repository but on un-tracked files","fromName":"Orion Poplawski","fromEmail":"orion@cora.nwra.com","sentAt":"2012-05-10T16:46:25Z","receivedAt":"2012-05-10T16:46:25Z","isPatch":false,"sender":{"key":"orion@cora.nwra.com","avatar":null},"body":"I'm a Fedora package which tracks the the package files in git.  When the \npackage source is unpacked it is unpacked under the git directory, however \nthese files are not tracked by git.\n\nI tried to use git apply to apply a patch (because it is coming mercurial and \nhas diff --git rename info in it) to the package source.  However, the \npresence of a .git repo in the parent tree caused git apply to refuse to apply \nthe patch, unfortunately silently without any complaint or error return code, \neven with --verbose.  I got it to work by passing the  appropriate --directory \noption, but this took me a long time to figure out due to the lack of a \nwarning messages.  Could one be added please?  Perhaps like in the attached patch?\n\nTIA,\n\n  Orion\n\n-- \nOrion Poplawski\nTechnical Manager                     303-415-9701 x222\nNWRA, Boulder Office                  FAX: 303-415-9702\n3380 Mitchell Lane                       orion@nwra.com\nBoulder, CO 80301                   http://www.nwra.com\n\n\n--- apply.c.orig\t2012-05-01 22:50:38.000000000 -0600\n+++ apply.c\t2012-05-10 10:45:10.744088807 -0600\n@@ -3631,8 +3631,12 @@\n \tif (0 < prefix_length) {\n \t\tint pathlen = strlen(pathname);\n \t\tif (pathlen <= prefix_length ||\n-\t\t    memcmp(prefix, pathname, prefix_length))\n+\t\t    memcmp(prefix, pathname, prefix_length)) {\n+\t\t\tif (apply_verbosely)\n+\t\t\t\terror(\"path '%s' is outide of git repo '%s'\",\n+\t\t\t\t      pathname, prefix);\n \t\t\treturn 0;\n+\t\t}\n \t}\n \n \t/* See if it matches any of exclude/include rule */\n"}]}