[PATCH v2 7/6] t7814: do not generate same commits in different repos

2019-06-28 Thread Nguyễn Thái Ngọc Duy
after every commit. This makes all commits unique. Of course there are still identical blobs in different repos, but because we often lookup commit first, then tree and blob, unique commits are already quite safe. Signed-off-by: Nguyễn Thái Ngọc Duy --- > And I can't quite understand how

[PATCH v2 3/6] tree-walk.c: remove the_repo from get_tree_entry()

2019-06-27 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- archive.c | 4 +++- blame.c| 4 ++-- builtin/rm.c | 2 +- builtin/update-index.c | 2 +- line-log.c | 7 --- match-trees.c | 6 +++--- merge-recursive.c

[PATCH v2 5/6] match-trees.c: remove the_repo from shift_tree*()

2019-06-27 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- cache.h | 4 ++-- match-trees.c | 12 +++- merge-recursive.c | 4 ++-- t/helper/test-match-trees.c | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git

[PATCH v2 6/6] Use the right 'struct repository' instead of the_repository

2019-06-27 Thread Nguyễn Thái Ngọc Duy
There are a couple of places where 'struct repository' is already passed around, but the_repository is still used. Use the right repo. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- merge-recursive.c | 35 --- sequencer.c

[PATCH v2 4/6] tree-walk.c: remove the_repo from get_tree_entry_follow_symlinks()

2019-06-27 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- sha1-name.c | 10 +- tree-walk.c | 12 tree-walk.h | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index e8fb215e5c..3c9fa10af8 100644 --- a/sha1-name.c

[PATCH v2 1/6] sha1-file.c: remove the_repo from read_object_with_reference()

2019-06-27 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/cat-file.c | 3 ++- builtin/grep.c | 6 -- builtin/pack-objects.c | 3 ++- cache.h| 3 ++- fast-import.c | 9 ++--- sha1-file.c| 5 +++-- tree-walk.c| 7 --- 7 files changed

[PATCH v2 0/6] Kill the_repository in tree-walk.c

2019-06-27 Thread Nguyễn Thái Ngọc Duy
s in order to make it work. And I can't quite understand how t7814 sometimes passed. I'll revisit this after this series is done and will try to get rid of add_to_alternates_memory() in git-grep. Nguyễn Thái Ngọc Duy (6): sha1-file.c: remove the_repo from read_object_with_reference()

[PATCH v2 2/6] tree-walk.c: remove the_repo from fill_tree_descriptor()

2019-06-27 Thread Nguyễn Thái Ngọc Duy
While at there, clean up the_repo usage in builtin/merge-tree.c a tiny bit. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/merge-tree.c | 22 +- builtin/rebase.c | 4 ++-- builtin/reset.c | 4 ++-- notes.c | 2

[PATCH/RFC] get_oid: new extended SHA-1 syntax to control resolution process

2019-06-26 Thread Nguyễn Thái Ngọc Duy
s/master@{literal}@{yesterday} or @{hash}^{tree}. Perhaps I should allow these tags at the end too, so you can enforce a variable like "$REV"@{literal} where $REV could be even HEAD~123 Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/revisions.txt | 10 refs.c

[PATCH v2 10/10] t3008: use the new SINGLE_CPU prereq

2019-06-24 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- t/t3008-ls-files-lazy-init-name-hash.sh | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/t/t3008-ls-files-lazy-init-name-hash.sh b/t/t3008-ls-files-lazy-init-name-hash.sh index 64f047332b..7f918c05f6 100755 --- a/t/t3008-ls-files

[PATCH v2 08/10] read-cache.c: dump "EOIE" extension as json

2019-06-24 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- read-cache.c | 8 t/t3011-ls-files-json.sh | 13 ++ t/t3011/eoie (new) | 96 t/test-lib.sh| 4 ++ 4 files changed, 121 insertions(+) diff --git a/read-cache.c b/read-cache.c

[PATCH v2 04/10] dir.c: dump "UNTR" extension as json

2019-06-24 Thread Nguyễn Thái Ngọc Duy
The big part of UNTR extension is dumped at the end instead of dumping as soon as we read it, because we actually "patch" some fields in untracked_cache_dir with EWAH bitmaps at the end. Signed-off-by: Nguyễn Thái Ngọc Duy --- dir.c

[PATCH v2 06/10] fsmonitor.c: dump "FSMN" extension as json

2019-06-24 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- fsmonitor.c | 6 ++ t/t3011-ls-files-json.sh | 14 +- t/t3011/fsmonitor (new) | 38 ++ 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/fsmonitor.c b/fsmonitor.c index

[PATCH v2 07/10] resolve-undo.c: dump "REUC" extension as json

2019-06-24 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- read-cache.c | 2 +- resolve-undo.c | 30 +- resolve-undo.h | 4 ++- t/t3011-ls-files-json.sh | 20 t/t3011/rerere (new) | 66 5 files changed, 119

[PATCH v2 01/10] ls-files: add --json to dump the index

2019-06-24 Thread Nguyễn Thái Ngọc Duy
rbose even on a small repository such as git.git. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-ls-files.txt| 5 +++ builtin/ls-files.c| 38 +--- cache.h | 2 + json-writer.c | 22 ++

[PATCH v2 03/10] cache-tree.c: dump "TREE" extension as json

2019-06-24 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache-tree.c | 36 +++- cache-tree.h | 5 - read-cache.c | 2 +- t/t3011-ls-files-json.sh | 4 +++- t/t3011/basic| 20 +++- 5 files changed, 58

[PATCH v2 09/10] read-cache.c: dump "IEOT" extension as json

2019-06-24 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- read-cache.c | 43 --- t/t3011/eoie | 13 - 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/read-cache.c b/read-cache.c index 37491dd03d..c26edcc9d9 100644 --- a/read-cache.c +++ b/read

[PATCH v2 02/10] read-cache.c: dump common extension info in json

2019-06-24 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- read-cache.c | 49 +++-- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/read-cache.c b/read-cache.c index db5147d088..4accd8bb08 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1694,8 +1694,26

[PATCH v2 05/10] split-index.c: dump "link" extension as json

2019-06-24 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- json-writer.c | 14 ++ json-writer.h | 3 +++ split-index.c | 9 - t/t3011-ls-files-json.sh | 14 ++ t/t3011/split-index (new) | 39 +++ 5 files

[PATCH v2 00/10] Add 'ls-files --debug-json' to dump the index in json

2019-06-24 Thread Nguyễn Thái Ngọc Duy
"file_offset": +}, +{ + "id": 2, + "name": "three", + "mode": "100644", + "flags": 0, + "oid": , + "stat": { +"ctime_sec": , +"ctim

[PATCH 6/6] Use the right 'struct repository' instead of the_repository

2019-06-24 Thread Nguyễn Thái Ngọc Duy
There are a couple of places where 'struct repository' is already passed around, but the_repository is still used. Use the right repo. Signed-off-by: Nguyễn Thái Ngọc Duy --- merge-recursive.c | 35 --- sequencer.c | 4 ++-- sha1-name.c

[PATCH 5/6] match-trees.c: remove the_repo from shift_tree*()

2019-06-24 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 4 ++-- match-trees.c | 12 +++- merge-recursive.c | 4 ++-- t/helper/test-match-trees.c | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/cache.h b/cache.h index

[PATCH 0/6] Kill the_repository in tree-walk.c

2019-06-24 Thread Nguyễn Thái Ngọc Duy
This is the continuation of nd/sha1-name-c-wo-the-repository. In that series I sealed off one place in sha1-name.c that cannot walk trees from arbitrary repositories. With tree-walk.c taking 'struct repository *' directly, that check in there can now be removed. Nguyễn Thái Ngọc Duy (

[PATCH 1/6] sha1-file.c: remove the_repo from read_object_with_reference()

2019-06-24 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/cat-file.c | 3 ++- builtin/grep.c | 6 -- builtin/pack-objects.c | 3 ++- cache.h| 3 ++- fast-import.c | 9 ++--- sha1-file.c| 5 +++-- tree-walk.c| 7 --- 7 files changed

[PATCH 4/6] tree-walk.c: remove the_repo from get_tree_entry_follow_symlinks()

2019-06-24 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 10 +- tree-walk.c | 12 tree-walk.h | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index e8fb215e5c..3c9fa10af8 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -1890,16

[PATCH 2/6] tree-walk.c: remove the_repo from fill_tree_descriptor()

2019-06-24 Thread Nguyễn Thái Ngọc Duy
While at there, clean up the_repo usage in builtin/merge-tree.c a tiny bit. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/merge-tree.c | 22 +- builtin/rebase.c | 4 ++-- builtin/reset.c | 4 ++-- notes.c | 2 +- sequencer.c | 2 +- tree

[PATCH 3/6] tree-walk.c: remove the_repo from get_tree_entry()

2019-06-24 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- archive.c | 4 +++- blame.c| 4 ++-- builtin/rm.c | 2 +- builtin/update-index.c | 2 +- line-log.c | 7 --- match-trees.c | 6 +++--- merge-recursive.c | 8 +--- notes.c

[PATCH] rm: add --intent-to-add, to be used with --cached

2019-06-22 Thread Nguyễn Thái Ngọc Duy
o trying to be clever. But that's more suitable for plumbing commands like update-index than rm, in my opinion. Signed-off-by: Nguyễn Thái Ngọc Duy --- This occurred to me while adding intent-to-add support to git-restore. It's not related to nd/switch-and-restore though and I

[PATCH 3/3] fetch-pack: print server version at the top in -v -v

2019-06-20 Thread Nguyễn Thái Ngọc Duy
will have even more debug out after capabilities. Signed-off-by: Nguyễn Thái Ngọc Duy --- fetch-pack.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fetch-pack.c b/fetch-pack.c index de935f8776..445a261f14 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -902

[PATCH 2/3] fetch-pack: print all relevant supported capabilities with -v -v

2019-06-20 Thread Nguyễn Thái Ngọc Duy
or printing all supported capabilities the server sends us. But I think it's still valuable this way because we see the capabilities that the client cares about. Signed-off-by: Nguyễn Thái Ngọc Duy --- fetch-pack.c | 30 +- 1 file changed, 21 insertions(+), 9 deletions(-)

[PATCH 1/3] fetch-pack: move capability names out of i18n strings

2019-06-20 Thread Nguyễn Thái Ngọc Duy
This reduces the work on translators since they only have one string to translate (and I think it's still enough context to translate). It also makes sure no capability name is translated by accident. Signed-off-by: Nguyễn Thái Ngọc Duy --- fetch-pack.c | 18 +- 1 file ch

[PATCH 1/4] t2027: use test_must_be_empty

2019-06-20 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- t/t2070-restore.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/t/t2070-restore.sh b/t/t2070-restore.sh index 73ea13ede9..2650df1966 100755 --- a/t/t2070-restore.sh +++ b/t/t2070-restore.sh @@ -90,9 +90,8 @@ test_expect_success

[PATCH 4/4] restore: add --intent-to-add (restoring worktree only)

2019-06-20 Thread Nguyễn Thái Ngọc Duy
ommit exactly as the given source either. Add --intent-to-add to help track new files in this case, which is the default on the least surprise principle. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-restore.txt | 7 builtin/checkout.c| 78 +++

[PATCH 2/4] switch: allow to switch in the middle of bisect

2019-06-20 Thread Nguyễn Thái Ngọc Duy
loss of local changes and stuff. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/checkout.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/builtin/checkout.c b/builtin/checkout.c index bed79ae595..f884d27f1f 100644 --- a/builtin/checkout.c +++ b/builtin/chec

[PATCH 0/4] Some more on top of nd/switch-and-restore

2019-06-20 Thread Nguyễn Thái Ngọc Duy
x27; is just annoyance. But I don't find myself using it and I'm a pretty heavy detached user. So while it kinda makes sense to do, I don't think it's worth the complication. Nguyễn Thái Ngọc Duy (4): t2027: use test_must_be_empty switch: allow to switch in the middle of bis

[PATCH 3/4] completion: disable dwim on "git switch -d"

2019-06-20 Thread Nguyễn Thái Ngọc Duy
s case a bit shorter. Signed-off-by: Nguyễn Thái Ngọc Duy --- contrib/completion/git-completion.bash | 4 1 file changed, 4 insertions(+) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 58d18d41a2..656e49710e 100644 --- a/contrib/completion

[PATCH 7/8] cache-tree.c: dump "TREE" extension as json

2019-06-19 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache-tree.c | 41 - cache-tree.h | 5 - read-cache.c | 2 +- 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/cache-tree.c b/cache-tree.c index b13bfaf71e..fc44016fe8 100644 --- a/cache-tree.c

[PATCH 8/8] dir.c: dump "UNTR" extension as json

2019-06-19 Thread Nguyễn Thái Ngọc Duy
The big part of UNTR extension is dumped at the end instead of dumping as soon as we read it, because we actually "patch" some fields in untracked_cache_dir with EWAH bitmaps at the end. Signed-off-by: Nguyễn Thái Ngọc Duy --- dir.c

[PATCH 1/8] ls-files: add --json to dump the index

2019-06-19 Thread Nguyễn Thái Ngọc Duy
rbose even on a small repository such as git.git. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-ls-files.txt | 5 +++ builtin/ls-files.c | 30 +++--- cache.h| 2 + json-writer.c | 16 json-writer.h

[PATCH 6/8] read-cache.c: dump "IEOT" extension as json

2019-06-19 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- read-cache.c | 34 +- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/read-cache.c b/read-cache.c index 04863c3853..200834e77e 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1911,7 +1911,7 @@ struct

[PATCH 4/8] resolve-undo.c: dump "REUC" extension as json

2019-06-19 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- read-cache.c | 2 +- resolve-undo.c | 36 +++- resolve-undo.h | 4 +++- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/read-cache.c b/read-cache.c index eec030b3bb..3b5c63f53a 100644 --- a/read-cache.c

[PATCH 5/8] read-cache.c: dump "EOIE" extension as json

2019-06-19 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- read-cache.c | 30 +++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/read-cache.c b/read-cache.c index 3b5c63f53a..04863c3853 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1914,7 +1914,7 @@ struct

[PATCH 2/8] split-index.c: dump "link" extension as json

2019-06-19 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- json-writer.c | 14 ++ json-writer.h | 2 ++ split-index.c | 13 - 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/json-writer.c b/json-writer.c index 281bc50b39..70403580ca 100644 --- a/json-writer.c +++ b/json

[PATCH 3/8] fsmonitor.c: dump "FSMN" extension as json

2019-06-19 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- fsmonitor.c | 9 + 1 file changed, 9 insertions(+) diff --git a/fsmonitor.c b/fsmonitor.c index 1dee0aded1..f6ba437255 100644 --- a/fsmonitor.c +++ b/fsmonitor.c @@ -3,6 +3,7 @@ #include "dir.h" #include "ewah/ewok.h" #

[PATCH 0/8] Add 'ls-files --json' to dump the index in json

2019-06-19 Thread Nguyễn Thái Ngọc Duy
g to merge it to git.git just for a single user. Maintaining off tree is still a pain for me, but I think I can manage it. Nguyễn Thái Ngọc Duy (8): ls-files: add --json to dump the index split-index.c: dump "link" extension as json fsmonitor.c: dump "FSMN" extension as json

[PATCH] fetch: only run 'gc' once when fetching multiple remotes

2019-06-19 Thread Nguyễn Thái Ngọc Duy
ll be fine because we should "join" all those processes before this step. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/fetch-options.txt | 4 builtin/fetch.c | 17 +++-- t/t5514-fetch-multiple.sh | 7 +-- 3 files changed, 2

[PATCH v2] completion: do not cache if --git-completion-helper fails

2019-06-12 Thread Nguyễn Thái Ngọc Duy
is called on a command that does not support --git-completion-helper. And we do have a generic call __git_complete_common "$command" but this case is protected with __git_support_parseopt_helper so we're good. Reported-by: Felipe Contreras Signed-off-by: Nguyễn Thái Ngọc Du

[PATCH] completion: do not cache if --git-completion-helper fails

2019-06-07 Thread Nguyễn Thái Ngọc Duy
is called on a command that does not support --git-completion-helper. And we do have a generic call __git_complete_common "$command" but this case is protected with __git_support_parseopt_helper so we're good. Reported-by: Felipe Contreras Signed-off-by: Nguyễn Thái Ngọc Du

[PATCH v2 3/3] parse-options: check empty value in OPT_INTEGER and OPT_ABBREV

2019-05-29 Thread Nguyễn Thái Ngọc Duy
ndled the same (sane) way. For OPT_ABBREV this is new behavior. But it makes it consistent with the rest. PS. OPT_MAGNITUDE has similar code but git_parse_ulong() does detect empty "arg". So it's good to go. Signed-off-by: Nguyễn Thái Ngọc Duy --- parse-options-cb.c | 3 +++

[PATCH v2 2/3] diff-parseopt: restore -U (no argument) behavior

2019-05-29 Thread Nguyễn Thái Ngọc Duy
ed without any argument, the option should be accepted, and the default value should be used. Without PARSE_OPT_OPTARG, parse_options() will reject this case and cause a regression. Reported-by: Bryan Turner Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c| 10

[PATCH v2 1/3] diff-parseopt: correct variable types that are used by parseopt

2019-05-29 Thread Nguyễn Thái Ngọc Duy
ks may be implemented in the future to prevent class of bugs. Reported-by: Todd Zullinger Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diff.h b/diff.h index b20cbcc091..d5e44baa96 100644 --- a/diff.h +++ b/diff.h @@ -169,7 +169,

[PATCH v2 0/3] fix diff-parseopt regressions

2019-05-29 Thread Nguyễn Thái Ngọc Duy
v2 reduces diff noise. My C is rusty (and probably holey too). For some reason I remember "unsigned" is equivalent to "unsigned short", not "unsigned int". Nguyễn Thái Ngọc Duy (3): diff-parseopt: correct variable types that are used by parseopt diff-par

[PATCH 4/3] parse-options: make compiler check value type mismatch

2019-05-24 Thread Nguyễn Thái Ngọc Duy
ning. The catch though, is that we can only call a function in variable declaration if it's in automatic scope. Global and static 'struct option' variables will fail to build after this. But I think this is an reasonable price to pay, compared to memory corruption. Signed-off-by: Ngu

[PATCH 0/3] fix diff-parseopt regressions

2019-05-24 Thread Nguyễn Thái Ngọc Duy
with that later. The third patch also brings back a corner case behavior of --inter-hunk-context and as a result strengthens OPT_INTEGER() error handling a bit. Nguyễn Thái Ngọc Duy (3): diff-parseopt: correct variable types that are used by parseopt diff-parseopt: restore -U (no argument) b

[PATCH 2/3] diff-parseopt: restore -U (no argument) behavior

2019-05-24 Thread Nguyễn Thái Ngọc Duy
ed without any argument, the option should be accepted, and the default value should be used. Without PARSE_OPT_OPTARG, parse_options() will reject this case and cause a regression. Reported-by: Bryan Turner Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c| 10

[PATCH 3/3] parse-options: check empty value in OPT_INTEGER and OPT_ABBREV

2019-05-24 Thread Nguyễn Thái Ngọc Duy
ndled the same (sane) way. For OPT_ABBREV this is new behavior. But it makes it consistent with the rest. PS. OPT_MAGNITUDE has similar code but git_parse_ulong() does detect empty "arg". So it's good to go. Signed-off-by: Nguyễn Thái Ngọc Duy --- parse-options-cb.c | 3 +++

[PATCH 1/3] diff-parseopt: correct variable types that are used by parseopt

2019-05-24 Thread Nguyễn Thái Ngọc Duy
ks may be implemented in the future to prevent class of bugs. Reported-by: Todd Zullinger Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.h | 70 +- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/diff.h b/diff.h index b20cbcc091

[PATCH] repository.c: always allocate 'index' at repo init time

2019-05-19 Thread Nguyễn Thái Ngọc Duy
zation. It's less effort than the first one, and also safer because you could still miss things during the code audit. The extra allocation cost is not a real concern. The 'index' field is still freed and reset to NULL in repo_clear(). But after that call, a lot more is missing in

[PATCH v4 0/2] nd/merge-quit updates

2019-05-18 Thread Nguyễn Thái Ngọc Duy
Another round because apparently the test case is not perfect. Nguyễn Thái Ngọc Duy (2): merge: remove drop_save() in favor of remove_merge_branch_state() merge: add --quit Documentation/git-merge.txt | 4 branch.c| 11 --- branch.h| 6

[PATCH v4 2/2] merge: add --quit

2019-05-18 Thread Nguyễn Thái Ngọc Duy
can't even continue the merge anymore. This also makes all in-progress commands, am, merge, rebase, revert and cherry-pick, take all three --abort, --continue and --quit (bisect has a different UI). Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-merge.txt | 4 builtin/merge.c

[PATCH v4 1/2] merge: remove drop_save() in favor of remove_merge_branch_state()

2019-05-18 Thread Nguyễn Thái Ngọc Duy
and use it instead of drop_save(). This function will also be used in the next patch that introduces --quit. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- branch.c| 11 --- branch.h| 6 ++ builtin/merge.c | 17 + 3 files

[PATCH v3 2/2] merge: add --quit

2019-05-14 Thread Nguyễn Thái Ngọc Duy
can't even continue the merge anymore. This also makes all in-progress commands, am, merge, rebase, revert and cherry-pick, take all three --abort, --continue and --quit (bisect has a different UI). Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-merge.txt | 4 builtin/merge.c

[PATCH v3 1/2] merge: remove drop_save() in favor of remove_merge_branch_state()

2019-05-14 Thread Nguyễn Thái Ngọc Duy
and use it instead of drop_save(). This function will also be used in the next patch that introduces --quit. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- branch.c| 11 --- branch.h| 6 ++ builtin/merge.c | 17 + 3 files

[PATCH v3 0/2] nd/merge-quit updates

2019-05-14 Thread Nguyễn Thái Ngọc Duy
v3 fixes the test breakage when GPG tests are skipped ('side' branch is affected by these skipped tests) Nguyễn Thái Ngọc Duy (2): merge: remove drop_save() in favor of remove_merge_branch_state() merge: add --quit Documentation/git-merge.txt | 4 branch.c

[PATCH] worktree add: be tolerant of corrupt worktrees

2019-05-13 Thread Nguyễn Thái Ngọc Duy
allow adding same path multiple times, 2018-08-28), or since v2.20.0. Though the real bug in find_worktree() is much older. Reported-by: Shaheed Haque Signed-off-by: Nguyễn Thái Ngọc Duy --- t/t2025-worktree-add.sh | 12 worktree.c | 7 +-- 2 files changed

[PATCH] init: make --template path relative to $CWD

2019-05-10 Thread Nguyễn Thái Ngọc Duy
e on. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/init-db.c | 3 +++ t/t0001-init.sh| 2 +- t/t1301-shared-repo.sh | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/builtin/init-db.c b/builtin/init-db.c index 93eff7618c..6b72a9bb09 100644 --- a/builtin/ini

[PATCH v2 0/2] nd/merge-quit update

2019-05-09 Thread Nguyễn Thái Ngọc Duy
A couple typos in the commit message. No code change. Nguyễn Thái Ngọc Duy (2): merge: remove drop_save() in favor of remove_merge_branch_state() merge: add --quit Documentation/git-merge.txt | 4 branch.c| 11 --- branch.h| 6

[PATCH v2 2/2] merge: add --quit

2019-05-09 Thread Nguyễn Thái Ngọc Duy
can't even continue the merge anymore. This also makes all in-progress commands, am, merge, rebase, revert and cherry-pick, take all three --abort, --continue and --quit (bisect has a different UI). Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- Documentation/git

[PATCH v2 1/2] merge: remove drop_save() in favor of remove_merge_branch_state()

2019-05-09 Thread Nguyễn Thái Ngọc Duy
and use it instead of drop_save(). This function will also be used in the next patch that introduces --quit. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- branch.c| 11 --- branch.h| 6 ++ builtin/merge.c | 17 + 3 files

[PATCH 03/19] revision.c: prepare to convert handle_revision_pseudo_opt()

2019-05-08 Thread Nguyễn Thái Ngọc Duy
This patch is essentially no-op. It allows to parse_options() to handle some options. But the new option list remains empty. The option will be moved one by one from the old manual parsing code to this list. Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 44

[PATCH 11/19] rev-parseopt: convert --reflog

2019-05-08 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 19 --- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/revision.c b/revision.c index d34e17984d..6efa9bee1e 100644 --- a/revision.c +++ b/revision.c @@ -2452,6 +2452,18 @@ static int rev_opt_glob(const struct

[PATCH 15/19] rev-parseopt: convert --single-worktree

2019-05-08 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/revision.c b/revision.c index f04eb7f140..dd22ac5c39 100644 --- a/revision.c +++ b/revision.c @@ -2601,6 +2601,9 @@ static void make_pseudo_options(struct

[PATCH 02/19] revision.h: move repo field down

2019-05-08 Thread Nguyễn Thái Ngọc Duy
This block at the top of rev_info is "Starting list" and repo is obviously not one. Move it to the bottom since it's not that important to stay on top. Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH 08/19] rev-parseopt: convert --remotes

2019-05-08 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 34 +- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/revision.c b/revision.c index 5183cdf66d..bcfca8856f 100644 --- a/revision.c +++ b/revision.c @@ -2425,6 +2425,27 @@ static int

[PATCH 16/19] rev-parseopt: prepare to convert handle_revision_opt()

2019-05-08 Thread Nguyễn Thái Ngọc Duy
e the same one from the diff option parser (which runs first now, if not overriden) Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/technical/api-diff.txt | 6 +-- diff.c | 16 --- diff.h | 1 - revis

[PATCH 07/19] rev-parseopt: convert --tags

2019-05-08 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 34 +- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/revision.c b/revision.c index 0d34f81716..5183cdf66d 100644 --- a/revision.c +++ b/revision.c @@ -2425,6 +2425,27 @@ static int

[PATCH 04/19] rev-parseopt: convert --all

2019-05-08 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 41 ++--- revision.h | 2 ++ 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/revision.c b/revision.c index 65d40c9255..9a346577f6 100644 --- a/revision.c +++ b/revision.c @@ -30,6 +30,10

[PATCH 12/19] rev-parseopt: convert --indexed-objects

2019-05-08 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 19 --- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/revision.c b/revision.c index 6efa9bee1e..9cfa4dc151 100644 --- a/revision.c +++ b/revision.c @@ -2438,6 +2438,18 @@ static int rev_opt_exclude(const struct

[PATCH 14/19] rev-parseopt: convert --no-walk and --do-walk

2019-05-08 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 47 ++- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/revision.c b/revision.c index b02cb4660b..f04eb7f140 100644 --- a/revision.c +++ b/revision.c @@ -2464,6 +2464,29 @@ static int

[PATCH 00/19] Convert revision.c to parseopt part 1/4

2019-05-08 Thread Nguyễn Thái Ngọc Duy
not quite done with those last "10 more" patches yet [2], still stuck at that ancient blame UI. But I should be done by the 76 patches are merged. [1] https://gitlab.com/pclouds/git/commits/revision-opt-parse-options [2] https://gitlab.com/pclouds/git/commits/parse-options-step-no-more

[PATCH 09/19] rev-parseopt: convert --glob

2019-05-08 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 28 +--- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/revision.c b/revision.c index bcfca8856f..013b8ec19f 100644 --- a/revision.c +++ b/revision.c @@ -30,6 +30,9 @@ #include "prio-queue.h"

[PATCH 10/19] rev-parseopt: convert --exclude

2019-05-08 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 19 ++- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/revision.c b/revision.c index 013b8ec19f..d34e17984d 100644 --- a/revision.c +++ b/revision.c @@ -2428,6 +2428,16 @@ static int rev_opt_branches(const

[PATCH 06/19] rev-parseopt: convert --bisect

2019-05-08 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 28 +--- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/revision.c b/revision.c index 7db1109b57..0d34f81716 100644 --- a/revision.c +++ b/revision.c @@ -2387,6 +2387,23 @@ static int rev_opt_all(const

[PATCH 05/19] rev-parseopt: convert --branches

2019-05-08 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 38 +- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/revision.c b/revision.c index 9a346577f6..7db1109b57 100644 --- a/revision.c +++ b/revision.c @@ -34,6 +34,10 @@ OPT_CALLBACK_F(s

[PATCH 01/19] revision.h: avoid bit fields in struct rev_info

2019-05-08 Thread Nguyễn Thái Ngọc Duy
consumption is not at all a concern. Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.h | 164 ++--- 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/revision.h b/revision.h index 4134dc6029..01e4c42274 100644 --- a/revision.h +++ b/revision.h

[PATCH 13/19] rev-parseopt: convert --not

2019-05-08 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/revision.c b/revision.c index 9cfa4dc151..b02cb4660b 100644 --- a/revision.c +++ b/revision.c @@ -2464,6 +2464,17 @@ static int rev_opt_glob(const struct

[PATCH 19/19] rev-parseopt: convert --min-age and --max-age

2019-05-08 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- parse-options-cb.c | 8 parse-options.h| 4 revision.c | 10 -- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/parse-options-cb.c b/parse-options-cb.c index 6e2e8d6273..7cdbbf5f6d 100644 --- a/parse

[PATCH 18/19] rev-parseopt: convert --skip

2019-05-08 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/revision.c b/revision.c index c53347d362..42d466cd08 100644 --- a/revision.c +++ b/revision.c @@ -1996,6 +1996,9 @@ static void make_rev_options(struct rev_info *revs

[PATCH 17/19] rev-parseopt: convert --max-count

2019-05-08 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 29 +++-- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/revision.c b/revision.c index f15aa3e62d..c53347d362 100644 --- a/revision.c +++ b/revision.c @@ -1976,12 +1976,26 @@ static int rev_opt_abbrev

[PATCH] submodule--helper: add a missing \n

2019-05-07 Thread Nguyễn Thái Ngọc Duy
This is a complete line. We're not expecting the next function to add anything to the same line. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/submodule--helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--hel

[PATCH] git-worktree.txt: update the per-worktree refs exceptions

2019-05-02 Thread Nguyễn Thái Ngọc Duy
y the `label` command worktree-local, 2018-04-25) Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-worktree.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt index 85d92c9761..8ed5250d5f 100644

[PATCH 1/2] merge: remove drop_save() in favor of remove_merge_branch_state()

2019-05-01 Thread Nguyễn Thái Ngọc Duy
and use it instead of drop_save(). This function will also be used in the next patch that introduces --quit. Signed-off-by: Nguyễn Thái Ngọc Duy --- branch.c| 11 --- branch.h| 6 ++ builtin/merge.c | 17 + 3 files changed, 19 insertions(+), 15

[PATCH 2/2] merge: add --quit

2019-05-01 Thread Nguyễn Thái Ngọc Duy
can't even continue the merge anymore. This also makes all in-progress commands, am, merge, rebase, revert and cherry-pick, take all three --abort, --continue and --quit (bisect has a different UI). Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-merge.txt | 4 builtin/merge.c

[PATCH 0/2] Add "git merge --quit"

2019-05-01 Thread Nguyễn Thái Ngọc Duy
-2ba9-a607-dd2ecba54...@gmail.com/ Nguyễn Thái Ngọc Duy (2): merge: remove drop_save() in favor of remove_merge_branch_state() merge: add --quit Documentation/git-merge.txt | 4 branch.c| 11 --- branch.h| 6 ++ builtin/merg

[PATCH v2] parse-options: don't emit "ambiguous option" for aliases

2019-04-29 Thread Nguyễn Thái Ngọc Duy
en it becomes a problem. So far we don't even have two aliases of any option. A big chunk of code is actually from Junio C Hamano. Signed-off-by: Nguyễn Thái Ngọc Duy --- OK it's working for real this time. test-parse-options.c is also updated to for testing OPT_ALIAS. bu

[PATCH v3 15/16] help: move git-diff and git-reset to different groups

2019-04-25 Thread Nguyễn Thái Ngọc Duy
e branches commitRecord changes to the repository merge Join two or more development histories together rebaseReapply commits on top of another base tip reset Reset current HEAD to the specified state switchSwitch branches tag Create, lis

[PATCH v3 14/16] doc: promote "git restore"

2019-04-25 Thread Nguyễn Thái Ngọc Duy
us" are add, rm and restore. "git checkout" is also removed from "git help" (i.e. it's no longer considered a commonly used command) Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-clean.txt| 2 +- Documentation/git-commit.txt | 2 +- D

[PATCH v3 16/16] Declare both git-switch and git-restore experimental

2019-04-25 Thread Nguyễn Thái Ngọc Duy
flaw in the UI, we could still fix it. If everything goes well and nobody complains loudly, we can remove the experimental status by reverting this patch. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-restore.txt | 2 ++ Documentation/git-switch.txt | 2 ++ 2 files changed, 4 inser

[PATCH v3 11/16] t: add tests for restore

2019-04-25 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- t/lib-patch-mode.sh | 12 t/t2070-restore.sh (new +x) | 99 +++ t/t2071-restore-patch.sh (new +x) | 110 ++ 3 files changed, 221 insertions(+) diff --git a/t/lib-patch-mode.sh

[PATCH v3 09/16] restore: replace --force with --ignore-unmerged

2019-04-25 Thread Nguyễn Thái Ngọc Duy
e diff looks a bit iffy since --force is moved to add_common_switch_branch_options() (i.e. for switching). But git-checkout is also doing switching and inherits this --force. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/checkout.c | 29 - 1 file changed, 20 insertions(

  1   2   3   4   5   6   7   8   9   10   >