Re: [PATCH v2 05/11] ref-filter: add parse_opt_merge_filter()

2015-06-13 Thread Christian Couder
On Sat, Jun 13, 2015 at 10:18 PM, Karthik Nayak karthik@gmail.com wrote: diff --git a/ref-filter.h b/ref-filter.h index c2856b8..799e118 100644 --- a/ref-filter.h +++ b/ref-filter.h @@ -50,6 +50,18 @@ struct ref_filter_cbdata { struct ref_filter *filter; }; +/* Macros for

Re: Failed assertion in pathspec.c

2015-06-13 Thread Duy Nguyen
On Sun, Jun 14, 2015 at 12:18 AM, Sami Boukortt samibouko...@gmail.com wrote: git: pathspec.c:317: prefix_pathspec: Assertion `item-nowildcard_len = item-len item-prefix = item-len' failed. Known issue, but no one stepped up to fix it yet

Re: [PATCH/RFCv5 3/3] git rebase -i: add static check for commands and SHA-1

2015-06-13 Thread Remi Galan Alfonso
Matthieu Moy matthieu@grenoble-inp.fr writes: Remi Galan Alfonso remi.galan-alfo...@ensimag.grenoble-inp.fr writes: It is mainly because here the SHA-1 is a long one (40 chars) OK, but then the minimum would be to add a comment saying that. Now, this makes me wonder why you are

Re: [PATCH v7 2/5] setup: sanity check file size in read_gitfile_gently

2015-06-13 Thread Eric Sunshine
On Tue, Jun 9, 2015 at 2:24 PM, Erik Elfström erik.elfst...@gmail.com wrote: read_gitfile_gently will allocate a buffer to fit the entire file that should be read. Add a sanity check of the file size before opening to avoid allocating a potentially huge amount of memory if we come across a

Re: [PATCH 01/13] delete_ref(): move declaration to refs.h

2015-06-13 Thread Michael Haggerty
On 06/09/2015 06:42 PM, Stefan Beller wrote: On Tue, Jun 9, 2015 at 3:10 AM, Michael Haggerty mhag...@alum.mit.edu wrote: In set notation, non-NULL = non-NULL and not NULL_SHA1 ∪ non-NULL and equal to NULL_SHA1 The latter two are *not* treated the same, so I don't see

[PATCH v2 00/12] Improve refs module encapsulation

2015-06-13 Thread Michael Haggerty
This is v2 of this patch series. I think I have addressed all of the feedback from v1 [1]. Thanks to Stefan, Peff and Junio for their feedback. Changes since v1: * Change docstring for delete_ref() and a comment within the function definition. * Squash together two commits dealing with the

[PATCH v2 05/12] delete_refs(): improve error message

2015-06-13 Thread Michael Haggerty
Change the error message from Could not remove branch %s to could not remove reference %s * s/branch/reference/. This change makes sense even for the existing caller, which uses the function to delete remote-tracking branches. * Convert it to lower case, as per our usual

[PATCH v2 02/12] remove_branches(): remove temporary

2015-06-13 Thread Michael Haggerty
Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/remote.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builtin/remote.c b/builtin/remote.c index f4a6ec9..53b8e13 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -756,8 +756,7 @@ static int

[PATCH v2 09/12] refs: remove some functions from the module's public interface

2015-06-13 Thread Michael Haggerty
The following functions are no longer used from outside the refs module: * lock_packed_refs() * add_packed_ref() * commit_packed_refs() * rollback_packed_refs() So make these functions private. This is an important step, because it means that nobody outside of the refs module needs to know the

[PATCH v2 10/12] initial_ref_transaction_commit(): check for duplicate refs

2015-06-13 Thread Michael Haggerty
Error out if the ref_transaction includes more than one update for any refname. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- refs.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/refs.c b/refs.c index a715524..dfe9090 100644 --- a/refs.c +++ b/refs.c @@ -4068,12

[PATCH v2 06/12] prune_remote(): use delete_refs()

2015-06-13 Thread Michael Haggerty
This will result in errors being emitted for references that can't be deleted, but that is a good thing. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/remote.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/builtin/remote.c b/builtin/remote.c

[PATCH v2 11/12] initial_ref_transaction_commit(): check for ref D/F conflicts

2015-06-13 Thread Michael Haggerty
In initial_ref_transaction_commit(), check for D/F conflicts (i.e., the type of conflict that exists between refs/foo and refs/foo/bar) among the references being created and between the references being created and any hypothetical existing references. Ideally, there shouldn't *be* any existing

[PATCH v2 12/12] refs: move the remaining ref module declarations to refs.h

2015-06-13 Thread Michael Haggerty
Some functions from the refs module were still declared in cache.h. Move them to refs.h. Add some parameter names where they were missing. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- archive.c | 1 + builtin/blame.c | 1 + builtin/fast-export.c | 1 +

[PATCH v2 01/12] delete_ref(): move declaration to refs.h

2015-06-13 Thread Michael Haggerty
Also * Add a docstring * Rename the second parameter to old_sha1, to be consistent with the convention used elsewhere in the refs module Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- cache.h | 2 -- refs.c | 5 +++-- refs.h | 10 ++ 3 files changed, 13 insertions(+), 4

[PATCH v2 04/12] delete_refs(): new function for the refs API

2015-06-13 Thread Michael Haggerty
Move the function remove_branches() from builtin/remote.c to refs.c, rename it to delete_refs(), and make it public. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/remote.c | 21 + refs.c | 19 +++ refs.h | 7 +++ 3

[PATCH v2 03/12] delete_ref(): handle special case more explicitly

2015-06-13 Thread Michael Haggerty
delete_ref() uses a different convention for its old_sha1 parameter than, say, ref_transaction_delete(): NULL_SHA1 means not to check the old value. Make this fact a little bit clearer in the code by handling it in explicit, commented code rather than burying it in a conditional expression.

[PATCH v2 08/12] initial_ref_transaction_commit(): function for initial ref creation

2015-06-13 Thread Michael Haggerty
git clone uses shortcuts when creating the initial set of references: * It writes them directly to packed-refs. * It doesn't lock the individual references (though it does lock the packed-refs file). * It doesn't check for refname conflicts between two new references or between one new

[PATCH v2 07/12] repack_without_refs(): make function private

2015-06-13 Thread Michael Haggerty
It is no longer called from outside of the refs module. Also move its docstring and change it to imperative voice. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- refs.c | 9 - refs.h | 11 --- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/refs.c

[PATCH v5] git-rebase--interactive.sh: add config option for custom instruction format

2015-06-13 Thread Michael Rappazzo
Difference between v4 and v5 of this patch: - added documention in Documentation/config.txt - renamed the new auto-rebase w/ config test to be less inaccurate Apologies for this, I should have caught these before. Michael Rappazzo (1): git-rebase--interactive.sh: add config option for

[PATCH v5] git-rebase--interactive.sh: add config option for custom instruction format

2015-06-13 Thread Michael Rappazzo
A config option 'rebase.instructionFormat' can override the default 'oneline' format of the rebase instruction list. Since the list is parsed using the left, right or boundary mark plus the sha1, they are prepended to the instruction format. Signed-off-by: Michael Rappazzo rappa...@gmail.com ---

Failed assertion in pathspec.c

2015-06-13 Thread Sami Boukortt
Hi, I can reliably trigger a failed assertion in Git 2.4.3 by performing the following steps: mkdir a; cd a git init touch a.txt git add a.txt git commit -m 'a' cd .. mkdir b; cd b git init git submodule add ../a cd a rm -fr .git git add . This results in: git: pathspec.c:317: prefix_pathspec:

Re: [PATCH 0/8] object_id part 2

2015-06-13 Thread brian m. carlson
On Sat, Jun 13, 2015 at 10:45:29AM +0200, Michael Haggerty wrote: In the same email where I made those design suggestions, I also I pointed out a bug in the implementation of parse_oid_hex(). Maybe that is the reason for the test failures. It probably is, although I either botched a conversion

Re: [PATCH 0/8] object_id part 2

2015-06-13 Thread Michael Haggerty
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/13/2015 12:27 AM, brian m. carlson wrote: On Fri, Jun 12, 2015 at 03:14:25PM -0700, Junio C Hamano wrote: brian m. carlson sand...@crustytoothpaste.net writes: While I did run the tests between each commit, I hadn't noticed they were

[PATCH v2 04/11] for-each-ref: add '--points-at' option

2015-06-13 Thread Karthik Nayak
Add the '--points-at' option provided by 'ref-filter'. The option lets the user to pick only refs which point to a particular commit. Add documentation and tests for the same. Based-on-patch-by: Jeff King p...@peff.net Mentored-by: Christian Couder christian.cou...@gmail.com Mentored-by:

[PATCH v2 02/11] tag: libify parse_opt_points_at()

2015-06-13 Thread Karthik Nayak
Rename 'parse_opt_points_at()' to 'parse_opt_object_name()' and move it from 'tag.c' to 'parse-options'. This now acts as a common parse_opt function which accepts an objectname and stores it into a sha1_array. Based-on-patch-by: Jeff King p...@peff.net Mentored-by: Christian Couder

[PATCH v2 03/11] ref-filter: implement '--points-at' option

2015-06-13 Thread Karthik Nayak
In 'tag -l' we have '--points-at' option which lets users list only tags which point to a particular commit. Implement this option in 'ref-filter.{c,h}' so that other commands can benefit from this. This is duplicated from tag.c, we will eventually remove that when we port tag.c to use ref-filter

[PATCH v2 01/11] t6301: for-each-ref tests for ref-filter APIs

2015-06-13 Thread Karthik Nayak
Add tests for for-each-ref which utilizes the ref-filter APIs. Based-on-patch-by: Jeff King p...@peff.net Mentored-by: Christian Couder christian.cou...@gmail.com Mentored-by: Matthieu Moy matthieu@grenoble-inp.fr Signed-off-by: Karthik Nayak karthik@gmail.com ---

[PATCH v2 00/11] add options to for-each-ref

2015-06-13 Thread karthik nayak
This is continuation of the patch series 'Create ref-filter from for-each-ref' found at : http://article.gmane.org/gmane.comp.version-control.git/271563 The previous version of this series can be found at : http://www.mail-archive.com/git%40vger.kernel.org/msg70929.html Changes made: * Added

[PATCH v2 06/11] ref-filter: implement '--merged' and '--no-merged' options

2015-06-13 Thread Karthik Nayak
In 'branch -l' we have '--merged' option which only lists refs (branches) merged into the named commit and '--no-merged' option which only lists refs (branches) not merged into the named commit. Implement these two options in ref-filter.{c,h} so that other commands can benefit from this.

[PATCH v2 05/11] ref-filter: add parse_opt_merge_filter()

2015-06-13 Thread Karthik Nayak
Add 'parse_opt_merge_filter()' to parse '--merged' and '--no-merged' options and write MACROS for the same. This is copied from 'builtin/branch.c' which will eventually be removed when we port 'branch.c' to use ref-filter APIs. Based-on-patch-by: Jeff King p...@peff.net Mentored-by: Christian

[PATCH v2 08/11] parse-option: rename parse_opt_with_commit()

2015-06-13 Thread Karthik Nayak
Rename parse_opt_with_commit() to parse_opt_commit_object_name() to show that it can be used to obtain a list of commits and is not constricted to usage of '--contains' option. Mentored-by: Christian Couder christian.cou...@gmail.com Mentored-by: Matthieu Moy matthieu@grenoble-inp.fr

[PATCH] Documentation/i18n.txt: clarify character encoding support

2015-06-13 Thread Karsten Blees
As a distributed VCS, git should better define the encodings of its core textual data structures, in particular those that are part of the network protocol. That git is encoding agnostic is only really true for blob objects. E.g. the 'non-NUL bytes' requirement of tree and commit objects excludes

[PATCH (resend)] git-gui: make gc warning threshold match 'git gc --auto'

2015-06-13 Thread Karsten Blees
Date: Wed, 6 Aug 2014 20:43:46 +0200 The number of loose objects at which git-gui shows a gc warning has historically been hardcoded to ~2000, or ~200 on Windows. The warning can only be disabled completely via gui.gcwarning=false. Especially on Windows, the hardcoded threshold is so

[PATCH v8 01/11] for-each-ref: extract helper functions out of grab_single_ref()

2015-06-13 Thread Karthik Nayak
Extract two helper functions out of grab_single_ref(). Firstly, new_refinfo() which is used to allocate memory for a new refinfo structure and copy the objectname, refname and flag to it. Secondly, match_name_as_path() which when given an array of patterns and the refname checks if the refname

[PATCH v8 02/11] for-each-ref: clean up code

2015-06-13 Thread Karthik Nayak
In 'grab_single_ref()' remove the extra count variable 'cnt' and use the variable 'grab_cnt' of structure 'grab_ref_cbdata' directly instead. Mentored-by: Christian Couder christian.cou...@gmail.com Mentored-by: Matthieu Moy matthieu@grenoble-inp.fr Signed-off-by: Karthik Nayak

[PATCH v2 11/11] for-each-ref: add '--contains' option

2015-06-13 Thread Karthik Nayak
Add the '--contains' option provided by 'ref-filter'. The '--contains' option lists only refs which are contain the mentioned commit (HEAD if no commit is explicitly given). Add documentation and tests for the same. Mentored-by: Christian Couder christian.cou...@gmail.com Mentored-by: Matthieu

[PATCH v2 10/11] ref-filter: implement '--contains' option

2015-06-13 Thread Karthik Nayak
'tag -l' and 'branch -l' have two different ways of finding out if a certain ref contains a commit. Implement both these methods in ref-filter and give the caller of ref-filter API the option to pick which implementation to be used. 'branch -l' uses 'is_descendant_of()' from commit.c which is

[PATCH v2 09/11] parse-options.h: add macros for '--contains' option

2015-06-13 Thread Karthik Nayak
Add a macro for using the '--contains' option in parse-options.h also include an optional '--with' option macro which performs the same action as '--contains'. Make tag.c use this new macro Mentored-by: Christian Couder christian.cou...@gmail.com Mentored-by: Matthieu Moy

[PATCH v2 07/11] for-each-ref: add '--merged' and '--no-merged' options

2015-06-13 Thread Karthik Nayak
Add the '--merged' and '--no-merged' options provided by 'ref-filter'. The '--merged' option lets the user to only list refs merged into the named commit. The '--no-merged' option lets the user to only list refs not merged into the named commit. Add documentation and tests for the same.

[PATCH v8 0/11] Create ref-filter from for-each-ref

2015-06-13 Thread karthik nayak
The previous version of the patch can be found at : http://thread.gmane.org/gmane.comp.version-control.git/271423 Changes : * Removed an unnecessary commit (v7 3/12) * Change a comment in 01/11 (v8) Total changes : Makefile |1 + builtin/for-each-ref.c | 1108

[PATCH v8 03/11] for-each-ref: rename 'refinfo' to 'ref_array_item'

2015-06-13 Thread Karthik Nayak
Rename 'refinfo' to 'ref_array_item' as a preparatory step for introduction of new structures in the forthcoming patch. Re-order the fields in 'ref_array_item' so that refname can be eventually converted to a FLEX_ARRAY. Mentored-by: Christian Couder christian.cou...@gmail.com Mentored-by:

[PATCH v8 09/11] ref-filter: move code from 'for-each-ref'

2015-06-13 Thread Karthik Nayak
Move most of the code from 'for-each-ref' to 'ref-filter' to make it publicly available to other commands, this is to unify the code of 'tag -l', 'branch -l' and 'for-each-ref' so that they can share their implementations with each other. Add 'ref-filter' to the Makefile, this completes the

[PATCH v8 05/11] for-each-ref: introduce 'ref_array_clear()'

2015-06-13 Thread Karthik Nayak
Introduce and implement 'ref_array_clear()' which will free all allocated memory for 'ref_array'. Mentored-by: Christian Couder christian.cou...@gmail.com Mentored-by: Matthieu Moy matthieu@grenoble-inp.fr Signed-off-by: Karthik Nayak karthik@gmail.com --- builtin/for-each-ref.c | 21

[PATCH v8 07/11] for-each-ref: rename variables called sort to sorting

2015-06-13 Thread Karthik Nayak
Rename all the variables called sort to sorting to match the function/structure name changes made in the previous patch. Mentored-by: Christian Couder christian.cou...@gmail.com Mentored-by: Matthieu Moy matthieu@grenoble-inp.fr Signed-off-by: Karthik Nayak karthik@gmail.com ---

[PATCH v8 08/11] ref-filter: add 'ref-filter.h'

2015-06-13 Thread Karthik Nayak
This is step one of creating a common library for 'for-each-ref', 'branch -l' and 'tag -l'. This creates a header file with the functions and data structures that ref-filter will provide. We move the data structures created in for-each-ref to this header file. Mentored-by: Christian Couder

[PATCH v8 04/11] for-each-ref: introduce new structures for better organisation

2015-06-13 Thread Karthik Nayak
Introduce 'ref_filter_cbdata' which will hold 'ref_filter' (conditions to filter the refs on) and 'ref_array' (the array of ref_array_items). Modify the code to use these new structures. This is a preparatory patch to eventually move code from 'for-each-ref' to 'ref-filter' and make it publicly

[PATCH v8 11/11] ref-filter: make 'ref_array_item' use a FLEX_ARRAY for refname

2015-06-13 Thread Karthik Nayak
This would remove the need of using a pointer to store refname. Mentored-by: Christian Couder christian.cou...@gmail.com Mentored-by: Matthieu Moy matthieu@grenoble-inp.fr Signed-off-by: Karthik Nayak karthik@gmail.com --- ref-filter.c | 7 --- ref-filter.h | 2 +- 2 files changed, 5

[PATCH v8 10/11] for-each-ref: introduce filter_refs()

2015-06-13 Thread Karthik Nayak
Introduce filter_refs() which will act as an API for filtering a set of refs. Based on the type of refs the user has requested, we iterate through those refs and apply filters as per the given ref_filter structure and finally store the filtered refs in the ref_array structure. Currently this will

[PATCH v8 06/11] for-each-ref: rename some functions and make them public

2015-06-13 Thread Karthik Nayak
Rename some of the functions and make them publicly available. This is a preparatory step for moving code from 'for-each-ref' to 'ref-filter' to make meaningful, targeted services available to other commands via public APIs. Functions renamed are: parse_atom()-

[PATCH v2 04/10] add_sought_entry_mem: convert to struct object_id

2015-06-13 Thread brian m. carlson
Convert this function to use struct object_id. Express several hardcoded constants in terms of GIT_SHA1_HEXSZ. Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- builtin/fetch-pack.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git

[PATCH v2 07/10] push_refs_with_export: convert to struct object_id

2015-06-13 Thread brian m. carlson
Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- transport-helper.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/transport-helper.c b/transport-helper.c index 4ca3e80..1f28b82 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -877,13

[PATCH v2 06/10] get_remote_heads: convert to struct object_id

2015-06-13 Thread brian m. carlson
Replace an unsigned char array with struct object_id and express several hard-coded constants in terms of GIT_SHA1_HEXSZ. Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- connect.c | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git

[PATCH v2 03/10] Convert struct ref to use object_id.

2015-06-13 Thread brian m. carlson
Use struct object_id in three fields in struct ref and convert all the necessary places that use it. Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- builtin/clone.c| 16 +++--- builtin/fetch-pack.c | 4 ++-- builtin/fetch.c| 50

[PATCH v2 02/10] sha1_file: introduce has_object_file helper.

2015-06-13 Thread brian m. carlson
Add has_object_file, which is a wrapper around has_sha1_file, but for struct object_id. Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- cache.h | 3 +++ sha1_file.c | 5 + 2 files changed, 8 insertions(+) diff --git a/cache.h b/cache.h index 571c98f..fa1f067 100644 ---

[PATCH v2 05/10] parse_fetch: convert to use struct object_id

2015-06-13 Thread brian m. carlson
Convert the parse_fetch function to use struct object_id. Remove the strlen check as get_oid_hex will fail safely on receiving a too-short NUL-terminated string. Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- remote-curl.c | 12 ++-- 1 file changed, 6 insertions(+), 6

[PATCH v2 01/10] refs: convert some internal functions to use object_id

2015-06-13 Thread brian m. carlson
Convert several internal functions in refs.c to use struct object_id, and use the GIT_SHA1_HEXSZ constants in parse_ref_line. Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- refs.c | 104 - 1 file changed, 52

[PATCH v2 00/10] object_id part 2

2015-06-13 Thread brian m. carlson
This is another series of conversions to struct object_id. This series converts more of the refs code and struct object to use struct object_id. It introduces an additional helper function, has_object_file, which is the equivalent of has_sha1_file. The name was chosen to be slightly more

[PATCH v2 08/10] ref_newer: convert to use struct object_id

2015-06-13 Thread brian m. carlson
Convert ref_newer and its caller to use struct object_id instead of unsigned char *. Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- builtin/remote.c | 2 +- http-push.c | 4 ++-- remote.c | 8 remote.h | 2 +- 4 files changed, 8 insertions(+), 8

[PATCH] Makefile / racy-git.txt: clarify USE_NSEC prerequisites

2015-06-13 Thread Karsten Blees
Signed-off-by: Karsten Blees bl...@dcon.de --- Enabling nanosecond file times was recently discussed on the libgit2 project, so I thought its time to fix the nanosecond issue on Linux. Don't know yet if the patch will be accepted (and in which kernel version). Considering that nanosecond file

[GSOC] Week 2: Unification of tag -l, branch -l and for-each-ref

2015-06-13 Thread karthik nayak
Hello All, As part of GSoC I'm working on the Unification of 'for-each-ref', 'tag -l' and 'branch -l'. I will update the list on my weekly progress in an effort to keep everyone updated. Current Progress: Currently I have two patches for review on the mailing list. 1. [PATCH v8 0/11] Create