[PATCH 03/34] git_snpath(): retire and replace with strbuf_git_path()

2014-11-30 Thread Nguyễn Thái Ngọc Duy
In the previous patch, git_snpath() is modified to allocate a new strbuf buffer because vsnpath() needs that. But that makes it awkward because git_snpath() receives a pre-allocated buffer from outside and has to copy data back. Rename it to strbuf_git_path() and make it receive strbuf directly.

[PATCH 01/34] path.c: make get_pathname() return strbuf instead of static buffer

2014-11-30 Thread Nguyễn Thái Ngọc Duy
We've been avoiding PATH_MAX whenever possible. This patch makes get_pathname() return a strbuf and updates the callers to take advantage of this. The code is simplified as we no longer need to worry about buffer overflow. vsnpath() behavior is changed slightly: previously it always clears the

[PATCH 02/34] path.c: make get_pathname() call sites return const char *

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Before the previous commit, get_pathname returns an array of PATH_MAX length. Even if git_path() and similar functions does not use the whole array, git_path() caller can, in theory. After the commit, get_pathname() may return a buffer that has just enough room for the returned string and

[PATCH 05/34] path.c: group git_path(), git_pathdup() and strbuf_git_path() together

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- path.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/path.c b/path.c index 6991103..df0f75b 100644 --- a/path.c +++ b/path.c @@ -78,6 +78,16 @@ void strbuf_git_path(struct strbuf *sb, const char

[PATCH 04/34] path.c: rename vsnpath() to do_git_path()

2014-11-30 Thread Nguyễn Thái Ngọc Duy
The name vsnpath() gives an impression that this is general path handling function. It's not. This is the underlying implementation of git_path(), git_pathdup() and strbuf_git_path() which will prefix $GIT_DIR in the result string. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- path.c

[PATCH 00/34] nd/multiple-work-trees reroll

2014-11-30 Thread Nguyễn Thái Ngọc Duy
This is rebased so the diff below (against the version on Junio's repo) is only approximate. Changes include test fixes for Windows port, $GIT_COMMON_DIR and $GIT_DIR/modules problems with submodules. Patch 03/34 is rewritten to touch less in refs.c to reduce conflicts. A lot of changes there are

[PATCH 06/34] git_path(): be aware of file relocation in $GIT_DIR

2014-11-30 Thread Nguyễn Thái Ngọc Duy
We allow the user to relocate certain paths out of $GIT_DIR via environment variables, e.g. GIT_OBJECT_DIRECTORY, GIT_INDEX_FILE and GIT_GRAFT_FILE. Callers are not supposed to use git_path() or git_pathdup() to get those paths. Instead they must use get_object_directory(), get_index_file() and

[PATCH 08/34] reflog: avoid constructing .lock path with git_path

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Among pathnames in $GIT_DIR, e.g. index or packed-refs, we want to automatically and silently map some of them to the $GIT_DIR of the repository we are borrowing from via $GIT_COMMON_DIR mechanism. When we formulate the pathname for its lockfile, we want it to be in the same location as its final

[PATCH 07/34] *.sh: respect $GIT_INDEX_FILE

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- git-pull.sh | 2 +- git-stash.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/git-pull.sh b/git-pull.sh index 4d4fc77..ad44226 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -240,7 +240,7 @@ test true = $rebase {

[PATCH 10/34] commit: use SEQ_DIR instead of hardcoding sequencer

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/commit.c b/builtin/commit.c index e108c53..3f02686 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -170,7 +170,7 @@ static void

[PATCH 11/34] $GIT_COMMON_DIR: a new environment variable

2014-11-30 Thread Nguyễn Thái Ngọc Duy
This variable is intended to support multiple working directories attached to a repository. Such a repository may have a main working directory, created by either git init or git clone and one or more linked working directories. These working directories and the main repository share the same

[PATCH 09/34] fast-import: use git_path() for accessing .git dir instead of get_git_dir()

2014-11-30 Thread Nguyễn Thái Ngọc Duy
This allows git_path() to redirect info/fast-import to another place if needed Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- fast-import.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fast-import.c b/fast-import.c index 3018130..1b50923 100644 ---

[PATCH 13/34] *.sh: avoid hardcoding $GIT_DIR/hooks/...

2014-11-30 Thread Nguyễn Thái Ngọc Duy
If $GIT_COMMON_DIR is set, it should be $GIT_COMMON_DIR/hooks/, not $GIT_DIR/hooks/. Just let rev-parse --git-path handle it. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- git-am.sh | 22 +++--- git-rebase--interactive.sh | 6

[PATCH 14/34] git-stash: avoid hardcoding $GIT_DIR/logs/....

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- git-stash.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git-stash.sh b/git-stash.sh index b6d4b06..6846b18 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -184,7 +184,7 @@ store_stash () { fi

[PATCH 19/34] setup.c: support multi-checkout repo setup

2014-11-30 Thread Nguyễn Thái Ngọc Duy
The repo setup procedure is updated to detect $GIT_DIR/commondir and set $GIT_COMMON_DIR properly. The core.worktree is ignored when $GIT_COMMON_DIR is set. This is because the config file is shared in multi-checkout setup, but checkout directories _are_ different. Making core.worktree effective

[PATCH 17/34] setup.c: convert check_repository_format_gently to use strbuf

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- setup.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/setup.c b/setup.c index 6c52f75..00a23e6 100644 --- a/setup.c +++ b/setup.c @@ -342,7 +342,9 @@ void setup_work_tree(void) static int

[PATCH 16/34] setup.c: detect $GIT_COMMON_DIR in is_git_directory()

2014-11-30 Thread Nguyễn Thái Ngọc Duy
If the file $GIT_DIR/commondir exists, it contains the value of $GIT_COMMON_DIR. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/gitrepository-layout.txt | 7 ++ setup.c| 43 +- 2 files changed, 44

[PATCH 15/34] setup.c: convert is_git_directory() to use strbuf

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- setup.c | 37 + 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/setup.c b/setup.c index 979b13f..afd6742 100644 --- a/setup.c +++ b/setup.c @@ -238,31 +238,36 @@ void

[PATCH 20/34] wrapper.c: wrapper to open a file, fprintf then close

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- cache.h | 2 ++ wrapper.c | 31 +++ 2 files changed, 33 insertions(+) diff --git a/cache.h b/cache.h index 9dc6ae0..f8e75a1 100644 --- a/cache.h +++ b/cache.h @@ -1499,6 +1499,8 @@ static inline ssize_t

[PATCH 21/34] use new wrapper write_file() for simple file writing

2014-11-30 Thread Nguyễn Thái Ngọc Duy
This fixes common problems in these code about error handling, forgetting to close the file handle after fprintf() fails, or not printing out the error string.. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/branch.c | 4 +--- builtin/init-db.c | 7 +-- daemon.c

[PATCH 12/34] git-sh-setup.sh: use rev-parse --git-path to get $GIT_DIR/objects

2014-11-30 Thread Nguyễn Thái Ngọc Duy
If $GIT_COMMON_DIR is set, $GIT_OBJECT_DIRECTORY should be $GIT_COMMON_DIR/objects, not $GIT_DIR/objects. Just let rev-parse --git-path handle it. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- git-sh-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH 18/34] setup.c: detect $GIT_COMMON_DIR check_repository_format_gently()

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- setup.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.c b/setup.c index 00a23e6..1d4f1aa 100644 --- a/setup.c +++ b/setup.c @@ -346,6 +346,10 @@ static int check_repository_format_gently(const char

[PATCH 31/34] checkout: don't require a work tree when checking out into a new one

2014-11-30 Thread Nguyễn Thái Ngọc Duy
From: Dennis Kaarsemaker den...@kaarsemaker.net For normal use cases, it does not make sense for 'checkout' to work on a bare repository, without a worktree. But checkout --to is an exception because it _creates_ a new worktree. Allow this option to run on bare repositories. People who check out

[PATCH 22/34] checkout: support checking out into a new working directory

2014-11-30 Thread Nguyễn Thái Ngọc Duy
git checkout --to sets up a new working directory with a .git file pointing to $GIT_DIR/worktrees/id. It then executes git checkout again on the new worktree with the same arguments except --to is taken out. The second checkout execution, which is not contaminated with any info from the current

[PATCH 32/34] t2025: add a test to make sure grafts is working from a linked checkout

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- t/t2025-checkout-to.sh | 18 ++ 1 file changed, 18 insertions(+) diff --git a/t/t2025-checkout-to.sh b/t/t2025-checkout-to.sh index 4bd1df4..eddd325 100755 --- a/t/t2025-checkout-to.sh +++ b/t/t2025-checkout-to.sh @@ -96,4

[PATCH 24/34] checkout: reject if the branch is already checked out elsewhere

2014-11-30 Thread Nguyễn Thái Ngọc Duy
One branch obviously can't be checked out at two places (but detached heads are ok). Give the user a choice in this case: --detach, -b new-branch, switch branch in the other checkout first or simply 'cd' and continue to work there. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com ---

[PATCH 26/34] gc: style change -- no SP before closing parenthesis

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/gc.c b/builtin/gc.c index 005adbe..0e65eff 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -287,7 +287,7 @@ int cmd_gc(int argc, const char **argv,

[PATCH 30/34] git_path(): keep info/sparse-checkout per work-tree

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Currently git_path(info/sparse-checkout) resolves to $GIT_COMMON_DIR/info/sparse-checkout in multiple worktree mode. It makes more sense for the sparse checkout patterns to be per worktree, so you can have multiple checkouts with different parts of the tree. With this, git checkout --to new on a

[PATCH 27/34] gc: factor out gc.pruneexpire parsing code

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/gc.c | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/builtin/gc.c b/builtin/gc.c index 0e65eff..0728650 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -55,6 +55,17 @@ static void

[PATCH 29/34] count-objects: report unused files in $GIT_DIR/worktrees/...

2014-11-30 Thread Nguyễn Thái Ngọc Duy
In linked checkouts, borrowed parts like config is taken from $GIT_COMMON_DIR. $GIT_DIR/config is never used. Report them as garbage. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/count-objects.c | 4 +++- cache.h | 1 + path.c | 29

[PATCH 25/34] checkout: clean up half-prepared directories in --to mode

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/checkout.c | 48 t/t2025-checkout-to.sh | 6 ++ 2 files changed, 54 insertions(+) diff --git a/builtin/checkout.c b/builtin/checkout.c index 01a28b4..5dfdbda 100644 ---

[PATCH 23/34] prune: strategies for linked checkouts

2014-11-30 Thread Nguyễn Thái Ngọc Duy
(alias R=$GIT_COMMON_DIR/worktrees/id) - linked checkouts are supposed to keep its location in $R/gitdir up to date. The use case is auto fixup after a manual checkout move. - linked checkouts are supposed to update mtime of $R/gitdir. If $R/gitdir's mtime is older than a limit, and it

[PATCH 33/34] checkout: do not fail if target is an empty directory

2014-11-30 Thread Nguyễn Thái Ngọc Duy
From: Max Kirillov m...@max630.net Non-recursive checkout creates empty directpries in place of submodules. If then I try to checkout --to submodules there, it refuses to do so, because directory already exists. Fix by allowing checking out to empty directory. Add test and modify the existing

[PATCH 28/34] gc: support prune --worktrees

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Helped-by: Marc Branchaud marcn...@xiplink.com Signed-off-by: Marc Branchaud marcn...@xiplink.com Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/config.txt | 7 +++ Documentation/git-checkout.txt | 11 +++ builtin/gc.c | 10 ++

[PATCH 34/34] git-common-dir: make modules/ per-working-directory directory

2014-11-30 Thread Nguyễn Thái Ngọc Duy
From: Max Kirillov m...@max630.net Each working directory of main repository has its own working directory of submodule, and in most cases they should be checked out to different revisions. So they should be separated. It looks logical to make submodule instances in different working directories

Re: What's cooking in git.git (Nov 2014, #04; Wed, 26)

2014-11-30 Thread Duy Nguyen
On Fri, Nov 28, 2014 at 1:39 AM, brian m. carlson sand...@crustytoothpaste.net wrote: On Wed, Nov 26, 2014 at 03:09:45PM -0800, Junio C Hamano wrote: * nd/untracked-cache (2014-10-27) 19 commits - t7063: tests for untracked cache - update-index: test the system before enabling untracked

[PATCH 02/19] ls_colors.c: parse color.ls.* from config file

2014-11-30 Thread Nguyễn Thái Ngọc Duy
This is the second (and preferred) source for color information. This will override $LS_COLORS. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/config.txt | 11 +++ ls_colors.c | 26 ++ 2 files changed, 37 insertions(+) diff

[PATCH 03/19] ls_colors.c: add a function to color a file name

2014-11-30 Thread Nguyễn Thái Ngọc Duy
The new function is based on print_color_indicator() from commit 7326d1f1a67edf21947ae98194f98c38b6e9e527 in coreutils.git. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- color.h | 2 ++ ls_colors.c | 66 + 2 files

[PATCH 00/19] Add git-list-files

2014-11-30 Thread Nguyễn Thái Ngọc Duy
This is something else that's been sitting in my tree for a while now. It adds git list-files, intended to be aliased as ls with your favourite display options. As you can guess it's a friendlier version (and pretty close to GNU ls) of ls-files. On one hand, I think this is a nice addition. On

[PATCH 01/19] ls_colors.c: add $LS_COLORS parsing code

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Reusing color settings from $LS_COLORS could give a native look and feel on file coloring. This code is basically from coreutils.git [1], rewritten to fit Git. As this is from GNU ls, the environment variable CLICOLOR is not tested. It is to be decided later whether we should ignore $LS_COLORS

[PATCH 04/19] ls_colors.c: highlight submodules like directories

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/config.txt | 3 ++- ls_colors.c | 8 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index 2090866..2290c47 100644 ---

[PATCH 06/19] ls-files: add --color to highlight file names

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/git-ls-files.txt | 7 +++ builtin/ls-files.c | 38 +++--- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/Documentation/git-ls-files.txt

[PATCH 05/19] ls-files: buffer full item in strbuf before printing

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Buffering so that we can manipulate the strings (e.g. coloring) further before finally printing them. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/ls-files.c | 48 +++- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git

[PATCH 07/19] ls-files: add --column

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/git-ls-files.txt | 6 ++ builtin/ls-files.c | 28 2 files changed, 34 insertions(+) diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt index

[PATCH 12/19] list-files: add -1 short for --no-column

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/git-list-files.txt | 3 +++ builtin/ls-files.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/Documentation/git-list-files.txt b/Documentation/git-list-files.txt index 5dccbbc..725a236 100644 ---

[PATCH 10/19] list-files: -u does not imply showing stages

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Showing full index entry information is something for ls-files only. The users of git list-files may just want to know what entries are not unmerged. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/ls-files.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH 08/19] ls-files: support --max-depth

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/git-ls-files.txt | 7 +++ builtin/ls-files.c | 7 +++ 2 files changed, 14 insertions(+) diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt index 99328b9..3d921eb 100644 ---

[PATCH 09/19] Add git-list-files, a user friendly version of ls-files and more

2014-11-30 Thread Nguyễn Thái Ngọc Duy
This is more user friendly version of ls-files: * it's automatically colored and columnized * it refreshes the index like all porcelain commands * it defaults to non-recursive behavior like ls * :(glob) is on by default so '*.c' means a.c but not a/b.c, use '**/*.c' for that. * auto pager The

[PATCH 11/19] list-files: add -R/--recursive short for --max-depth=-1

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/git-list-files.txt | 4 builtin/ls-files.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/Documentation/git-list-files.txt b/Documentation/git-list-files.txt index 3039e1e..5dccbbc 100644 ---

[PATCH 15/19] list-files: do not show duplicate cached entries

2014-11-30 Thread Nguyễn Thái Ngọc Duy
With the current show_files() list-files -tcm will show foo.c M foo.c The first item is redundant. If foo.c is modified, we know it's in the cache. Introduce show_files_compact to do that because ls-files is plumbing and scripts may already depend on current display behavior. Another

[PATCH 13/19] list-files: add -t back

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Tag H (cached) is not shown though because it's usually the majority and becomes noise. Not showing it makes the other tags stand out. -t is on by default if more than one file category is selected. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/git-list-files.txt | 6

[PATCH 16/19] list-files: show directories as well as files

2014-11-30 Thread Nguyễn Thái Ngọc Duy
The index does not store directories explicitly (except submodules) so we have to figure them out from file list. The function show_directories() deliberately generates duplicate directories and expects the previous patch to remove duplicates. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com

[PATCH 18/19] list-files -F: show submodules with the new indicator ''

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/git-list-files.txt | 4 ++-- builtin/ls-files.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/git-list-files.txt b/Documentation/git-list-files.txt index 22084eb..c57129b

[PATCH 19/19] list-files: -M aka diff-cached

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/ls-files.c | 57 +++--- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/builtin/ls-files.c b/builtin/ls-files.c index 5b5a068..08ae206 100644 --- a/builtin/ls-files.c

[PATCH 14/19] list-files: sort output and remove duplicates

2014-11-30 Thread Nguyễn Thái Ngọc Duy
When you mix different file types, with ls-files you may get separate listing. For example, ls-files -cm will show file abc twice: one as part of cached list, one of modified list. With ls (and this patch) they will be in a single sorted list (easier for the eye). Duplicate entries are also

[PATCH 17/19] list-files: add -F/--classify

2014-11-30 Thread Nguyễn Thái Ngọc Duy
This appends an indicator after the file name if it's executable, a directory and so on, like in GNU ls. In fact append_indicator() is a rewrite from get_type_indicator() in coreutils.git commit 7326d1f1a67edf21947ae98194f98c38b6e9e527. Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com ---

[PATCH 1/3] tree.c: update read_tree_recursive callback to pass strbuf as base

2014-11-30 Thread Nguyễn Thái Ngọc Duy
This allows the callback to use 'base' as a temporary buffer to quickly assemble full path without extra allocation. The callback has to restore it afterwards of course. Helped-by: Eric Sunshine sunsh...@sunshineco.com Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- archive.c

[PATCH 2/3] ls-tree: remove path filtering logic in show_tree

2014-11-30 Thread Nguyễn Thái Ngọc Duy
ls-tree uses read_tree_recursive() which already does path filtering using pathspec. No need to filter one more time based on prefix only. ls-tree ../somewhere does not work because of this. write_name_quotedpfx() can now be retired because nobody else uses it. Signed-off-by: Nguyễn Thái Ngọc Duy

[PATCH 0/3] ls-tree fixes

2014-11-30 Thread Nguyễn Thái Ngọc Duy
The first two fix ls-tree's unable to handle relative paths outside $PWD. The last one rejects negative pathspec. This is a resend from http://thread.gmane.org/gmane.comp.version-control.git/259233/focus=259264 Nguyễn Thái Ngọc Duy (3): tree.c: update read_tree_recursive callback to pass

[PATCH 3/3] ls-tree: disable negative pathspec because it's not supported

2014-11-30 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/ls-tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c index 053edb2..3b04a0f 100644 --- a/builtin/ls-tree.c +++ b/builtin/ls-tree.c @@ -174,7 +174,8 @@ int

Re: [PATCH] introduce git root

2014-11-30 Thread Matthieu Moy
Arjun Sreedharan arjun...@gmail.com writes: On 30 November 2014 at 04:38, Philip Oakley philipoak...@iee.org wrote: From: Arjun Sreedharan arjun...@gmail.com This introduces `git root` which outputs the root directory (the directory that contains .git). The same can be accomplished by `git

Thinning a repository

2014-11-30 Thread Yuri D'Elia
Hi everyone, Is there a quick way to reproduce the effect of a shallow clone on a local repository that doesn't involve filter-branch and/or re-clone? My motivation is to reduce the local size of repositories I'm only following, by trimming the history without prejudice to a [N] set of last

Re: Thinning a repository

2014-11-30 Thread Fredrik Gustafsson
On Sun, Nov 30, 2014 at 01:18:34PM +0100, Yuri D'Elia wrote: Is there a quick way to reproduce the effect of a shallow clone on a local repository that doesn't involve filter-branch and/or re-clone? I'm curious, why is it a bad thing to do a re-clone? If you clone your local repo it would be

Re: Thinning a repository

2014-11-30 Thread Yuri D'Elia
On 11/30/2014 01:34 PM, Fredrik Gustafsson wrote: On Sun, Nov 30, 2014 at 01:18:34PM +0100, Yuri D'Elia wrote: Is there a quick way to reproduce the effect of a shallow clone on a local repository that doesn't involve filter-branch and/or re-clone? I'm curious, why is it a bad thing to do a

Re: Force git submodule update --remote for some branches

2014-11-30 Thread Jens Lehmann
Am 28.11.2014 um 18:54 schrieb Timothy M. Redaelli: I have a repository with a submodule and I'd like to force git to checkout the LAST version of the submodule and not the stored one (like git submodule update --remote), but only on some branches and without the need to remember to add --remote

Re: [PATCH 24/34] checkout: reject if the branch is already checked out elsewhere

2014-11-30 Thread Mark Levedahl
On 11/30/2014 03:24 AM, Nguyễn Thái Ngọc Duy wrote: One branch obviously can't be checked out at two places (but detached heads are ok). Give the user a choice in this case: --detach, -b new-branch, switch branch in the other checkout first or simply 'cd' and continue to work there. This

Re: What's cooking in git.git (Nov 2014, #04; Wed, 26)

2014-11-30 Thread brian m. carlson
On Sun, Nov 30, 2014 at 03:35:33PM +0700, Duy Nguyen wrote: I'm not Junio :) but I think the core changes are done. I wanted to actually add watchman support on top of untracked cache as well to see if it needs any more changes. I think I can see how it could be done now (not easy, but not

[PATCH v2] t0027: check the eol conversion warnings

2014-11-30 Thread Torsten Bögershausen
Depending on the file content, eol parameters and .gitattributes git add may give a warning when the eol of a file will change when the file is checked out again. There are 2 different warnings, either CRLF will be replaced... or LF will be replaced Let t0027 check for these warnings: call

Re: [PATCH] compat: convert modes to use portable file type values

2014-11-30 Thread Torsten Bögershausen
On 2014-11-30 03.41, David Michael wrote: Some minor comments: +static inline mode_t mode_native_to_git(mode_t native_mode) +{ + if (S_ISREG(native_mode)) + return 010 | (native_mode 0); + else if (S_ISDIR(native_mode)) + return 004 | (native_mode

[PATCH/RFC v2] Squashed changes for multiple worktrees vs. submodules

2014-11-30 Thread Max Kirillov
builtin/checkout.c: use absolute path instead of given argument for picking worktree name, it happens to be needed because for submodule checkout the new worktree is always . environment.c: add GIT_COMMON_DIR to local_repo_env git-submodule.sh: implement automatic cloning of main repository and

Re: [PATCHv3 2/3] mailmap: use higher level string list functions

2014-11-30 Thread Junio C Hamano
Eric Sunshine sunsh...@sunshineco.com writes: On Thu, Nov 27, 2014 at 1:44 PM, Michael Blume blume.m...@gmail.com wrote: The variable index seems to be unused/uninitialized now -- it's still printed in debug messages, but if I'm reading correctly, its contents are going to be nonsense. Nice

Re: [PATCH] commit: inform pre-commit if --amend is used

2014-11-30 Thread Junio C Hamano
Mark Levedahl mleved...@gmail.com writes: On 11/28/2014 12:18 AM, Jeff King wrote: Thanks for the links; I had no recollection of that thread. Unsurprisingly, I like the HEAD/HEAD~1 suggestion. That peff guy seems really clever (and handsome, too, I'll bet). I'd still be OK with any of the

Re: What's cooking in git.git (Nov 2014, #04; Wed, 26)

2014-11-30 Thread Junio C Hamano
brian m. carlson sand...@crustytoothpaste.net writes: On Wed, Nov 26, 2014 at 03:09:45PM -0800, Junio C Hamano wrote: * nd/untracked-cache (2014-10-27) 19 commits ... - dir.c: optionally compute sha-1 of a .gitignore file You didn't comment on the status of this branch, and I'm interested.

Re: 'simple' push check that branch name matches does not work if push.default is unset (and hence implicitly simple)

2014-11-30 Thread Junio C Hamano
Jeff King p...@peff.net writes: There is some other magic with simple, too, around triangular workflows. Describing it in detail would probably be too verbose in this message, but we do refer to the description of push.default, which is probably enough. Technically this new bit you are

Re: [PATCHv3 2/3] mailmap: use higher level string list functions

2014-11-30 Thread Stefan Beller
On 30.11.2014 16:47, Junio C Hamano wrote: Eric Sunshine sunsh...@sunshineco.com writes: On Thu, Nov 27, 2014 at 1:44 PM, Michael Blume blume.m...@gmail.com wrote: The variable index seems to be unused/uninitialized now -- it's still printed in debug messages, but if I'm reading correctly,

Re: Our cumbersome mailing list workflow

2014-11-30 Thread Junio C Hamano
Michael Haggerty mhag...@alum.mit.edu writes: It seems like a few desirable features are being talked about here, and summarizing the discussion as centralized vs decentralized is too simplistic. What is really important? 1. Convenient and efficient, including for newcomers 2. Usable while

Deprecation warnings under XCode

2014-11-30 Thread Michael Blume
I have no idea whether this should concern anyone, but my mac build of git shows CC imap-send.o imap-send.c:183:36: warning: 'ERR_error_string' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations] fprintf(stderr, %s: %s\n, func, ERR_error_string(ERR_get_error(),

Re: [PATCH] introduce git root

2014-11-30 Thread Junio C Hamano
Matthieu Moy matthieu@grenoble-inp.fr writes: ... git rev-parse --show-toplevel is not just long, it's just not the place where people would look for (it's neither about revision nor about parsing, so clearly, rev-parse is not a good place to host the feature in the UI). For the record,

Re: [PATCH] compat: convert modes to use portable file type values

2014-11-30 Thread Junio C Hamano
David Michael fedora@gmail.com writes: This is my most recent attempt at solving the problem of z/OS using different file type values than every other OS. I believe it should be safe as long as the file type bits don't ever need to be converted back to their native values (and I didn't

Re: [PATCH v5] Add another option for receive.denyCurrentBranch

2014-11-30 Thread Junio C Hamano
Thanks, will queue. I think we would need a bit more tests to protect the feature from future changes, if you care about the cleanliness requirement of this feature which is a lot stricter than that of git checkout. Perhaps like this one on top. -- 8 -- From: Junio C Hamano gits...@pobox.com

Re: [PATCH] compat: convert modes to use portable file type values

2014-11-30 Thread David Michael
On Sun, Nov 30, 2014 at 3:16 PM, Torsten Bögershausen tbo...@web.de wrote: [snip] Could the code be more human-readable ? static inline mode_t mode_native_to_git(mode_t native_mode) { int perm_bits = native_mode 0; if (S_ISREG(native_mode)) return 010

Re: [PATCH] introduce git root

2014-11-30 Thread Christian Couder
On Mon, Dec 1, 2014 at 4:04 AM, Junio C Hamano gits...@pobox.com wrote: If I were redoing this today, I would probably nominate the git potty as such a kitchen synk command. We have --man-path that shows the location of the manual pages, --exec-path[=path] that either shows or allows us to

Re: [PATCH] introduce git root

2014-11-30 Thread Junio C Hamano
Christian Couder christian.cou...@gmail.com writes: I wonder if we could reuse git config which is already a kitchen synk command to get/set a lot of parameters. I doubt it makes much sense. * Things like toplevel and cdup are not even something you configure. It is where you are, the

Re: Deprecation warnings under XCode

2014-11-30 Thread Torsten Bögershausen
On 12/01/2014 04:02 AM, Michael Blume wrote: I have no idea whether this should concern anyone, but my mac build of git shows CC imap-send.o imap-send.c:183:36: warning: 'ERR_error_string' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations] fprintf(stderr, %s:

Re: [PATCH] compat: convert modes to use portable file type values

2014-11-30 Thread Torsten Bögershausen
On 12/01/2014 04:40 AM, David Michael wrote: On Sun, Nov 30, 2014 at 3:16 PM, Torsten Bögershausen tbo...@web.de wrote: [snip] Could the code be more human-readable ? static inline mode_t mode_native_to_git(mode_t native_mode) { int perm_bits = native_mode 0; if

[PATCH] git-svn: Support for propset

2014-11-30 Thread Alfred Perlstein
Hello folks, I have resurrected the code submitted by David Fraser to facilitate git-svn to set properties on files. This is my very first patch submission to git(1) so please be gentle. I have tried my best to abide with all the instructions located here:

[PATCH] git-svn: Support for git-svn propset

2014-11-30 Thread Alfred Perlstein
This change allows git-svn to support setting subversion properties. Very useful for manually setting properties when committing to a subversion repo that *requires* properties to be set without requiring moving your changeset to separate subversion checkout in order to set props. This change is

Re: [PATCH v5] Add another option for receive.denyCurrentBranch

2014-11-30 Thread Johannes Schindelin
Hi Junio, On Sun, 30 Nov 2014, Junio C Hamano wrote: Thanks, will queue. Thanks! I think we would need a bit more tests to protect the feature from future changes, if you care about the cleanliness requirement of this feature which is a lot stricter than that of git checkout. Perhaps