This is the first half of the series, making git ready for sparse checkout. The only difference from the last (first half) sent series is safeguard bitmask fix in 1/9 Nguy
The on-disk format of index only saves 16 bit flags, nearly all have
been used. The last bit (CE_EXTENDED) is used to for future extension.
This patch extends index entry format to save more flags in future.
The new entry format will be used when CE_EXTENDED bit is 1.
Because older implementation may not understand CE_EXTENDED bit and
misread the new format, if there is any extended entry in index, index
header version will turn 3, which makes it incompatible for older git.
If there is none, header version will return to 2 again.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
cache.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----
read-cache.c | 51 +++++++++++++++++++++++++++++++++++++++++----------
2 files changed, 95 insertions(+), 14 deletions(-)
diff --git a/cache.h b/cache.h
index f4b8ddf..5180879 100644
--- a/cache.h
+++ b/cache.h
@@ -109,6 +109,26 @@ struct ondisk_cache_entry {
char name[FLEX_ARRAY]; /* more */
};
+/*
+ * This struct is used when CE_EXTENDED bit is 1
+ * The struct must match ondisk_cache_entry exactly from
+ * ctime till flags
+ */
+struct ondisk_cache_entry_extended {
+ struct cache_time ctime;
+ struct cache_time mtime;
+ unsigned int dev;
+ unsigned int ino;
+ unsigned int mode;
+ unsigned int uid;
+ unsigned int gid;
+ unsigned int size;
+ unsigned char sha1[20];
+ unsigned short flags;
+ unsigned short flags2;
+ char name[FLEX_ARRAY]; /* more */
+};
+
struct cache_entry {
unsigned int ce_ctime;
unsigned int ce_mtime;
@@ -130,7 +150,15 @@ struct cache_entry {
#define CE_VALID (0x8000)
#define CE_STAGESHIFT 12
-/* In-memory only */
+/*
+ * Range 0xFFFF0000 in ce_flags is divided into
+ * two parts: in-memory flags and on-disk ones.
+ * Flags in CE_EXTENDED_FLAGS will get saved on-disk
+ * if you want to save a new flag, add it in
+ * CE_EXTENDED_FLAGS
+ *
+ * In-memory only flags
+ */
#define CE_UPDATE (0x10000)
#define CE_REMOVE (0x20000)
#define ...This bit is the basis of sparse checkout. If this bit is on, the entry is outside sparse checkout and therefore should be ignored (similar to CE_VALID) Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> --- Documentation/git-checkout.txt | 33 +++++++++++++++++++++++++++++++++ cache.h | 10 +++++++++- read-cache.c | 6 +++--- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 82e154d..4bd9eba 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -171,6 +171,39 @@ the reflog for HEAD where you were, e.g. $ git log -g -2 HEAD ------------ +Sparse checkout +--------------- + +Normally when you checkout a branch, your working directory +will be fully populated. In some situations, you just need to +work on certain files, no full checkout is needed. Sparse +checkout is a mode that limits the checkout area according to your +needs. With sparse checkout, you can work on a single file, a +collection of files, a subdirectory or a collection of separated +subdirectories. + +Because sparse checkout uses a new index format, it will be +incompatible with git prior to 1.6.0 regarding worktree operations. +Operations that only need access to the repository itself, such as +clone, push, or pull/fetch from another (normal) repository... should +not be affected by sparse checkout. + +In sparse checkout mode, checkout status of every files in your +working directory will be recorded in index. If a file is marked +"no-checkout", it means that file is not needed to be present in +working directory by user or any git command. When a new file is added +to index, it will be marked "checkout" unless sparse patterns are +applied. Unmerged files are always "checkout". When you checkout new +files using "git checkout <file>" they will be automatically marked +"checkout". Other commands such as "git apply" can also checkout ...
The first option to be introduced is --sparse, which puts ls-files in "sparse mode". In this mode, cached entries are divided into - checkout entries: shown by --cached (new behavior with --sparse) - no-checkout entries: show by --no-checkout (new option) - orphaned entries: shown by --orphaned (new option) Orphaned entries are themselves no-checkout ones but for some reasons still be present in working directory. While at it, fix "--deleted" running out of checkout area. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> --- Documentation/git-ls-files.txt | 24 +++++++++++++++++++++- builtin-ls-files.c | 41 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt index 9f85d60..1de68e2 100644 --- a/Documentation/git-ls-files.txt +++ b/Documentation/git-ls-files.txt @@ -10,8 +10,9 @@ SYNOPSIS -------- [verse] 'git ls-files' [-z] [-t] [-v] - (--[cached|deleted|others|ignored|stage|unmerged|killed|modified])\* + (--[cached|deleted|others|ignored|stage|unmerged|killed|modified|orphaned|no-checkout])\* (-[c|d|o|i|s|u|k|m])\* + [--sparse] [-x <pattern>|--exclude=<pattern>] [-X <file>|--exclude-from=<file>] [--exclude-per-directory=<file>] @@ -32,7 +33,9 @@ OPTIONS ------- -c:: --cached:: - Show cached files in the output (default) + Show cached files in the output (default). When used with --sparse, + show only cached files that are marked "checkout", no-checkout + entries will be excluded. -d:: --deleted:: @@ -72,6 +75,21 @@ OPTIONS to file/directory conflicts for checkout-index to succeed. +--no-checkout:: + Show no-checkout entries. This option implies --sparse. + +--orphaned:: + Show orphaned entries. Orphaned entries are no-checkout + entries that are present in working directory. This option + implies --sparse. + +--sparse:: + When --sparse is passed, cached files will be divided into ...
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
builtin-update-index.c | 24 ++++++++++--------------
1 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/builtin-update-index.c b/builtin-update-index.c
index 417f972..ae94739 100644
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
@@ -24,8 +24,8 @@ static int info_only;
static int force_remove;
static int verbose;
static int mark_valid_only;
-#define MARK_VALID 1
-#define UNMARK_VALID 2
+#define MARK_FLAG 1
+#define UNMARK_FLAG 2
static void report(const char *fmt, ...)
{
@@ -40,19 +40,15 @@ static void report(const char *fmt, ...)
va_end(vp);
}
-static int mark_valid(const char *path)
+static int mark_ce_flags(const char *path, int flag, int mark)
{
int namelen = strlen(path);
int pos = cache_name_pos(path, namelen);
if (0 <= pos) {
- switch (mark_valid_only) {
- case MARK_VALID:
- active_cache[pos]->ce_flags |= CE_VALID;
- break;
- case UNMARK_VALID:
- active_cache[pos]->ce_flags &= ~CE_VALID;
- break;
- }
+ if (mark)
+ active_cache[pos]->ce_flags |= flag;
+ else
+ active_cache[pos]->ce_flags &= ~flag;
cache_tree_invalidate_path(active_cache_tree, path);
active_cache_changed = 1;
return 0;
@@ -276,7 +272,7 @@ static void update_one(const char *path, const char *prefix, int prefix_length)
goto free_return;
}
if (mark_valid_only) {
- if (mark_valid(p))
+ if (mark_ce_flags(p, CE_VALID, mark_valid_only == MARK_FLAG))
die("Unable to mark file %s", path);
goto free_return;
}
@@ -649,11 +645,11 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
continue;
}
if (!strcmp(path, "--assume-unchanged")) {
- mark_valid_only = MARK_VALID;
+ mark_valid_only = MARK_FLAG;
continue;
}
if (!strcmp(path, "--no-assume-unchanged")) {
- mark_valid_only = UNMARK_VALID;
+ mark_valid_only = UNMARK_FLAG;
continue;
}
if (!strcmp(path, ...Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> --- .gitignore | 1 + Documentation/git-checkout.txt | 3 +- Documentation/git-update-index.txt | 13 ++++++++++++ Makefile | 2 +- builtin-update-index.c | 16 ++++++++++++++- t/t2104-update-index-no-checkout.sh | 36 +++++++++++++++++++++++++++++++++++ test-index-version.c | 14 +++++++++++++ 7 files changed, 82 insertions(+), 3 deletions(-) create mode 100755 t/t2104-update-index-no-checkout.sh create mode 100644 test-index-version.c diff --git a/.gitignore b/.gitignore index bbaf9de..0c35577 100644 --- a/.gitignore +++ b/.gitignore @@ -147,6 +147,7 @@ test-date test-delta test-dump-cache-tree test-genrandom +test-index-version test-match-trees test-parse-options test-path-utils diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 4bd9eba..2b344e1 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -196,7 +196,8 @@ to index, it will be marked "checkout" unless sparse patterns are applied. Unmerged files are always "checkout". When you checkout new files using "git checkout <file>" they will be automatically marked "checkout". Other commands such as "git apply" can also checkout new -files if they are needed. +files if they are needed. linkgit:git-update-index[1] can be used to +update "checkout/no-checkout" status in index. "No-checkout" status is very similar to "assume-unchanged bit" (see linkgit:git-update-index[1]). The main difference between them diff --git a/Documentation/git-update-index.txt b/Documentation/git-update-index.txt index 1d9d81a..ec03e05 100644 --- a/Documentation/git-update-index.txt +++ b/Documentation/git-update-index.txt @@ -15,6 +15,7 @@ SYNOPSIS [--cacheinfo <mode> <object> <file>]\* [--chmod=(+|-)x] [--assume-unchanged | --no-assume-unchanged] + [--checkout | ...
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
t/t3004-ls-files-sparse.sh | 40 +++++++++++++++++++++++++++++++++
t/t3004/cached.expected | 5 ++++
t/t3004/deleted.expected | 1 +
t/t3004/everything.expected | 10 ++++++++
t/t3004/modified.expected | 2 +
t/t3004/no-checkout.expected | 2 +
t/t3004/orphaned-no-checkout.expected | 3 ++
t/t3004/orphaned.expected | 1 +
t/t3004/others.expected | 2 +
t/t3004/sparse-cached.expected | 3 ++
t/t3004/sparse-everything.expected | 11 +++++++++
11 files changed, 80 insertions(+), 0 deletions(-)
create mode 100755 t/t3004-ls-files-sparse.sh
create mode 100644 t/t3004/cached.expected
create mode 100644 t/t3004/deleted.expected
create mode 100644 t/t3004/everything.expected
create mode 100644 t/t3004/modified.expected
create mode 100644 t/t3004/no-checkout.expected
create mode 100644 t/t3004/orphaned-no-checkout.expected
create mode 100644 t/t3004/orphaned.expected
create mode 100644 t/t3004/others.expected
create mode 100644 t/t3004/sparse-cached.expected
create mode 100644 t/t3004/sparse-everything.expected
diff --git a/t/t3004-ls-files-sparse.sh b/t/t3004-ls-files-sparse.sh
new file mode 100755
index 0000000..ec2c869
--- /dev/null
+++ b/t/t3004-ls-files-sparse.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+test_description="test ls-files in --sparse mode"
+
+. test-lib.sh
+
+test_ls_files() {
+ T=../t3004/$1.expected
+ shift
+ test_expect_success "ls-files $*" "git ls-files $* > result && test_cmp $T result"
+}
+
+test_expect_success 'setup' '
+ touch other orphaned no-checkout cached modified deleted &&
+ git add orphaned no-checkout cached modified deleted &&
+ git update-index --no-checkout orphaned no-checkout &&
+ echo modified >> modified &&
+ rm no-checkout deleted
+'
+
+test_ls_files cached
+test_ls_files cached --cached
+test_ls_files sparse-cached ...Mind-boggling, but this manages to break on Solaris. Fix is below. -- >8 -- t2104: touch portability fix Some versions of touch support the syntax: touch [MMDDhhmm[yy]] file... which makes the first argument an optional time specification. They can get confused by touch 1 2 foo bar as they assume that '1' is a bogus time specification. This is broken, for example, with /bin/touch on Solaris 8. To fix it, we'll just reverse the order of arguments so that an unambiguous argument is in the slot for the optional time specification. Signed-off-by: Jeff King <peff@peff.net> --- Note that this has implications for 'touch "$FOO" "$BAR"' used in scripts if FOO might be entirely numeric. However, a quick grep shows we usually touch one file at a time. t/t2104-update-index-no-checkout.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/t/t2104-update-index-no-checkout.sh b/t/t2104-update-index-no-checkout.sh index be9f913..37a6861 100755 --- a/t/t2104-update-index-no-checkout.sh +++ b/t/t2104-update-index-no-checkout.sh @@ -9,7 +9,7 @@ test_description='git update-index no-checkout bits (a.k.a sparse checkout)' test_expect_success 'setup' ' mkdir sub && - touch 1 2 sub/1 sub/2 && + touch sub/1 sub/2 1 2 && git add 1 2 sub/1 sub/2 ' -- 1.6.0.4.984.gbd0b7 --
I tend to avoid "touch", not specifically for this reason, but surely this is another reason why ">sub/1" is much better way to create a throw-away You can always do: : >>"$FOO" --
Having said all that, I wouldn't suggest redoing the patch using >> redirection. But change from "touch 1 nondigit" to "touch nondigit 1" is a bit too subtle to my taste. Let's write it this way instead: diff --git a/t/t2104-update-index-no-checkout.sh b/t/t2104-update-index-no-checkout.sh index be9f913..37a6861 100755 --- a/t/t2104-update-index-no-checkout.sh +++ b/t/t2104-update-index-no-checkout.sh @@ -9,7 +9,7 @@ test_description='git update-index no-checkout bits (a.k.a sparse checkout)' test_expect_success 'setup' ' mkdir sub && - touch 1 2 sub/1 sub/2 && + touch ./1 ./2 sub/1 sub/2 && git add 1 2 sub/1 sub/2 ' --
Yes, I also dislike the subtlety, but my "obvious" idea was something
like:
for i in 1 2 sub/1 sub/2; do
touch $i
done
this is less clunky, and I have confirmed that it solves the problem. I
just wasn't clever enough to think of it in the first place. ;)
-Peff
--
Thanks for catching. The last half also has the same problem. Another way is maybe just stay away for those numbers, naming the files by alphabet. Just wonder if we could have some ways to automatically catch this kind of bug in the future. -- Duy --
I'm not sure what you mean by "the last half also has the same problem"; Dscho suggested something similar. I would be happy if somebody wrote a portability lint that found problems in shell constructs and calling conventions of tools. In practice, though, I think it ends up being quite hard to catalog all of the quirks of every platform (and certainly, I would never have thought that this would break -- as it was, after it _did_ break I had to sit scratching my head wondering how that piece of code could be wrong). So I think a simpler approach makes sense: write tests that make sure the system is doing what you want, and then run those tests periodically in the environments that you care about checking. When it breaks, you know there is a problem. :) And that is exactly how this bug was caught. -Peff --
Sorry for the confusion. I meant the second half of the series, implementing UI interface for sparce checkout, which is not in pu yet. -- Duy --
A tool to do so essentially amounts to coming up with a set of POSIX command line tools that know and flag all the known bugs broken platform tools have, at the same time producing a reasonable end result so that it can continue running and detecting more portability issues in the scripts. Using dash as the shell helps to catch use of constructs outside POSIX, running various GNU tools with POSIXLY_CORRECT=YesPlease may have similar effects, but quirks specific to particular platforms like the above is fundamentally hard to check. Running autobuilder farms like Jeff does is probably the best thing we can do. --
Tm90IGluIHRoaXMgaGFsZiBidXQgSSd2ZSBzZWVuIHRoYXQgeW91IGFkZGVkIGEgLS1kZWZhdWx0 LXNwYXJzZSBmbGFnCnRvICJnaXQgY2xvbmUiLiBJIHRoaW5rIGl0IGlzIHVzZWxlc3MgYXMgbW9z dGx5IGFsd2F5cyB0aGUgb25lIGdpdmVuCmluIC1zcGFyc2UtY2hlY2tvdXQgc2hvdWxkIGJlIHVz ZWQuCgpUaGFua3MKClNhbnRpCgpPbiBXZWQsIE9jdCAxLCAyMDA4IGF0IDY6MDQgQU0sIE5ndXnh u4VuIFRow6FpIE5n4buNYyBEdXkgPHBjbG91ZHNAZ21haWwuY29tPiB3cm90ZToKPiBUaGlzIGlz IHRoZSBmaXJzdCBoYWxmIG9mIHRoZSBzZXJpZXMsIG1ha2luZyBnaXQgcmVhZHkgZm9yIHNwYXJz ZQo+IGNoZWNrb3V0LiBUaGUgb25seSBkaWZmZXJlbmNlIGZyb20gdGhlIGxhc3QgKGZpcnN0IGhh bGYpIHNlbnQKPiBzZXJpZXMgaXMgc2FmZWd1YXJkIGJpdG1hc2sgZml4IGluIDEvOQo+Cj4gTmd1 eeG7hW4gVGjDoWkgTmfhu41jIER1eSAoOSk6Cj4gIEV4dGVuZCBpbmRleCB0byBzYXZlIG1vcmUg ZmxhZ3MKPiAgSW50cm9kdWNlIENFX05PX0NIRUNLT1VUIGJpdAo+ICBscy1maWxlczogYWRkIG9w dGlvbnMgdG8gc3VwcG9ydCBzcGFyc2UgY2hlY2tvdXQKPiAgdXBkYXRlLWluZGV4OiByZWZhY3Rv ciBtYXJrX3ZhbGlkKCkgaW4gcHJlcGFyYXRpb24gZm9yIG5ldyBvcHRpb25zCj4gIHVwZGF0ZS1p bmRleDogYWRkIC0tY2hlY2tvdXQvLS1uby1jaGVja291dCB0byB1cGRhdGUgQ0VfTk9fQ0hFQ0tP VVQKPiAgICBiaXQKPiAgbHMtZmlsZXM6IEFkZCB0ZXN0cyBmb3IgLS1zcGFyc2UgYW5kIGZyaWVu ZHMKPiAgUHJldmVudCBkaWZmIG1hY2hpbmVyeSBmcm9tIGV4YW1pbmluZyB3b3JrdHJlZSBvdXRz aWRlIHNwYXJzZQo+ICAgIGNoZWNrb3V0Cj4gIGNoZWNrb3V0X2VudHJ5KCk6IENFX05PX0NIRUNL T1VUIG9uIGNoZWNrZWQgb3V0IGVudHJpZXMuCj4gIGdyZXA6IHNraXAgZmlsZXMgb3V0c2lkZSBz cGFyc2UgY2hlY2tvdXQgYXJlYQo+Cj4gIC5naXRpZ25vcmUgICAgICAgICAgICAgICAgICAgICAg ICAgICAgfCAgICAxICsKPiAgRG9jdW1lbnRhdGlvbi9naXQtY2hlY2tvdXQudHh0ICAgICAgICB8 ICAgMzQgKysrKysrKysrKysrKysrKysKPiAgRG9jdW1lbnRhdGlvbi9naXQtZ3JlcC50eHQgICAg ICAgICAgICB8ICAgIDQgKy0KPiAgRG9jdW1lbnRhdGlvbi9naXQtbHMtZmlsZXMudHh0ICAgICAg ICB8ICAgMjQgKysrKysrKysrKystCj4gIERvY3VtZW50YXRpb24vZ2l0LXVwZGF0ZS1pbmRleC50 eHQgICAgfCAgIDEzICsrKysrKwo+ICBNYWtlZmlsZSAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIHwgICAgMiArLQo+ICBidWlsdGluLWdyZXAuYyAgICAgICAgICAgICAgICAgICAgICAgIHwg ICAgNyArKystCj4gIGJ1aWx0aW4tbHMtZmlsZXMuYyAgICAgICAgICAgICAgICAgICAgfCAgIDQx ICsrKysrKysrKysrKysrKysrKy0tCj4gIGJ1aWx0aW4tdXBkYXRlLWluZGV4LmMgICAgICAgICAg ICAgICAgfCAgIDQw ...
To be more precise, whenever you do "git clone --sparse-checkout" you will want it to be the default sparse pattern. Best regards, Santi --
T24gMTAvMS8wOCwgU2FudGkgQsOpamFyIDxzYW50aUBhZ29saW5hLm5ldD4gd3JvdGU6Cj4gT24g V2VkLCBPY3QgMSwgMjAwOCBhdCAxMjoyMCBQTSwgU2FudGkgQsOpamFyIDxzYW50aUBhZ29saW5h Lm5ldD4gd3JvdGU6Cj4gID4gTm90IGluIHRoaXMgaGFsZiBidXQgSSd2ZSBzZWVuIHRoYXQgeW91 IGFkZGVkIGEgLS1kZWZhdWx0LXNwYXJzZSBmbGFnCj4gID4gdG8gImdpdCBjbG9uZSIuIEkgdGhp bmsgaXQgaXMgdXNlbGVzcyBhcyBtb3N0bHkgYWx3YXlzIHRoZSBvbmUgZ2l2ZW4KPiAgPiBpbiAt c3BhcnNlLWNoZWNrb3V0IHNob3VsZCBiZSB1c2VkLgo+Cj4KPiBUbyBiZSBtb3JlIHByZWNpc2Us IHdoZW5ldmVyIHlvdSBkbyAiZ2l0IGNsb25lIC0tc3BhcnNlLWNoZWNrb3V0IiB5b3UKPiAgd2ls bCB3YW50IGl0IHRvIGJlIHRoZSBkZWZhdWx0IHNwYXJzZSBwYXR0ZXJuLgoKWWVzLCBpZiBvbmx5 IHRoZSBkZWZhdWx0IHBhdHRlcm4gZ2V0cyB1cGRhdGVkIHByb3Blcmx5IHdoZW4geW91IHVwZGF0 ZQp5b3VyIGNoZWNrb3V0IGFyZWEuIElmICJnaXQgY2xvbmUgLS1zcGFyc2UtY2hlY2tvdXQiIG1h a2VzIHRoZSBkZWZhdWx0CnBhdHRlcm4sIHRoZW4gImdpdCBjaGVja291dCAtLXJlc2V0LXNwYXJz ZSIgc2hvdWxkIHJlc2V0IHRoZSBkZWZhdWx0CnBhdHRlcm4gYXMgd2VsbC4gVGhlIGhhcmQgcGFy dCBpcyBob3cgdG8gdXBkYXRlIGRlZmF1bHQgcGF0dGVybiB3aXRoCi0taW5jbHVkZS1zcGFyc2Ug YW5kIC0tZXhjbHVkZS1zcGFyc2UuIEFsc28sIHBlb3BsZSBjYW4gdXNlICJnaXQKdXBkYXRlLWlu ZGV4IiB0byB1cGRhdGUgY2hlY2tvdXQgYXJlYSwgd2hpY2ggc2hvdWxkIG5vdCB0b3VjaCBkZWZh dWx0CnBhdHRlcm4gYXQgYWxsLiBNYXliZSBqdXN0IHRocm93IGEgd2FybmluZyB3aGVuIGRlZmF1 bHQgcGF0dGVybiBubwpsb25nZXIgbWF0Y2hlcyB0aGUgY2hlY2tvdXQgYXJlYSwgdGhlbiBsZXQg dGhlbSBkZWNpZGUuCi0tIApEdXkK --
I don't parse this sentence, but I cannot see the connection between
the default sparse pattern for _clone_ and updating it or the working
Maybe you could let the core.defaultsparse be defined multiple times.
[core]
defaultsparse = Documentation/*
defaultsparse = t/*
defaultsparse = !t/*svn*
equivalent to
[core]
defaultsparse = Documentation/*:t/*:!t/*svn*
I would prefer having a --not-update-sparse-pattern.
The most common workflow should be the most straightforward. The most
common use-case would be somebody working _only_ in some subdirectory
(say Documentation), then what s/he normally does is:
1) cloning and default sparse chechout:
$ git clone --sparse-checkout=Documentation/* ...
or within an existing wd
$ git checkout --reset-sparse=Documentation/* ...
(maybe just --sparse?)
2) Work normally inside the Documentation directory...
3) Abort a merge with conflicts outside the sparse area:
$ git reset --hard ORIG_HEAD)
<Now there are files outside the default sparse area>
$ git checkout --reset-sparse # with --sparse to set the sparse pattern
Including/excluding more paths in the default sparse checkout is not
something you would do normally, but I think it makes sense to add
them to the default pattern.
Please correct me if you think there are other use-cases, or more
Sure, and inform in the "git status" that you are in a sparse checkout.
Best regards,
Santi
--
