# [PATCH] Documentation/git-clean.txt: don't mention deletion of .git/modules/*

9 messages from 2016-02-06 to 2016-02-09. Participants: Matt McCutchen, Junio C Hamano, Mikko Rapeli.
Thread: https://gitlist.dev/t/41359

## Matt McCutchen, 2016-02-06 20:25

Subject: [PATCH] Documentation/git-clean.txt: don't mention deletion of .git/modules/*
Message-ID: <1454897459.2511.14.camel@mattmccutchen.net>
URL: https://gitlist.dev/e/1454897459.2511.14.camel%40mattmccutchen.net
In-Reply-To: <1454790889.23898.225.camel@mattmccutchen.net>

```
I found no evidence of such behavior in the source code.

Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
---
This is based on the maint branch, a08595f.

Try #2 to get correct email formatting.

 Documentation/git-clean.txt | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt
index 641681f..51a7e26 100644
--- a/Documentation/git-clean.txt
+++ b/Documentation/git-clean.txt
@@ -37,9 +37,7 @@ OPTIONS
 	to false, 'git clean' will refuse to delete files or directories
 	unless given -f, -n or -i. Git will refuse to delete directories
 	with .git sub directory or file unless a second -f
-	is given. This affects also git submodules where the storage area
-	of the removed submodule under .git/modules/ is not removed until
-	-f is given twice.
+	is given.
 
 -i::
 --interactive::
-- 
2.5.0

```

## Matt McCutchen, 2016-02-06 20:34

Subject: [PATCH] Documentation/git-clean.txt: don't mention deletion of .git/modules/*
Message-ID: <1454790889.23898.225.camel@mattmccutchen.net>
URL: https://gitlist.dev/e/1454790889.23898.225.camel%40mattmccutchen.net

```
I found no evidence of such behavior in the source code.

Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
---

This is based on the maint branch, a08595f.

 Documentation/git-clean.txt | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt
index 641681f..51a7e26 100644
--- a/Documentation/git-clean.txt
+++ b/Documentation/git-clean.txt
@@ -37,9 +37,7 @@ OPTIONS
 	to false, 'git clean' will refuse to delete files or directories
 	unless given -f, -n or -i. Git will refuse to delete directories
 	with .git sub directory or file unless a second -f
-	is given. This affects also git submodules where the storage area
-	of the removed submodule under .git/modules/ is not removed until
-	-f is given twice.
+	is given.
 
 -i::
 --interactive::
-- 
2.5.0

```

## Junio C Hamano, 2016-02-08 22:22

Subject: Re: [PATCH] Documentation/git-clean.txt: don't mention deletion of .git/modules/*
Message-ID: <xmqqvb5y6dx2.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqvb5y6dx2.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <1454790889.23898.225.camel@mattmccutchen.net>

```
Matt McCutchen <matt@mattmccutchen.net> writes:

> I found no evidence of such behavior in the source code.
>
> Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
> ---

That was added last year at bcd57cb9 (Documentation/git-clean.txt:
document that -f may need to be given twice, 2015-02-26).  It would
be better to know what got changed since then--that is, was the
additional text unnecessary even back then, or we made changes to
the system since then and forgot to remove the added text.

Mikko, is this need to give -f twice still the case?

>
> This is based on the maint branch, a08595f.
>
>  Documentation/git-clean.txt | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt
> index 641681f..51a7e26 100644
> --- a/Documentation/git-clean.txt
> +++ b/Documentation/git-clean.txt
> @@ -37,9 +37,7 @@ OPTIONS
>  	to false, 'git clean' will refuse to delete files or directories
>  	unless given -f, -n or -i. Git will refuse to delete directories
>  	with .git sub directory or file unless a second -f
> -	is given. This affects also git submodules where the storage area
> -	of the removed submodule under .git/modules/ is not removed until
> -	-f is given twice.
> +	is given.
>  
>  -i::
>  --interactive::
> -- 
> 2.5.0

```

## Matt McCutchen, 2016-02-08 22:36

Subject: Re: [PATCH] Documentation/git-clean.txt: don't mention deletion of .git/modules/*
Message-ID: <1454971010.2511.89.camel@mattmccutchen.net>
URL: https://gitlist.dev/e/1454971010.2511.89.camel%40mattmccutchen.net
In-Reply-To: <xmqqvb5y6dx2.fsf@gitster.mtv.corp.google.com>

```
On Mon, 2016-02-08 at 14:22 -0800, Junio C Hamano wrote:
> Matt McCutchen <matt@mattmccutchen.net> writes:
> 
> > I found no evidence of such behavior in the source code.
> > 
> > Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
> > ---
> 
> That was added last year at bcd57cb9 (Documentation/git-clean.txt:
> document that -f may need to be given twice, 2015-02-26).  It would
> be better to know what got changed since then--that is, was the
> additional text unnecessary even back then, or we made changes to
> the system since then and forgot to remove the added text.
> 
> Mikko, is this need to give -f twice still the case?

I know you probably want confirmation from Mikko, but I'll offer my
understanding.  There were two statements added in bcd57cb9:

1. -f may need to be given twice to delete nested worktrees and
embedded repositories.  This is still true.

2. Deletion of submodule repositories under .git/modules is conditional
on -f being given twice.  AFAICT, this was wrong even back then: "git
clean" has never deleted such repositories under any conditions.

My patch is only removing #2.

Matt

```

## Mikko Rapeli, 2016-02-08 22:47

Subject: Re: [PATCH] Documentation/git-clean.txt: don't mention deletion of .git/modules/*
Message-ID: <20160208224739.GH6104@lakka.kapsi.fi>
URL: https://gitlist.dev/e/20160208224739.GH6104%40lakka.kapsi.fi
In-Reply-To: <1454971010.2511.89.camel@mattmccutchen.net>

```
On Mon, Feb 08, 2016 at 05:36:50PM -0500, Matt McCutchen wrote:
> On Mon, 2016-02-08 at 14:22 -0800, Junio C Hamano wrote:
> > Matt McCutchen <matt@mattmccutchen.net> writes:
> > 
> > > I found no evidence of such behavior in the source code.
> > > 
> > > Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
> > > ---
> > 
> > That was added last year at bcd57cb9 (Documentation/git-clean.txt:
> > document that -f may need to be given twice, 2015-02-26).  It would
> > be better to know what got changed since then--that is, was the
> > additional text unnecessary even back then, or we made changes to
> > the system since then and forgot to remove the added text.
> > 
> > Mikko, is this need to give -f twice still the case?
> 
> I know you probably want confirmation from Mikko, but I'll offer my
> understanding.  There were two statements added in bcd57cb9:
> 
> 1. -f may need to be given twice to delete nested worktrees and
> embedded repositories.  This is still true.
>
> 2. Deletion of submodule repositories under .git/modules is conditional
> on -f being given twice.  AFAICT, this was wrong even back then: "git
> clean" has never deleted such repositories under any conditions.

This is the use case which I've used double -f at work with several build
jobs but with older 1:1.7.9.5-1ubuntu0.2 (Ubuntu 12.04) and 1:1.9.1-1ubuntu0.2
(Ubuntu 14.04) versions of git.

But I can confirm that git version 1:2.7.0~rc3-1 (Debian unstable) is no
longer removing the git submodule trees from .git/modules with double -f.

At work, we really want to remove the .git/modules subtrees since we want to
test changes to .git/modules structure via normal commits to the git trees.
Thus we need a way removing all non-tracked files from the git tree
which includes obsolete (or for test only) git submodule trees.

I will test the old versions tomorrow again. Maybe in older git versions
the code path from 1) deletes also the git modules from 2).

-Mikko

```

## Junio C Hamano, 2016-02-08 23:50

Subject: Re: [PATCH] Documentation/git-clean.txt: don't mention deletion of .git/modules/*
Message-ID: <xmqq4mdi69ti.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqq4mdi69ti.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <1454971010.2511.89.camel@mattmccutchen.net>

```
Matt McCutchen <matt@mattmccutchen.net> writes:

> On Mon, 2016-02-08 at 14:22 -0800, Junio C Hamano wrote:
>> Matt McCutchen <matt@mattmccutchen.net> writes:
>> 
>> > I found no evidence of such behavior in the source code.
>> > 
>> > Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
>> > ---
>> 
>> That was added last year at bcd57cb9 (Documentation/git-clean.txt:
>> document that -f may need to be given twice, 2015-02-26).  It would
>> be better to know what got changed since then--that is, was the
>> additional text unnecessary even back then, or we made changes to
>> the system since then and forgot to remove the added text.
>> 
>> Mikko, is this need to give -f twice still the case?
>
> I know you probably want confirmation from Mikko, but I'll offer my
> understanding.  There were two statements added in bcd57cb9:
>
> 1. -f may need to be given twice to delete nested worktrees and
> embedded repositories.  This is still true.
>
> 2. Deletion of submodule repositories under .git/modules is conditional
> on -f being given twice.  AFAICT, this was wrong even back then: "git
> clean" has never deleted such repositories under any conditions.
>
> My patch is only removing #2.
>
> Matt

Thanks for clarification.

"The latter half, the removal of the submodules, was never done with
double -f back when the sentence was written, and we still do not do
so." or "Back when the sentence was written, we used to require
double -f, and we fixed that at commit X but forgot to update this
text." are two possibilities, and either one explains and justifies
this change even stronger than "There is no code to do such thing in
today's version." and that is where my question came from.

```

## Mikko Rapeli, 2016-02-09 07:55

Subject: Re: [PATCH] Documentation/git-clean.txt: don't mention deletion of .git/modules/*
Message-ID: <20160209075553.GI6104@lakka.kapsi.fi>
URL: https://gitlist.dev/e/20160209075553.GI6104%40lakka.kapsi.fi
In-Reply-To: <20160208224739.GH6104@lakka.kapsi.fi>

```
On Tue, Feb 09, 2016 at 12:47:39AM +0200, Mikko Rapeli wrote:
> On Mon, Feb 08, 2016 at 05:36:50PM -0500, Matt McCutchen wrote:
> > On Mon, 2016-02-08 at 14:22 -0800, Junio C Hamano wrote:
> > > Matt McCutchen <matt@mattmccutchen.net> writes:
> > > 
> > > > I found no evidence of such behavior in the source code.
> > > > 
> > > > Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
> > > > ---
> > > 
> > > That was added last year at bcd57cb9 (Documentation/git-clean.txt:
> > > document that -f may need to be given twice, 2015-02-26).  It would
> > > be better to know what got changed since then--that is, was the
> > > additional text unnecessary even back then, or we made changes to
> > > the system since then and forgot to remove the added text.
> > > 
> > > Mikko, is this need to give -f twice still the case?
> > 
> > I know you probably want confirmation from Mikko, but I'll offer my
> > understanding.  There were two statements added in bcd57cb9:
> > 
> > 1. -f may need to be given twice to delete nested worktrees and
> > embedded repositories.  This is still true.
> >
> > 2. Deletion of submodule repositories under .git/modules is conditional
> > on -f being given twice.  AFAICT, this was wrong even back then: "git
> > clean" has never deleted such repositories under any conditions.
> 
> This is the use case which I've used double -f at work with several build
> jobs but with older 1:1.7.9.5-1ubuntu0.2 (Ubuntu 12.04) and 1:1.9.1-1ubuntu0.2
> (Ubuntu 14.04) versions of git.

Sorry, can't reproduce the problem where submodules stayed in the tree until
git clean was called with two -f's.

You are right in removing the second part.

> But I can confirm that git version 1:2.7.0~rc3-1 (Debian unstable) is no
> longer removing the git submodule trees from .git/modules with double -f.
> 
> At work, we really want to remove the .git/modules subtrees since we want to
> test changes to .git/modules structure via normal commits to the git trees.
> Thus we need a way removing all non-tracked files from the git tree
> which includes obsolete (or for test only) git submodule trees.

This usecase does not exists in git then. Using gerrit topics git branches
to test changes to submodule structure does not work since there is no way of
undoing these changes from the working tree.

I should not have started using submodules in the first place, sigh.

-Mikko

```

## Junio C Hamano, 2016-02-09 17:34

Subject: Re: [PATCH] Documentation/git-clean.txt: don't mention deletion of .git/modules/*
Message-ID: <xmqqpow54wkh.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqpow54wkh.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <20160209075553.GI6104@lakka.kapsi.fi>

```
Mikko Rapeli <mikko.rapeli@iki.fi> writes:

> Sorry, can't reproduce the problem where submodules stayed in the tree until
> git clean was called with two -f's.
>
> You are right in removing the second part.

Thanks, then let's do this.

-- >8 --
From: Matt McCutchen <matt@mattmccutchen.net>
Date: Sat, 6 Feb 2016 15:25:41 -0500
Subject: [PATCH] Documentation/git-clean.txt: don't mention deletion of .git/modules/*

The latter half fo this sentence, the removal of the submodules, was
never done with (or without) double -f back when it was written, and
we still do not do so.

Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/git-clean.txt | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt
index 641681f..51a7e26 100644
--- a/Documentation/git-clean.txt
+++ b/Documentation/git-clean.txt
@@ -37,9 +37,7 @@ OPTIONS
 	to false, 'git clean' will refuse to delete files or directories
 	unless given -f, -n or -i. Git will refuse to delete directories
 	with .git sub directory or file unless a second -f
-	is given. This affects also git submodules where the storage area
-	of the removed submodule under .git/modules/ is not removed until
-	-f is given twice.
+	is given.
 
 -i::
 --interactive::
-- 
2.7.1-358-gd2e280b

```

## Matt McCutchen, 2016-02-09 17:40

Subject: Re: [PATCH] Documentation/git-clean.txt: don't mention deletion of .git/modules/*
Message-ID: <1455039656.2511.177.camel@mattmccutchen.net>
URL: https://gitlist.dev/e/1455039656.2511.177.camel%40mattmccutchen.net
In-Reply-To: <xmqqpow54wkh.fsf@gitster.mtv.corp.google.com>

```
On Tue, 2016-02-09 at 09:34 -0800, Junio C Hamano wrote:
> Mikko Rapeli <mikko.rapeli@iki.fi> writes:
> 
> > Sorry, can't reproduce the problem where submodules stayed in the
> > tree until
> > git clean was called with two -f's.
> > 
> > You are right in removing the second part.
> 
> Thanks, then let's do this.

Looks good except for a typo (below).  I'll try to write better commit
messages in the future.

> -- >8 --
> From: Matt McCutchen <matt@mattmccutchen.net>
> Date: Sat, 6 Feb 2016 15:25:41 -0500
> Subject: [PATCH] Documentation/git-clean.txt: don't mention deletion
> of .git/modules/*
> 
> The latter half fo

of

> this sentence, the removal of the submodules, was
> never done with (or without) double -f back when it was written, and
> we still do not do so.
> 
> Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
> Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>  Documentation/git-clean.txt | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/Documentation/git-clean.txt b/Documentation/git-
> clean.txt
> index 641681f..51a7e26 100644
> --- a/Documentation/git-clean.txt
> +++ b/Documentation/git-clean.txt
> @@ -37,9 +37,7 @@ OPTIONS
>  	to false, 'git clean' will refuse to delete files or
> directories
>  	unless given -f, -n or -i. Git will refuse to delete
> directories
>  	with .git sub directory or file unless a second -f
> -	is given. This affects also git submodules where the storage
> area
> -	of the removed submodule under .git/modules/ is not removed
> until
> -	-f is given twice.
> +	is given.
>  
>  -i::
>  --interactive::

```
