{"push_id":4374853274,"size":8,"distinct_size":7,"ref":"refs/heads/ls-files-bug","head":"2200bf144af2eab98919dd6ed6313d408b1cba1e","before":"036a4575edd483431e6835d20f3b9a8acfd89cf2","commits":[{"sha":"4b24ba9966d41558cc2382d81e6e76b4375b555c","author":{"name":"Elijah Newren","email":"955405675e5ddb1a110d200661c528aa223ef60f@gmail.com"},"message":"t3011: demonstrate directory traversal failures\n\nAdd several tests demonstrating directory traversal failures of various\nsorts in dir.c (and one similar looking test that turns out to be a\ngit_fnmatch bug).  A lot of these tests look like near duplicates of\neach other, but an optimization path in dir.c to pre-descend into a\ncommon prefix and the specialized treatment of trailing slashes in dir.c\nmean the tiny differences are sometimes important and potentially cause\ndifferent codepaths to be explored.\n\nOf the 7 failing tests, 2 are new to git-2.24.0 (tweaked by side effects\nof the en/clean-nested-with-ignored-topic); the other 5 also failed\nunder git-2.23.0 and earlier.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>","distinct":false,"url":"https://api.github.com/repos/newren/git/commits/4b24ba9966d41558cc2382d81e6e76b4375b555c"},{"sha":"bfaf7592ee611f7e9f6fbcf7b1e4ae32f8307548","author":{"name":"Elijah Newren","email":"955405675e5ddb1a110d200661c528aa223ef60f@gmail.com"},"message":"Revert \"dir.c: make 'git-status --ignored' work within leading directories\"\n\nCommit be8a84c52669 (\"dir.c: make 'git-status --ignored' work within\nleading directories\", 2013-04-15) noted that\n   git status --ignored <SOMEPATH>\nwould not list ignored files and directories within <SOMEPATH> if\n<SOMEPATH> was untracked, and modified the behavior to make it show\nthem.  However, it did so via a hack that broke consistency; it would\nshow paths under <SOMEPATH> differently than a simple\n   git status --ignored | grep <SOMEPATH>\nwould show them.  A correct fix is slightly more involved, and\ncomplicated slightly by this hack, so we revert this commit (but keep\ncorrected versions of the testcases) and will later fix the original\nbug with a subsequent patch.\n\nSome history may be helpful:\n\nA very, very similar case to the commit we are reverting was raised in\ncommit 48ffef966c76 (\"ls-files: fix overeager pathspec optimization\",\n2010-01-08); but it actually went in somewhat the opposite direction.  In\nthat commit, it mentioned how\n   git ls-files -o --exclude-standard t/\nused to show untracked files under t/ even when t/ was ignored, and then\nchanged the behavior to stop showing untracked files under an ignored\ndirectory.  More importantly, this commit considered keeping this\nbehavior but noted that it would be inconsistent with the behavior when\nmultiple pathspecs were specified and thus rejected it.\n\nThe reason for this whole inconsistency when one pathspec is specified\nversus zero or two is because common prefixes of pathspecs are sent\nthrough a different set of checks (in treat_leading_path()) than normal\nfile/directory traversal (those go through read_directory_recursive()\nand treat_path()).  As such, for consistency, one needs to check that\nboth codepaths produce the same result.\n\nRevert commit be8a84c526691667fc04a8241d93a3de1de298ab, except instead\nof removing the testcase it added, modify it to check for correct and\nconsistent behavior.  A subsequent patch in this series will fix the\ntestcase.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>","distinct":true,"url":"https://api.github.com/repos/newren/git/commits/bfaf7592ee611f7e9f6fbcf7b1e4ae32f8307548"},{"sha":"ea2588e87cd4f42f685eef0aa41da83c8fd7333f","author":{"name":"Elijah Newren","email":"955405675e5ddb1a110d200661c528aa223ef60f@gmail.com"},"message":"dir: remove stray quote character in comment\n\nSigned-off-by: Elijah Newren <newren@gmail.com>","distinct":true,"url":"https://api.github.com/repos/newren/git/commits/ea2588e87cd4f42f685eef0aa41da83c8fd7333f"},{"sha":"c3220758ab2393ea07f403de04951e32404408b2","author":{"name":"Elijah Newren","email":"955405675e5ddb1a110d200661c528aa223ef60f@gmail.com"},"message":"dir: exit before wildcard fall-through if there is no wildcard\n\nThe DO_MATCH_LEADING_PATHSPEC had a fall-through case for if there was a\nwildcard, noting that we don't yet have enough information to determine\nif a further paths under the current directory might match due to the\npresence of wildcards.  But if we have no wildcards in our pathspec,\nthen we shouldn't get to that fall-through case.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>","distinct":true,"url":"https://api.github.com/repos/newren/git/commits/c3220758ab2393ea07f403de04951e32404408b2"},{"sha":"738d9ae4c9ca0e54502b9ef606e2fc8dba9a94e1","author":{"name":"Elijah Newren","email":"955405675e5ddb1a110d200661c528aa223ef60f@gmail.com"},"message":"dir: break part of read_directory_recursive() out for reuse\n\nCreate an add_path_to_appropriate_result_list() function from the code\nat the end of read_directory_recursive() so we can use it elsewhere.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>","distinct":true,"url":"https://api.github.com/repos/newren/git/commits/738d9ae4c9ca0e54502b9ef606e2fc8dba9a94e1"},{"sha":"b897095136920965111f22840373e03524a8c0ae","author":{"name":"Elijah Newren","email":"955405675e5ddb1a110d200661c528aa223ef60f@gmail.com"},"message":"dir: fix checks on common prefix directory\n\nMany years ago, the directory traversing logic had an optimization that\nwould always recurse into any directory that was a common prefix of all\nthe pathspecs without walking the leading directories to get down to\nthe desired directory.  Thus,\n   git ls-files -o .git/                        # case A\nwould notice that .git/ was a common prefix of all pathspecs (since\nit is the only pathspec listed), and then traverse into it and start\nshowing unknown files under that directory.  Unfortunately, .git/ is not\na directory we should be traversing into, which made this optimization\nproblematic.  This also affected cases like\n   git ls-files -o --exclude-standard t/        # case B\nwhere t/ was in the .gitignore file and thus isn't interesting and\nshouldn't be recursed into.  It also affected cases like\n   git ls-files -o --directory untracked_dir/   # case C\nwhere untracked_dir/ is indeed untracked and thus interesting, but the\n--directory flag means we only want to show the directory itself, not\nrecurse into it and start listing untracked files below it.\n\nThe case B class of bugs were noted and fixed in commits 16e2cfa90993\n(\"read_directory(): further split treat_path()\", 2010-01-08) and\n48ffef966c76 (\"ls-files: fix overeager pathspec optimization\",\n2010-01-08), with the idea being that we first wanted to check whether\nthe common prefix was interesting.  The former patch noted that\ntreat_path() couldn't be used when checking the common prefix because\ntreat_path() requires a dir_entry() and we haven't read any directories\nat the point we are checking the common prefix.  So, that patch split\ntreat_one_path() out of treat_path().  The latter patch then created a\nnew treat_leading_path() which duplicated by hand the bits of\ntreat_path() that couldn't be broken out and then called\ntreat_one_path() for the remainder.  There were three problems with this\napproach:\n\n  * The duplicated logic in treat_leading_path() accidentally missed the\n    check for special paths (such as is_dot_or_dotdot and matching\n    \".git\"), causing case A types of bugs to continue to be an issue.\n  * The treat_leading_path() logic assumed we should traverse into\n    anything where path_treatment was not path_none, i.e. it perpetuated\n    class C types of bugs.\n  * It meant we had split logic that needed to kept in sync, running the\n    risk that people introduced new inconsistencies (such as in commit\n    be8a84c52669, which we reverted earlier in this series, or in commit\n    df5bcdf83ae which we'll fix in a subsequent commit)\n\nFix most these problems by making treat_leading_path() not only loop\nover each leading path component, but calling treat_path() directly on\neach.  To do so, we have to create a synthetic dir_entry, but that only\ntakes a few lines.  Then, pay attention to the path_treatment result we\nget from treat_path() and don't treat path_excluded, path_untracked, and\npath_recurse all the same as path_recurse.\n\nThis leaves one remaining problem, the new inconsistency from commit\ndf5bcdf83ae.  That will be addressed in a subsequent commit.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>","distinct":true,"url":"https://api.github.com/repos/newren/git/commits/b897095136920965111f22840373e03524a8c0ae"},{"sha":"4f8bf05d265bdf6c9242e21feeda14ad86dd0a4c","author":{"name":"Elijah Newren","email":"955405675e5ddb1a110d200661c528aa223ef60f@gmail.com"},"message":"dir: synchronize treat_leading_path() and read_directory_recursive()\n\nOur optimization to avoid calling into read_directory_recursive() when\nall pathspecs have a common leading directory mean that we need to match\nthe logic that read_directory_recursive() would use if we had just\ncalled it from the root.  Since it does more than call treat_path() we\nneed to copy that same logic.\n\nAlternatively, we could try to change treat_path to return path_recurse\nfor an untracked directory under the given special circumstances that\nthis logic checks for, but a simple switch results in many test failures\nsuch as 'git clean -d' not wiping out untracked but empty directories.\nTo work around that, we'd need the caller of treat_path to check for\npath_recurse and sometimes special case it into path_untracked.  In\nother words, we'd still have extra logic in both places.\n\nNeeding to duplicate logic like this means it is guaranteed someone will\neventually need to make further changes and forget to update both\nlocations.  It is tempting to just nuke the leading_directory special\ncasing to avoid such bugs and simplify the code, but unpack_trees'\nverify_clean_subdirectory() also calls read_directory() and does so with\na non-empty leading path, so I'm hesitant to try to restructure further.\nAdd obnoxious warnings to treat_leading_path() and\nread_directory_recursive() to try to warn people of such problems.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>","distinct":true,"url":"https://api.github.com/repos/newren/git/commits/4f8bf05d265bdf6c9242e21feeda14ad86dd0a4c"},{"sha":"2200bf144af2eab98919dd6ed6313d408b1cba1e","author":{"name":"Elijah Newren","email":"955405675e5ddb1a110d200661c528aa223ef60f@gmail.com"},"message":"dir: consolidate similar code in treat_directory()\n\nBoth the DIR_SKIP_NESTED_GIT and DIR_NO_GITLINKS cases were checking for\nwhether a path was actually a nonbare repository.  That code could be\nshared, with just the result of how to act differing between the two\ncases.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>","distinct":true,"url":"https://api.github.com/repos/newren/git/commits/2200bf144af2eab98919dd6ed6313d408b1cba1e"}]}
{"actor":{"display_login":"newren"}}