summaryrefslogtreecommitdiff
path: root/builtin-clean.c
AgeCommit message (Collapse)Author
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>
2008-01-12git-clean: fix off-by-one memory access when given no argumentsJeff King
The "seen" variable is used by match_pathspec, and must have as many elements as there are in the given pathspec. We create the pathspec either from the command line arguments _or_ from just the current prefix. Thus allocating "seen" based upon just argc is wrong, since if argc == 0, then we still have one pathspec, the prefix, but we don't allocate any space in "seen". Signed-off-by: Jeff King <peff@peff.net> Tested-by: İsmail Dönmez <ismail@pardus.org.tr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-04git-clean: make "Would remove ..." path relative to cwd againJunio C Hamano
The rewrite changed the output to use the path relative to the top of the work tree without a good reason. This fixes it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-06git-clean: Honor pathspec.Junio C Hamano
git-clean "*.rej" should attempt to look at only paths that match pattern "*.rej", but rewrite to C broke it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-19Teach git clean to use setup_standard_excludes()Shawn Bohrer
Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-19git-clean: Fix error message if clean.requireForce is not set.Junio C Hamano
It was distracting to see this error message: clean.requireForce set and -n or -f not given; refusing to clean even though clean.requireForce was not set at all. This patch distinguishes the cases and gives a different message depending on whether the configuration variable is not set or set to true. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-19Make git-clean a builtinShawn Bohrer
This replaces git-clean.sh with builtin-clean.c, and moves git-clean.sh to the examples. This also introduces a change in behavior when removing directories explicitly specified as a path. For example currently: 1. When dir has only untracked files, these two behave differently: $ git clean -n dir $ git clean -n dir/ the former says "Would not remove dir/", while the latter would say "Would remove dir/untracked" for all paths under it, but not the directory itself. With -d, the former would stop refusing, however since the user explicitly asked to remove the directory the -d is no longer required. 2. When there are more parameters: $ git clean -n dir foo $ git clean -n dir/ foo both cases refuse to remove dir/ unless -d is specified. Once again since both cases requested to remove dir the -d is no longer required. Thanks to Johannes Schindelin for the conversion to using the parse-options API. Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>