[PATCH 06/11] grep/pcre: prepare locale-dependent tables for icase matching

2016-06-23 Thread Nguyễn Thái Ngọc Duy
The default tables are usually built with C locale and only suitable for LANG=C or similar. This should make case insensitive search work correctly for all single-byte charsets. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- grep.c | 8

[PATCH 11/11] grep.c: reuse "icase" variable

2016-06-23 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- grep.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/grep.c b/grep.c index 6e99b01..cb058a5 100644 --- a/grep.c +++ b/grep.c @@ -445,10 +445,7 @@ static void compile_regexp(struct grep_pat *p, struct

[PATCH 10/11] diffcore-pickaxe: support case insensitive match on non-ascii

2016-06-23 Thread Nguyễn Thái Ngọc Duy
.sh might cause problems elsewhere, probably. Noticed-by: Plamen Totev Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diffcore-pickaxe.c | 11 +++ t/t7812-grep-icase-non-ascii.sh | 7 +++ 2 files changed, 18 insertions(+) diff --git a/diffcore-picka

[PATCH 07/11] gettext: add is_utf8_locale()

2016-06-23 Thread Nguyễn Thái Ngọc Duy
UTF-8. pcre library might support utf-8 even if libc is built without locale support.. The peeking code is a copy from compat/regex/regcomp.c Helped-by: Ævar Arnfjörð Bjarmason Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- gettext.c | 24 ++-- gette

[PATCH v2 00/12] nd/icase updates

2016-06-24 Thread Nguyễn Thái Ngọc Duy
kwsprep(p->kws); return; + } else if (opt->fixed) { + compile_fixed_regexp(p, opt); + return; } if (opt->pcre) { Nguyễn Thái Ngọc Duy (12): grep: break down an "if" stmt in preparation for next changes test-regex: isolate the

[PATCH v2 01/12] grep: break down an "if" stmt in preparation for next changes

2016-06-24 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- grep.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/grep.c b/grep.c index 7b2b96a..f430d7e 100644 --- a/grep.c +++ b/grep.c @@ -403,7 +403,9 @@ static void compile_regexp(struct grep_pat *p, struct

[PATCH v2 03/12] test-regex: expose full regcomp() to the command line

2016-06-24 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- test-regex.c | 51 +-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/test-regex.c b/test-regex.c index 67a1a65..eff26f5 100644 --- a/test-regex.c +++ b/test

[PATCH v2 09/12] grep/pcre: support utf-8

2016-06-24 Thread Nguyễn Thái Ngọc Duy
a byte stream and everything should work. If we force utf-8 based on locale only and pcre validates utf-8 and the file content is in non-utf8 encoding, things break. Noticed-by: Plamen Totev Helped-by: Plamen Totev Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- grep.c

[PATCH v2 11/12] diffcore-pickaxe: support case insensitive match on non-ascii

2016-06-24 Thread Nguyễn Thái Ngọc Duy
.sh might cause problems elsewhere, probably. Noticed-by: Plamen Totev Signed-off-by: Nguyễn Thái Ngọc Duy --- diffcore-pickaxe.c | 11 +++ t/t7812-grep-icase-non-ascii.sh | 7 +++ 2 files changed, 18 insertions(+) diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.

[PATCH v2 10/12] diffcore-pickaxe: Add regcomp_or_die()

2016-06-24 Thread Nguyễn Thái Ngọc Duy
There's another regcomp code block coming in this function that needs the same error handling. This function can help avoid duplicating error handling code. Helped-by: Jeff King Signed-off-by: Nguyễn Thái Ngọc Duy --- diffcore-pickaxe.c | 22 +- 1 file change

[PATCH v2 08/12] gettext: add is_utf8_locale()

2016-06-24 Thread Nguyễn Thái Ngọc Duy
UTF-8. pcre library might support utf-8 even if libc is built without locale support.. The peeking code is a copy from compat/regex/regcomp.c Helped-by: Ævar Arnfjörð Bjarmason Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- gettext.c | 24 ++-- gette

[PATCH v2 07/12] grep/pcre: prepare locale-dependent tables for icase matching

2016-06-24 Thread Nguyễn Thái Ngọc Duy
The default tables are usually built with C locale and only suitable for LANG=C or similar. This should make case insensitive search work correctly for all single-byte charsets. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- grep.c | 8

[PATCH v2 06/12] grep: rewrite an if/else condition to avoid duplicate expression

2016-06-24 Thread Nguyễn Thái Ngọc Duy
"!icase || ascii_only" is repeated twice in this if/else chain as this series evolves. Rewrite it (and basically revert the first if condition back to before the "grep: break down an "if" stmt..." commit). Helped-by: Junio C Hamano Signed-off-by: Nguyễn Thái Ngọc

[PATCH v2 04/12] grep/icase: avoid kwsset on literal non-ascii strings

2016-06-24 Thread Nguyễn Thái Ngọc Duy
instead. Slower, but accurate. Noticed-by: Plamen Totev Helped-by: René Scharfe Helped-by: Eric Sunshine Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- grep.c | 7 ++- t/t7812-grep-icase-non-ascii.sh (new +x) | 23

[PATCH v2 05/12] grep/icase: avoid kwsset when -F is specified

2016-06-24 Thread Nguyễn Thái Ngọc Duy
ue at least for UTF-8. For others, let's wait until people yell up. Chances are nobody uses multibyte, non utf-8 charsets anymore. Noticed-by: Plamen Totev Helped-by: René Scharfe Helped-by: Eric Sunshine Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C

[PATCH v2 12/12] grep.c: reuse "icase" variable

2016-06-24 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- grep.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/grep.c b/grep.c index 3d63612..92587a8 100644 --- a/grep.c +++ b/grep.c @@ -438,10 +438,7 @@ static void compile_regexp(struct grep_pat *p, struct

[PATCH v2 02/12] test-regex: isolate the bug test code

2016-06-24 Thread Nguyễn Thái Ngọc Duy
This is in preparation to turn test-regex into some generic regex testing command. Helped-by: Eric Sunshine Helped-by: Ramsay Jones Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- t/t0070-fundamental.sh | 2 +- test-regex.c | 12 ++-- 2 files changed

[PATCH 00/10] git worktree (re)move

2016-06-25 Thread Nguyễn Thái Ngọc Duy
e) and 'master' (for error_errno). Nguyễn Thái Ngọc Duy (10): copy.c: import copy_file() from busybox copy.c: delete unused code in copy_file() copy.c: convert bb_(p)error_msg to error(_errno) copy.c: style fix copy.c: convert copy_file() to copy_dir_recursively() wor

[PATCH 04/10] copy.c: style fix

2016-06-25 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- copy.c | 50 +- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/copy.c b/copy.c index 074b609..60c7d8a 100644 --- a/copy.c +++ b/copy.c @@ -111,8 +111,10 @@ int FAST_FUNC copy_file(const char

[PATCH 02/10] copy.c: delete unused code in copy_file()

2016-06-25 Thread Nguyễn Thái Ngọc Duy
-control context (SELinux). Some probably need a reimplementation to better fit in (verbose printing code). Signed-off-by: Nguyễn Thái Ngọc Duy --- copy.c | 101 + 1 file changed, 7 insertions(+), 94 deletions(-) diff --git a/copy

[PATCH 09/10] worktree move: accept destination as directory

2016-06-25 Thread Nguyễn Thái Ngọc Duy
Similar to "mv a b/", which is actually "mv a b/a", we extract basename of source worktree and create a directory of the same name at destination if dst path is a directory. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/worktree.c | 19 ++- 1 file changed,

[PATCH 05/10] copy.c: convert copy_file() to copy_dir_recursively()

2016-06-25 Thread Nguyễn Thái Ngọc Duy
This finally enables busybox's copy_file() code under a new name (because "copy_file" is already taken in Git code base). Because this comes from busybox, POSIXy (or even Linuxy) behavior is expected. More changes may be needed for Windows support. Signed-off-by: Nguyễ

[PATCH 10/10] worktree: add "remove" command

2016-06-25 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-worktree.txt | 21 + builtin/worktree.c | 78 ++ contrib/completion/git-completion.bash | 5 ++- t/t2028-worktree-move.sh | 26 4 files

[PATCH 01/10] copy.c: import copy_file() from busybox

2016-06-25 Thread Nguyễn Thái Ngọc Duy
bility to clean things up properly when things fail and we may have to deal with "mv" differences between platforms. Signed-off-by: Nguyễn Thái Ngọc Duy --- copy.c | 331 + 1 file changed, 331 insertions(+) diff --git a/cop

[PATCH 06/10] worktree.c: add validate_worktree()

2016-06-25 Thread Nguyễn Thái Ngọc Duy
d we should not move that one. Signed-off-by: Nguyễn Thái Ngọc Duy --- worktree.c | 63 ++ worktree.h | 5 + 2 files changed, 68 insertions(+) diff --git a/worktree.c b/worktree.c index 03f8ce9..d5149d8 100644 --- a/worktree.c +++ b/

[PATCH 08/10] worktree: add "move" commmand

2016-06-25 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-worktree.txt | 7 +++- builtin/worktree.c | 61 ++ contrib/completion/git-completion.bash | 2 +- t/t2028-worktree-move.sh | 30 + 4 files changed

[PATCH 03/10] copy.c: convert bb_(p)error_msg to error(_errno)

2016-06-25 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- copy.c | 85 -- 1 file changed, 31 insertions(+), 54 deletions(-) diff --git a/copy.c b/copy.c index b7a87f1..074b609 100644 --- a/copy.c +++ b/copy.c @@ -82,23 +82,16 @@ int FAST_FUNC

[PATCH 07/10] worktree.c: add update_worktree_location()

2016-06-25 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- worktree.c | 25 + worktree.h | 6 ++ 2 files changed, 31 insertions(+) diff --git a/worktree.c b/worktree.c index d5149d8..9b227a4 100644 --- a/worktree.c +++ b/worktree.c @@ -354,6 +354,31 @@ int validate_worktree(const

[PATCH] new-command.txt: correct the command description file

2016-06-25 Thread Nguyễn Thái Ngọc Duy
It has always been command-list.txt even at the time this new-command.txt document is added. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/howto/new-command.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/howto/new-command.txt b/Documentation/howto

[PATCH v4 0/5] Better ref summary alignment in "git fetch"

2016-06-25 Thread Nguyễn Thái Ngọc Duy
v4 is a cleaned up version of v3. Tests are added. Typos in git-fetch.txt are corrected. The "{ -> origin/}master" format is dropped. Nguyễn Thái Ngọc Duy (5): git-fetch.txt: document fetch output fetch: refactor ref update status formatting code fetch: change flag code for d

[PATCH v4 1/5] git-fetch.txt: document fetch output

2016-06-25 Thread Nguyễn Thái Ngọc Duy
e new refs based on where... - 2012-04-16) [5] http://thread.gmane.org/gmane.comp.version-control.git/61657 Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-fetch.txt | 46 + 1 file changed, 46 insertions(+) diff --git a/Documentation/git-f

[PATCH v4 4/5] fetch: align all "remote -> local" output

2016-06-25 Thread Nguyễn Thái Ngọc Duy
output. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/fetch.c | 46 -- t/t5510-fetch.sh | 15 +++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/builtin/fetch.c b/builtin/fetch.c index 8177f90..c42795b 100644 --- a/builti

[PATCH v4 2/5] fetch: refactor ref update status formatting code

2016-06-25 Thread Nguyễn Thái Ngọc Duy
. The result should be the same because these call sites do not contain characters outside ASCII range. The two strbuf_addf() calls instead of one is mostly to reduce diff-noise in a future patch where "ref -> ref" is reformatted differently. Signed-off-by: Nguyễn Thái Ngọc Duy --- bu

[PATCH v4 3/5] fetch: change flag code for displaying tag update and deleted ref

2016-06-25 Thread Nguyễn Thái Ngọc Duy
This makes the fetch flag code consistent with push, where '-' means deleted ref. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-fetch.txt | 4 ++-- builtin/fetch.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/git-f

[PATCH v4 5/5] fetch: reduce duplicate in ref update status lines with placeholder

2016-06-25 Thread Nguyễn Thái Ngọc Duy
head -> pull/123 Activated with fetch.output=compact. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/config.txt| 5 +++ Documentation/git-fetch.txt | 5 +++ builtin/fetch.c | 75 - t/t5510-fetch.sh| 17

[PATCH] config: add conditional include

2016-06-26 Thread Nguyễn Thái Ngọc Duy
. This code is originally written by Jeff King [1]. All genius designs are his. All bugs are mine (claiming bugs is just more fun :). [1] http://thread.gmane.org/gmane.comp.version-control.git/273811/focus=273825 Signed-off-by: Nguyễn Thái Ngọc Duy --- Original thread is [1]. Sebastian may not ne

[PATCH] connect: read $GIT_SSH_COMMAND from config file

2016-06-26 Thread Nguyễn Thái Ngọc Duy
Similar to $GIT_ASKPASS or $GIT_PROXY_COMMAND, we also read from config file first then fall back to $GIT_SSH_COMMAND. This is useful for selecting different private keys targetting the same host (e.g. github) Signed-off-by: Nguyễn Thái Ngọc Duy --- core.gitProxy can also be used for my

[PATCH v13 21/20] unix-socket.c: add stub implementation when unix sockets are not supported

2016-06-26 Thread Nguyễn Thái Ngọc Duy
s not exist, $GIT_DIR/index-helper.sock does not exist, so no unix socket call is made by read-cache.c in the first place. Signed-off-by: Nguyễn Thái Ngọc Duy --- BTW 20/20 didn't seem to make it to the list (or my mailbox). And you probably want to update .mailmap with @novalis.org as ma

[PATCH 2/3] diff.c: separate "prefix" from RELATIVE_NAME (aka --relative)

2016-06-26 Thread Nguyễn Thái Ngọc Duy
ry - 2008-02-12) and makes sure that the prefix stripping/filtering only happens when RELATIVE_NAME flag is set. The stripping is much simpler because all stripping now goes through strip_prefix(). So the patch is mostly about filtering. Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 13 +

[PATCH/RFC 3/3] diff.c: add --relative-names to be used with --name-only

2016-06-26 Thread Nguyễn Thái Ngọc Duy
relative to cwd would be much easier to pip this way. Signed-off-by: Nguyễn Thái Ngọc Duy --- It would be great if --relative could be used for this (and it feels weird that the option performs both actions at once, stripping _and_ filtering where filtering could easily be done with pathspe

[PATCH 1/3] diff.c: refactor strip_prefix()

2016-06-26 Thread Nguyễn Thái Ngọc Duy
By passing "struct diff_options *" to strip_prefix(), we can do some more intelligent and repeated logic at one place. The removal of "if (opt->prefix_length)" is just the beginning. Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 24 ++-- 1 file

[PATCH 0/3] diff: add --relative-names

2016-06-26 Thread Nguyễn Thái Ngọc Duy
For more explanation head straight to 3/3. The first two patches are preparation. Nguyễn Thái Ngọc Duy (3): diff.c: refactor strip_prefix() diff.c: separate "prefix" from RELATIVE_NAME (aka --relative) diff.c: add --relative-names to be used with --name-only Documentation/diff-o

[PATCH v2 0/2] Config conditional include

2016-06-28 Thread Nguyễn Thái Ngọc Duy
To leave room for future expansion, perhaps we should declare that ':' can't appear in the pattern, so we can add more prefix later, and even stack them, e.g. "regexp:gitdir:". The prefix can't be one char long. That should be enough for windows to specify full path

[PATCH v2 2/2] config: add conditional include

2016-06-28 Thread Nguyễn Thái Ngọc Duy
only or worse, a mix of '/' and '\\'. At some point, we need to teach wildmatch() that '/' and '\' should be treated the same way (via a flag) as well. Then we could care less about '/' vs '\\'. But a Windows dev probably has to do it

[PATCH v2 1/2] add skip_prefix_mem helper

2016-06-28 Thread Nguyễn Thái Ngọc Duy
gned-off-by: Jeff King Signed-off-by: Nguyễn Thái Ngọc Duy --- git-compat-util.h | 17 + 1 file changed, 17 insertions(+) diff --git a/git-compat-util.h b/git-compat-util.h index 49d4029..c99cddc 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -473,6 +473,23 @@ static inlin

[PATCH] fixup! worktree: add "lock" command

2016-06-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- Torsten, this seems to fix the symlink problem for me. How many times have I got similar reports from you and still managed to forget ... t/t2028-worktree-move.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t2028-worktree

[PATCH] log: decorate HEAD -> branch with the same color for branch and HEAD

2016-06-30 Thread Nguyễn Thái Ngọc Duy
r eyes. If color is used, we can make the branch name's color the same as HEAD to visually emphasize that it's the current branch. Signed-off-by: Nguyễn Thái Ngọc Duy --- For the original discussion of 76c61fb see http://thread.gmane.org/gmane.comp.version-control.git/263922 l

[PATCH v5 5/5] fetch: reduce duplicate in ref update status lines with placeholder

2016-07-01 Thread Nguyễn Thái Ngọc Duy
", exclude it from column width calculation - implement a new format, { -> origin/}foo, which makes the problem go away at the cost of a bit harder to read - reverse all the arrows so we have "* <- looong-ref", again still hard to read. Signed-off-by: Nguyễn Thái Ngọc D

[PATCH v5 3/5] fetch: change flag code for displaying tag update and deleted ref

2016-07-01 Thread Nguyễn Thái Ngọc Duy
This makes the fetch flag code consistent with push, where '-' means deleted ref. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-fetch.txt | 4 ++-- builtin/fetch.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/git-f

[PATCH v5 0/5] Better ref summary alignment in "git fetch"

2016-07-01 Thread Nguyễn Thái Ngọc Duy
8..6032776 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -712,8 +712,8 @@ test_expect_success 'fetch compact output' ' grep -e "->" | cut -c 22- >../actual ) && cat >expect <<-\EOF && - master ->

[PATCH v5 1/5] git-fetch.txt: document fetch output

2016-07-01 Thread Nguyễn Thái Ngọc Duy
e new refs based on where... - 2012-04-16) [5] http://thread.gmane.org/gmane.comp.version-control.git/61657 Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-fetch.txt | 46 + 1 file changed, 46 insertions(+) diff --git a/Documentation/git-f

[PATCH v5 2/5] fetch: refactor ref update status formatting code

2016-07-01 Thread Nguyễn Thái Ngọc Duy
. The result should be the same because these call sites do not contain characters outside ASCII range. The two strbuf_addf() calls instead of one is mostly to reduce diff-noise in a future patch where "ref -> ref" is reformatted differently. Signed-off-by: Nguyễn Thái Ngọc Duy --- bu

[PATCH v5 4/5] fetch: align all "remote -> local" output

2016-07-01 Thread Nguyễn Thái Ngọc Duy
output. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/fetch.c | 47 +-- t/t5510-fetch.sh | 15 +++ 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/builtin/fetch.c b/builtin/fetch.c index 8177f90..2bc609b 100644 --- a/builti

[PATCH] config.c: fix potential number truncation in git_parse_signed()

2016-07-02 Thread Nguyễn Thái Ngọc Duy
de though. Nevertheless, add an explicit check for truncation to shut clang up and error out. Signed-off-by: Nguyễn Thái Ngọc Duy --- config.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/config.c b/config.c index d7ce34b..880bd4a 100644 --- a/config.c +++ b/config

[PATCH] cache-tree.c: fix i-t-a check skipping directory updates sometimes

2016-07-04 Thread Nguyễn Thái Ngọc Duy
dir/file2 or subdir/file3, this is not a problem because we jump over them anyway. Which may explain why the bug is hidden for nearly four years. Fix it by making sure we only skip i-t-a entries when the entry in question is actual an index entry, not a directory. Reported-by: Yuri Kanivetsky Signed-

[PATCH 0/5] Number truncation with 4+ GB files on 32-bit systems

2016-07-05 Thread Nguyễn Thái Ngọc Duy
ize" in builtin/pack-objects.c:write_one(). I might send 6/5 for that one. Nguyễn Thái Ngọc Duy (5): pack-objects: pass length to check_pack_crc() without truncation sha1_file.c: use type off_t* for object_info->disk_sizep index-pack: correct "len" type in unpack_data() index-pack: rep

[PATCH 1/5] pack-objects: pass length to check_pack_crc() without truncation

2016-07-05 Thread Nguyễn Thái Ngọc Duy
misleading "error: bad packed object CRC for ..." as a result. Use off_t for len and datalen. check_pack_crc() already accepts this argument as off_t and can deal with 4+ GB. Noticed-by: Christoph Michelbach Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/pack-objects.c | 2 +- s

[PATCH 2/5] sha1_file.c: use type off_t* for object_info->disk_sizep

2016-07-05 Thread Nguyễn Thái Ngọc Duy
This field, filled by sha1_object_info() contains the on-disk size of an object, which could go over 4GB limit of unsigned long on 32-bit systems. Use off_t for it instead and update all callers. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/cat-file.c | 4 ++-- cache.h| 2 +- 2

[PATCH 3/5] index-pack: correct "len" type in unpack_data()

2016-07-05 Thread Nguyễn Thái Ngọc Duy
On 32-bit systems with large file support, one entry could be larger than 4GB and overflow "len". Correct it so we can unpack a full entry. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/index-pack.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git

[PATCH 5/5] index-pack: correct "offset" type in unpack_entry_data()

2016-07-05 Thread Nguyễn Thái Ngọc Duy
unpack_entry_data() receives an off_t value from unpack_raw_entry(), which could be larger than unsigned long on 32-bit systems with large file support. Correct the type so truncation does not happen. This only affects bad object reporting though. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin

[PATCH 4/5] index-pack: report correct bad object offsets even if they are large

2016-07-05 Thread Nguyễn Thái Ngọc Duy
Use the right type for offsets in this case, off_t, which makes a difference on 32-bit systems with large file support, and change formatting code accordingly. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/index-pack.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a

[PATCH v2 0/2] cache-tree building fix in the presence of ita entries

2016-07-06 Thread Nguyễn Thái Ngọc Duy
contains all i-t-a entries. Without 1/2, we skip adding 'c' to the tree object 'a/b' (by luck). But if 'a/b' has _nothing_ else but 'a/b/c' then again we will have an empty tree object, which should not be added in 'a'. It's a cascading effect al

[PATCH v2 2/2] cache-tree: do not generate empty trees as a result of all i-t-a subentries

2016-07-06 Thread Nguyễn Thái Ngọc Duy
ng but i-t-a entries, we ignore it. But then if 'a/b' contains only (the non-existing) 'a/b/c', then we should ignore 'a/b' while building 'a' too. And it goes all the way up to top directory. Noticed-by: Junio C Hamano Signed-off-by: Nguyễn Thái Ngọc Duy -

[PATCH v2 1/2] cache-tree.c: fix i-t-a entry skipping directory updates sometimes

2016-07-06 Thread Nguyễn Thái Ngọc Duy
dir/file2 or subdir/file3, this is not a problem because we jump over them anyway. Which may explain why the bug is hidden for nearly four years. Fix it by making sure we only skip i-t-a entries when the entry in question is actual an index entry, not a directory. Reported-by: Yuri Kanivetsky Signed-

[PATCH v3 1/4] test-lib.sh: introduce and use $_EMPTY_TREE

2016-07-08 Thread Nguyễn Thái Ngọc Duy
This is a special SHA1. Let's keep it at one place, easier to replace later when the hash change comes, easier to recognize. Start with an underscore to reduce the chances somebody may override it without realizing it's predefined. Signed-off-by: Nguyễn Thái Ngọc Duy --- t/t000

[PATCH v3 2/4] test-lib.sh: introduce and use $_EMPTY_BLOB

2016-07-08 Thread Nguyễn Thái Ngọc Duy
Similar to $_EMPTY_TREE this makes it easier to recognize this special SHA-1 and change hash later. Signed-off-by: Nguyễn Thái Ngọc Duy --- t/t1011-read-tree-sparse-checkout.sh | 8 t/t1700-split-index.sh | 24 t/t3102-ls-tree-wildcards.sh

[PATCH v3 4/4] cache-tree: do not generate empty trees as a result of all i-t-a subentries

2016-07-08 Thread Nguyễn Thái Ngọc Duy
then if 'a/b' contains only (the non-existing) 'a/b/c', then we should ignore 'a/b' while building 'a' too. And it goes all the way up to top directory. Noticed-by: Junio C Hamano Signed-off-by: Nguyễn Thái Ngọc Duy --- cache-tree.c | 7 +++

[PATCH v3 3/4] cache-tree.c: fix i-t-a entry skipping directory updates sometimes

2016-07-08 Thread Nguyễn Thái Ngọc Duy
dir/file2 or subdir/file3, this is not a problem because we jump over them anyway. Which may explain why the bug is hidden for nearly four years. Fix it by making sure we only skip i-t-a entries when the entry in question is actual an index entry, not a directory. Reported-by: Yuri Kanivetsky Signed-

[PATCH v3 0/4] cache-tree building fix in the presence of ita entries

2016-07-08 Thread Nguyễn Thái Ngọc Duy
blob while we're at it) in one place. Note that I didn't make lib-pack.sh and t5308 use $_EMPTY_BLOB because the actual SHA-1 characters matter (t5308) and I'm not so sure about variable expansion in the case/esac block and not wanting to check all the shells out there again (lib-pac

[PATCH v2] log: decorate HEAD -> branch with the same color for arrow and HEAD

2016-07-09 Thread Nguyễn Thái Ngọc Duy
ed by type. Color the arrow the same as HEAD to visually emphasize that the following branch is HEAD, without paying too much attention to the actual separators "->" or "," Signed-off-by: Nguyễn Thái Ngọc Duy --- I'm going to take Michael's silence as no ob

[PATCH 6/5] pack-objects: do not truncate result in-pack object size on 32-bit systems

2016-07-10 Thread Nguyễn Thái Ngọc Duy
ng is 32-bit while off_t can be 64-bit), we got wrong offsets and produce incorrect .idx file, which may make it look like the .pack file is corrupted. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/pack-objects.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --

[PATCH 7/5] fsck: use streaming interface for large blobs in pack

2016-07-10 Thread Nguyễn Thái Ngọc Duy
is false. We will call the callback function "fn" with NULL as "data". The only callback of this function is fsck_obj_buffer(), which does not touch "data" at all if it's a blob. Signed-off-by: Nguyễn Thái Ngọc Duy --- pack-check.c | 15 +-- pack.h

[PATCH] Speed up sparse checkout when $GIT_DIR/info/sparse-checkout is unchanged

2016-07-11 Thread Nguyễn Thái Ngọc Duy
mance: 0.972682413 s: git command: 'git' 'checkout' Signed-off-by: Nguyễn Thái Ngọc Duy --- I mentioned about this some time ago and finally got curious enough to try out. The saving is in the signficant range in my opinion, but real world effect is probably lower (or mu

[PATCH v3] config: add conditional include

2016-07-12 Thread Nguyễn Thái Ngọc Duy
Helped-by: Jeff King Signed-off-by: Nguyễn Thái Ngọc Duy --- v3 fixes some memory leak and typos. Most importantly it no longer depends on core.ignorecase for case-insensitive matching. The choice must be explicitly made by the user when they choose "gitdir" or "gi

[PATCH v2 7/7] fsck: use streaming interface for large blobs in pack

2016-07-13 Thread Nguyễn Thái Ngọc Duy
is false. We will call the callback function "fn" with NULL as "data". The only callback of this function is fsck_obj_buffer(), which does not touch "data" at all if it's a blob. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/fsck.c |

[PATCH v2 3/7] index-pack: correct "len" type in unpack_data()

2016-07-13 Thread Nguyễn Thái Ngọc Duy
On 32-bit systems with large file support, one entry could be larger than 4GB and overflow "len". Correct it so we can unpack a full entry. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/index-pack.c | 14 +++--- 1 file changed, 7 insert

[PATCH v2 1/7] pack-objects: pass length to check_pack_crc() without truncation

2016-07-13 Thread Nguyễn Thái Ngọc Duy
misleading "error: bad packed object CRC for ..." as a result. Use off_t for len and datalen. check_pack_crc() already accepts this argument as off_t and can deal with 4+ GB. Noticed-by: Christoph Michelbach Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- bu

[PATCH v2 4/7] index-pack: report correct bad object offsets even if they are large

2016-07-13 Thread Nguyễn Thái Ngọc Duy
Use the right type for offsets in this case, off_t, which makes a difference on 32-bit systems with large file support, and change formatting code accordingly. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/index-pack.c | 7 --- 1 file changed, 4 insertions

[PATCH v2 2/7] sha1_file.c: use type off_t* for object_info->disk_sizep

2016-07-13 Thread Nguyễn Thái Ngọc Duy
This field, filled by sha1_object_info() contains the on-disk size of an object, which could go over 4GB limit of unsigned long on 32-bit systems. Use off_t for it instead and update all callers. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/cat-file.c | 4

[PATCH v2 5/7] index-pack: correct "offset" type in unpack_entry_data()

2016-07-13 Thread Nguyễn Thái Ngọc Duy
unpack_entry_data() receives an off_t value from unpack_raw_entry(), which could be larger than unsigned long on 32-bit systems with large file support. Correct the type so truncation does not happen. This only affects bad object reporting though. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off

[PATCH v2 6/7] pack-objects: do not truncate result in-pack object size on 32-bit systems

2016-07-13 Thread Nguyễn Thái Ngọc Duy
ng is 32-bit while off_t can be 64-bit), we got wrong offsets and produce incorrect .idx file, which may make it look like the .pack file is corrupted. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/pack-objects.c | 15 --- 1 file changed, 8 insertions(+)

[PATCH v2 0/7] Number truncation with 4+ GB files on 32-bit systems

2016-07-13 Thread Nguyễn Thái Ngọc Duy
g to allocate .* over limit" err | wc -l) && - test "$n" -gt 1 +test_expect_success 'fsck large blobs' ' + git fsck 2>err && + test_must_be_empty err ' test_done Nguyễn Thái Ngọc Duy (7): pack-objects: pass length to check_pack_crc() wit

[PATCH v4] config: add conditional include

2016-07-14 Thread Nguyễn Thái Ngọc Duy
Helped-by: Jeff King Signed-off-by: Nguyễn Thái Ngọc Duy --- The diff from v3 is mostly clarification in code and document. diff --git a/Documentation/config.txt b/Documentation/config.txt index 18623ee..d971334 100644 --- a/Documentation/config.txt +++ b/Documentation

[PATCH v4 0/4] cache-tree building fix in the presence of ita entries

2016-07-15 Thread Nguyễn Thái Ngọc Duy
IN)) + if (contains_ita && !hashcmp(sha1, EMPTY_TREE_SHA1_BIN)) continue; strbuf_grow(&buffer, entlen + 100); Nguyễn Thái Ngọc Duy (4): test-lib.sh: introduce and use $EMPTY_TREE test-lib.sh: introduce and use $EMPTY_BLOB cache-tree.c: f

[PATCH v4 1/4] test-lib.sh: introduce and use $EMPTY_TREE

2016-07-15 Thread Nguyễn Thái Ngọc Duy
This is a special SHA1. Let's keep it at one place, easier to replace later when the hash change comes, easier to recognize. Signed-off-by: Nguyễn Thái Ngọc Duy --- t/t-basic.sh| 2 +- t/t1100-commit-tree-options.sh | 2 +- t/t4010-diff-pathspec.sh| 2 -- t/

[PATCH v4 3/4] cache-tree.c: fix i-t-a entry skipping directory updates sometimes

2016-07-15 Thread Nguyễn Thái Ngọc Duy
dir/file2 or subdir/file3, this is not a problem because we jump over them anyway. Which may explain why the bug is hidden for nearly four years. Fix it by making sure we only skip i-t-a entries when the entry in question is actual an index entry, not a directory. Reported-by: Yuri Kanivetsky Signed-

[PATCH v4 2/4] test-lib.sh: introduce and use $EMPTY_BLOB

2016-07-15 Thread Nguyễn Thái Ngọc Duy
Similar to $EMPTY_TREE this makes it easier to recognize this special SHA-1 and change hash later. Signed-off-by: Nguyễn Thái Ngọc Duy --- t/t1011-read-tree-sparse-checkout.sh | 8 t/t1700-split-index.sh | 24 t/t3102-ls-tree-wildcards.sh

[PATCH v4 4/4] cache-tree: do not generate empty trees as a result of all i-t-a subentries

2016-07-15 Thread Nguyễn Thái Ngọc Duy
then if 'a/b' contains only (the non-existing) 'a/b/c', then we should ignore 'a/b' while building 'a' too. And it goes all the way up to top directory. Noticed-by: Junio C Hamano Signed-off-by: Nguyễn Thái Ngọc Duy --- cache-tree.c | 10 ++

[PATCH v4 0/4] Split .git/config in multiple worktree setup

2016-07-20 Thread Nguyễn Thái Ngọc Duy
On Wed, Jul 20, 2016 at 6:14 AM, Duy Nguyen wrote: >> If yes, do you know if someone is working on this? If nobody is working on >> this, do >> you have some pointers for me what the main problems are? > > The blocker is config file being shared (you do not want to share > core.worktree and submo

[PATCH v4 3/4] submodule: support running in multiple worktree setup

2016-07-20 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-worktree.txt | 8 git-submodule.sh | 8 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt index 41350db..2a5661d 100644 --- a

[PATCH v4 1/4] worktree: add per-worktree config files

2016-07-20 Thread Nguyễn Thái Ngọc Duy
ption that the majority of config variables are shared so it is the default mode. A safer move would be default writes go to per-worktree file, so that accidental changes are isolated. (*) "git config --worktree" points back to "config" file when this extension is not

[PATCH v4 4/4] t2029: some really basic tests for submodules in multi worktree

2016-07-20 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- t/t2029-worktree-submodule.sh (new +x) | 166 + 1 file changed, 166 insertions(+) create mode 100755 t/t2029-worktree-submodule.sh diff --git a/t/t2029-worktree-submodule.sh b/t/t2029-worktree-submodule.sh new file mode

[PATCH v4 2/4] submodule: update core.worktree using git-config

2016-07-20 Thread Nguyễn Thái Ngọc Duy
also updates core.worktree. But in there, we create a new clone, we know what is the initial repository layout, so we know we can simply update "config" file without risks. Signed-off-by: Nguyễn Thái Ngọc Duy --- submodule.c | 16 +++- 1 file changed, 11 insertions(+), 5 del

[PATCH] config.mak.uname: correct perl path on FreeBSD

2016-07-25 Thread Nguyễn Thái Ngọc Duy
It looks the the symlink /usr/bin/perl (to /usr/local/bin/perl) has been removed at least on FreeBSD 10.3. See [1] for more information. [1] https://svnweb.freebsd.org/ports/head/UPDATING?r1=386270&r2=386269&pathrev=386270&diff_format=c Signed-off-by: Nguyễn Thái Ngọc Duy --- Test

[PATCH] t7063: work around FreeBSD's lazy mtime update feature

2016-07-30 Thread Nguyễn Thái Ngọc Duy
f99a20dacb070c5e7f9739efdf96d [2] git://github.com/freebsd/freebsd.git [3] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=5577 Reported-by: Eric Wong Signed-off-by: Nguyễn Thái Ngọc Duy --- This is only of those commits that commit messages are more important than the patch itself. One of the

[PATCH v2] t7063: work around FreeBSD's lazy mtime update feature

2016-08-03 Thread Nguyễn Thái Ngọc Duy
[2] git://github.com/freebsd/freebsd.git [3] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=5577 Reported-by: Eric Wong Signed-off-by: Nguyễn Thái Ngọc Duy --- v2 goes with Junio's suggestion (good one!). And since there is an intention to reuse this new function, I make sure all directorie

[PATCH v3] t7063: work around FreeBSD's lazy mtime update feature

2016-08-03 Thread Nguyễn Thái Ngọc Duy
[2] git://github.com/freebsd/freebsd.git [3] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=5577 Reported-by: Eric Wong Signed-off-by: Nguyễn Thái Ngọc Duy --- v3 differs from v2 in one line --- a/t/t7063-status-untracked-cache.sh +++ b/t/t7063-status-untracked-cache.sh @@ -11

[PATCH] config.c: handle error case for fstat() calls

2016-12-19 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- Will this fix the problem I'm replying to? I don't know. I found this while checking the code and it should be fixed regardless. config.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/config.c b/config.c ind

[PATCH 1/2] config.c: rename label unlock_and_out

2016-12-20 Thread Nguyễn Thái Ngọc Duy
There are two ways to unlock a file: commit, or revert. Rename it to commit_and_out to avoid confusion. Signed-off-by: Nguyễn Thái Ngọc Duy --- config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.c b/config.c index 4973256..505e0d0 100644 --- a/config.c +++ b

[PATCH 2/2] config.c: handle lock file in error case in git_config_rename_...

2016-12-20 Thread Nguyễn Thái Ngọc Duy
ile() is called, rollback_lock_file() becomes no-op. Signed-off-by: Nguyễn Thái Ngọc Duy --- config.c | 1 + 1 file changed, 1 insertion(+) diff --git a/config.c b/config.c index 505e0d0..e02def4 100644 --- a/config.c +++ b/config.c @@ -2483,6 +2483,7 @@ int git_config_rename_section_in_file(const char *

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