We generally want to avoid lookup_unknown_object, because it
results in allocating more memory for the object than may be
strictly necessary.
In this case, it is used to check whether we have an
already-parsed object before calling parse_object, to save
us from reading the object from disk. Using
The point of the "index" field of struct commit is that
every allocated commit would have one. It is supposed to be
an invariant that whenever object->type is set to
OBJ_COMMIT, we have a unique index.
Commit 969eba6 (commit: push commit_index update into
alloc_commit_node, 2014-06-10) covered thi
The only way that "obj" can be non-NULL is if it came from
one of the lookup_* functions. These functions always ensure
that the object has the expected type (and return NULL
otherwise), so there is no need for us to set the type.
Signed-off-by: Jeff King
---
object.c | 2 --
1 file changed, 2 d
When we call lookup_commit, lookup_tree, etc, the logic goes
something like:
1. Look for an existing object struct. If we don't have
one, allocate and return a new one.
2. Double check that any object we have is the expected
type (and complain and return NULL otherwise).
3. Conve
We keep a static counter to set the commit index on newly
allocated objects. However, since we also need to set the
index on any_objects which are converted to commits, let's
make the counter available as a public function.
While we're moving it, let's make sure the counter is
allocated as an unsi
The "struct object" type implements basic object
polymorphism. Individual instances are allocated as
concrete types (or as a union type that can store any
object), and a "struct object *" can be cast into its real
type after examining its "type" enum. This means it is
dangerous to have a type fie
On Sat, Jul 12, 2014 at 02:05:39PM -0400, Jeff King wrote:
> > I don't particularly like 'flag' here. (not a massive dislike, mind you:)
> >
> > Perhaps: flag->object_type, type->node_type?
> > Or, if that's too verbose, maybe just: flag->type, type->node?
>
> Me either, but as you noticed, type
From: Ramsay Jones
In order to encapsulate the setting of the unique commit index, commit
969eba63 ("commit: push commit_index update into alloc_commit_node",
10-06-2014) introduced a (logically private) intermediary allocator
function. However, this function (alloc_raw_commit_node()) was declare
Because the allocator functions for tree, blobs, etc are all
very similar, we originally used a macro to avoid repeating
ourselves. Since the prior commit, though, the heavy lifting
is done by an inline helper function. The macro does still
save us a few lines, but at some readability cost. It
ob
On Sat, Jul 12, 2014 at 11:44 AM, David Turner wrote:
> @@ -342,6 +342,15 @@ static char *prepare_index(int argc, const char **argv,
> const char *prefix,
>
> discard_cache();
> read_cache_from(index_lock.filename);
> + if (update_main_cache_tree(WRIT
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 " on a
From: Dennis Kaarsemaker
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 from a bare reposito
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
---
builtin/count-objects.c | 4 +++-
cache.h | 1 +
path.c | 29 ++
Signed-off-by: Nguyễn Thái Ngọc Duy
---
builtin/checkout.c | 49 +++--
1 file changed, 47 insertions(+), 2 deletions(-)
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 81adb74..3167fd2 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
Signed-off-by: Nguyễn Thái Ngọc Duy
---
builtin/gc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/gc.c b/builtin/gc.c
index 8d219d8..3bfb990 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -298,7 +298,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
Signed-off-by: Nguyễn Thái Ngọc Duy
---
builtin/gc.c | 21 +
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/builtin/gc.c b/builtin/gc.c
index 3bfb990..e38c902 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -55,6 +55,17 @@ static void remove_pidfile_on_signal(i
Signed-off-by: Nguyễn Thái Ngọc Duy
---
Documentation/config.txt | 7 +++
builtin/gc.c | 11 +++
2 files changed, 18 insertions(+)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 286e539..57999fa 100644
--- a/Documentation/config.txt
+++ b/Document
(alias R=$GIT_COMMON_DIR/repos/)
- 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 points t
The normal rule is anything outside refs/heads/ is detached. This
increases strictness of the rule a bit more: if the branch is checked
out (either in $GIT_COMMON_DIR/HEAD or any $GIT_DIR/repos/.../HEAD)
then it's detached as well.
A hint is given so the user knows where to go and do something the
Signed-off-by: Nguyễn Thái Ngọc Duy
---
setup.c | 37 +
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/setup.c b/setup.c
index 0a22f8b..425fd79 100644
--- a/setup.c
+++ b/setup.c
@@ -238,31 +238,36 @@ void verify_non_filename(const char *prefix
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
---
git-sh-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git-sh-setup.sh b/git-sh-
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
---
git-am.sh | 22 +++---
git-rebase--interactive.sh | 6 +++---
git-rebase
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
i
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 fi
"git checkout --to" sets up a new working directory with a .git file
pointing to $GIT_DIR/repos/. 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 rep
Signed-off-by: Nguyễn Thái Ngọc Duy
---
setup.c | 6 --
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/setup.c b/setup.c
index a17389f..79f79f2 100644
--- a/setup.c
+++ b/setup.c
@@ -346,6 +346,10 @@ static int check_repository_format_gently(const char
*gitdir, int *nongit_ok)
This allows git_path() to redirect info/fast-import to another place
if needed
Signed-off-by: Nguyễn Thái Ngọc Duy
---
fast-import.c | 5 +
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index d9c068b..ea426c4 100644
--- a/fast-import.c
+++ b/fast-
Signed-off-by: Nguyễn Thái Ngọc Duy
---
git-stash.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-stash.sh b/git-stash.sh
index 393e1ec..41f8f6b 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -184,7 +184,7 @@ store_stash () {
fi
# Make sure the re
Signed-off-by: Nguyễn Thái Ngọc Duy
---
cache.h | 2 ++
wrapper.c | 31 +++
2 files changed, 33 insertions(+)
diff --git a/cache.h b/cache.h
index e3ff7dc..bf4d15e 100644
--- a/cache.h
+++ b/cache.h
@@ -1359,6 +1359,8 @@ static inline ssize_t write_str_in_full(int
Signed-off-by: Nguyễn Thái Ngọc Duy
---
builtin/commit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index 461c3b1..4b9f012 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -156,7 +156,7 @@ static void determine_whence(struct wt_s
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 r
Signed-off-by: Nguyễn Thái Ngọc Duy
---
setup.c | 12
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/setup.c b/setup.c
index 176d505..a17389f 100644
--- a/setup.c
+++ b/setup.c
@@ -342,7 +342,9 @@ void setup_work_tree(void)
static int check_repository_format_gently(
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
---
Documentation/gitrepository-layout.txt | 7 ++
setup.c| 43 +-
2 files changed, 44 insertions(+), 6 dele
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
---
builtin/branch.c | 4 +---
builtin/init-db.c | 7 +--
daemon.c | 11 +--
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 git_path
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
---
path.c | 8
1 f
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 get
Signed-off-by: Nguyễn Thái Ngọc Duy
---
path.c | 20 ++--
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/path.c b/path.c
index 2cb2e61..65881aa 100644
--- a/path.c
+++ b/path.c
@@ -78,6 +78,16 @@ void strbuf_git_path(struct strbuf *sb, const char *fmt, ...)
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.
U
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 buf
Signed-off-by: Nguyễn Thái Ngọc Duy
---
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 18a394f..6ab0c31 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -240,7 +240,7 @@ test true = "$rebase" && {
if !
v7 fixes all comments from Eric and Max. Jeff's two patches are
dropped because they have landed in latest master now. Diff against
v6:
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 470f979..57999fa 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1
On Fri, Jul 11, 2014 at 12:52 PM, Yi EungJun wrote:
> Add an Accept-Language header which indicates the user's preferred
> languages defined by $LANGUAGE, $LC_ALL, $LC_MESSAGES and $LANG.
>
> Examples:
> LANGUAGE= -> ""
> LANGUAGE=ko:en -> "Accept-Language: ko, en; q=0.9, *; q=0.1"
> LANGUAG
On Fri, Jul 11, 2014 at 6:55 PM, Jacob Keller wrote:
> Add support for configuring default sort ordering for git tags. Command
> line option will override this configured value, using the exact same
> syntax.
>
> Cc: Jeff King
> Signed-off-by: Jacob Keller
> ---
> Made parse_sort_string take a "
On Jul 12, 2014, at 11:10 AM, Pete Wyckoff wrote:
>> Some additional investigation.
>>
>> I am working in a copy of a repository that was originally used to pull the
>> data
>> from Perforce. As part of my experiments to figure out this problem, I
>> deleted
>> the contents of .git/git-p4-t
Thanks for your detailed review and nice suggestions. I will accept
most of them.
2014-07-12 2:35 GMT+09:00 Jeff King :
>> + /* Decide the precision for q-factor on number of preferred languages.
>> */
>> + if (num_langs + 1 > 100) { /* +1 is for '*' */
>> + q_precision = 0.00
Am 10.07.2014 22:52, schrieb Junio C Hamano:
> Junio C Hamano writes:
>
>> Jens Lehmann writes:
>>
>>> I agree, but this case is special. The test asserts that nobody
>>> added, modified or removed *anything* inside the .git directory.
>>> The reason for problem we are seeing here is that I have
duanemur...@mac.com wrote on Thu, 10 Jul 2014 12:19 -0700:
> Some additional investigation.
>
> I am working in a copy of a repository that was originally used to pull the
> data
> from Perforce. As part of my experiments to figure out this problem, I
> deleted
> the contents of .git/git-p4-t
On Sat, Jul 12, 2014 at 03:55:35PM +0100, Ramsay Jones wrote:
> > if (!obj) {
> > struct commit *c = alloc_commit_node();
> > - return create_object(sha1, OBJ_COMMIT, c);
> > + return create_object(sha1, c);
> > }
>
> perhaps:
> if (!obj)
>
On Sat, Jul 12, 2014 at 03:44:06PM +0100, Ramsay Jones wrote:
> > - return alloc_node(&name##_state, sizeof(type)); \
> > + return alloc_node(&name##_state, flag, sizeof(type)); \
> > }
>
> I don't particularly like 'flag' here. (not a massive dislike, mind you:)
>
> Perhaps: flag
lcharri...@promptu.com wrote on Thu, 10 Jul 2014 15:45 +0200:
> I've used git-p4 for several years now and it's generally working well for
> me.
>
> The only thing that bugs me at this time is having to re-clone regularly.
> Here is how this happens:
>
> * Say my p4 client maps //foo/bar/... to /
On 11/07/14 09:46, Jeff King wrote:
[snip]
Sorry, hit send too early ...
> diff --git a/blob.c b/blob.c
> index ae320bd..5720a38 100644
> --- a/blob.c
> +++ b/blob.c
> @@ -7,7 +7,7 @@ struct blob *lookup_blob(const unsigned char *sha1)
> {
> struct object *obj = lookup_object(sha1);
>
On 11/07/14 09:46, Jeff King wrote:
> The "struct object" type implements basic object
> polymorphism. Individual instances are allocated as
> concrete types (or as a union type that can store any
> object), and a "struct object *" can be cast into its real
> type after examining its "type" enum.
On Wed, Jul 09, 2014 at 02:33:11PM +0700, Nguyễn Thái Ngọc Duy wrote:
> +static int check_linked_checkout(struct branch_info *new,
> + const char *name, const char *path)
> +{
...
> + if (!strncmp(start, new->path, end - start) &&
> + new->path[end - start]
Yi EungJun:
Add an Accept-Language header which indicates the user's preferred
languages defined by $LANGUAGE, $LC_ALL, $LC_MESSAGES and $LANG.
This one seems to fix all the issues I had with the first patch,
thanks!
--
\\// Peter - http://www.softwolves.pp.se/
--
To unsubscribe from this l
Jeff King:
If that is the case, though, I wonder if we should actually be adding it
as a git-protocol header so that all transports can benefit (i.e., we
could be localizing human-readable error messages in upload-pack,
receive-pack, etc).
That would be very nice, thre is a lot of language mix
On Sat, Jul 12, 2014 at 6:56 AM, Jeff King wrote:
> I think none of the regular devs uses PROFILE, and it bit-rotted
By the way, is there no build (CI) server for git.git to regularly
test branches on different platforms or at least different build
configs on the same platform?
--
To unsubscribe
On Sat, Jul 12, 2014 at 6:56 AM, Jeff King wrote:
> On Fri, Jul 11, 2014 at 12:12:55AM +0200, Tuncer Ayaz wrote:
>
> > Sorry, didn't test properly when I tried with/without config.mak,
> > and PROFILE=BUILD was the problem. I had that in config.mak based
> > on information gathered from INSTALL and
Hello Hannes,
> Am 10.07.2014 22:05, schrieb Johannes Sixt:
> > It looks like I totally missed the topic sk/mingw-unicode-spawn-args.
...
> > Am I doing something wrong? Does the topic depend on a particular
> > version of MSYS (or DLL)?
unfortunately, I paused my submissions at random point.
I'
59 matches
Mail list logo