git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Weird behavior/bug for git clean in untracked directory
@ 2017-10-04 19:06 David Spångberg
  0 siblings, 0 replies; only message in thread
From: David Spångberg @ 2017-10-04 19:06 UTC (permalink / raw)
  To: git

Hello

I'm a little bit confused about the behavior of git clean when trying to
clean multiple files/directories at once. For instance if I create two
directories with an empty file in an new git repository as such:

  mkdir tmprepo
  cd tmprepo
  git init
  mkdir a b
  touch a/file b/file

and try to clean both these files at the same time with git clean as
such:

  git clean -f a/file b/file

then git will not clean any of the files. However, if I separate the
cleaning into two separate calls like this:

  git clean -f a/file
  git clean -f b/file

then both directories will be cleaned. The git clean manual page suggests
git clean should support multiple paths/directories:

  SYNOPSIS
         git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <path>...

  DESCRIPTION
         ...
         If any optional <path>... _arguments_ are given, only those _paths_ are affected.

The expected behavior for me would be that there should be no difference
between the first `git clean...' with two files and the two
`git clean...' with one file each.

I've tested on the following git versions so far:

  * 2.1.4
  * 2.14.2
  * 2.14.2.959.g6663358d3 (currently latest on next branch)


Best regards,
David

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-10-04 19:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-04 19:06 Weird behavior/bug for git clean in untracked directory David Spångberg

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).