summaryrefslogtreecommitdiff
path: root/t/t7300-clean.sh
AgeCommit message (Collapse)Author
2013-04-15dir.c: git-clean -d -X: don't delete tracked directoriesKarsten Blees
The notion of "ignored tracked" directories introduced in 721ac4ed "dir.c: Make git-status --ignored more consistent" has a few unwanted side effects: - git-clean -d -X: deletes ignored tracked directories. git-clean should never delete tracked content. - git-ls-files --ignored --other --directory: lists ignored tracked directories instead of "other" directories. - git-status --ignored: lists ignored tracked directories while contained files may be listed as modified. Paths listed by git-status should be disjoint (except in long format where a path may be listed in both the staged and unstaged section). Additionally, the current behaviour violates documentation in gitignore(5) ("Specifies intentionally *untracked* files to ignore") and Documentation/ technical/api-directory-listing.txt ("DIR_SHOW_OTHER_DIRECTORIES: Include a directory that is *not tracked*."). In dir.c::treat_directory, remove the special handling of ignored tracked directories, so that the DIR_SHOW_OTHER_DIRECTORIES flag only affects "other" (i.e. untracked) directories. In dir.c::dir_add_name, check that added paths are untracked even if DIR_SHOW_IGNORED is set. Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-15clean: preserve nested git worktree in subdirectoriesJunio C Hamano
remove_dir_recursively() has a check to avoid removing the directory it was asked to remove without recursing into it and report success when the directory is the top level of a working tree of a nested git repository, to protect such a repository from "clean -f" (without double -f). If a working tree of a nested git repository is in a subdirectory of a toplevel project, however, this protection did not apply by mistake; we forgot to pass the REMOVE_DIR_KEEP_NESTED_GIT down to the recursive removal codepath. This requires us to also teach the higher level not to remove the directory it is asked to remove, when the recursed invocation did not remove the directory it was asked to remove due to a nested git repository, as it is not an error to leave the parent directories of such a nested repository. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-27Merge branch 'ar/clean-rmdir-empty'Junio C Hamano
* ar/clean-rmdir-empty: clean: unreadable directory may still be rmdir-able if it is empty
2011-04-01clean: unreadable directory may still be rmdir-able if it is emptyAlex Riesen
As a last ditch effort, try rmdir(2) when we cannot read the directory to be removed. It may be an empty directory that we can remove without any permission, as long as we can modify its parent directory. Noticed by Linus. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-10i18n: git-clean basic messagesÆvar Arnfjörð Bjarmason
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-26t7300: add a missing SYMLINKS prerequisiteJohannes Sixt
The test fails on Windows since 2dec68c (tests: add missing &&, batch 2). Even though this test allocates and leaves behind files, subsequent tests do not depend on this, so it is safe to just skip it. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09tests: add missing &&, batch 2Jonathan Nieder
Same rules as before: this patch only adds " &&" to the end of some lines in the test suite. Intended to be applied on top of or squashed with the last batch if they look okay. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-17t/t7300: workaround ancient touch by rearranging argumentsBrandon Casey
The ancient touch on Solaris 7 thinks that a decimal number supplied as the first argument specifies a date_time to give to the files specified by the remaining arguments. In this case, it fails to parse '1' as a proper date_time and exits with a failure status. Workaround this flaw by rearranging the arguments supplied to touch so that a non-digit appears first and touch will not be confused. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-04Merge branch 'ab/test-2'Junio C Hamano
* ab/test-2: (51 commits) tests: factor HOME=$(pwd) in test-lib.sh test-lib: use subshell instead of cd $new && .. && cd $old tests: simplify "missing PREREQ" message t/t0000-basic.sh: Run the passing TODO test inside its own test-lib test-lib: Allow overriding of TEST_DIRECTORY test-lib: Use "$GIT_BUILD_DIR" instead of "$TEST_DIRECTORY"/../ test-lib: Use $TEST_DIRECTORY or $GIT_BUILD_DIR instead of $(pwd) and ../ test: Introduce $GIT_BUILD_DIR cvs tests: do not touch test CVS repositories shipped with source t/t9602-cvsimport-branches-tags.sh: Add a PERL prerequisite t/t9601-cvsimport-vendor-branch.sh: Add a PERL prerequisite t/t7105-reset-patch.sh: Add a PERL prerequisite t/t9001-send-email.sh: convert setup code to tests t/t9001-send-email.sh: change from skip_all=* to prereq skip t/t9001-send-email.sh: Remove needless PROG=* assignment t/t9600-cvsimport.sh: change from skip_all=* to prereq skip lib-patch-mode tests: change from skip_all=* to prereq skip t/t3701-add-interactive.sh: change from skip_all=* to prereq skip tests: Move FILEMODE prerequisite to lib-prereq-FILEMODE.sh t/Makefile: Create test-results dir for smoke target ... Conflicts: t/t6035-merge-dir-to-symlink.sh
2010-08-18tests: A SANITY test prereq for testing if we're rootÆvar Arnfjörð Bjarmason
Some tests depend on not being able to write to files after chmod -w. This doesn't work when running the tests as root. Change test-lib.sh to test if this works, and if so it sets a new SANITY test prerequisite. The tests that use this previously failed when run under root. There was already a test for this in t3600-rm.sh, added by Junio C Hamano in 2283645 in 2006. That check now uses the new SANITY prerequisite. Some of this was resurrected from the "Tests in Cygwin" thread in May 2009: http://thread.gmane.org/gmane.comp.version-control.git/116729/focus=118385 Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-20Add test for git clean -e.Jared Hance
Signed-off-by: Jared Hance <jaredhance@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-13Merge branch 'nd/sparse'Junio C Hamano
* nd/sparse: (25 commits) t7002: test for not using external grep on skip-worktree paths t7002: set test prerequisite "external-grep" if supported grep: do not do external grep on skip-worktree entries commit: correctly respect skip-worktree bit ie_match_stat(): do not ignore skip-worktree bit with CE_MATCH_IGNORE_VALID tests: rename duplicate t1009 sparse checkout: inhibit empty worktree Add tests for sparse checkout read-tree: add --no-sparse-checkout to disable sparse checkout support unpack-trees(): ignore worktree check outside checkout area unpack_trees(): apply $GIT_DIR/info/sparse-checkout to the final index unpack-trees(): "enable" sparse checkout and load $GIT_DIR/info/sparse-checkout unpack-trees.c: generalize verify_* functions unpack-trees(): add CE_WT_REMOVE to remove on worktree alone Introduce "sparse checkout" dir.c: export excluded_1() and add_excludes_from_file_1() excluded_1(): support exclude files in index unpack-trees(): carry skip-worktree bit over in merged_entry() Read .gitignore from index if it is skip-worktree Avoid writing to buffer in add_excludes_from_file_1() ... Conflicts: .gitignore Documentation/config.txt Documentation/git-update-index.txt Makefile entry.c t/t7002-grep.sh
2009-08-24Read .gitignore from index if it is skip-worktreeNguyễn Thái Ngọc Duy
This adds index as a prerequisite for directory listing (with exclude). At the moment directory listing is used by "git clean", "git add", "git ls-files" and "git status"/"git commit" and unpack_trees()-related commands. These commands have been checked/modified to populate index before doing directory listing. add_excludes_from_file() does not enable this feature, because it is used to read .git/info/exclude and some explicit files specified by "git ls-files". Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-29clean: require double -f options to nuke nested git repository and work treeJunio C Hamano
When you have an embedded git work tree in your work tree (be it an orphaned submodule, or an independent checkout of an unrelated project), "git clean -d -f" blindly descended into it and removed everything. This is rarely what the user wants. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-19t7300: fix clean up on WindowsJohannes Schindelin
On Windows, you cannot remove files that are in use, not even with 'rm -rf'. So we need to run 'exec <foo/bar' inside a subshell lest removing the whole test repository fail. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2008-09-03tests: use "git xyzzy" form (t7200 - t9001)Nanako Shiraishi
Converts tests between t7201-t9001. Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13t/: Use "test_must_fail git" instead of "! git"Stephan Beyer
This patch changes every occurrence of "! git" -- with the meaning that a git call has to gracefully fail -- into "test_must_fail git". This is useful to - make sure the test does not fail because of a signal, e.g. SIGSEGV, and - advertise the use of "test_must_fail" for new tests. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05Fix tests breaking when checkout path contains shell metacharactersBryan Donlan
This fixes the remainder of the issues where the test script itself is at fault for failing when the git checkout path contains whitespace or other shell metacharacters. The majority of git svn tests used the idiom test_expect_success "title" "test script using $svnrepo" These were changed to have the test script in single-quotes: test_expect_success "title" 'test script using "$svnrepo"' which unfortunately makes the patch appear larger than it really is. One consequence of this change is that in the verbose test output the value of $svnrepo (and in some cases other variables, too) is no longer expanded, i.e. previously we saw * expecting success: test script using /path/to/git/t/trash/svnrepo but now it is: * expecting success: test script using "$svnrepo" Signed-off-by: Bryan Donlan <bdonlan@fushizen.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-15git clean: Add test to verify directories aren't removed with a prefixShawn Bohrer
Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-08git-clean: add tests for relative pathJunio C Hamano
This adds tests for recent change by Dmitry to fix the report "git clean" gives on removed paths, and also makes sure the command detects paths that is outside working tree. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-04Fix test for cleanup failure in t7300 on WindowsAlex Riesen
Keep the file open to: the OS does not allow removal of open files. The saner systems just have a saner permission model and chmod 0 is enough for the test. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-21git-clean: handle errors if removing files failsMiklos Vajna
git-clean simply ignored errors if removing a file or directory failed. This patch makes it raise a warning and the exit code also greater than zero if there are remaining files. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-06t7300: add test for clean with wildcard pathspecJeff King
Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-14Merge branch 'maint'Junio C Hamano
* maint: git-clean: honor core.excludesfile Documentation: Fix man page breakage with DocBook XSL v1.72 git-remote.txt: fix typo core-tutorial.txt: Fix argument mistake in an example. replace reference to git-rm with git-reset in git-commit doc Grammar fixes for gitattributes documentation Don't allow fast-import tree delta chains to exceed maximum depth revert/cherry-pick: allow starting from dirty work tree. t/t3404: fix test for a bogus todo file. Conflicts: fast-import.c
2007-11-14git-clean: honor core.excludesfileJunio C Hamano
git-clean did not honor core.excludesfile configuration variable, although some other commands such as git-add and git-status did. Fix this inconsistency. Original report and patch from Shun'ichi Fuji. Rewritten by me and bugs and tests are mine. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-08Merge branch 'jc/clean-config'Junio C Hamano
* jc/clean-config: clean: require -f to do damage by default
2007-11-05Add more tests for git-cleanShawn Bohrer
Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-04clean: require -f to do damage by defaultJunio C Hamano
This makes the clean.requireForce configuration default to true. Too many people are burned by typing "git clean" by mistake when they meant to say "make clean". Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-03Rewrite "git-frotz" to "git frotz"Junio C Hamano
This uses the remove-dashes target to replace "git-frotz" to "git frotz". Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-05-07t7300: Basic tests for git-cleanMichael Spang
This tests the -d, -n, -f, -x, and -X options to git-clean. Signed-off-by: Michael Spang <mspang@uwaterloo.ca> Signed-off-by: Junio C Hamano <junkio@cox.net>