[PATCH v3 09/16] refs: rename lookup_ref_store() to lookup_submodule_ref_store()

2017-02-17 Thread Nguyễn Thái Ngọc Duy
With get_main_ref_store() being used inside get_ref_store(), lookup_ref_store() is only used for submodule code path. Rename to reflect that and delete dead code. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a

[PATCH/RFC 00/15] Fix git-gc losing objects in multi worktree

2017-02-17 Thread Nguyễn Thái Ngọc Duy
x.org/git/%3c20170216120302.5302-1-pclo...@gmail.com%3E/ [2] https://github.com/pclouds/git/commits/prune-in-worktrees-2 Nguyễn Thái Ngọc Duy (15): revision.h: new flag in struct rev_info wrt. worktree-related refs revision.c: refactor add_index_objects_to_pending() revision.c: --inde

[PATCH 01/15] revision.h: new flag in struct rev_info wrt. worktree-related refs

2017-02-17 Thread Nguyễn Thái Ngọc Duy
-worktree. The flag will eventually be exposed as a rev-list argument with documents. For now it stays internal until the new behavior is fully implemented. Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.h | 1 + 1 file changed, 1 insertion(+) diff --git a/revision.h b/revision.h index 9fac1a607

[PATCH 04/15] refs: move submodule slash stripping code to get_submodule_ref_store

2017-02-17 Thread Nguyễn Thái Ngọc Duy
This is a better place that will benefit all submodule callers instead of just resolve_gitlink_ref() Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 38 -- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/refs.c b/refs.c index 23e0a8eda

[PATCH 02/15] revision.c: refactor add_index_objects_to_pending()

2017-02-17 Thread Nguyễn Thái Ngọc Duy
The core code is factored out and take 'struct index_state *' instead so that we can reuse it to add objects from index files other than .git/index in the next patch. Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 18 -- 1 file changed, 12 insertions(+), 6

[PATCH 03/15] revision.c: --indexed-objects add objects from all worktrees

2017-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 21 + t/t5304-prune.sh | 9 + 2 files changed, 30 insertions(+) diff --git a/revision.c b/revision.c index ece868a25..d82f72ff3 100644 --- a/revision.c +++ b/revision.c @@ -19,6 +19,7 @@ #include "dir

[PATCH 06/15] refs: add refs_head_ref()

2017-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 19 +-- refs.h | 1 + 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/refs.c b/refs.c index 06890db5d..26758b8cf 100644 --- a/refs.c +++ b/refs.c @@ -1139,27 +1139,26 @@ int rename_ref_available(const char

[PATCH 07/15] refs: add refs_for_each_ref()

2017-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 33 ++--- refs.h | 1 + 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/refs.c b/refs.c index 26758b8cf..fc6cca3db 100644 --- a/refs.c +++ b/refs.c @@ -1170,10 +1170,9 @@ int head_ref(each_ref_fn fn

[PATCH 10/15] refs: remove dead for_each_*_submodule()

2017-02-17 Thread Nguyễn Thái Ngọc Duy
These are used in revision.c. After the last patch they are replaced with the refs_ version. Delete them (except for_each_remote_ref_submodule which is still used by submodule.c) Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 30 -- refs.h | 9 - 2 files

[PATCH 05/15] refs: add refs_read_ref[_full]()

2017-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 19 --- refs.h | 5 + 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/refs.c b/refs.c index 9c86c44b8..06890db5d 100644 --- a/refs.c +++ b/refs.c @@ -186,16 +186,29 @@ struct ref_filter { void *cb_data

[PATCH 11/15] revision.c: --all adds HEAD from all worktrees

2017-02-17 Thread Nguyễn Thái Ngọc Duy
separate topic to reduce the scope of this one. Signed-off-by: Nguyễn Thái Ngọc Duy --- reachable.c | 1 + refs.c | 22 ++ refs.h | 1 + revision.c | 13 + submodule.c | 2 ++ t/t5304-prune.sh | 12 6 fi

[PATCH 09/15] revision.c: use refs_for_each*() instead of for_each_*_submodule()

2017-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 48 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/revision.c b/revision.c index d82f72ff3..d82c37b44 100644 --- a/revision.c +++ b/revision.c @@ -1189,12 +1189,19 @@ void

[PATCH 08/15] refs: add a refs_for_each_in() and friends

2017-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 39 +++ refs.h | 5 + 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/refs.c b/refs.c index fc6cca3db..37b03d4ff 100644 --- a/refs.c +++ b/refs.c @@ -300,34 +300,52 @@ void

[PATCH 13/15] files-backend: make reflog iterator go through per-worktree reflog

2017-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs/files-backend.c | 24 +++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 011a7e256..d429f8713 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -3314,6

[PATCH 12/15] refs: add refs_for_each_reflog[_ent]()

2017-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 19 ++- refs.h | 3 +++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/refs.c b/refs.c index ce165c0ea..622c6b669 100644 --- a/refs.c +++ b/refs.c @@ -1592,9 +1592,8 @@ int verify_refname_available(const char

[PATCH 14/15] revision.c: --reflog add HEAD reflog from all worktrees

2017-02-17 Thread Nguyễn Thái Ngọc Duy
rm we should be able to obtain a "per-worktree only" ref store and would need to revert the changes in reflog iteration API. So let's just wait until then. add_reflogs_to_pending() is called by reachable.c so by default "git prune" will examine reflog from all worktre

[PATCH 15/15] rev-list: expose and document --single-worktree

2017-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/rev-list-options.txt | 8 revision.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt index 5da7cf5a8..dd773f97c 100644 --- a

[PATCH v4 02/15] files-backend: convert git_path() to strbuf_git_path()

2017-02-18 Thread Nguyễn Thái Ngọc Duy
have to worry about memory management again. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs/files-backend.c | 146 --- 1 file changed, 115 insertions(+), 31 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 1ebd59ec0..c6c86f8

[PATCH v4 00/15] Remove submodule from files-backend.c

2017-02-18 Thread Nguyễn Thái Ngọc Duy
treating both per-worktree and pseudo as per-worktree in files_path() only and keep classification unchanged. Side note, my other two series seem to apply cleanly on top of this v3, so no resend. Nguyễn Thái Ngọc Duy (15): refs-internal.c: make files_log_ref_write() static files-backend: convert

[PATCH v4 01/15] refs-internal.c: make files_log_ref_write() static

2017-02-18 Thread Nguyễn Thái Ngọc Duy
Created in 5f3c3a4e6f (files_log_ref_write: new function - 2015-11-10) but probably never used outside refs-internal.c Signed-off-by: Nguyễn Thái Ngọc Duy --- refs/files-backend.c | 3 +++ refs/refs-internal.h | 4 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/refs/files

[PATCH v4 03/15] files-backend: add files_path()

2017-02-18 Thread Nguyễn Thái Ngọc Duy
f_store' should be replaced by "gitdir". And a compound ref_store is created to combine two files backends together, one represents the shared refs in $GIT_COMMON_DIR, one per-worktree. At that point, files_path() becomes a wrapper of strbuf_vaddf(). Signed-off-by: Nguyễn Thái Ngọc

[PATCH v4 04/15] files-backend: replace *git_path*() with files_path()

2017-02-18 Thread Nguyễn Thái Ngọc Duy
files-backend.c (probably should not exist in the first place). But we'll leave it there until we have better multi-worktree support in refs before we update it. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs/files-backend.c | 208 +++ 1 file ch

[PATCH v4 06/15] files-backend: remove the use of git_path()

2017-02-18 Thread Nguyễn Thái Ngọc Duy
le() still does path translation underneath. But that's for another patch. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs/files-backend.c | 37 + 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c

[PATCH v4 07/15] refs.c: introduce get_main_ref_store()

2017-02-18 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/refs.c b/refs.c index c6af84357..c3bdc99d8 100644 --- a/refs.c +++ b/refs.c @@ -1450,15 +1450,23 @@ static struct ref_store *ref_store_init(const char *submodule

[PATCH v4 08/15] refs: rename lookup_ref_store() to lookup_submodule_ref_store()

2017-02-18 Thread Nguyễn Thái Ngọc Duy
With get_main_ref_store() being used inside get_ref_store(), lookup_ref_store() is only used for submodule code path. Rename to reflect that and delete dead code. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a

[PATCH v4 09/15] refs.c: flatten get_ref_store() a bit

2017-02-18 Thread Nguyễn Thái Ngọc Duy
This helps the future changes in this code. And because get_ref_store() is destined to become get_submodule_ref_store(), the "get main store" code path will be removed eventually. After this the patch to delete that code will be cleaner. Signed-off-by: Nguyễn Thái Ngọc Duy --- r

[PATCH v4 05/15] refs.c: share is_per_worktree_ref() to files-backend.c

2017-02-18 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 6 -- refs/refs-internal.h | 6 ++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/refs.c b/refs.c index 81b64b4ed..c6af84357 100644 --- a/refs.c +++ b/refs.c @@ -489,12 +489,6 @@ int dwim_log(const char *str

[PATCH v4 10/15] refs.c: kill register_ref_store(), add register_submodule_ref_store()

2017-02-18 Thread Nguyễn Thái Ngọc Duy
This is the last function in this code (besides public API) that takes submodule argument and handles both main/submodule cases. Break it down, move main store registration in get_main_ref_store() and keep the rest in register_submodule_ref_store(). Signed-off-by: Nguyễn Thái Ngọc Duy

[PATCH v4 12/15] path.c: move some code out of strbuf_git_path_submodule()

2017-02-18 Thread Nguyễn Thái Ngọc Duy
refs is learning to avoid path rewriting that is done by strbuf_git_path_submodule(). Factor out this code so it could be reused by refs* Signed-off-by: Nguyễn Thái Ngọc Duy --- path.c | 34 +++--- submodule.c | 31 +++ submodule.h

[PATCH v4 14/15] files-backend: remove submodule_allowed from files_downcast()

2017-02-18 Thread Nguyễn Thái Ngọc Duy
true... Signed-off-by: Nguyễn Thái Ngọc Duy --- refs/files-backend.c | 70 1 file changed, 21 insertions(+), 49 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 529c80af1..b8ccf4e47 100644 --- a/refs/files-backend.c

[PATCH v4 11/15] refs.c: make get_main_ref_store() public and use it

2017-02-18 Thread Nguyễn Thái Ngọc Duy
get_ref_store() will soon be renamed to get_submodule_ref_store(). Together with future get_worktree_ref_store(), the three functions provide an appropriate ref store for different operation modes. New APIs will be added to operate directly on ref stores. Signed-off-by: Nguyễn Thái Ngọc Duy

[PATCH v4 13/15] refs: move submodule code out of files-backend.c

2017-02-18 Thread Nguyễn Thái Ngọc Duy
submodules since we don't convert submodule path to gitdir at every backend call like before. We pay that once at ref-store creation. More cleanup in files_downcast() follows shortly. It's separate to keep noises from this patch. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c

[PATCH v4 15/15] refs: rename get_ref_store() to get_submodule_ref_store() and make it public

2017-02-18 Thread Nguyễn Thái Ngọc Duy
This function is intended to replace *_submodule() refs API. It provides a ref store for a specific submodule, which can be operated on by a new set of refs API. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 12 refs.h | 11 +++ refs/files

[PATCH v5 02/24] files-backend: make files_log_ref_write() static

2017-02-22 Thread Nguyễn Thái Ngọc Duy
Created in 5f3c3a4e6f (files_log_ref_write: new function - 2015-11-10) but probably never used outside refs-internal.c Signed-off-by: Nguyễn Thái Ngọc Duy --- refs/files-backend.c | 3 +++ refs/refs-internal.h | 4 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/refs/files

[PATCH v5 01/24] refs.h: add forward declaration for structs used in this file

2017-02-22 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.h | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/refs.h b/refs.h index 9fbff90e7..c494b641a 100644 --- a/refs.h +++ b/refs.h @@ -1,6 +1,11 @@ #ifndef REFS_H #define REFS_H +struct object_id; +struct ref_transaction

[PATCH v5 00/24] Remove submodule from files-backend.c

2017-02-22 Thread Nguyễn Thái Ngọc Duy
, if you take this on 'pu', you'll have to kick my other two series out (they should not even compile). I'm not resending them until I get a "looks mostly ok" from Michael. No point in updating them when this series keeps moving. This series is also available on my gi

[PATCH v5 08/24] files-backend: remove the use of git_path()

2017-02-22 Thread Nguyễn Thái Ngọc Duy
_submodule() still does path translation underneath. But that's for another patch. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs/files-backend.c | 43 ++- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/refs/files-backend.c b/refs/files-

[PATCH v5 04/24] files-backend: convert git_path() to strbuf_git_path()

2017-02-22 Thread Nguyễn Thái Ngọc Duy
have to worry about memory management again. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs/files-backend.c | 139 +++ 1 file changed, 106 insertions(+), 33 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 4676525de..435db12

[PATCH v5 06/24] files-backend: add and use files_reflog_path()

2017-02-22 Thread Nguyễn Thái Ngọc Duy
Keep repo-related path handling in one place. This will make it easier to add submodule/multiworktree support later. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs/files-backend.c | 148 +++ 1 file changed, 89 insertions(+), 59 deletions(-) diff

[PATCH v5 07/24] files-backend: add and use files_refname_path()

2017-02-22 Thread Nguyễn Thái Ngọc Duy
y. Not yet. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs/files-backend.c | 45 + 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 7b4ea4c56..72f4e1746 100644 --- a/refs/files-backend.c +++ b/

[PATCH/RFC] git.c: support "!!" aliases that do not move cwd

2016-10-06 Thread Nguyễn Thái Ngọc Duy
more natural to keep cwd where it is. We have a way to do that now after 441981b (git: simplify environment save/restore logic - 2016-01-26). It's just a matter of choosing the right syntax. I'm going with '!!'. I'm not very happy with it. But I do like this type of ali

[PATCH 0/4] nd/ita-empty-commit update

2016-10-24 Thread Nguyễn Thái Ngọc Duy
could be diff-cached-ignores-ita, but that's just half of what it does. The other half is diff-files-includes-ita... Nguyễn Thái Ngọc Duy (4): Subject: diff-lib: allow ita entries treated as "not yet exist in index" diff: add --ita-[in]visible-in-index commit: fix empty commi

[PATCH 4/4] commit: don't be fooled by ita entries when creating initial commit

2016-10-24 Thread Nguyễn Thái Ngọc Duy
ita entries are dropped at tree generation phase. If the entire index consists of just ita entries, the result would be a a commit with no entries, which should be caught unless --allow-empty is specified. The test "!!active_nr" is not sufficient to catch this. Signed-off-by: Nguyễn Thá

[PATCH 3/4] commit: fix empty commit creation when there's no changes but ita entries

2016-10-24 Thread Nguyễn Thái Ngọc Duy
ent commit. index_differs_from() is supposed to catch this so we can abort git-commit (unless --no-empty is specified). Update it to optionally ignore i-t-a entries when doing a diff between the index and HEAD so that it would return "no change" in this case and abort commit. Signed-off-by: Nguyễn Thái Ng

[PATCH 1/4] diff-lib: allow ita entries treated as "not yet exist in index"

2016-10-24 Thread Nguyễn Thái Ngọc Duy
ask it, while making sure other unaudited callers will get the same comparison result. Signed-off-by: Nguyễn Thái Ngọc Duy --- diff-lib.c | 14 ++ diff.h | 1 + t/t2203-add-intent.sh | 16 +++- t/t7064-wtstatus-pv2.sh | 4 ++-- wt-stat

[PATCH 2/4] diff: add --ita-[in]visible-in-index

2016-10-24 Thread Nguyễn Thái Ngọc Duy
, but a bunch other commands like 'apply', 'merge', 'reset'.... need to be taken into consideration as well. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/diff-options.txt | 8 diff.c | 4 t/t2203-add-intent.sh |

[PATCH] rebase: add --forget to cleanup rebase, leave HEAD untouched

2016-10-26 Thread Nguyễn Thái Ngọc Duy
t top-dir, or in a linked worktree. And "rm -r" is very dangerous to do in .git, a mistake in there could destroy object database or other important data. Provide "git rebase --forget" for this exact use case. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-rebase.txt

[PATCH v2] rebase: add --forget to cleanup rebase, leave everything else untouched

2016-11-09 Thread Nguyễn Thái Ngọc Duy
t top-dir, or in a linked worktree. And "rm -r" is very dangerous to do in .git, a mistake in there could destroy object database or other important data. Provide "git rebase --forget" for this exact use case. Signed-off-by: Nguyễn Thái Ngọc Duy --- v2 changes just th

[PATCH v3] rebase: add --forget to cleanup rebase, leave everything else untouched

2016-11-11 Thread Nguyễn Thái Ngọc Duy
t top-dir, or in a linked worktree. And "rm -r" is very dangerous to do in .git, a mistake in there could destroy object database or other important data. Provide "git rebase --forget" for this exact use case. Signed-off-by: Nguyễn Thái Ngọc Duy --- v3 rewrote the desscription

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

2016-11-11 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 00/11] git worktree (re)move

2016-11-11 Thread Nguyễn Thái Ngọc Duy
uys"). [1] https://public-inbox.org/git/20160625075433.4608-1-pclo...@gmail.com/ Nguyễn Thái Ngọc Duy (11): 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

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

2016-11-11 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 f7869f8..7e15ec7 100644 --- a/worktree.c +++ b/

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

2016-11-11 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 03/11] copy.c: convert bb_(p)error_msg to error(_errno)

2016-11-11 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 10/11] worktree move: refuse to move worktrees with submodules

2016-11-11 Thread Nguyễn Thái Ngọc Duy
de is in place, this validate_no_submodules() could be removed. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/worktree.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/builtin/worktree.c b/builtin/worktree.c index 307019c..11be345 100644 --- a/builtin/worktree.c +++ b/builtin/worktree

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

2016-11-11 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- worktree.c | 21 + worktree.h | 6 ++ 2 files changed, 27 insertions(+) diff --git a/worktree.c b/worktree.c index 7e15ec7..db63758 100644 --- a/worktree.c +++ b/worktree.c @@ -354,6 +354,27 @@ int validate_worktree(const struct

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

2016-11-11 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 09/11] worktree move: accept destination as directory

2016-11-11 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/11] copy.c: convert copy_file() to copy_dir_recursively()

2016-11-11 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 08/11] worktree move: new command

2016-11-11 Thread Nguyễn Thái Ngọc Duy
move the repository with the main worktree. The tricky part is make sure all file descriptors to the repository are closed, or it may fail on Windows. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-worktree.txt | 7 +++- builtin/worktree.c

[PATCH 11/11] worktree remove: new command

2016-11-11 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/RFC] ref-filter: support sorting case-insensitively

2016-11-17 Thread Nguyễn Thái Ngọc Duy
ine here. Another option is just use a symbol, like '-' or '*' to mark case-insensitivity. But that does not look very descriptive. I don't see any symbol suggesting this case stuff. What do you think? Signed-off-by: Nguyễn Thái Ngọc Duy --- Docume

[PATCH 2/3] get_worktrees() must return main worktree as first item even on error

2016-11-22 Thread Nguyễn Thái Ngọc Duy
; stuff in HEAD, from resolve_refs_unsafe(). Now may be the time since refs refactoring is mostly done. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/worktree.c | 8 +--- worktree.c | 6 ++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/builtin/wo

[PATCH 1/3] worktree.c: zero new 'struct worktree' on allocation

2016-11-22 Thread Nguyễn Thái Ngọc Duy
This keeps things a bit simpler when we add more fields, knowing that default values are always zero. Signed-off-by: Nguyễn Thái Ngọc Duy --- worktree.c | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/worktree.c b/worktree.c index f7869f8..f7c1b5e 100644

[PATCH 0/3] Minor fixes on 'git worktree'

2016-11-22 Thread Nguyễn Thái Ngọc Duy
This fixes two things: - make sure the first item is always the main worktree even if we fail to retrieve some info - keep 'worktree list' order stable (which in turn fixes the random failure on my 'worktree-move' series Nguyễn Thái Ngọc Duy (3): worktree.c: zero

[PATCH 3/3] worktree list: keep the list sorted

2016-11-22 Thread Nguyễn Thái Ngọc Duy
It makes it easier to write tests for. But it should also be good for the user since locating a worktree by eye would be easier once they notice this. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/worktree.c | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git

[PATCH] merge-recursive.c: use QSORT macro

2016-11-22 Thread Nguyễn Thái Ngọc Duy
This is the follow up of rs/qsort series, merged in b8688ad (Merge branch 'rs/qsort' - 2016-10-10), where coccinelle was used to do automatic transformation. Signed-off-by: Nguyễn Thái Ngọc Duy --- coccinelle missed this place, understandably, because it can't know that

[PATCH v2] merge-recursive.c: use string_list_sort instead of qsort

2016-11-24 Thread Nguyễn Thái Ngọc Duy
u sort one variable but you use the number of items and item size from an unrelated variable (from a first glance) Signed-off-by: Nguyễn Thái Ngọc Duy --- merge-recursive.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/merge-recursive.c b/merge-recursive.c ind

[PATCH v2 0/5] nd/worktree-list-fixup

2016-11-28 Thread Nguyễn Thái Ngọc Duy
This version * changes get_worktrees() to take a flag, and adds one flag for sorting. * adds tests for both the 'main worktree always present' and the sorting problems. * reworks 3/5 a bit, keep changes closer, easier to see the cause and consequence. Nguyễn Thái N

[PATCH v2 1/5] worktree.c: zero new 'struct worktree' on allocation

2016-11-28 Thread Nguyễn Thái Ngọc Duy
This keeps things a bit simpler when we add more fields, knowing that default values are always zero. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- worktree.c | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/worktree.c b/worktree.c

[PATCH v2 2/5] worktree: reorder an if statement

2016-11-28 Thread Nguyễn Thái Ngọc Duy
This is no-op. But it helps reduce diff noise in the next patch. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/worktree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/worktree.c b/builtin/worktree.c index 5c4854d..8a654e4 100644 --- a/builtin/worktree.c

[PATCH v2 4/5] worktree.c: get_worktrees() takes a new flag argument

2016-11-28 Thread Nguyễn Thái Ngọc Duy
This is another no-op patch, in preparation for get_worktrees() to do optional things, like sorting. Signed-off-by: Nguyễn Thái Ngọc Duy --- branch.c | 2 +- builtin/branch.c | 2 +- builtin/worktree.c | 6 +++--- worktree.c | 4 ++-- worktree.h | 2 +- 5 files

[PATCH v2 3/5] get_worktrees() must return main worktree as first item even on error

2016-11-28 Thread Nguyễn Thái Ngọc Duy
quot; stuff in HEAD, from resolve_refs_unsafe(). Now may be the time since refs refactoring is mostly done. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/worktree.c | 6 -- t/t2027-worktree-list.sh | 21 + worktree.c | 10 +++--- 3 files cha

[PATCH v2 5/5] worktree list: keep the list sorted

2016-11-28 Thread Nguyễn Thái Ngọc Duy
It makes it easier to write tests for. But it should also be good for the user since locating a worktree by eye would be easier once they notice this. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/worktree.c | 2 +- t/t2027-worktree-list.sh | 19 +++ worktree.c

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

2016-11-28 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 eb61212..929072a 100644 --- a/worktree.c +++ b/

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

2016-11-28 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 v2 04/11] copy.c: style fix

2016-11-28 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 v2 00/11] git worktree (re)move

2016-11-28 Thread Nguyễn Thái Ngọc Duy
v2 contains some style fix and adapts to the new get_worktrees() api from nd/worktree-list-fixup (which means it can't be built without that series). Nguyễn Thái Ngọc Duy (11): copy.c: import copy_file() from busybox copy.c: delete unused code in copy_file() copy.c: convert bb_(p)erro

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

2016-11-28 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- worktree.c | 21 + worktree.h | 6 ++ 2 files changed, 27 insertions(+) diff --git a/worktree.c b/worktree.c index 929072a..7684951 100644 --- a/worktree.c +++ b/worktree.c @@ -354,6 +354,27 @@ int validate_worktree(const struct

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

2016-11-28 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 v2 09/11] worktree move: accept destination as directory

2016-11-28 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 v2 08/11] worktree move: new command

2016-11-28 Thread Nguyễn Thái Ngọc Duy
move the repository with the main worktree. The tricky part is make sure all file descriptors to the repository are closed, or it may fail on Windows. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-worktree.txt | 7 +++- builtin/worktree.c

[PATCH v2 11/11] worktree remove: new command

2016-11-28 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 | 79 ++ contrib/completion/git-completion.bash | 5 ++- t/t2028-worktree-move.sh | 26 +++ 4 files changed

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

2016-11-28 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 v2 10/11] worktree move: refuse to move worktrees with submodules

2016-11-28 Thread Nguyễn Thái Ngọc Duy
de is in place, this validate_no_submodules() could be removed. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/worktree.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/builtin/worktree.c b/builtin/worktree.c index f732a74..e36e4dc 100644 --- a/builtin/worktree.c +++ b/builtin/worktree

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

2016-11-28 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 v2] tag, branch, for-each-ref: add --ignore-case for sorting and filtering

2016-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- v2 has a different approach, and I think it's a better one even with that unanswered question above. Documentation/git-branch.txt | 4 Documentation/git-for-each-ref.txt | 3 +++ Documentation/git-tag.txt | 4 ++

[PATCH v2] tag, branch, for-each-ref: add --ignore-case for sorting and filtering

2016-12-03 Thread Nguyễn Thái Ngọc Duy
at should be no problem. for-each-ref, as a plumbing, might want finer control. But we can always add --{filter,sort}-ignore-case when there is a need for it. Signed-off-by: Nguyễn Thái Ngọc Duy --- Changes are in tests only: diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh

[PATCH v2 3/6] shallow.c: make paint_alloc slightly more robust

2016-12-06 Thread Nguyễn Thái Ngọc Duy
n a memory chunk larger than pool size. Check this case and abort. Noticed-by: Rasmus Villemoes [1] Details are in commit message of 58babff (shallow.c: the 8 steps to select new commits for .git/shallow - 2013-12-05), step 6. Signed-off-by: Nguyễn Thái Ngọc Duy --- shallow.c | 3 +++ 1 file

[PATCH v2 4/6] shallow.c: avoid theoretical pointer wrap-around

2016-12-06 Thread Nguyễn Thái Ngọc Duy
ast a theoretical chance that the LHS could wrap around 0, giving a false negative. This might as well be written using pointer subtraction avoiding these issues. Signed-off-by: Rasmus Villemoes Signed-off-by: Nguyễn Thái Ngọc Duy --- shallow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH v2 5/6] shallow.c: bit manipulation tweaks

2016-12-06 Thread Nguyễn Thái Ngọc Duy
s non-negative. But let's just help less smart compilers generate good code anyway. Signed-off-by: Rasmus Villemoes Signed-off-by: Nguyễn Thái Ngọc Duy --- shallow.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shallow.c b/shallow.c index 719f699..beb967e 1006

[PATCH v2 6/6] shallow.c: remove useless code

2016-12-06 Thread Nguyễn Thái Ngọc Duy
G. We care about the marking on _shallow commits_ that are not reachable from our current history (and having UNINTERESTING on it means it's reachable). So it's ok for an UNINTERESTING not to be ref-marked. Reported-by: Rasmus Villemoes Signed-off-by: Nguyễn Thái Ngọc Duy --- shallow.c |

[PATCH v2 1/6] shallow.c: rename fields in paint_info to better express their purposes

2016-12-06 Thread Nguyễn Thái Ngọc Duy
slab" is a poor choice of name, at least poorer than "pool". Signed-off-by: Nguyễn Thái Ngọc Duy --- shallow.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/shallow.c b/shallow.c index 4d0b005..8100dfd 100644 --- a/shallow.c ++

[PATCH v2 2/6] shallow.c: stop abusing COMMIT_SLAB_SIZE for paint_info's memory pools

2016-12-06 Thread Nguyễn Thái Ngọc Duy
We need to allocate a "big" block of memory in paint_alloc(). The exact size does not really matter. But the pool size has no relation with commit-slab. Stop using that macro here. Signed-off-by: Nguyễn Thái Ngọc Duy --- shallow.c | 6 -- 1 file changed, 4 insertions(+), 2

[PATCH v2 0/6] shallow.c improvements

2016-12-06 Thread Nguyễn Thái Ngọc Duy
wonder I don't remember much about it :-D Nguyễn Thái Ngọc Duy (4): shallow.c: rename fields in paint_info to better express their purposes shallow.c: stop abusing COMMIT_SLAB_SIZE for paint_info's memory pools shallow.c: make paint_alloc slightly more robust shallow.c: remove useless

[PATCH] rebase: rename --forget to be consistent with sequencer

2016-12-09 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-rebase.txt | 4 ++-- contrib/completion/git-completion.bash | 4 ++-- git-rebase.sh | 6 +++--- t/t3407-rebase-abort.sh| 8 4 files changed, 11 insertions(+), 11 deletions

[PATCH] revert, cherry-pick: rename --quit to be consistent with rebase

2016-12-09 Thread Nguyễn Thái Ngọc Duy
The old --quit remains supported, just hidden away. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/git-cherry-pick.txt | 2 +- Documentation/git-revert.txt | 2 +- Documentation/sequencer.txt| 2 +- builtin/revert.c | 7

[PATCH v2 04/41] builtin/am.c: use error_errno()

2016-05-03 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/am.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/builtin/am.c b/builtin/am.c index d003939..3dfe70b 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -769,15 +769,15 @@ static int split_mail_conv(mail_conv_fn fn

[PATCH v2 00/41] Add and use error_errno() and warning_errno()

2016-05-03 Thread Nguyễn Thái Ngọc Duy
Changes are in [01/41] usage.c: move format processing out of die_errno() [02/41] usage.c: add warning_errno() and error_errno() [12/41] builtin/update-index.c: prefer "err" to "errno" in process_lstat_error [17/41] compat/win32/syslog.c: use warning_errno() [27/41] grep.c: use error_err

[PATCH v2 03/41] bisect.c: use die_errno() and warning_errno()

2016-05-03 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- bisect.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bisect.c b/bisect.c index 7996c29..6d93edb 100644 --- a/bisect.c +++ b/bisect.c @@ -860,8 +860,8 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int

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