[PATCH] log: support 256 colors with --graph=256colors

2016-12-20 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- I got mad after tracing two consecutive red history lines in `git log --graph --oneline` back to their merge points, far far away. Yeah probably should fire up tig, or gitk or something. This may sound like a good thing to add, but I don't kno

[PATCH v2] log --graph: customize the graph lines with config log.graphColors

2016-12-24 Thread Nguyễn Thái Ngọc Duy
k the colors you want. Even with standard terminal, if your background color is neither black or white, then the graph line may match your background and become hidden. You can exclude your background color (or simply the colors you hate) with this. Signed-off-by: Nguyễn Thái Ngọc Duy --- Sounds

[PATCH 0/6] git worktree move/remove

2017-01-08 Thread Nguyễn Thái Ngọc Duy
This version is the same as nd/worktree-move but with the recursive directory copy code removed. We rely on rename() to move directories. Nguyễn Thái Ngọc Duy (6): worktree.c: add validate_worktree() worktree.c: add update_worktree_location() worktree move: new command worktree move

[PATCH 3/6] worktree move: new command

2017-01-08 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 1/6] worktree.c: add validate_worktree()

2017-01-08 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 2/6] worktree.c: add update_worktree_location()

2017-01-08 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 4/6] worktree move: accept destination as directory

2017-01-08 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 5/6] worktree move: refuse to move worktrees with submodules

2017-01-08 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 900b68b..64d0264 100644 --- a/builtin/worktree.c +++ b/builtin/worktree

[PATCH 6/6] worktree remove: new command

2017-01-08 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 v3] log --graph: customize the graph lines with config log.graphColors

2017-01-08 Thread Nguyễn Thái Ngọc Duy
k the colors you want. Even with standard terminal, if your background color is neither black or white, then the graph line may match your background and become hidden. You can exclude your background color (or simply the colors you hate) with this. Signed-off-by: Nguyễn Thái Ngọc Duy --- Compared

[PATCH v4] log --graph: customize the graph lines with config log.graphColors

2017-01-09 Thread Nguyễn Thái Ngọc Duy
k the colors you want. Even with standard terminal, if your background color is neither black or white, then the graph line may match your background and become hidden. You can exclude your background color (or simply the colors you hate) with this. Signed-off-by: Nguyễn Thái Ngọc Duy --- v4: * r

[PATCH v5 0/4] Per-worktree config file support

2017-01-10 Thread Nguyễn Thái Ngọc Duy
ut is done automatically _update_ a config variable with "git config --worktree". I think this one is more or less ready. I have an RFC follow-up patch about core.bare, but that could be handled separately. [1] http://public-inbox.org/git/20160720172419.25473-1-pclo...@gmail.com/ Nguyễn T

[PATCH v5 2/4] config: --worktree for manipulating per-worktree config file

2017-01-10 Thread Nguyễn Thái Ngọc Duy
As noted in the previous commit, "git config" without options will read both per-worktree and per-repo by default. --worktree is needed to read just per-worktree config. Writing goes to per-repo by default though, unless --worktree is given. Signed-off-by: Nguyễn Thái Ngọc Duy --- Doc

[PATCH v5 3/4] config: automatically migrate to new config layout when --worktree is used

2017-01-10 Thread Nguyễn Thái Ngọc Duy
It's not fun to ask the user to set extensions.worktreeConfig manually. It's error-prone too. So we do it automatically whenever anybody sets a per-worktree config with "git config" (support for builtin commands is coming later). Signed-off-by: Nguyễn Thái Ngọc Duy --

[PATCH v5 1/4] config: read per-worktree config files

2017-01-10 Thread Nguyễn Thái Ngọc Duy
design places a bet on the assumption 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 wh

[PATCH v5 4/4] t2029: add tests for per-worktree config

2017-01-10 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- t/t2029-worktree-config.sh (new +x) | 82 + 1 file changed, 82 insertions(+) create mode 100755 t/t2029-worktree-config.sh diff --git a/t/t2029-worktree-config.sh b/t/t2029-worktree-config.sh new file mode 100755 index

[PATCH/RFC 5/4] Redefine core.bare in multiple working tree setting

2017-01-10 Thread Nguyễn Thái Ngọc Duy
e. This patch is incomplete. I need to go through all is_bare_repository() calls and adjust their behavior. But I wanted to run the idea through the community first.. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/config.txt | 2 +- Documentation/git-worktree.txt | 7 +++ t

[PATCH v5 1/3] color.c: fix color_parse_mem() with value_len == 0

2017-01-19 Thread Nguyễn Thái Ngọc Duy
In this code we want to match the word "reset". If len is zero, strncasecmp() will return zero and we incorrectly assume it's "reset" as a result. Signed-off-by: Nguyễn Thái Ngọc Duy --- color.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/color.c b/color

[PATCH v5 0/3] nd/log-graph-configurable-colors

2017-01-19 Thread Nguyễn Thái Ngọc Duy
v5 moves space trimming to color_parse_mem() from read_graph_colors_config, which is renamed to parse_graph... because the config reading is moved back to graph_init. I think it looks better, but we may be pushing the limits of argv_array's abuse. Nguyễn Thái Ngọc Duy (3): color.c

[PATCH v5 2/3] color.c: trim leading spaces in color_parse_mem()

2017-01-19 Thread Nguyễn Thái Ngọc Duy
Normally color_parse_mem() is called from config parser which trims the leading spaces already. The new caller in the next patch won't. Let's be tidy and trim leading spaces too (we already trim trailing spaces before comma). Signed-off-by: Nguyễn Thái Ngọc Duy --- color.c | 7 +

[PATCH v5 3/3] log --graph: customize the graph lines with config log.graphColors

2017-01-19 Thread Nguyễn Thái Ngọc Duy
k the colors you want. Even with standard terminal, if your background color is neither black or white, then the graph line may match your background and become hidden. You can exclude your background color (or simply the colors you hate) with this. Signed-off-by: Nguyễn Thái Ngọc Duy --- Document

[PATCH] log: new option decorate reflog of remote refs

2017-01-19 Thread Nguyễn Thái Ngọc Duy
t;origin/foo@{1}" This is for remote refs only because based on my experience, docorating local reflog is just too noisy. You will most likely see HEAD@{1}, HEAD@{2} and so on. We can add that as a separate option in future if we see a need for it. Signed-off-by: Nguyễn Thái Ngọc Duy --- I&#x

[PATCH/TOY] Shortcuts to quickly refer to a commit name with keyboard

2017-01-20 Thread Nguyễn Thái Ngọc Duy
OK This patch is horrible. Though the idea is cool and I've found it very useful. So here it is. Perhaps the idea may be revised a bit that's more suitable for more than one user. The problem is old, SHA-1 name is not keyboard-friendly, even in abbreviated form. And recent change has made abbrev f

[PATCH 2/5] revision.c: group ref selection options together

2017-01-25 Thread Nguyễn Thái Ngọc Duy
). Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 134 + 1 file changed, 100 insertions(+), 34 deletions(-) diff --git a/revision.c b/revision.c index b37dbec378..6ebd38d1c8 100644 --- a/revision.c +++ b/revision.c @@ -2059,6

[PATCH 3/5] revision.c: allow to change pseudo opt parsing function

2017-01-25 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 11 --- revision.h | 4 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/revision.c b/revision.c index 6ebd38d1c8..cda2606c66 100644 --- a/revision.c +++ b/revision.c @@ -2273,10 +2273,15 @@ int setup_revisions(int

[PATCH 5/5] revision.c: add --decorate-reflog

2017-01-25 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 46 ++ 1 file changed, 46 insertions(+) diff --git a/revision.c b/revision.c index 45cffcab44..b77face513 100644 --- a/revision.c +++ b/revision.c @@ -2157,6 +2157,49 @@ static int

[PATCH 0/5] Prep steps for --decorate-reflog

2017-01-25 Thread Nguyễn Thái Ngọc Duy
series does not really implement --decorate-reflog. It shuffles revision.c code around a bit so thay the option can be implemented later. The most controversal patch would be 4/5 where --exclude behavior is changed slighly. Good? Bad? Horror hooorrrible? Nguyễn Thái Ngọc Duy (5): rev-list-options

[PATCH 1/5] rev-list-options.txt: delete an empty line

2017-01-25 Thread Nguyễn Thái Ngọc Duy
The convention has been option name is followed immediately by its description without a line break. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/rev-list-options.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list

[PATCH 4/5] revision.c: refactor ref selection handler after --exclude

2017-01-25 Thread Nguyễn Thái Ngọc Duy
ones") but I feel option order is not a good fit to express them. Signed-off-by: Nguyễn Thái Ngọc Duy --- revision.c | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/revision.c b/revision.c index cda2606c66..45cffcab44 100644 --- a/revision.c +++ b/r

[PATCH 00/11] nd/worktree-move update

2017-02-02 Thread Nguyễn Thái Ngọc Duy
RECTORY - worktree $TRASH_DIRECTORY/destination - worktree $TRASH_DIRECTORY/elsewhere + worktree $toplevel + worktree $toplevel/destination + worktree $toplevel/elsewhere EOF test_cmp expected actual && git -C destination log --format=%s

[PATCH 01/11] worktree.c: zero new 'struct worktree' on allocation

2017-02-02 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 02/11] worktree: reorder an if statement

2017-02-02 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 Signed-off-by: Junio C Hamano --- builtin/worktree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/worktree.c b/builtin/worktree.c index 5c4854d3e4

[PATCH 05/11] worktree list: keep the list sorted

2017-02-02 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 Signed-off-by: Junio C Hamano --- builtin/worktree.c | 2 +- t/t2027-worktree-list.sh | 19

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

2017-02-02 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 Signed-off-by: Junio C Hamano --- builtin/worktree.c | 6 -- t/t2027-worktree-list.sh | 21 + worktree.c

[PATCH 08/11] worktree move: new command

2017-02-02 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 07/11] worktree.c: add update_worktree_location()

2017-02-02 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- worktree.c | 21 + worktree.h | 6 ++ 2 files changed, 27 insertions(+) diff --git a/worktree.c b/worktree.c index 929072ad89..7684951da5 100644 --- a/worktree.c +++ b/worktree.c @@ -354,6 +354,27

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

2017-02-02 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 Signed-off-by: Junio C Hamano --- worktree.c | 63 ++ worktree.h | 5 + 2 files changed, 68 insertions(+) diff --git a/worktree.c b/worktree.c index eb6121263b..929

[PATCH 04/11] worktree.c: get_worktrees() takes a new flag argument

2017-02-02 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 Signed-off-by: Junio C Hamano --- branch.c | 2 +- builtin/branch.c | 2 +- builtin/worktree.c | 6 +++--- worktree.c | 4

[PATCH 11/11] worktree remove: new command

2017-02-02 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/git-worktree.txt | 21 + builtin/worktree.c | 79 ++ contrib/completion/git-completion.bash | 5 ++- t/t2028-worktree-move.sh

[PATCH 10/11] worktree move: refuse to move worktrees with submodules

2017-02-02 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 900b68bb5d..6c58d620ce 100644 --- a/builtin/worktree.c +++ b/builtin/

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

2017-02-02 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 Signed-off-by: Junio C Hamano --- builtin/worktree.c | 19 ++

[PATCH] rev-list-options.txt: update --all about detached HEAD

2017-02-07 Thread Nguyễn Thái Ngọc Duy
This is the document patch for f0298cf1c6 (revision walker: include a detached HEAD in --all - 2009-01-16) Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/rev-list-options.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/rev-list-options.txt b

[PATCH v2] rev-list-options.txt: update --all about HEAD

2017-02-07 Thread Nguyễn Thái Ngọc Duy
about the detached-ness. Signed-off-by: Nguyễn Thái Ngọc Duy --- v2 drops "detached". Documentation/rev-list-options.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt index 5da7cf5a8d..

[PATCH] refs-internal.c: make files_log_ref_write() static

2017-02-08 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 1/2] refs.c: add resolve_ref_submodule()

2017-02-08 Thread Nguyễn Thái Ngọc Duy
This is basically the extended version of resolve_gitlink_ref() where we have access to more info from the underlying resolve_ref_recursively() call. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 20 ++-- refs.h | 3 +++ 2 files changed, 17 insertions(+), 6 deletions

[PATCH RFC 0/2] Kill manual ref parsing code in worktree.c

2017-02-08 Thread Nguyễn Thái Ngọc Duy
last 24 hours. Still can't find any fundamental flaw... Nguyễn Thái Ngọc Duy (2): refs.c: add resolve_ref_submodule() worktree.c: use submodule interface to access refs from another worktree branch.c | 3 +- refs.c | 20 +-

[PATCH 2/2] worktree.c: use submodule interface to access refs from another worktree

2017-02-08 Thread Nguyễn Thái Ngọc Duy
limit support to "standard" layout, at least for now. (*) The differences in sharing object database and refs between submodules and linked worktrees don't really matter in this context. (**) At this point, we may want to rename refs *_submodule API to something more neutral

[PATCH] clean: use warning_errno() when appropriate

2017-02-13 Thread Nguyễn Thái Ngọc Duy
All these warning() calls are preceded by a system call. Report the actual error to help the user understand why we fail to remove something. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/clean.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/clean.c b

[PATCH/RFC 00/11] Remove submodule from files-backend.c

2017-02-13 Thread Nguyễn Thái Ngọc Duy
s my next step. Compound ref store will have to wait until I'm done with my gc-in-worktree problem as I think I can live without it for now. I think after compound ref store is in place, adding lmdb backend back should be much cleaner because it does not care about either submodules or

[PATCH 08/11] refs.c: factor submodule code out of get_ref_store()

2017-02-13 Thread Nguyễn Thái Ngọc Duy
This code is going to be expanded a bit soon. Keep it out for better readability later. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 22 ++ 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/refs.c b/refs.c index 2cacd934e..8ef7a52ba 100644 --- a/refs.c +++ b

[PATCH 10/11] files-backend: remove submodule_allowed from files_downcast()

2017-02-13 Thread Nguyễn Thái Ngọc Duy
true... Signed-off-by: Nguyễn Thái Ngọc Duy --- refs/files-backend.c | 69 1 file changed, 21 insertions(+), 48 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 834bc6fdf..2fb270b6f 100644 --- a/refs/files-backend.c

[PATCH 11/11] refs: split and make get_*_ref_store() public API

2017-02-13 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 59 ++-- refs.h | 13 refs/files-backend.c | 2 +- refs/refs-internal.h | 12 --- 4 files changed, 48 insertions(+), 38 deletions(-) diff --git a

[PATCH 09/11] refs: move submodule code out of files-backend.c

2017-02-13 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 01/11] refs-internal.c: make files_log_ref_write() static

2017-02-13 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 04/11] files-backend: replace *git_path*() with files_path()

2017-02-13 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 | 193 ++- 1 file c

[PATCH 06/11] refs-internal.h: correct is_per_worktree_ref()

2017-02-13 Thread Nguyễn Thái Ngọc Duy
All refs outside refs/ directory is per-worktree, not just HEAD. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs/refs-internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refs/refs-internal.h b/refs/refs-internal.h index f4aed49f5..69d02b6ba 100644 --- a/refs/refs

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

2017-02-13 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 | 114 --- 1 file changed, 90 insertions(+), 24 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 75565c3aa..6582c9b

[PATCH 07/11] files-backend: remove the use of git_path()

2017-02-13 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 | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index c69e4fe84..5

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

2017-02-13 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 f03dcf58b..2cacd934e 100644 --- a/refs.c +++ b/refs.c @@ -489,12 +489,6 @@ int dwim_log(const char *str

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

2017-02-13 Thread Nguyễn Thái Ngọc Duy
f_store' should be replace 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 v2] clean: use warning_errno() when appropriate

2017-02-14 Thread Nguyễn Thái Ngọc Duy
All these warning() calls are preceded by a system call. Report the actual error to help the user understand why we fail to remove something. Signed-off-by: Nguyễn Thái Ngọc Duy --- v2 dances with errno builtin/clean.c | 19 ++- 1 file changed, 14 insertions(+), 5 deletions

[PATCH v2 00/16] Remove submodule from files-backend.c

2017-02-16 Thread Nguyễn Thái Ngọc Duy
binbSOlqAf8r_.bin Description: plain

[PATCH v2 03/16] files-backend: add files_path()

2017-02-16 Thread Nguyễn Thái Ngọc Duy
f_store' should be replace 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 v2 02/16] files-backend: convert git_path() to strbuf_git_path()

2017-02-16 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 | 111 +-- 1 file changed, 89 insertions(+), 22 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 75565c3aa..f0c878b

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

2017-02-16 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 v2 04/16] files-backend: replace *git_path*() with files_path()

2017-02-16 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 | 185 ++- 1 file c

[PATCH v2 06/16] refs-internal.h: correct is_per_worktree_ref()

2017-02-16 Thread Nguyễn Thái Ngọc Duy
All refs outside refs/ directory is per-worktree, not just HEAD. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs/refs-internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refs/refs-internal.h b/refs/refs-internal.h index f4aed49f5..69d02b6ba 100644 --- a/refs/refs

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

2017-02-16 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 4f845798b..7a474198e 100644 --- a/refs.c +++ b/refs.c @@ -489,12 +489,6 @@ int dwim_log(const char *str

[PATCH v2 07/16] files-backend: remove the use of git_path()

2017-02-16 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 | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 24f5bf7f1..7

[PATCH v2 10/16] refs.c: flatten get_ref_store() a bit

2017-02-16 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 v2 11/16] refs.c: kill register_ref_store(), add register_submodule_ref_store()

2017-02-16 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 v2 08/16] refs.c: introduce get_main_ref_store()

2017-02-16 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 7a474198e..10994d992 100644 --- a/refs.c +++ b/refs.c @@ -1445,15 +1445,23 @@ static struct ref_store *ref_store_init(const char *submodule

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

2017-02-16 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 v2 13/16] path.c: move some code out of strbuf_git_path_submodule()

2017-02-16 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 v2 12/16] refs.c: make get_main_ref_store() public and use it

2017-02-16 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 v2 15/16] files-backend: remove submodule_allowed from files_downcast()

2017-02-16 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 e8946e638..d9fc29d8d 100644 --- a/refs/files-backend.c

[PATCH v2 14/16] refs: move submodule code out of files-backend.c

2017-02-16 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 v2 16/16] refs: rename get_ref_store() to get_submodule_ref_store() and make it public

2017-02-16 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 v2 4/5] refs: add refs_create_symref()

2017-02-16 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 22 +- refs.h | 4 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/refs.c b/refs.c index e0e191107..23e0a8eda 100644 --- a/refs.c +++ b/refs.c @@ -1535,13 +1535,25 @@ int peel_ref(const char *refname

[PATCH v2 3/5] worktree.c: kill parse_ref() in favor of refs_resolve_ref_unsafe()

2017-02-16 Thread Nguyễn Thái Ngọc Duy
The manual parsing code is replaced with a call to refs_resolve_ref_unsafe(). The manual parsing code must die because only refs/files-backend.c should do that. Signed-off-by: Nguyễn Thái Ngọc Duy --- branch.c | 3 +- worktree.c | 102

[PATCH v2 2/5] refs.c: add refs_resolve_ref_unsafe()

2017-02-16 Thread Nguyễn Thái Ngọc Duy
Surprise surprise. This is just rename and introduce resolve_ref_recursively() to the public. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 9 + refs.h | 6 ++ refs/files-backend.c | 2 +- refs/refs-internal.h | 5 - 4 files changed, 12 insertions

[PATCH v2 0/5] Kill manual ref parsing code in worktree.c

2017-02-16 Thread Nguyễn Thái Ngọc Duy
the naming convention with refs_ prefix for new APIs may not be the best idea... [1] public-inbox.org/git/20170213152011.12050-1-pclo...@gmail.com Nguyễn Thái Ngọc Duy (5): refs: introduce get_worktree_ref_store() refs.c: add refs_resolve_ref_unsafe() worktree.c: kill parse_ref() i

[PATCH v2 1/5] refs: introduce get_worktree_ref_store()

2017-02-16 Thread Nguyễn Thái Ngọc Duy
lists worktrees of a submodule), we can update this function to work with submodules as well. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 27 +++ refs.h | 2 ++ 2 files changed, 29 insertions(+) diff --git a/refs.c b/refs.c index e7206a420..ba4d9420c 100644 --- a

[PATCH v2 5/5] refs: kill set_worktree_head_symref()

2017-02-16 Thread Nguyễn Thái Ngọc Duy
refs_create_symref(), we can move back pretty close to the code before 70999e9cec, where create_symref() was used for updating HEAD. Signed-off-by: Nguyễn Thái Ngọc Duy --- branch.c | 12 ++-- refs.h | 9 - refs/files-backend.c | 41

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

2017-02-17 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 v3 06/16] refs-internal.h: correct is_per_worktree_ref()

2017-02-17 Thread Nguyễn Thái Ngọc Duy
All refs outside refs/ directory is per-worktree, not just HEAD. Signed-off-by: Nguyễn Thái Ngọc Duy --- refs/refs-internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refs/refs-internal.h b/refs/refs-internal.h index f4aed49f5..69d02b6ba 100644 --- a/refs/refs

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

2017-02-17 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 4f845798b..7a474198e 100644 --- a/refs.c +++ b/refs.c @@ -489,12 +489,6 @@ int dwim_log(const char *str

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

2017-02-17 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 | 185 ++- 1 file c

[PATCH v3 03/16] files-backend: add files_path()

2017-02-17 Thread Nguyễn Thái Ngọc Duy
f_store' should be replace 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 v3 02/16] files-backend: convert git_path() to strbuf_git_path()

2017-02-17 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 | 111 +-- 1 file changed, 89 insertions(+), 22 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 75565c3aa..f0c878b

[PATCH v3 00/16] Remove submodule from files-backend.c

2017-02-17 Thread Nguyễn Thái Ngọc Duy
->gitcommondir.buf, tmp.buf); + else if (is_per_worktree_ref(tmp.buf) || +(skip_prefix(tmp.buf, "logs/", &ref) && + is_per_worktree_ref(ref))) strbuf_addf(sb, "%s/%s", refs->gitdir.buf, tmp.buf); else

[PATCH v3 12/16] refs.c: make get_main_ref_store() public and use it

2017-02-17 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 v3 10/16] refs.c: flatten get_ref_store() a bit

2017-02-17 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 v3 13/16] path.c: move some code out of strbuf_git_path_submodule()

2017-02-17 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 v3 16/16] refs: rename get_ref_store() to get_submodule_ref_store() and make it public

2017-02-17 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 v3 08/16] refs.c: introduce get_main_ref_store()

2017-02-17 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 7a474198e..10994d992 100644 --- a/refs.c +++ b/refs.c @@ -1445,15 +1445,23 @@ static struct ref_store *ref_store_init(const char *submodule

[PATCH v3 14/16] refs: move submodule code out of files-backend.c

2017-02-17 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 v3 11/16] refs.c: kill register_ref_store(), add register_submodule_ref_store()

2017-02-17 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 v3 07/16] files-backend: remove the use of git_path()

2017-02-17 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 | 22 -- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 24f5bf7f1..0

[PATCH v3 15/16] files-backend: remove submodule_allowed from files_downcast()

2017-02-17 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 627466043..d35032fcd 100644 --- a/refs/files-backend.c

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