Update several uses of hard-coded 40-based constants to use either
the_hash_algo or GIT_MAX_HEXSZ, as appropriate. Replace a combined use
of oid_to_hex and memcpy with oid_to_hex_r, which not only avoids the
need for a constant, but is more efficient. Make use of parse_oid_hex
to eliminate the ne
When comparing an object ID against that of the empty tree, use the
is_empty_tree_oid function to ensure that we abstract over the hash
algorithm properly. In addition, this is more readable than a plain
oidcmp.
Signed-off-by: brian m. carlson
---
cache-tree.c | 2 +-
1 file changed, 1 insertio
Convert one use of EMPTY_TREE_SHA1_HEX to use oid_to_hex and
the_hash_algo to avoid a dependency on a given hash algorithm.
Signed-off-by: brian m. carlson
---
sequencer.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sequencer.c b/sequencer.c
index 667f35ebdf..b879593486
This script hard-codes the object ID of the empty tree. To avoid any
problems when changing hashes, compute this value by calling git
hash-object.
---
git-merge-one-file.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh
index 9879
To ensure that we are hash algorithm agnostic, use the_hash_algo to look
up the object ID for the empty blob instead of using the empty_tree_oid
variable.
Signed-off-by: brian m. carlson
---
dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dir.c b/dir.c
index 06f4c4a8bf.
The read_empty and reset_hard functions are static and their callers
have already changed to use struct object_id, so convert them as well.
To avoid dependency on the hash algorithm in use, switch from using
EMPTY_TREE_SHA1_HEX to using oid_to_hex with the_hash_algo.
Signed-off-by: brian m. carlso
Convert the last use of EMPTY_TREE_SHA1_BIN to use a direct copy from
the_hash_algo->empty_tree to avoid a dependency on a given hash
algorithm.
Signed-off-by: brian m. carlson
---
builtin/reset.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/reset.c b/builtin/reset
Convert several uses of EMPTY_TREE_SHA1_BIN to use the_hash_algo
and struct object_id instead.
Signed-off-by: brian m. carlson
---
builtin/am.c | 8
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/builtin/am.c b/builtin/am.c
index 9c82603f70..f445fcb593 100644
--- a/builti
"Robin H. Johnson" writes:
> On Fri, Apr 13, 2018 at 07:01:29PM +0200, Michał Górny wrote:
>> Currently git does not control mtimes of files being checked out. This
>> means that the only assumption you could make is that all files created
>> or modified within a single checkout action will have
Instead of using hard-coded 40 constants, refer to the_hash_algo for the
current hash size.
Signed-off-by: brian m. carlson
---
diff.c | 18 --
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/diff.c b/diff.c
index 314c57e3c0..b1666b9b2d 100644
--- a/diff.c
+++ b/di
Signed-off-by: brian m. carlson
---
commit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/commit.c b/commit.c
index ca474a7c11..9617f85caa 100644
--- a/commit.c
+++ b/commit.c
@@ -331,7 +331,7 @@ int parse_commit_buffer(struct commit *item, const void
*buffer, unsigned
Convert this function to take a pointer to struct object_id and rename
it has_object_pack for consistency with has_object_file.
Signed-off-by: brian m. carlson
---
builtin/count-objects.c | 2 +-
builtin/fsck.c | 2 +-
builtin/prune-packed.c | 2 +-
diff.c | 2 +-
pack
Convert one use of EMPTY_TREE_SHA1_HEX to use oid_to_hex and
the_hash_algo to avoid a dependency on a given hash algorithm.
Signed-off-by: brian m. carlson
---
builtin/receive-pack.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/receive-pack.c b/builtin/receive-pack
Convert two static functions to use struct object_id and parse_oid_hex,
instead of relying on harcoded 20 and 40-based constants.
Signed-off-by: brian m. carlson
---
fsck.c | 20 +++-
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/fsck.c b/fsck.c
index 9218c2a643.
Convert two uses of EMPTY_TREE_SHA1_HEX to use oid_to_hex_r and
the_hash_algo to avoid a dependency on a given hash algorithm. Use
oid_to_hex_r in preference to oid_to_hex because the buffer needs to
last through several function calls which might exhaust the limit of
four static buffers.
Signed-
Convert the base_sha1 member of struct split_index to use struct
object_id and rename it base_oid. Include cache.h to make the structure
visible.
Signed-off-by: brian m. carlson
---
builtin/rev-parse.c | 4 ++--
read-cache.c | 22 +++---
split-i
The code for reading certain pack v2 offsets had a hard-coded 5
representing the number of uint32_t words that we needed to skip over.
Specify this value in terms of a value from the_hash_algo.
Signed-off-by: brian m. carlson
---
builtin/index-pack.c | 3 ++-
1 file changed, 2 insertions(+), 1 d
Convert struct submodule and struct parse_config_parameter to use struct
object_id. Adjust the functions which take members of these structures
as arguments to also use struct object_id. Include cache.h into
submodule-config.h to make struct object_id visible.
Signed-off-by: brian m. carlson
--
Instead of using hard-coded instances of the constant 20, use
the_hash_algo to look up the correct constant.
Signed-off-by: brian m. carlson
---
builtin/pack-redundant.c | 12 +++-
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/builtin/pack-redundant.c b/builtin/pack-redun
Use the_hash_algo to look up the length of our current hash instead of
hard-coding the value 20.
Signed-off-by: brian m. carlson
---
tree-walk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tree-walk.c b/tree-walk.c
index e11b3063af..27797c5406 100644
--- a/tree-walk.c
+++
Since the only caller of this function already uses struct object_id,
update get_tree_entry_follow_symlinks to use it in parameters and
internally.
Signed-off-by: brian m. carlson
---
sha1_name.c | 4 ++--
tree-walk.c | 16
tree-walk.h | 2 +-
3 files changed, 11 insertions(+)
There are several instances of the constant 20 and 20-based values in
the packfile code. Abstract away dependence on SHA-1 by using the
values from the_hash_algo instead.
Use unsigned values for temporary constants to provide the compiler with
more information about what kinds of values it should
Add a repository argument to allow the callers of retry_bad_packed_offset
to be more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.
As with the previous commits, use a macro to
Add a repository argument to allow the callers of read_object
to be more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.
As with the previous commits, use a macro to catch calle
Add a repository argument to allow the callers of oid_object_info
to be more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.
In the expanded macro the identifier `the_repository
This applies on top of origin/sb/object-store-replace and is available as
https://github.com/stefanbeller/git/tree/oid_object_info
This continues the work of sb/packfiles-in-repository,
extending the layer at which we have to pass in an explicit
repository object to oid_object_info.
A test merge
Add a repository argument to allow oid_object_info_extended callers
to be more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.
Signed-off-by: Stefan Beller
---
builtin/cat-fil
Add a repository argument to allow the callers of cache_or_unpack_entry
to be more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.
As with the previous commits, use a macro to c
From: Jonathan Nieder
Add a repository argument to allow callers of packed_object_info to be
more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.
As with the previous commits,
Add a repository argument to allow the callers of unpack_entry
to be more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.
As with the previous commits, use a macro to catch call
This involves also adapting sha1_object_info_extended and a some
internal functions that are used to implement these. It all has to
happen in one patch, because of a single recursive chain of calls visits
all these functions.
Signed-off-by: Jonathan Nieder
Signed-off-by: Stefan Beller
---
cache
Add a repository argument to allow the callers of packed_to_object_type
to be more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.
As with the previous commits, use a macro to c
Elijah Newren writes:
> Out of 53288 merge commits with exactly two parents in linux.git:
> - 48491 merged identically
> - 4737 merged the same other than a few different "Auto-merging
> " output lines (as expected due to patch 35/36)
> - 53 merged the same other than different "Checkin
Add a config option that allows selecting the default color scheme for
blame. The command line still takes precedence over the configuration.
It is to be seen, how color.ui will integrate with blame coloring.
Signed-off-by: Stefan Beller
---
Documentation/config.txt | 5 +
builtin/blame.c
When using git-blame lots of lines contain redundant information, for
example in hunks that consist of multiple lines, the metadata (commit
name, author, date) are repeated. A reader may not be interested in those,
so offer an option to color the information that is repeated from the
previous line
This is a revamp of
https://public-inbox.org/git/20180416220955.46163-1-sbel...@google.com/
Junio had some issue with that version, as it would collide config and command
line options. This is fixed now by introducing another option.
Thanks,
Stefan
Stefan Beller (3):
builtin/blame: dim uninter
Choose a different color for dates and imitate a 'temperature cool down'
depending upon age.
Originally I had planned to have the temperature cool down dependent on
the age of the project or file for example, as that might scale better,
but that can be added on top of this commit, e.g. instead of
On Mon, Apr 23, 2018 at 4:46 PM, Junio C Hamano wrote:
> Elijah Newren writes:
>
>> Out of 53288 merge commits with exactly two parents in linux.git:
>> - 48491 merged identically
>> - 4737 merged the same other than a few different "Auto-merging
>> " output lines (as expected due to patc
Currently, all callers of unpack_trees() set o->src_index == o->dst_index.
The code in unpack_trees() does not correctly handle them being different.
There are two separate issues:
First, there is the possibility of memory corruption. Since
unpack_trees() creates a temporary index in o->result an
On Mon, Apr 23, 2018 at 04:43:20PM -0700, Stefan Beller wrote:
> Add a repository argument to allow the callers of oid_object_info
> to be more specific about which repository to handle. This is a small
> mechanical change; it doesn't change the implementation to handle
> repositories other than th
On Mon, Apr 23, 2018 at 04:43:27PM -0700, Stefan Beller wrote:
> This involves also adapting sha1_object_info_extended and a some
> internal functions that are used to implement these. It all has to
> happen in one patch, because of a single recursive chain of calls visits
> all these functions.
A
On Mon, Apr 23, 2018 at 5:34 PM, brian m. carlson
wrote:
> On Mon, Apr 23, 2018 at 04:43:27PM -0700, Stefan Beller wrote:
>> This involves also adapting sha1_object_info_extended and a some
>> internal functions that are used to implement these. It all has to
>> happen in one patch, because of a s
Jonathan Nieder writes:
> diff --git a/Makefile b/Makefile
> index 8f4cb506ff..727eca5d0a 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2108,7 +2108,7 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE)
> GIT-PERL-DEFINES Makefile
> INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
> INSTLIBDIR="
> This script hard-codes the object ID of the empty tree. To avoid any
s/tree/blob/
> problems when changing hashes, compute this value by calling git
> hash-object.
Missing signoff.
> ---
> git-merge-one-file.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/git-me
On Tue, Apr 24, 2018 at 03:00:55AM +0200, SZEDER Gábor wrote:
> > This script hard-codes the object ID of the empty tree. To avoid any
>
> s/tree/blob/
>
> > problems when changing hashes, compute this value by calling git
> > hash-object.
>
> Missing signoff.
Thanks, will fix.
--
brian m. ca
Johannes Schindelin writes:
> +void argv_array_split(struct argv_array *array, const char *to_split)
> +{
> + while (isspace(*to_split))
> + to_split++;
> + for (;;) {
> + const char *p = to_split;
> +
> + if (!*p)
> + break;
> +
> +
Johannes Schindelin writes:
> Eric Sunshine pointed out that I had such a commit message in
> https://public-inbox.org/git/CAPig+cRrS0_nYJJY=o6cbov630snqhpv5qgrqdd8mw-syzn...@mail.gmail.com/
> and I went on a hunt to figure out how the heck this happened.
>
> Turns out that if there is a fixup/sq
Johannes Schindelin writes:
> We carried a slightly different version of the git_setup_gettext() patch
> (which took care of releasing the buffer allocated by system_path()),
> and we carry two more patches that touch the same area, so now that
> dj/runtime-prefix hit `next`, it seems a good time
Junio C Hamano writes:
>> base-commit: b46fe60e1d7235603a29499822493bd3791195da
>
> Basing your work on the tip of 'next' is good for discussion, but
> not readily usable for final application. Let me see if I can
> untangle the dependents to come up with a reasonable base.
I'll queue this on t
Elijah Newren writes:
> Marked as PATCH v2, though I marked the previous one as "RFC PATCH v10
> 32.5/36" because I thought I was going to put it in my series. But it is
> an independent fix that my series needs.
Thanks. Let's take this before the remainder of the series ;-)
Stefan Beller writes:
> This is a revamp of
> https://public-inbox.org/git/20180416220955.46163-1-sbel...@google.com/
>
> Junio had some issue with that version, as it would collide config and command
> line options. This is fixed now by introducing another option.
Heh, that sounds as if the ser
Jonathan Nieder writes:
> Junio noticed that this variable is not quoted correctly when it is
> passed to sed. As a shell-quoted string, it should be inside
> single-quotes like $(perllibdir_relative_SQ), not outside them like
> $INSTLIBDIR.
Spreading credit is very much appreciated, but in thi
f6a0ad4b (Makefile: generate Perl header from template file,
2018-04-10) moved some code for generating the 'use lib' lines at the
top of perl scripts from the $(SCRIPT_PERL_GEN) rule to a separate
GIT-PERL-HEADER rule.
This rule first populates INSTLIBDIR and then substitutes it into the
GIT-PERL
Junio C Hamano writes:
> Johannes Schindelin writes:
>
>> +void argv_array_split(struct argv_array *array, const char *to_split)
>> +{
>> +while (isspace(*to_split))
>> +to_split++;
>> +for (;;) {
>> +const char *p = to_split;
>> +
>> +if (!*p)
>> +
Junio C Hamano writes:
> Junio C Hamano writes:
>
>>> base-commit: b46fe60e1d7235603a29499822493bd3791195da
>>
>> Basing your work on the tip of 'next' is good for discussion, but
>> not readily usable for final application. Let me see if I can
>> untangle the dependents to come up with a reaso
Good catch, thanks for doing this!
-Dan
On Mon, Apr 23, 2018 at 10:18 PM Jonathan Nieder wrote:
> f6a0ad4b (Makefile: generate Perl header from template file,
> 2018-04-10) moved some code for generating the 'use lib' lines at the
> top of perl scripts from the $(SCRIPT_PERL_GEN) rule to a separa
Elijah Newren writes:
> unpack-trees.c | 17 ++---
> 1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/unpack-trees.c b/unpack-trees.c
> index e73745051e..08f6cab82e 100644
> --- a/unpack-trees.c
> +++ b/unpack-trees.c
> @@ -1284,9 +1284,20 @@ int unpack_trees(unsigne
On Mon, Apr 23, 2018 at 3:38 PM, Thomas Gummerer wrote:
> There are two members of 'struct add_opts', which are only used inside
> the 'add()' function, but being part of 'struct add_opts' they are
> needlessly also passed to the 'add_worktree' function.
>
> Make them local to the 'add()' function
On Mon, Apr 23, 2018 at 3:38 PM, Thomas Gummerer wrote:
> Currently 'git worktree add' produces output like the following:
>
> Preparing ../foo (identifier foo)
> HEAD is now at 26da330922
>
> The '../foo' is the path where the worktree is created, which the user
> has just given on the c
On Mon, Apr 23, 2018 at 3:38 PM, Thomas Gummerer wrote:
> Currently 'git worktree add ' creates a new branch named after the
> basename of the path by default. If a branch with that name already
> exists, the command refuses to do anything, unless the '--force' option
> is given.
>
> However we c
On Mon, Apr 23, 2018 at 03:34:21AM -0400, Eric Sunshine wrote:
> On Mon, Apr 23, 2018 at 3:27 AM, Ævar Arnfjörð Bjarmason
> wrote:
> > On Mon, Apr 23 2018, Eric Sunshine wrote:
> >> One important issue I noticed is that patch 3/7 neglects to update
> >> grep.c:init_grep_defaults() to initialize op
On Mon, Apr 23, 2018 at 10:01:17AM +0200, Ævar Arnfjörð Bjarmason wrote:
>
> On Mon, Apr 23 2018, Taylor Blau wrote:
>
> > For your consideration:
> > https://github.com/ttaylorr/git/compare/tb/grep-colno
>
> Looks good to me aside from two minor issues I noticed:
>
> * In "grep.c: display column
"Philip Oakley" writes:
>> +-r::
>> +--rebase-merges::
>> + By default, a rebase will simply drop merge commits and only rebase
>> + the non-merge commits. With this option, it will try to preserve
>> + the branching structure within the commits that are to be rebased,
>> + by recreating the merg
Hi,
Attached is v3 of my series to teach '--column-numbers' to 'git-grep(1)'.
Since last time, I have:
* Removed '-m' in a few places that I forgot to during v2 [1] [2].
* Expanded upon the definition of '--column-number' in 'git grep
--help'. [3]
* Initialized some new fields in gre
When calling match_line(), callers presently cannot determine the
relative offset of the match because match_line() discards the
'regmatch_t' that contains this information.
Instead, teach match_line() to take in a 'regmatch_t *' so that callers
can inspect the match's starting and ending offset f
lineNumber has casing that is inconsistent with surrounding options,
like color.grep.matchContext, and color.grep.matchSelected. Re-case this
documentation in order to be consistent with the text around it, and to
ensure that new entries are consistent, too.
Signed-off-by: Taylor Blau
---
Docume
To support showing the matched column when calling 'git-grep(1)', teach
'grep_opt' the normal set of options to configure the default behavior
and colorization of this feature.
Signed-off-by: Taylor Blau
---
grep.c | 3 +++
grep.h | 2 ++
2 files changed, 5 insertions(+)
diff --git a/grep.c b/g
Teach 'git-grep(1)' a new option, '--column-number', to show the column
number of the first match on a non-context line.
For example:
$ ./git-grep -n --column-number foo | head -n3
.clang-format:51:14:# myFunction(foo, bar, baz);
.clang-format:64:7:# int foo();
.clang-format:75:8:# void f
To prepare for 'git grep' learning '--column-number', teach grep.c's
show_line() how to show the column of the first match on non-context
line.
Signed-off-by: Taylor Blau
---
grep.c | 21 -
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/grep.c b/grep.c
index f
To support git-grep(1)'s new option, '--column-number', document and
teach grep.c how to interpret relevant configuration options, similar to
those associated with '--line-number'.
Signed-off-by: Taylor Blau
---
Documentation/config.txt | 5 +
Documentation/git-grep.txt | 3 +++
grep.c
Take advantage of 'git-grep(1)''s new option, '--column-number' in order
to teach Peff's 'git-jump' script how to jump to the correct column for
any given match.
'git-grep(1)''s output is in the correct format for Vim's jump list, so
no additional cleanup is necessary.
Signed-off-by: Taylor Blau
After we initialize the various fields in `opts` but before we actually
use them, we might return early. Move the initialization further down,
to immediately before we use `opts`.
This limits the scope of `opts` and will help a subsequent commit fix a
memory leak without having to worry about thos
Hi Phillip,
On 23 April 2018 at 17:54, Phillip Wood wrote:
> I'm fine with leaving it, I've might get round to doing a small series to
> clean things up slightly in a few weeks. At the moment
> setup_unpack_trees_porcelain() leaks memory as it is called for each merge
> and allocates new strings
The strings allocated in `setup_unpack_trees_porcelain()` are never
freed. Provide a function `clear_unpack_trees_porcelain()` to do so and
call it in the functions which use `setup_unpack_trees_porcelain()`.
In all current callers, the pointers are about to go out of scope, so we
do not need to s
On Tue, Apr 24, 2018 at 1:07 AM, Taylor Blau wrote:
> Take advantage of 'git-grep(1)''s new option, '--column-number' in order
> to teach Peff's 'git-jump' script how to jump to the correct column for
> any given match.
>
> 'git-grep(1)''s output is in the correct format for Vim's jump list, so
>
On Tue, Apr 24, 2018 at 1:07 AM, Taylor Blau wrote:
> To prepare for 'git grep' learning '--column-number', teach grep.c's
> show_line() how to show the column of the first match on non-context
> line.
>
> Signed-off-by: Taylor Blau
> ---
> diff --git a/grep.c b/grep.c
> @@ -1399,6 +1399,17 @@ st
Ævar Arnfjörð Bjarmason writes:
> I think when we add features to git-grep we should be as close to GNU
> grep as possible (e.g. not add this -m alias meaning something different
> as in your v1), but if GNU grep doesn't have something go with the trend
> of other grep tools, as noted at
> https:
On Mon, Apr 23, 2018 at 10:13 PM, Martin Ågren wrote:
> After we initialize the various fields in `opts` but before we actually
> use them, we might return early. Move the initialization further down,
> to immediately before we use `opts`.
>
> This limits the scope of `opts` and will help a subseq
Currently, all callers of unpack_trees() set o->src_index == o->dst_index.
The code in unpack_trees() does not correctly handle them being different.
There are two separate issues:
First, there is the possibility of memory corruption. Since
unpack_trees() creates a temporary index in o->result an
101 - 179 of 179 matches
Mail list logo