Avoid scanning strings twice, once with strchr() and then with
strlen(), by using strchrnul().
Helped-by: Junio C Hamano
Signed-off-by: Rohit Mani
---
PATCH v2 Updated commit description
Updated code according to suggestions [1]
[1] http://article.gmane.org/gmane.comp.version-control
On 2014-03-08 03.47, Nguyễn Thái Ngọc Duy wrote:
> 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() beha
Hello,
I am Mrs.Supini Thrunkul from Tai Yau Bank Hong Kong,I need your cooperation
to transfer $47.3 million US Dollars to any trusted account within your
control.
Contact me for more details.
Mrs.Supini Thrunkul
Tel: +85 2580 848 65
--
To unsubscribe from this list: send the line "unsub
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
---
Documentation/config.txt | 7 +++
builtin/gc.c | 17 +
2 files changed, 24 insertions(+)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 313d4b3..c635b8d 100644
--- a/Documentation/config.txt
+++ b/Do
"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
---
builtin/checkout.c | 49 +++--
1 file changed, 47 insertions(+), 2 deletions(-)
diff --git a/builtin/checkout.c b/builtin/checkout.c
index aa4ffd1..97fdfcc 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
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 +--
Signed-off-by: Nguyễn Thái Ngọc Duy
---
builtin/gc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/gc.c b/builtin/gc.c
index c19545d..39d9b27 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -260,7 +260,7 @@ int cmd_gc(int argc, const char **argv, const char *pref
(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 | 6 --
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/setup.c b/setup.c
index 5085ab1..42849f3 100644
--- a/setup.c
+++ b/setup.c
@@ -292,6 +292,10 @@ static int check_repository_format_gently(const char
*gitdir, int *nongit_ok)
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 992e241..979ac6e 100644
--- a/cache.h
+++ b/cache.h
@@ -1239,6 +1239,8 @@ static inline ssize_t write_str_in_full(int
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 0de9a6c..8093326 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -183,7 +183,7 @@ store_stash () {
fi
# Make sure the re
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
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
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
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 6c3f85f..4994437 100644
--- a/setup.c
+++ b/setup.c
@@ -184,31 +184,36 @@ void verify_non_filename(const char *prefix
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 7e5b334..5085ab1 100644
--- a/setup.c
+++ b/setup.c
@@ -288,7 +288,9 @@ void setup_work_tree(void)
static int check_repository_format_gently(
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 3767478..ee3ac10 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -155,7 +155,7 @@ static void determine_whence(struct wt_s
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.
T
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
---
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 0a5aa2c..2a90262 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -218,7 +218,7 @@ test true = "$rebase" && {
if !
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
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 987fdec..1c0f160 100644
--- a/path.c
+++ b/path.c
@@ -78,6 +78,16 @@ void strbuf_git_path(struct strbuf *sb, const char *fmt, ...)
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
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
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
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-
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 a9f328d..28e7a63 100644
--- a/fast-import.c
+++ b/fast-
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
The diff against v4 is kinda big but it's mostly about converting
`...` to $(...) and making git_path() and friends return a const
string.
Another notable change is I no longer attempt to support checkouts on
portable devices. Torsten pointed out (privately) that my dealing with
Windows drives was
On Thu, Mar 6, 2014 at 2:42 AM, Junio C Hamano wrote:
> Nguyễn Thái Ngọc Duy writes:
>
>> core.worktree::
>> Set the path to the root of the working tree.
>> + If GIT_COMMON_DIR environment variable is set, core.worktree
>> + is ignored and not used for determining the root of wor
Le vendredi 07 mars 2014 à 15:37 -0800, Junio C Hamano a écrit :
> Henri GEIST writes:
>
> > This information is technical in nature but has some importance for general
> > users.
> > As this kind of clone have a separate gitdir, you will have a surprise if
> > you
> > copy past the worktree as
On Sat, Mar 8, 2014 at 1:27 AM, Junio C Hamano wrote:
>>> On the receive-pack side, the comment at the bottom of
>>> preprare_shallow_update() makes it clear that, if we wanted to use
>>> hooks, we cannot avoid having the proposed new shallow-file in a
>>> temporary file, which is unfortunate. Do
Henri GEIST writes:
> This information is technical in nature but has some importance for general
> users.
> As this kind of clone have a separate gitdir, you will have a surprise if you
> copy past the worktree as the gitdir will not come together.
I am not sure if I understand exactly what yo
Am 06.03.2014 23:20, schrieb Henri GEIST:
> Le jeudi 06 mars 2014 à 21:51 +0100, Jens Lehmann a écrit :
>> Am 06.03.2014 21:15, schrieb Henri GEIST:
>>> Le jeudi 06 mars 2014 à 20:48 +0100, Jens Lehmann a écrit :
Am 06.03.2014 02:25, schrieb Henri GEIST:
Wow, that shouldn't even work (as
Le vendredi 07 mars 2014 à 16:42 -0500, Andrew Keller a écrit :
> On Mar 7, 2014, at 2:53 AM, Henri GEIST wrote:
>
> > Adding a note in the submodule documentation signaling that the
> > automatically cloned missing submodules are cloned with a separate
> > gitdir. And where it is put.
> >
> > S
Andrew Keller writes:
>> diff --git a/Documentation/git-submodule.txt
>> b/Documentation/git-submodule.txt
>> index 21cb59a..ea837fd 100644
>> --- a/Documentation/git-submodule.txt
>> +++ b/Documentation/git-submodule.txt
> ...
> Also, this file contains mostly high-level documentation, and this
David Kastrup writes:
> Junio C Hamano writes:
>
>> Christian Couder writes:
>>
>>> The config information is stored in the list
>>> whose first item is pointed to by:
>>>
>>> static struct trailer_item *first_conf_item;
>>
>> If feels somewhat strange ...
>
> Can't say I agree here. Basically
Junio C Hamano writes:
> Christian Couder writes:
>
>> This patch implements reading the configuration
>> to get trailer information, and then processing
>> it and storing it in a doubly linked list.
>
> "Read and process the ...", perhaps?
>
>> The config information is stored in the list
>> wh
Christian Couder writes:
> * many style fixes
This round is readable ;-) Thanks.
> * clearer and nicer setup tests
Those long lines that use "printf" with many embedded \n were harder
to read and also looked harder to maintain if we ever wanted to
change them. Splicing a string with \n in th
On Mar 7, 2014, at 2:53 AM, Henri GEIST wrote:
> Adding a note in the submodule documentation signaling that the
> automatically cloned missing submodules are cloned with a separate
> gitdir. And where it is put.
>
> Signed-off-by: Henri GEIST
> ---
> Documentation/git-submodule.txt |5
Christian Couder writes:
> This patch implements reading the configuration
> to get trailer information, and then processing
> it and storing it in a doubly linked list.
"Read and process the ...", perhaps?
> The config information is stored in the list
> whose first item is pointed to by:
>
>
On Thu, Mar 06, 2014 at 10:47:43PM +0100, Julian Brost wrote:
> I've noticed some behavior of git that might lead to some security
> issues if the user is not aware of this.
>
> Assume we have an evil user on a system, let's call him eve. He
> prepares a repository where he allows other user to p
Just like "git branch" can be told to list the branches that has the
named commit by "git branch --with ", teach the same
short-hand to "git tag", so that "git tag --with " shows the
releases with the named commit.
Signed-off-by: Junio C Hamano
---
* After umpteenth time I got an optparse error
Andreas Schwab writes:
> Yann Droneaud writes:
>
>> But I'd like to know if there's a specific reason for git merge to not
>> support --date and --author ?
>
> It's rather unusual that a merge is performed on behalf of a different
> author.
Yes. Michael's "Nobody bothered to implement it" is a
On Fri, Mar 7, 2014 at 1:47 PM, Brian Gernhardt
wrote:
> The value is parsed with strtol and compared against LONG_MIN and
> LONG_MAX, which doesn't make much sense for an int.
>
> Signed-off-by: Brian Gernhardt
Thanks. Find a more complete fix here [1].
[1]: http://thread.gmane.org/gmane.comp.
Duy Nguyen writes:
> I don't know the scope of these microprojects, but yes I think it'll
> take a few hours for this. By the way, a bit more thought on the idea:
> instead of making OPT_BOOL_NONEG() that sets NONEG, we could make
> OPT_BOOL_FLAGS(..., NONEG), which is more flexible.
What does a
The value is parsed with strtol and compared against LONG_MIN and
LONG_MAX, which doesn't make much sense for an int.
Signed-off-by: Brian Gernhardt
---
pretty.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pretty.c b/pretty.c
index 3b811ed..29ebc4f 100644
--- a/pretty.c
+
Duy Nguyen writes:
> On Thu, Mar 6, 2014 at 3:49 PM, Nguyễn Thái Ngọc Duy
> wrote:
>> diff --git a/t/t5537-fetch-shallow.sh b/t/t5537-fetch-shallow.sh
>> index 3ae9092..a980574 100755
>> --- a/t/t5537-fetch-shallow.sh
>> +++ b/t/t5537-fetch-shallow.sh
>> @@ -173,4 +173,17 @@ EOF
>> )
>>
Duy Nguyen writes:
> On Fri, Mar 7, 2014 at 1:37 AM, Junio C Hamano wrote:
>> I like what I see in this patch, but I wonder if we can essentially
>> revert that "temporary shallow file" patch and replace it with the
>> same (or a similar) mechanism uniformly?
>
> Using --shallow-file is uniform.
On Fri, Mar 7, 2014 at 12:15 PM, Jeff King wrote:
> On Thu, Mar 06, 2014 at 08:35:24PM -0500, Eric Sunshine wrote:
>
>> 1dca155fe3fa (log: handle integer overflow in timestamps, 2014-02-24)
>> assigns the result of strtol() to an 'int' and then checks it against
>> LONG_MIN and LONG_MAX, indicatin
On Fri, Mar 07, 2014 at 08:08:37AM +0100, Christian Couder wrote:
> > Be it graft or replace, I do not think we want to invite people to
> > use these mechansims too lightly to locally rewrite their history
> > willy-nilly without fixing their mistakes at the object layer with
> > "commit --amend"
On Thu, Mar 06, 2014 at 08:57:58PM -0500, Eric Sunshine wrote:
> > + if (strbuf_read(&result, cmd.out, 41) < 0)
> > + die_errno("unable to read from mktree");
> > + close(cmd.out);
> > +
> > + if (finish_command(&cmd))
> > +
On Thu, Mar 06, 2014 at 08:35:24PM -0500, Eric Sunshine wrote:
> 1dca155fe3fa (log: handle integer overflow in timestamps, 2014-02-24)
> assigns the result of strtol() to an 'int' and then checks it against
> LONG_MIN and LONG_MAX, indicating underflow or overflow, even though
> 'int' may not be l
Hello,
I am Mrs.Supini Thrunkul from Tai Yau Bank Hong Kong,I need your cooperation
to transfer $47.3 million US Dollars to any trusted account within your
control.
Contact me for more details.
Mrs.Supini Thrunkul
Tel: +85 2580 848 65
--
To unsubscribe from this list: send the line "unsub
David,
I investigated further and found that \"$LOCAL\" \"$REMOTE\" return the remote
and local files (reversed). (One can easily see this in my 2/28 e-mail.)
Reversing these (\"$REMOTE\" \"$LOCAL\") does indeed reverse the output. It is
easy to work around this issue, but how can this be?
Yann Droneaud writes:
> But I'd like to know if there's a specific reason for git merge to not
> support --date and --author ?
It's rather unusual that a merge is performed on behalf of a different
author.
Andreas.
--
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53
On Fri, Mar 7, 2014 at 9:08 AM, Dan Carpenter wrote:
> On Fri, Mar 07, 2014 at 07:19:15AM +0100, Christian Couder wrote:
>>
>> Yeah, I don't know why, but these days I find it very hard to review
>> style issues in my own code without being distracted.
>> And by the way is there a good script to c
Hello Eric,
Thanks for your reply, and for that information. should i patch again
or this should do?
And what next? Talk to the mentor?
Thanks
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger
On 03/07/2014 11:30 AM, Yann Droneaud wrote:
> I was trying to rebuild some history and found myself trying to use some
> options with git merge which are available in git commit:
>
> git merge \
> --date "2013-12-31 23:59:59 +" \
> --author "Happy New Year " \
> current-year
>
Hi,
I was trying to rebuild some history and found myself trying to use some
options with git merge which are available in git commit:
git merge \
--date "2013-12-31 23:59:59 +" \
--author "Happy New Year " \
current-year
But unfortunately, unlike git commit, git merge doesn'
On Thu, Mar 6, 2014 at 12:05 PM, Karthik Nayak wrote:
> Replace all instances of starts_with() by skip_prefix(),
> which can not only be used to check presence of a prefix,
> but also used further on as it returns the string after the prefix,
> if the prefix is present. And also manages to do, wha
Thanks for the submission. Some comments below to give you a taste of
the Git review process...
On Thu, Mar 6, 2014 at 2:58 AM, Paweł Wawruch wrote:
> From adfcfa0a334378a6242347efc0d614fa193610db Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Pawe=C5=82=20Wawruch?=
> Date: Thu, 6 Mar 2014 00:05:00
On Fri, Mar 07, 2014 at 07:19:15AM +0100, Christian Couder wrote:
> On Wed, Mar 5, 2014 at 11:52 PM, Junio C Hamano wrote:
> >
> > This round is marked as the sixth, but I still see quite a many
> > style issues, which I expect not to see from long timers without
> > being told. Somewhat disappoi
66 matches
Mail list logo