[PATCH 26/31] sha1-name.c: remove the_repo from get_oid_with_context_1()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sha1-name.c b/sha1-name.c index 6b53ea2eeb..64a50d1291 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -12,6 +12,7 @@ #include "packfile.h" #include "

[PATCH 29/31] sha1-name.c: remove the_repo from maybe_die_on_misspelt_object_name

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 4 +++- setup.c | 7 --- sha1-name.c | 6 -- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/cache.h b/cache.h index 942d9912a2..da7035c261 100644 --- a/cache.h +++ b/cache.h @@ -1361,7 +1361,9 @@ extern int

[PATCH 27/31] sha1-name.c: add repo_get_oid()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 3 ++- sha1-name.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cache.h b/cache.h index 9ff5af0bef..942d9912a2 100644 --- a/cache.h +++ b/cache.h @@ -1354,7 +1354,8 @@ enum get_oid_result

[PATCH 30/31] sha1-name.c: remove the_repo from other get_oid_*

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 18 -- sha1-name.c | 35 --- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/cache.h b/cache.h index da7035c261..7ce8c566fc 100644 --- a/cache.h +++ b/cache.h @@ -1355,12

[PATCH 31/31] sha1-name.c: remove the_repo from get_oid_mb()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 3 ++- sha1-name.c | 18 +++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/cache.h b/cache.h index 7ce8c566fc..24fbff94f7 100644 --- a/cache.h +++ b/cache.h @@ -1360,6 +1360,7 @@ int repo_get_oid_committish

[PATCH 22/31] sha1-name.c: remove the_repo from get_oid_1()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
There is a cyclic dependency between one of these functions so they cannot be converted one by one, so all related functions are converted at once. Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 7 +-- sha1-name.c | 59 - 2 files

[PATCH 15/31] sha1-name.c: remove the_repo from get_short_oid()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index cdcf84b826..2643b75b54 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -436,7 +436,8 @@ static void sort_ambiguous_oid_array

[PATCH 24/31] sha1-name.c: remove the_repo from diagnose_invalid_index_path()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- dir.c | 8 dir.h | 4 +++- sha1-name.c | 7 --- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/dir.c b/dir.c index b2cabadf25..e6d97343f4 100644 --- a/dir.c +++ b/dir.c @@ -2315,6 +2315,14 @@ int file_exists(const

[PATCH 23/31] sha1-name.c: remove the_repo from handle_one_ref()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 19 ++- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index 5741a9f821..d9050776dd 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -1189,15 +1189,21 @@ static enum get_oid_result

[PATCH 25/31] sha1-name.c: remove the_repo from resolve_relative_path()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
"remove" is not entirely correct. But at least the function is aware that if the given repo is not the_repository, then $CWD and is_inside_work_tree() means nothing. Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) di

[PATCH 06/31] refs.c: add repo_dwim_ref()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 12 +--- refs.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/refs.c b/refs.c index 1f5864aa36..bd0fec5776 100644 --- a/refs.c +++ b/refs.c @@ -555,14 +555,20 @@ static char *substitute_branch_name(struct

[PATCH 09/31] commit.c: add repo_get_commit_tree()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- commit.c | 5 +++-- commit.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/commit.c b/commit.c index a5333c7ac6..f0a5506f04 100644 --- a/commit.c +++ b/commit.c @@ -340,7 +340,8 @@ void free_commit_buffer(struct parsed_object_pool

[PATCH 08/31] refs.c: remove the_repo from read_ref_at()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/show-branch.c | 6 -- refs.c| 7 --- refs.h| 3 ++- sha1-name.c | 3 ++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/builtin/show-branch.c b/builtin/show-branch.c index

[PATCH 19/31] sha1-name.c: remove the_repo from get_oid_oneline()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index 49c62d5254..fb80306f1a 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -15,7 +15,7 @@ #include "midx.h" #include "

[PATCH 21/31] sha1-name.c: remove the_repo from get_oid_basic()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 25 - 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index 1cda854f02..d4c135aea8 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -773,8 +773,8 @@ static inline int push_mark

[PATCH 20/31] sha1-name.c: remove the_repo from get_describe_name()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index fb80306f1a..1cda854f02 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -1097,7 +1097,9 @@ static int peel_onion(const char *name, int len

[PATCH 18/31] sha1-name.c: add repo_interpret_branch_name()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index 7d9512ac44..49c62d5254 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -1390,7 +1390,8 @@ static int interpret_empty_at(const

[PATCH 01/31] packfile.c: add repo_approximate_object_count()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- packfile.c | 14 +++--- packfile.h | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packfile.c b/packfile.c index 16bcb75262..2ad4fab2f8 100644 --- a/packfile.c +++ b/packfile.c @@ -893,25 +893,25 @@ static void

[PATCH 02/31] refs.c: add refs_ref_exists()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/refs.c b/refs.c index 142888a40a..b869f32d8b 100644 --- a/refs.c +++ b/refs.c @@ -241,9 +241,14 @@ int read_ref(const char *refname, struct object_id *oid) return

[PATCH 03/31] refs.c: add refs_shorten_unambiguous_ref()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 11 +-- refs.h | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index b869f32d8b..3dde824aab 100644 --- a/refs.c +++ b/refs.c @@ -1169,7 +1169,8 @@ int update_ref(const char *msg, const char *refname

[PATCH 05/31] refs.c: remove the_repo from expand_ref()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c| 10 ++ refs.h| 2 +- upload-pack.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/refs.c b/refs.c index 44df049796..1f5864aa36 100644 --- a/refs.c +++ b/refs.c @@ -558,12 +558,13 @@ static char

[PATCH 13/31] sha1-name.c: store and use repo in struct disambiguate_state

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 95 + 1 file changed, 59 insertions(+), 36 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index 9b57787b76..a75992eb54 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -17,13 +17,14

[PATCH 16/31] sha1-name.c: remove the_repo from interpret_nth_prior_checkout()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index 2643b75b54..af8bf5b351 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -771,7 +771,7 @@ static inline int push_mark(const char

[PATCH 12/31] sha1-name.c: add repo_find_unique_abbrev_r()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 6 -- sha1-name.c | 15 +-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/cache.h b/cache.h index aa52850d84..524a44110a 100644 --- a/cache.h +++ b/cache.h @@ -1019,8 +1019,10 @@ extern void

[PATCH 17/31] sha1-name.c: remove the_repo from interpret_branch_mark()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index af8bf5b351..7d9512ac44 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -1412,9 +1412,9 @@ static int reinterpret(const char *name

[PATCH 14/31] sha1-name.c: add repo_for_each_abbrev()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 3 ++- sha1-name.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cache.h b/cache.h index 524a44110a..92973e7ae0 100644 --- a/cache.h +++ b/cache.h @@ -1366,7 +1366,8 @@ extern enum get_oid_result

[PATCH 04/31] refs.c: remove the_repo from substitute_branch_name()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 8 ++-- refs.c | 9 + sha1-name.c | 8 ++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/cache.h b/cache.h index 27fe635f62..aa52850d84 100644 --- a/cache.h +++ b/cache.h @@ -1442,8 +1442,12 @@ extern

[PATCH 07/31] refs.c: add repo_dwim_log()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 21 +++-- refs.h | 1 + 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/refs.c b/refs.c index bd0fec5776..edea001446 100644 --- a/refs.c +++ b/refs.c @@ -603,9 +603,11 @@ int expand_ref(struct repository *repo

[PATCH 11/31] sha1-name.c: remove the_repo from find_abbrev_len_packed()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index 7558ce51a3..b9381aaba6 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -514,6 +514,7 @@ struct min_abbrev_data { unsigned int

[PATCH 00/31] Kill the_repository in sha1-name.c

2019-02-17 Thread Nguyễn Thái Ngọc Duy
fter 28/31 are technically not needed, but since I have converted most of sha1-name.c, might as well convert the rest. There is a new function get_oidf() from another series on 'pu', which can't be converted right now of course. But it could be fixed easily later. It also causes a co

[PATCH 10/31] sha1-name.c: remove the_repo from sort_ambiguous()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index 15a1107998..7558ce51a3 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -383,10 +383,11 @@ static int collect_ambiguous(const

[PATCH 1/1] Introduce "precious" file concept

2019-02-16 Thread Nguyễn Thái Ngọc Duy
lone. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-clean.txt | 3 ++- Documentation/gitattributes.txt | 11 +++ Documentation/gitignore.txt | 4 attr.c | 12 attr.h | 2 ++ builtin/clean.c

[PATCH 0/1] Introduce "precious" file attribute

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Compared to the last round [1], the "precious" attribute is now only used by "git clean". "git merge" and "git checkout" will not abort when they are about to overwrite precious files. [1] https://public-inbox.org/git/20181126193804.30741-1-pcl

[PATCH v3 16/21] diff-parseopt: convert -C|--find-copies

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 59 +- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/diff.c b/diff.c index e51f6b3005..35bac115cc 100644 --- a/diff.c +++ b/diff.c @@ -4617,8

[PATCH v3 18/21] diff-parseopt: convert --no-renames|--[no--rename-empty

2019-02-16 Thread Nguyễn Thái Ngọc Duy
For --rename-empty, see 90d43b0768 (teach diffcore-rename to optionally ignore empty content - 2012-03-22) for more information. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- Documentation/diff-options.txt | 3 +++ diff.c | 13 ++--- 2

[PATCH v3 19/21] diff-parseopt: convert --relative

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 25 + 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/diff.c b/diff.c index d423a06b41..b9c267a199 100644 --- a/diff.c +++ b/diff.c @@ -4960,6 +4960,18 @@ static enum

[PATCH v3 20/21] diff-parseopt: convert --[no-]minimal

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/diff.c b/diff.c index b9c267a199..33492e754f 100644 --- a/diff.c +++ b/diff.c @@ -5105,6 +5105,11 @@ static void prep_parse_options(struct

[PATCH v3 17/21] diff-parseopt: convert --find-copies-harder

2019-02-16 Thread Nguyễn Thái Ngọc Duy
--no-find-copies-harder is also added on purpose (because I don't see why we should not have the --no- version for this) Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diff.c b/diff.c

[PATCH v3 21/21] diff-parseopt: convert --ignore-some-changes

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 27 --- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/diff.c b/diff.c index 33492e754f..a63ee4a44d 100644 --- a/diff.c +++ b/diff.c @@ -5109,6 +5109,21 @@ static void

[PATCH v3 14/21] diff-parseopt: convert -M|--find-renames

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 35 +++ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/diff.c b/diff.c index d2139082b7..2c904e0526 100644 --- a/diff.c +++ b/diff.c @@ -4909,6 +4909,22 @@ static int

[PATCH v3 12/21] diff-parseopt: convert --output-*

2019-02-16 Thread Nguyễn Thái Ngọc Duy
This also validates that the user specifies a single character in --output-indicator-*, not a string. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- Documentation/diff-options.txt | 10 + diff.c | 71 +- 2 files

[PATCH v3 15/21] diff-parseopt: convert -D|--irreversible-delete

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/diff.c b/diff.c index 2c904e0526..e51f6b3005 100644 --- a/diff.c +++ b/diff.c @@ -5060,6 +5060,9 @@ static void prep_parse_options(struct

[PATCH v3 10/21] diff-parseopt: convert --stat*

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 118 + 1 file changed, 52 insertions(+), 66 deletions(-) diff --git a/diff.c b/diff.c index 9c8f5336bc..1feb13deb3 100644 --- a/diff.c +++ b/diff.c @@ -104,11

[PATCH v3 11/21] diff-parseopt: convert --[no-]compact-summary

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 25 +++-- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/diff.c b/diff.c index 1feb13deb3..b24f6825a1 100644 --- a/diff.c +++ b/diff.c @@ -4841,6 +4841,21 @@ static int

[PATCH v3 13/21] diff-parseopt: convert -B|--break-rewrites

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 62 ++ 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/diff.c b/diff.c index 8df396cb9a..d2139082b7 100644 --- a/diff.c +++ b/diff.c @@ -4841,6 +4841,30 @@ static int

[PATCH v3 09/21] diff-parseopt: convert -s|--no-patch

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 99047fb5fe..9c8f5336bc 100644 --- a/diff.c +++ b/diff.c @@ -4906,6 +4906,9 @@ static void prep_parse_options(struct

[PATCH v3 06/21] diff-parseopt: convert --patch-with-stat

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/diff.c b/diff.c index 0276f25200..b9811aefef 100644 --- a/diff.c +++ b/diff.c @@ -4921,6 +4921,10 @@ static void prep_parse_options(struct

[PATCH v3 03/21] diff-parseopt: convert --dirstat and friends

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- Documentation/diff-options.txt | 7 ++ diff.c | 39 +- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/Documentation/diff-options.txt b

[PATCH v3 07/21] diff-parseopt: convert --name-only

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index b9811aefef..7ea308814f 100644 --- a/diff.c +++ b/diff.c @@ -4949,6 +4949,9 @@ static void prep_parse_options(struct

[PATCH v3 05/21] diff-parseopt: convert --summary

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 5e16082091..0276f25200 100644 --- a/diff.c +++ b/diff.c @@ -4942,6 +4942,9 @@ static void prep_parse_options(struct

[PATCH v3 08/21] diff-parseopt: convert --name-status

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 7ea308814f..99047fb5fe 100644 --- a/diff.c +++ b/diff.c @@ -4952,6 +4952,9 @@ static void prep_parse_options(struct

[PATCH v3 04/21] diff-parseopt: convert --check

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 1cdbe8e688..5e16082091 100644 --- a/diff.c +++ b/diff.c @@ -4939,6 +4939,9 @@ static void prep_parse_options(struct

[PATCH v3 02/21] diff-parseopt: convert --numstat and --shortstat

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/diff.c b/diff.c index 12e333c67f..419b6ac4ae 100644 --- a/diff.c +++ b/diff.c @@ -4905,6 +4905,12 @@ static void prep_parse_options

[PATCH v3 00/21] nd/diff-parseopt part 2

2019-02-16 Thread Nguyễn Thái Ngọc Duy
v3 is the same as v2 except I will not delete the patches while it's still sending, grr... Nguyễn Thái Ngọc Duy (21): diff-parseopt: convert --patch-with-raw diff-parseopt: convert --numstat and --shortstat diff-parseopt: convert --dirstat and friends diff-parseopt: convert --check

[PATCH v3 01/21] diff-parseopt: convert --patch-with-raw

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/diff.c b/diff.c index 4bc9df7362..12e333c67f 100644 --- a/diff.c +++ b/diff.c @@ -4901,6 +4901,10 @@ static void prep_parse_options(struct

[PATCH v2 05/21] diff-parseopt: convert --summary

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 5e16082091..0276f25200 100644 --- a/diff.c +++ b/diff.c @@ -4942,6 +4942,9 @@ static void prep_parse_options(struct

[PATCH v2 03/21] diff-parseopt: convert --dirstat and friends

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- Documentation/diff-options.txt | 7 ++ diff.c | 39 +- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/Documentation/diff-options.txt b

[PATCH v2 04/21] diff-parseopt: convert --check

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 1cdbe8e688..5e16082091 100644 --- a/diff.c +++ b/diff.c @@ -4939,6 +4939,9 @@ static void prep_parse_options(struct

[PATCH v2 02/21] diff-parseopt: convert --numstat and --shortstat

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/diff.c b/diff.c index 12e333c67f..419b6ac4ae 100644 --- a/diff.c +++ b/diff.c @@ -4905,6 +4905,12 @@ static void prep_parse_options

[PATCH v2 06/21] diff-parseopt: convert --patch-with-stat

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/diff.c b/diff.c index 0276f25200..b9811aefef 100644 --- a/diff.c +++ b/diff.c @@ -4921,6 +4921,10 @@ static void prep_parse_options(struct

[PATCH v2 01/21] diff-parseopt: convert --patch-with-raw

2019-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/diff.c b/diff.c index 4bc9df7362..12e333c67f 100644 --- a/diff.c +++ b/diff.c @@ -4901,6 +4901,10 @@ static void prep_parse_options(struct

[PATCH v2 00/21] nd/diff-parseopt part 2

2019-02-16 Thread Nguyễn Thái Ngọc Duy
v2 changes the subject line to help clarify in "git log --oneline" Nguyễn Thái Ngọc Duy (21): diff-parseopt: convert --patch-with-raw diff-parseopt: convert --numstat and --shortstat diff-parseopt: convert --dirstat and friends diff-parseopt: convert --check diff-parseop

[PATCH v2] completion: add more parameter value completion

2019-02-16 Thread Nguyễn Thái Ngọc Duy
This adds value completion for a couple more paramters. To make it easier to maintain these hard coded lists, add a comment at the original list/code to remind people to update git-completion.bash too. Signed-off-by: Nguyễn Thái Ngọc Duy --- apply.c| 4

[PATCH] read-cache.c: index format v5 -- 30% smaller/faster than v4

2019-02-13 Thread Nguyễn Thái Ngọc Duy
thread to hide away all this even if it becomes significant. For writing, I believe the extra cycles spent in writing is still nothing compared to hashing code and this should still result in faster index update (numbers needed). On webkit.git, updating one entry on v5 is 30% faster than v4. Signed-

[PATCH v2] read-cache.c: fix writing "link" index ext with null base oid

2019-02-13 Thread Nguyễn Thái Ngọc Duy
with a segfault. This should not happen anymore, but it's still wrong to dereference a potential NULL pointer, especially when we do check for NULL pointer in the next code. Reported-by: Luke Diamand Signed-off-by: Nguyễn Thái Ngọc Duy --- v2 added a new test read-cache.c | 5 +

[PATCH] imap-send.c: add a missing space in error message

2019-02-11 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- Jiang Xin's typo patch [1] made me quickly go through all multi-line strings. This is the only bad string I found. [1] https://public-inbox.org/git/canyiybgf6oj0k3-k+s0dso-bzz2excvcoyxojtqsbbmhetg...@mail.gmail.com/ imap-send.c | 2 +- 1 file ch

[PATCH] unpack-trees.c: fix writing "link" index ext with null base oid

2019-02-09 Thread Nguyễn Thái Ngọc Duy
with a segfault. This should not happen anymore, but it's still wrong to dereference a potential NULL pointer, especially when we do check for NULL pointer in the next code. Reported-by: Luke Diamand Signed-off-by: Nguyễn Thái Ngọc Duy --- I considered adding a test, but since the problem is

[PATCH v2 17/19] t: add tests for switch

2019-02-08 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- t/t2060-switch.sh | 87 +++ 1 file changed, 87 insertions(+) create mode 100755 t/t2060-switch.sh diff --git a/t/t2060-switch.sh b/t/t2060-switch.sh new file mode 100755 index 00..1e1e834c1b --- /dev

[PATCH v2 15/19] switch: no implicit dwim, use --guess to dwim

2019-02-08 Thread Nguyễn Thái Ngọc Duy
witch' do automatic detach or dwim again. But that will be opt-in after the user knows what is what. For now give a short option if you want to use it often. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-checkout.txt | 37 -- builtin/checkout.c

[PATCH v2 14/19] switch: add short option for --detach

2019-02-08 Thread Nguyễn Thái Ngọc Duy
t. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/checkout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/checkout.c b/builtin/checkout.c index d6c968f5f3..a5284391a9 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -1381,7 +1381,

[PATCH v2 16/19] switch: no worktree status unless real branch switch happens

2019-02-08 Thread Nguyễn Thái Ngọc Duy
-B and --detach. Users of big repos are encouraged to move to switch. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/config/checkout.txt | 8 -- builtin/checkout.c| 127 +++--- t/t1090-sparse-checkout-scope.sh | 14 3 files changed, 9 inser

[PATCH v2 19/19] doc: promote "git switch"

2019-02-08 Thread Nguyễn Thái Ngọc Duy
commands... Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-branch.txt | 12 +++--- Documentation/git-check-ref-format.txt | 3 +- Documentation/git-format-patch.txt | 2 +- Documentation/git-merge-base.txt | 2 +- Documentation/git-rebase.txt | 2 +

[PATCH v2 18/19] completion: support switch

2019-02-08 Thread Nguyễn Thái Ngọc Duy
Completion support for --guess could be made better. If no --detach is given, we should only provide a list of refs/heads/* and dwim ones, not the entire ref space. But I still can't penetrate that __git_refs() function yet. Signed-off-by: Nguyễn Thái Ngọc Duy --- contrib/completio

[PATCH v2 13/19] switch: only allow explicit detached HEAD

2019-02-08 Thread Nguyễn Thái Ngọc Duy
of (until you know better). To keep switch a bit more friendly to new users, we only allow entering detached HEAD mode when --detach is given. "git switch" must take a branch (unless you create a new branch, then of course switch can take any commit-ish) Signed-off-by: Nguyễn Thái Ng

[PATCH v2 12/19] switch: reject "do nothing" case

2019-02-08 Thread Nguyễn Thái Ngọc Duy
to either - really switch a branch - (explicitly) detach from the current branch - create a new branch Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/checkout.c | 9 + 1 file changed, 9 insertions(+) diff --git a/builtin/checkout.c b/builtin/checkout.c index 4822d5c5d7..86e524f7c1

[PATCH v2 09/19] switch: better names for -b and -B

2019-02-08 Thread Nguyễn Thái Ngọc Duy
The shortcut of these options do not make much sense when used with switch. And their descriptions are also tied to checkout out. Move -b/-B to cmd_checkout() and new -c/-C with the same functionality in cmd_switch_branch() Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/checkout.c | 32

[PATCH v2 11/19] switch: stop accepting pathspec

2019-02-08 Thread Nguyễn Thái Ngọc Duy
This command is about switching branch (or creating a new one) and should not accept pathspec. This helps simplify ambiguation handling. The other two ("git checkout" and "git restore") of course do accept pathspec as before. Signed-off-by: Nguyễn Thái Ngọc Duy --- bui

[PATCH v2 10/19] switch: remove -l

2019-02-08 Thread Nguyễn Thái Ngọc Duy
This option is ancient. Nowadays reflog is enabled by default and automatically created for new branches. Keep it in git-checkout only. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/checkout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/checkout.c b/builtin

[PATCH v2 08/19] checkout: split part of it to new command switch

2019-02-08 Thread Nguyễn Thái Ngọc Duy
n page. Signed-off-by: Nguyễn Thái Ngọc Duy --- .gitignore| 1 + Documentation/config/advice.txt | 13 +- Documentation/config/branch.txt | 4 +- Documentation/config/checkout.txt | 9 +- Documentation/config/diff.txt | 3 +- Documentation/git-checkout.txt

[PATCH v2 07/19] checkout: split options[] array in three pieces

2019-02-08 Thread Nguyễn Thái Ngọc Duy
separate. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/checkout.c | 82 +- parse-options-cb.c | 17 ++ parse-options.h| 3 +- 3 files changed, 78 insertions(+), 24 deletions(-) diff --git a/builtin/checkout.c b/builtin/checkout.c index

[PATCH v2 01/19] git-checkout.txt: fix one syntax line

2019-02-08 Thread Nguyễn Thái Ngọc Duy
if exists, for the current branch. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-checkout.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index ce7d38b8b7..bc7fbdb8d2 100644 --- a/Documentation/g

[PATCH v2 02/19] doc: document --overwrite-ignore

2019-02-08 Thread Nguyễn Thái Ngọc Duy
I added this option in git-checkout and git-merge in c1d7036b6b (checkout,merge: disallow overwriting ignored files with --no-overwrite-ignore - 2011-11-27) but did not remember to update documentation. This completes that commit. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git

[PATCH v2 04/19] checkout: factor out some code in parse_branchname_arg()

2019-02-08 Thread Nguyễn Thái Ngọc Duy
This is in preparation for the new command restore, which also needs to parse opts->source_tree but does not need all the disambiguation logic. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/checkout.c | 51 -- 1 file changed, 31 insertions(+),

[PATCH v2 03/19] t: rename t2014-switch.sh to t2014-checkout-switch.sh

2019-02-08 Thread Nguyễn Thái Ngọc Duy
The old name does not really say that this is about 'checkout -b'. See 49d833dc07 (Revert "checkout branch: prime cache-tree fully" - 2009-05-12) for more information Signed-off-by: Nguyễn Thái Ngọc Duy --- t/{t2014-switch.sh => t2014-checkout-switch.sh} | 0 1 file chan

[PATCH v2 00/19] Add new command "switch"

2019-02-08 Thread Nguyễn Thái Ngọc Duy
and commit them, and you can discard any commits you make in this +- state without impacting any branches by performing another checkout. ++ state without impacting any branches by switching back to a branch. + If you want to create a new branch to retain commits you create, you

[PATCH v2 06/19] checkout: move 'confict_style' and 'dwim_..' to checkout_opts

2019-02-08 Thread Nguyễn Thái Ngọc Duy
These local variables are referenced by struct option[]. This struct will soon be broken down, moved away and we can't rely on local variables anymore. Move these two to struct checkout_opts in preparation for that. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/checkout.c

[PATCH v2 05/19] checkout: make "opts" in cmd_checkout() a pointer

2019-02-08 Thread Nguyễn Thái Ngọc Duy
"opts" will soon be moved out of cmd_checkout(). To keep changes in that patch smaller, convert "opts" to a pointer and keep the real thing behind "real_opts". Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/checkout.c | 115 +++

[PATCH 21/21] diff.c: convert --ignore-some-changes

2019-02-07 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 27 --- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/diff.c b/diff.c index 33492e754f..a63ee4a44d 100644 --- a/diff.c +++ b/diff.c @@ -5109,6 +5109,21 @@ static void prep_parse_options(struct diff_options

[PATCH 20/21] diff.c: convert --[no-]minimal

2019-02-07 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/diff.c b/diff.c index b9c267a199..33492e754f 100644 --- a/diff.c +++ b/diff.c @@ -5105,6 +5105,11 @@ static void prep_parse_options(struct diff_options *options

[PATCH 17/21] diff.c: convert --find-copies-harder

2019-02-07 Thread Nguyễn Thái Ngọc Duy
--no-find-copies-harder is also added on purpose (because I don't see why we should not have the --no- version for this) Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diff.c b/diff.c index 35bac115cc..abb1566f95 1

[PATCH 10/21] diff.c: convert --stat*

2019-02-07 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 118 + 1 file changed, 52 insertions(+), 66 deletions(-) diff --git a/diff.c b/diff.c index 9c8f5336bc..1feb13deb3 100644 --- a/diff.c +++ b/diff.c @@ -104,11 +104,6 @@ static const char

[PATCH 13/21] diff.c: convert -B|--break-rewrites

2019-02-07 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 62 ++ 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/diff.c b/diff.c index 8df396cb9a..d2139082b7 100644 --- a/diff.c +++ b/diff.c @@ -4841,6 +4841,30 @@ static int

[PATCH 11/21] diff.c: convert --[no-]compact-summary

2019-02-07 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 25 +++-- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/diff.c b/diff.c index 1feb13deb3..b24f6825a1 100644 --- a/diff.c +++ b/diff.c @@ -4841,6 +4841,21 @@ static int parse_objfind_opt(struct diff_options *opt

[PATCH 12/21] diff.c: convert --output-*

2019-02-07 Thread Nguyễn Thái Ngọc Duy
This also validates that the user specifies a single character in --output-indicator-*, not a string. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/diff-options.txt | 10 + diff.c | 71 +- 2 files changed, 63 insertions(+), 18

[PATCH 18/21] diff.c: convert --no-renames|--[no--rename-empty

2019-02-07 Thread Nguyễn Thái Ngọc Duy
For --rename-empty, see 90d43b0768 (teach diffcore-rename to optionally ignore empty content - 2012-03-22) for more information. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/diff-options.txt | 3 +++ diff.c | 13 ++--- 2 files changed, 9 insertions

[PATCH 19/21] diff.c: convert --relative

2019-02-07 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 25 + 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/diff.c b/diff.c index d423a06b41..b9c267a199 100644 --- a/diff.c +++ b/diff.c @@ -4960,6 +4960,18 @@ static enum parse_opt_result diff_opt_output(struct

[PATCH 16/21] diff.c: convert -C|--find-copies

2019-02-07 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 59 +- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/diff.c b/diff.c index e51f6b3005..35bac115cc 100644 --- a/diff.c +++ b/diff.c @@ -4617,8 +4617,6 @@ static int opt_arg

[PATCH 15/21] diff.c: convert -D|--irreversible-delete

2019-02-07 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/diff.c b/diff.c index 2c904e0526..e51f6b3005 100644 --- a/diff.c +++ b/diff.c @@ -5060,6 +5060,9 @@ static void prep_parse_options(struct diff_options *options

[PATCH 14/21] diff.c: convert -M|--find-renames

2019-02-07 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 35 +++ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/diff.c b/diff.c index d2139082b7..2c904e0526 100644 --- a/diff.c +++ b/diff.c @@ -4909,6 +4909,22 @@ static int diff_opt_dirstat(const struct

[PATCH 08/21] diff.c: convert --name-status

2019-02-07 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 7ea308814f..99047fb5fe 100644 --- a/diff.c +++ b/diff.c @@ -4952,6 +4952,9 @@ static void prep_parse_options(struct diff_options *options

<    1   2   3   4   5   6   7   8   9   10   >