"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: got add recursion
To:
Tracey Emery <tracey@traceyemery.net>
Cc:
gameoftrees@openbsd.org
Date:
Sat, 23 Nov 2019 10:27:54 +0100

Download raw body.

Thread
On Fri, Nov 22, 2019 at 08:30:02AM -0700, Tracey Emery wrote:
> Ok, I think I addressed everything. New diff below to reflect your
> changes, added the directory test, and cleaned up a couple of errant
> tabs in the revert test.
> 
> Anything else I missed? Ok?

Thanks, this change is in the repo now.

There is another thing that needs consideration.
How should 'add -R' interact with the ignores feature of 'got status'?

In the example below, recursive addition will not add the file a/bar because
it matches an ignore pattern:

$ got init repo
$ mkdir tree
$ cd tree
$ mkdir a
$ echo foo > a/foo
$ echo 'a/**' > .gitignore
$ got import -m "init" -r ../repo .
A  /tmp/tree/a/foo
A  /tmp/tree/.gitignore
Created branch refs/heads/main with commit 994c081f495b4cb67e7c0448c44c4a74b283e7af
$ cd ..
$ got co repo wt
A  wt/.gitignore
A  wt/a/foo
Now shut up and hack
$ cd wt
$ echo bar > a/bar
$ got st
$ got add -R .
$ mkdir b
$ echo baz > b/baz
$ mkdir b/c
$ echo zoo > b/c/zoo
$ got st
?  b/baz
?  b/c/zoo
$ got add -R b
A  b/baz
A  b/c/zoo
$ got st
A  b/baz
A  b/c/zoo


So 'a/bar' is ignored above, but it can be added explicitly:

$ got add a/bar
A  a/bar
$ got st
A  a/bar
A  b/baz
A  b/c/zoo
$

This behaviour is fine. If users ignore '*.so' files, we don't want 'add -R'
to add such files by default. And 'svn add' has the same behaviour so there
is precedent.

However,

1) We may want to encode the interaction of 'add -R' and ignored files
in a regression test so we don't break it accidentally.

2) 'svn add' also supports a --no-ignore option to allow recursive addition
even for ignored files. Should we also add such an option: 'got add -R -I'?
The docs could say something like:
 -I	With -R, add files even if they match a 'got status' ignore pattern.