Re: [PATCH v5 12/27] refs: forbid cross-backend ref renames

2016-02-19 Thread Duy Nguyen
On Thu, Feb 18, 2016 at 12:17 PM, David Turner wrote: > This would be pretty weird, but since it will break, we should prevent > it. > > Signed-off-by: David Turner > --- > refs.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git

Re: [PATCH v5 25/27] refs: add LMDB refs storage backend

2016-02-19 Thread Duy Nguyen
> On Fri, 2016-02-19 at 09:54 +0700, Duy Nguyen wrote: >> On Fri, Feb 19, 2016 at 3:23 AM, David Turner < >> dtur...@twopensource.com> wrote: >> > > > +static int read_per_worktree_ref(const char *submodule, const >> > > > char >> > > > *refname, >> > > > +struct

Re: [PATCHv14 5/7] git submodule update: have a dedicated helper for cloning

2016-02-19 Thread Jonathan Nieder
Stefan Beller wrote: > On Fri, Feb 19, 2016 at 3:07 PM, Jonathan Nieder wrote: [...] >>> + strbuf_addf(err, "Skipping submodule '%s'\n", >>> + displaypath); >> >> Does the caller expect a newline at the end of err? >> >> In the refs code

Re: [PATCH] submodule: Fetch the direct sha1 first

2016-02-19 Thread Junio C Hamano
Stefan Beller writes: > On Fri, Feb 19, 2016 at 2:29 PM, Junio C Hamano wrote: >> Stefan Beller writes: >> >>> Doing a 'git fetch' only and not the fetch for the specific sha1 would be >>> incorrect? >> >> I thought that was what you

Re: [PATCHv14 5/7] git submodule update: have a dedicated helper for cloning

2016-02-19 Thread Stefan Beller
On Fri, Feb 19, 2016 at 3:07 PM, Jonathan Nieder wrote: > > I still have trouble reading this patch (patch 5). Some musing below > to figure out what could change to make it more readable (perhaps in a > patch on top). After this review (I added replies from bottom to top,

Re: [PATCH] submodule: Fetch the direct sha1 first

2016-02-19 Thread Stefan Beller
On Fri, Feb 19, 2016 at 2:29 PM, Junio C Hamano wrote: > Stefan Beller writes: > >> Doing a 'git fetch' only and not the fetch for the specific sha1 would be >> incorrect? > > I thought that was what you are attempting to address. Yep. In an ideal world I

Re: [PATCH v5 25/27] refs: add LMDB refs storage backend

2016-02-19 Thread Junio C Hamano
David Turner writes: > Something like the following? > > commit aad6b84fd1869f6e1cf6ed15bcece0c2f6429e9d > Author: David Turner > Date: Thu Feb 18 17:09:29 2016 -0500 > > refs: break out some functions from resolve_ref_1 > > A

Re: [PATCHv14 5/7] git submodule update: have a dedicated helper for cloning

2016-02-19 Thread Jonathan Nieder
Hi, Stefan Beller wrote: > This introduces a new helper function in git submodule--helper > which takes care of cloning all submodules, which we want to > parallelize eventually. Patches 1-4 are still Reviewed-by: Jonathan Nieder I still have trouble reading this patch

Re: [PATCH v5 25/27] refs: add LMDB refs storage backend

2016-02-19 Thread David Turner
On Thu, 2016-02-18 at 15:50 +0700, Duy Nguyen wrote: > Caveat: I did not study how to use lmdb. I just guessed what it does > based on function names. I don't know much about refs handling either > (especially since the transaction thing is introduced) > > > diff --git

Re: [PATCH] git-p4.py: Make submit working on bare repository

2016-02-19 Thread Junio C Hamano
Amadeusz Żołnowski writes: > git-p4 can be successfully used from bare repository (which may act as a > bridge between Perforce repository and pure Git repositories). After > submitting changelist to Perforce, git-p4 performs unconditional rebase > which obviously fails. >

Re: [PATCH] submodule: Fetch the direct sha1 first

2016-02-19 Thread Junio C Hamano
Stefan Beller writes: > Doing a 'git fetch' only and not the fetch for the specific sha1 would be > incorrect? I thought that was what you are attempting to address. > ('git fetch' with no args finishes successfully, so no fallback is > triggered. But we are not sure if we

Re: [PATCH] submodule: Fetch the direct sha1 first

2016-02-19 Thread Stefan Beller
On Fri, Feb 19, 2016 at 1:13 PM, Junio C Hamano wrote: > Stefan Beller writes: > >> When reviewing a change in Gerrit, which also updates a submodule, >> a common review practice is to download and cherry-pick the patch locally >> to test it. However when

[PATCH] git-p4.py: Make submit working on bare repository

2016-02-19 Thread Amadeusz Żołnowski
git-p4 can be successfully used from bare repository (which may act as a bridge between Perforce repository and pure Git repositories). After submitting changelist to Perforce, git-p4 performs unconditional rebase which obviously fails. Perform rebase only on non-bare repositories, so submit

Re: [PATCH] exec_cmd.c: use find_last_dir_sep() for code simplification

2016-02-19 Thread Junio C Hamano
Alexander Kuleshov writes: > We are trying to extract dirname from argv0 in the git_extract_argv0_path(). > But in the same time, the provides find_last_dir_sep() > to get dirname from a given path. Let's use it instead of loop for the code > simplification. > >

Re: [PATCH] submodule: Fetch the direct sha1 first

2016-02-19 Thread Junio C Hamano
Stefan Beller writes: > When reviewing a change in Gerrit, which also updates a submodule, > a common review practice is to download and cherry-pick the patch locally > to test it. However when testing it locally, the 'git submodule update' > may fail fetching the correct

Re: [PATCHv14 0/7] Expose submodule parallelism to the user

2016-02-19 Thread Junio C Hamano
Looks good. I didn't notice these unnecessary blank lines while reading the previous rounds, and it is good to see them go. Let's wait for a few days and merge them to 'next'. David's ref backend topic textually depends on this, and we'd better give it a solid foundation to build on soon.

Re: GSoC 2016: applications open, deadline = Fri, 19/2

2016-02-19 Thread Junio C Hamano
Lars Schneider writes: > If this mode is enabled then Git shall print a warning message before > running a potentially destructive command. In addition to the warning > Git shall print a command that would reverse the operation if possible. > Most of the information

Re: GSoC 2016: applications open, deadline = Fri, 19/2

2016-02-19 Thread Junio C Hamano
Matthieu Moy writes: >> We have these "powerful" tools for a reason. After making a mess >> experimenting with your working tree files, "reset --hard" is the >> best tool to go back to the known-good state, > > I disagree with that. This reminds me a discussion I

Re: git submodule should honor "-c credential.helper" command line argument

2016-02-19 Thread Jacob Keller
On Fri, Feb 19, 2016 at 9:33 AM, Junio C Hamano wrote: > Jeff King writes: > >> That being said, I am not sure this is the right solution. In the thread >> I linked earlier[1], Jens indicated he would prefer not to blindly share >> config with the submodules,

Re: Test failures with GNU grep 2.23

2016-02-19 Thread Jeff King
On Fri, Feb 19, 2016 at 07:23:11PM +, John Keeping wrote: > I suspect that any grep that lacks "-a" also lacks binary file handling > that will break these tests. I found a Solaris grep that doesn't > support "-a" and it treats these files as text. > > From that perspective, it would be

Re: Test failures with GNU grep 2.23

2016-02-19 Thread John Keeping
On Fri, Feb 19, 2016 at 09:38:17AM -0800, Junio C Hamano wrote: > Jeff King writes: > > > Yeah, I'd worry that "-a" is not portable. OTOH, BSD grep seems to have > > it, so between that and GNU, I think most systems are covered. We could > > do: > > > > test_lazy_prereq GREP_A '

Re: [PATCH 13/21] fast-import: simplify allocation in start_packfile

2016-02-19 Thread Jeff King
On Fri, Feb 19, 2016 at 09:48:54AM -0800, Junio C Hamano wrote: > Jeff King writes: > > > This function allocate a packed_git flex-array, and adds a > > s/allocate//, right? Yes, thanks. -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a

Re: Test failures with GNU grep 2.23

2016-02-19 Thread Jeff King
On Fri, Feb 19, 2016 at 09:38:17AM -0800, Junio C Hamano wrote: > Jeff King writes: > > > Yeah, I'd worry that "-a" is not portable. OTOH, BSD grep seems to have > > it, so between that and GNU, I think most systems are covered. We could > > do: > > > > test_lazy_prereq GREP_A

Re: [PATCHv13 5/7] git submodule update: have a dedicated helper for cloning

2016-02-19 Thread Stefan Beller
On Fri, Feb 19, 2016 at 11:08 AM, Jeff King wrote: > On Fri, Feb 19, 2016 at 12:20:48PM -0500, Eric Sunshine wrote: > >> >>> + argv_array_pushl(>args, "--path", sub->path, NULL); >> >>> + argv_array_pushl(>args, "--name", sub->name, NULL); >> >>> +

Re: [PATCH v5 25/27] refs: add LMDB refs storage backend

2016-02-19 Thread David Turner
On Fri, 2016-02-19 at 09:54 +0700, Duy Nguyen wrote: > On Fri, Feb 19, 2016 at 3:23 AM, David Turner < > dtur...@twopensource.com> wrote: > > > > +static int read_per_worktree_ref(const char *submodule, const > > > > char > > > > *refname, > > > > +struct MDB_val *val,

Re: [PATCHv13 5/7] git submodule update: have a dedicated helper for cloning

2016-02-19 Thread Jeff King
On Fri, Feb 19, 2016 at 12:20:48PM -0500, Eric Sunshine wrote: > >>> + argv_array_pushl(>args, "--path", sub->path, NULL); > >>> + argv_array_pushl(>args, "--name", sub->name, NULL); > >>> + argv_array_pushl(>args, "--url", strdup(url), NULL); > >> > >> No need

[PATCH] submodule: Fetch the direct sha1 first

2016-02-19 Thread Stefan Beller
When reviewing a change in Gerrit, which also updates a submodule, a common review practice is to download and cherry-pick the patch locally to test it. However when testing it locally, the 'git submodule update' may fail fetching the correct submodule sha1 as the corresponding commit in the

Re: [PATCH] git-p4.py: Don't try to rebase on submit from bare repository

2016-02-19 Thread Eric Sunshine
On Fri, Feb 19, 2016 at 1:27 PM, Amadeusz Żołnowski wrote: > git-p4 can be successfully used from bare repository (which acts as a > bridge between Perforce repository and pure Git repositories). On submit > git-p4 performs unconditional rebase. Do rebase only on non-bare >

Re: GSoC 2016: Microproject

2016-02-19 Thread Mehul Jain
On Fri, Feb 19, 2016 at 11:20 PM, Stefan Beller wrote: > Yes, most likely t/t5521-pull-options.sh or t/t5520-pull.sh would be the right > place as judging from the file name of the tests. Thanks for specifying the files. I think t/t5520-pull.sh line 258 will be the best place

[PATCH] git-p4.py: Don't try to rebase on submit from bare repository

2016-02-19 Thread Amadeusz Żołnowski
git-p4 can be successfully used from bare repository (which acts as a bridge between Perforce repository and pure Git repositories). On submit git-p4 performs unconditional rebase. Do rebase only on non-bare repositories. Signed-off-by: Amadeusz Żołnowski --- git-p4.py | 5

Re: [PATCH v6 0/4] config: add '--sources' option to print the source of a config value

2016-02-19 Thread Junio C Hamano
larsxschnei...@gmail.com writes: > From: Lars Schneider > > diff to v5: > * rename 'type' to 'origin_type' as 'type' is too broad a word in the context > of configuration file (Thanks to the reviewers Junio and Dscho) > * add dedicated patch to rename

[PATCHv14 4/7] submodule update: direct error message to stderr

2016-02-19 Thread Stefan Beller
Reroute the error message for specified but initialized submodules to stderr instead of stdout. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- git-submodule.sh | 4 ++-- t/t7400-submodule-basic.sh | 4 ++-- 2 files changed, 4

[PATCHv14 7/7] clone: allow an explicit argument for parallel submodule clones

2016-02-19 Thread Stefan Beller
Just pass it along to "git submodule update", which may pick reasonable defaults if you don't specify an explicit number. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- Documentation/git-clone.txt | 6 +- builtin/clone.c |

[PATCHv14 3/7] fetching submodules: respect `submodule.fetchJobs` config option

2016-02-19 Thread Stefan Beller
This allows to configure fetching and updating in parallel without having the command line option. This moved the responsibility to determine how many parallel processes to start from builtin/fetch to submodule.c as we need a way to communicate "The user did not specify the number of parallel

[PATCHv14 0/7] Expose submodule parallelism to the user

2016-02-19 Thread Stefan Beller
Thanks Junio, Jeff and Eric for reviewing once again! * fixes as proposed by Junio for readability in parse_submodule_update_strategy * Do not leak the `url`, as found by Jeff. (I dug into the code of argv_array_pushl and you're obviously correct) Thanks, Stefan Interdiff to v13: diff --git

[PATCHv14 2/7] submodule-config: drop check against NULL

2016-02-19 Thread Stefan Beller
Adhere to the common coding style of Git and not check explicitly for NULL throughout the file. There are still other occurrences in the code base but that is usually inside of conditions with side effects. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano

[PATCHv14 1/7] submodule-config: keep update strategy around

2016-02-19 Thread Stefan Beller
Currently submodule..update is only handled by git-submodule.sh. C code will start to need to make use of that value as more of the functionality of git-submodule.sh moves into library code in C. Add the update field to 'struct submodule' and populate it so it can be read as sm->update or from

[PATCHv14 6/7] submodule update: expose parallelism to the user

2016-02-19 Thread Stefan Beller
Expose possible parallelism either via the "--jobs" CLI parameter or the "submodule.fetchJobs" setting. By having the variable initialized to -1, we make sure 0 can be passed into the parallel processing machine, which will then pick as many parallel workers as there are CPUs. Signed-off-by:

[PATCHv14 5/7] git submodule update: have a dedicated helper for cloning

2016-02-19 Thread Stefan Beller
This introduces a new helper function in git submodule--helper which takes care of cloning all submodules, which we want to parallelize eventually. Some tests (such as empty URL, update_mode=none) are required in the helper to make the decision for cloning. These checks have been moved into the C

Re: GSoC 2016: Microproject

2016-02-19 Thread Stefan Beller
On Fri, Feb 19, 2016 at 9:39 AM, Mehul Jain wrote: > On Fri, Feb 19, 2016 at 6:33 PM, Matthieu Moy > wrote: >> Hi, >> >> This is a double-post. You've posted almost the same message under the >> title "GSoC 2016". Nothing serious, but

Re: [PATCH 13/21] fast-import: simplify allocation in start_packfile

2016-02-19 Thread Junio C Hamano
Jeff King writes: > This function allocate a packed_git flex-array, and adds a s/allocate//, right? > mysterious 2 bytes to the length of the pack_name field. One > is for the trailing NUL, but the other has no purpose. This > is probably cargo-culted from add_packed_git, which

Re: GSoC 2016: Microproject

2016-02-19 Thread Mehul Jain
On Fri, Feb 19, 2016 at 6:33 PM, Matthieu Moy wrote: > Hi, > > This is a double-post. You've posted almost the same message under the > title "GSoC 2016". Nothing serious, but attention to details is > important if you want to give a good image of yourself. I'm

Re: Test failures with GNU grep 2.23

2016-02-19 Thread Junio C Hamano
Jeff King writes: > Yeah, I'd worry that "-a" is not portable. OTOH, BSD grep seems to have > it, so between that and GNU, I think most systems are covered. We could > do: > > test_lazy_prereq GREP_A ' > echo foo | grep -a foo > ' > > and mark these tests with it. I'd

Re: git submodule should honor "-c credential.helper" command line argument

2016-02-19 Thread Junio C Hamano
Jeff King writes: > That being said, I am not sure this is the right solution. In the thread > I linked earlier[1], Jens indicated he would prefer not to blindly share > config with the submodules, and I think I agree. Or are you proposing to > pick and choose the keys in

Re: Test failures with GNU grep 2.23

2016-02-19 Thread Eric Sunshine
On Fri, Feb 19, 2016 at 6:59 AM, Jeff King wrote: > On Sun, Feb 07, 2016 at 04:25:40PM +, John Keeping wrote: >> The following patch fixes the tests for me, but I wonder if "-a" is >> supported on all target platforms (it's not in POSIX, which specifies >> that the "input files

Re: [PATCHv13 5/7] git submodule update: have a dedicated helper for cloning

2016-02-19 Thread Eric Sunshine
On Fri, Feb 19, 2016 at 11:47 AM, Stefan Beller wrote: > On Fri, Feb 19, 2016 at 4:03 AM, Jeff King wrote: >> On Thu, Feb 18, 2016 at 03:33:16PM -0800, Stefan Beller wrote: >> >>> + if (needs_cloning) { >>> + cp->git_cmd = 1; >>> +

Re: [PATCH] git-p4.py: Don't try to rebase on submit from bare repository

2016-02-19 Thread Junio C Hamano
Luke Diamand writes: > On 17 February 2016 at 22:46, Amadeusz Żołnowski wrote: >> git-p4 can be successfully used from bare repository (which acts as a >> bridge between Perforce repository and pure Git repositories). On submit >> git-p4 performs

Re: [PATCH 05/20] rename_tmp_log(): use raceproof_create_file()

2016-02-19 Thread Junio C Hamano
Michael Haggerty writes: > Now, we have to consider the opposite case, namely that we are calling a > non-buggy implementation of `rename()`, and we artificially change > ENOTDIR to EISDIR. Can that cause any bad effects? > > I don't think so, because the case where a

Re: [PATCHv13 5/7] git submodule update: have a dedicated helper for cloning

2016-02-19 Thread Stefan Beller
On Fri, Feb 19, 2016 at 4:03 AM, Jeff King wrote: > On Thu, Feb 18, 2016 at 03:33:16PM -0800, Stefan Beller wrote: > >> + if (needs_cloning) { >> + cp->git_cmd = 1; >> + cp->no_stdin = 1; >> + cp->stdout_to_stderr = 1; >> +

Re: [PATCH 05/20] rename_tmp_log(): use raceproof_create_file()

2016-02-19 Thread Michael Haggerty
On 02/17/2016 09:53 PM, Junio C Hamano wrote: > Michael Haggerty writes: > >> Besides shortening the code, this saves an unnecessary call to >> safe_create_leading_directories_const() in almost all cases. >> >> Signed-off-by: Michael Haggerty >> ---

Greetings

2016-02-19 Thread Estelle Amadieu
Greetings, I am Mrs Estelle Amadieu, I am 65 years old base in Cote d'Ivoire I write to relate to you of my intention to use my money 2.5 million dollars for charity work in your country. I was married to Late Chrestien Amadieu who was a contractor with the Government of Cote d'Ivoire before

Re: GSoC 2016: Microproject

2016-02-19 Thread Matthieu Moy
Hi, This is a double-post. You've posted almost the same message under the title "GSoC 2016". Nothing serious, but attention to details is important if you want to give a good image of yourself. Mehul Jain writes: > Hello everyone, > > I'm Mehul Jain. I'm looking for

Re: GSoC 2016: applications open, deadline = Fri, 19/2

2016-02-19 Thread Matthieu Moy
Lars Schneider writes: > Thanks for your elaborate response. I think I got your point and I > tried to adjust my "beginner mode" proposal accordingly [1]. Now merged as https://github.com/git/git.github.io/commit/6b8b5e19cdb221192dedd70ba3e207636f1cdab1 I've added a

Re: [PATCH] merge_blobs: use strbuf instead of manually-sized mmfile_t

2016-02-19 Thread Stefan Frühwirth
On 2016-02-16 at 22:27 Junio C Hamano wrote: Three, I know the existence of the program is not more than "we could do something like this" illustration by Linus, and its output is in no way _designed_ to be so. We know today that it does not do Well, then it is just really sad that the

Re: [PATCH] merge_blobs: use strbuf instead of manually-sized mmfile_t

2016-02-19 Thread Stefan Frühwirth
On 2016-02-16 at 21:35 Jeff King wrote: Yeah, I agree there isn't a great solution in git here. Using "git merge" is definitely wrong if you don't want to touch HEAD or have a working directory. If you _just_ care about doing the tree-level merge without content-level merging inside blobs, you

Re: [PATCHv13 5/7] git submodule update: have a dedicated helper for cloning

2016-02-19 Thread Jeff King
On Thu, Feb 18, 2016 at 03:33:16PM -0800, Stefan Beller wrote: > + if (needs_cloning) { > + cp->git_cmd = 1; > + cp->no_stdin = 1; > + cp->stdout_to_stderr = 1; > + cp->err = -1; > + argv_array_push(>args, "submodule--helper"); > +

Re: Test failures with GNU grep 2.23

2016-02-19 Thread Jeff King
On Sun, Feb 07, 2016 at 04:25:40PM +, John Keeping wrote: > It seems that binary file detection has changed in GNU grep 2.23 as a > result of commit 40ed879 (grep: fix bug with with invalid unibyte > sequence). I read this bug report a while ago when you posted it, but happily ignored it

Re: GSoC 2016: applications open, deadline = Fri, 19/2

2016-02-19 Thread Thomas Gummerer
On 02/18, Lars Schneider wrote: > > On 17 Feb 2016, at 19:58, Matthieu Moy wrote: > > > Lars Schneider writes: > > > >> Coincidentally I started working on similar thing already (1) and I have > >> lots of ideas around it. > > > > I guess

Re: GSoC 2016: applications open, deadline = now => submitted

2016-02-19 Thread Jeff King
On Fri, Feb 19, 2016 at 10:10:55AM +0100, Matthieu Moy wrote: > > I think we can continue to modify up to the deadline (at least that has > > been the case in years past). > > Indeed: I've completed the application and it's still possible to modify > (the form just says "You've completed this

Re: Windows git bash - child processes see system PATH environment variable instead of user...

2016-02-19 Thread Johannes Schindelin
Hi Edward, On Fri, 19 Feb 2016, Edward Marshall wrote: > Hey, thanks for getting back to me. I subseuqently found the > git-for-windows issues tracker on github so have posted an updated > version of this there - not sure where is the best place for issues. It is the best place for

[PATCH 20/21] convert ewah/bitmap code to use xmalloc

2016-02-19 Thread Jeff King
This code was originally written with the idea that it could be spun off into its own ewah library, and uses the overrideable ewah_malloc to do allocations. We plug in xmalloc as our ewah_malloc, of course. But over the years the ewah code itself has become more entangled with git, and the return

[PATCH 21/21] ewah: convert to REALLOC_ARRAY, etc

2016-02-19 Thread Jeff King
Now that we're built around xmalloc and friends, we can use helpers like REALLOC_ARRAY, ALLOC_GROW, and so on to make the code shorter and protect against integer overflow. Signed-off-by: Jeff King --- ewah/bitmap.c | 16 ewah/ewah_bitmap.c | 5 ++---

[PATCH 15/21] test-path-utils: fix normalize_path_copy output buffer size

2016-02-19 Thread Jeff King
The normalize_path_copy function needs an output buffer that is at least as long as its input (it may shrink the path, but never expand it). However, this test program feeds it static PATH_MAX-sized buffers, which have no relation to the input size. In the normalize_ceiling_entry case, we do at

[PATCH 19/21] diff_populate_gitlink: use a strbuf

2016-02-19 Thread Jeff King
We allocate 100 bytes to hold the "Submodule commit ..." text. This is enough, but it's not immediately obvious that this is the case, and we have to repeat the magic 100 twice. We could get away with xstrfmt here, but we want to know the size, as well, so let's use a real strbuf. And while we're

[PATCH 18/21] transport_anonymize_url: use xstrfmt

2016-02-19 Thread Jeff King
This function uses xcalloc and two memcpy calls to concatenate two strings. We can do this as an xstrfmt one-liner, and then it is more clear that we are allocating the correct amount of memory. Signed-off-by: Jeff King --- transport.c | 8 +++- 1 file changed, 3

[PATCH 16/21] sequencer: simplify memory allocation of get_message

2016-02-19 Thread Jeff King
For a commit with sha1 "1234abcd" and subject "foo", this function produces a struct with three strings: 1. "foo" 2. "1234abcd... foo" 3. "parent of 1234abcd... foo" It takes advantage of the fact that these strings are subsets of each other, and allocates only _one_ string, with pointers

[PATCH 14/21] fetch-pack: simplify add_sought_entry

2016-02-19 Thread Jeff King
We have two variants of this function, one that takes a string and one that takes a ptr/len combo. But we only call the latter with the length of a NUL-terminated string, so our first simplification is to drop it in favor of the string variant. Since we know we have a string, we can also replace

[PATCH 17/21] git-compat-util: drop mempcpy compat code

2016-02-19 Thread Jeff King
There are no callers of this left, as the last one was dropped in the previous patch. And there are not likely to be new ones, as the function has been around since 2010 without gaining any new callers. Signed-off-by: Jeff King --- git-compat-util.h | 9 - 1 file changed,

[PATCH 12/21] write_untracked_extension: use FLEX_ALLOC helper

2016-02-19 Thread Jeff King
We perform unchecked additions when computing the size of a "struct ondisk_untracked_cache". This is unlikely to have an integer overflow in practice, but we'd like to avoid this dangerous pattern to make further audits easier. Note that there's one subtlety here, though. We protect ourselves

[PATCH 13/21] fast-import: simplify allocation in start_packfile

2016-02-19 Thread Jeff King
This function allocate a packed_git flex-array, and adds a mysterious 2 bytes to the length of the pack_name field. One is for the trailing NUL, but the other has no purpose. This is probably cargo-culted from add_packed_git, which gets the ".idx" path and needed to allocate enough space to hold

[PATCH 11/21] prepare_{git,shell}_cmd: use argv_array

2016-02-19 Thread Jeff King
These functions transform an existing argv into one suitable for exec-ing or spawning via git or a shell. We can use an argv_array in each to avoid dealing with manual counting and allocation. This also makes the memory allocation more clear and fixes some leaks. In prepare_shell_cmd, we would

[PATCH 08/21] use xmallocz to avoid size arithmetic

2016-02-19 Thread Jeff King
We frequently allocate strings as xmalloc(len + 1), where the extra 1 is for the NUL terminator. This can be done more simply with xmallocz, which also checks for integer overflow. There's no case where switching xmalloc(n+1) to xmallocz(n) is wrong; the result is the same length, and malloc made

[PATCH 10/21] use st_add and st_mult for allocation size computation

2016-02-19 Thread Jeff King
If our size computation overflows size_t, we may allocate a much smaller buffer than we expected and overflow it. It's probably impossible to trigger an overflow in most of these sites in practice, but it is easy enough convert their additions and multiplications into overflow-checking variants.

[PATCH 09/21] convert trivial cases to FLEX_ARRAY macros

2016-02-19 Thread Jeff King
Using FLEX_ARRAY macros reduces the amount of manual computation size we have to do. It also ensures we don't overflow size_t, and it makes sure we write the same number of bytes that we allocated. Signed-off-by: Jeff King --- attr.c | 4 +--- builtin/blame.c

[PATCH 07/21] convert trivial cases to ALLOC_ARRAY

2016-02-19 Thread Jeff King
Each of these cases can be converted to use ALLOC_ARRAY or REALLOC_ARRAY, which has two advantages: 1. It automatically checks the array-size multiplication for overflow. 2. It always uses sizeof(*array) for the element-size, so that it can never go out of sync with the declared

[PATCH 06/21] convert manual allocations to argv_array

2016-02-19 Thread Jeff King
There are many manual argv allocations that predate the argv_array API. Switching to that API brings a few advantages: 1. We no longer have to manually compute the correct final array size (so it's one less thing we can screw up). 2. In many cases we had to make a separate pass to

[PATCH 03/21] tree-diff: catch integer overflow in combine_diff_path allocation

2016-02-19 Thread Jeff King
A combine_diff_path struct has two "flex" members allocated alongside the struct: a string to hold the pathname, and an array of parent pointers. We use an "int" to compute this, meaning we may easily overflow it if the pathname is extremely long. We can fix this by using size_t, and checking for

[PATCH 04/21] harden REALLOC_ARRAY and xcalloc against size_t overflow

2016-02-19 Thread Jeff King
REALLOC_ARRAY inherently involves a multiplication which can overflow size_t, resulting in a much smaller buffer than we think we've allocated. We can easily harden it by using st_mult() to check for overflow. Likewise, we can add ALLOC_ARRAY to do the same thing for xmalloc calls. xcalloc()

[PATCH 05/21] add helpers for allocating flex-array structs

2016-02-19 Thread Jeff King
Allocating a struct with a flex array is pretty simple in practice: you over-allocate the struct, then copy some data into the over-allocation. But it can be a slight pain to make sure you're allocating and copying the right amounts. This patch adds a few helpers to turn simple cases of

[PATCH 02/21] add helpers for detecting size_t overflow

2016-02-19 Thread Jeff King
Performing computations on size_t variables that we feed to xmalloc and friends can be dangerous, as an integer overflow can cause us to allocate a much smaller chunk than we realized. We already have unsigned_add_overflows(), but let's add unsigned_mult_overflows() to that. Furthermore, rather

[PATCH 01/21] reflog_expire_cfg: NUL-terminate pattern field

2016-02-19 Thread Jeff King
You can tweak the reflog expiration for a particular subset of refs by configuring gc.foo.reflogexpire. We keep a linked list of reflog_expire_cfg structs, each of which holds the pattern and a "len" field for the length of the pattern. The pattern itself is _not_ NUL-terminated. However, we feed

[PATCH v2 0/21] hardening allocations against integer overflow

2016-02-19 Thread Jeff King
Here's a re-roll of jk/tighten-alloc series from: http://thread.gmane.org/gmane.comp.version-control.git/286253 This one fixes all of the minor typo/gramm-o problems from the first round. As Eric noted, the change to reflog_expire_cfg is an actual bug-fix. Rather than silently fixing it, I've

Re: Windows git bash - child processes see system PATH environment variable instead of user...

2016-02-19 Thread Edward Marshall
Hey, thanks for getting back to me. I subseuqently found the git-for-windows issues tracker on github so have posted an updated version of this there - not sure where is the best place for issues. I have also found that the cause was having %VPROJECT%..\bin inside my user PATH but no VPROJECT

Re: Windows git bash - child processes see system PATH environment variable instead of user...

2016-02-19 Thread Johannes Schindelin
Hi Edward, On Wed, 17 Feb 2016, Edward Marshall wrote: > Edward@Edward-PC MINGW64 /f/Work > $ echo $PATH > ...(USER PATH)... I presume this is Git for Windows 2.7.1(2), installed via the default installer? And I also assume that you run this in Git Bash? Can you test whether this also happens

Re: GSoC 2016: applications open, libgit2 and git.git

2016-02-19 Thread Carlos Martín Nieto
On Fri, 2016-02-19 at 09:06 +0100, Matthieu Moy wrote: > Carlos Martín Nieto writes: > > > We still have most of the same things open as for the 2014 list. > > I'll > > ask around to see if we have. Last year I wasn't involved in the > > candidate selection but IIRC we didn't do a

Re: [PATCH] git-p4.py: Don't try to rebase on submit from bare repository

2016-02-19 Thread Luke Diamand
On 17 February 2016 at 22:46, Amadeusz Żołnowski wrote: > git-p4 can be successfully used from bare repository (which acts as a > bridge between Perforce repository and pure Git repositories). On submit > git-p4 performs unconditional rebase. Do rebase only on non-bare >

Re: GSoC 2016: applications open, deadline = Fri, 19/2

2016-02-19 Thread Duy Nguyen
On Fri, Feb 19, 2016 at 2:17 PM, Matthieu Moy wrote: >> with David's multiple ref backend work, we could have a third, >> no-dependency backend. We can use index format to store refs. > > This sounds like an interesting but ambitious project for a GSoC. There > are a

Re: [PATCH v2 14/25] shallow.c: implement a generic shallow boundary finder based on rev-list

2016-02-19 Thread Duy Nguyen
On Mon, Feb 08, 2016 at 01:09:24PM -0800, Junio C Hamano wrote: > Nguyễn Thái Ngọc Duy writes: > > > Instead of a custom commit walker like get_shallow_commits(), this new > > function uses rev-list to mark NOT_SHALLOW to all reachable commits, > > except borders. The

Re: GSoC 2016: applications open, deadline = Fri, 19/2

2016-02-19 Thread Lars Schneider
On 18 Feb 2016, at 20:13, Junio C Hamano wrote: > Stefan Beller writes: > >> On Thu, Feb 18, 2016 at 12:41 AM, Lars Schneider >> wrote: Feel free to start writting an idea for http://git.github.io/SoC-2016-Ideas/.

[PATCH v6 2/4] rename git_config_from_buf to git_config_from_mem

2016-02-19 Thread larsxschneider
From: Lars Schneider This matches the naming used in the index_{fd,mem,...} functions. Suggested-by: Junio C Hamano Signed-off-by: Lars Schneider --- cache.h| 2 +- config.c | 4 ++--

[PATCH v6 0/4] config: add '--sources' option to print the source of a config value

2016-02-19 Thread larsxschneider
From: Lars Schneider diff to v5: * rename 'type' to 'origin_type' as 'type' is too broad a word in the context of configuration file (Thanks to the reviewers Junio and Dscho) * add dedicated patch to rename git_config_from_buf to git_config_from_mem (this change was

[PATCH v6 1/4] t: do not hide Git's exit code in tests using 'nul_to_q'

2016-02-19 Thread larsxschneider
From: Lars Schneider Git should not be on the left-hand side of a pipe, because it hides the exit code, and we want to make sure git does not fail. Fix all invocations of 'nul_to_q' (defined in /t/test-lib-functions.sh) using this pattern. There is one more occurrence

[PATCH v6 4/4] config: add '--show-origin' option to print the origin of a config value

2016-02-19 Thread larsxschneider
From: Lars Schneider If config values are queried using 'git config' (e.g. via --get, --get-all, --get-regexp, or --list flag) then it is sometimes hard to find the configuration file where the values were defined. Teach 'git config' the '--show-origin' option to print

[PATCH v6 3/4] config: add 'origin_type' to config_source struct

2016-02-19 Thread larsxschneider
From: Lars Schneider Use the config origin_type to print more detailed error messages that inform the user about the origin of a config error (file, stdin, blob). Helped-by: Ramsay Jones Signed-off-by: Lars Schneider

Re: GSoC 2016: applications open, deadline = now => submitted

2016-02-19 Thread Matthieu Moy
Jeff King writes: > On Fri, Feb 19, 2016 at 09:09:50AM +0100, Matthieu Moy wrote: > >> Hi, >> >> The deadline is tonight (19:00 UTC). I don't want to miss it, so I'll >> submit the application very soon based on >> http://git.github.io/SoC-2016-Org-Application/. > > I think we

GSoC 2016: Microproject

2016-02-19 Thread Mehul Jain
Hello everyone, I'm Mehul Jain. I'm looking for participating in GSoC 2016. I've started work on a Microproject" Teach git pull --rebase the --no-autostash" option. While looking at Git's source code I have made following observation: In the pull.c file 1. git_config_get_bool( , ) search in the

[PATCH] exec_cmd.c: use find_last_dir_sep() for code simplification

2016-02-19 Thread Alexander Kuleshov
We are trying to extract dirname from argv0 in the git_extract_argv0_path(). But in the same time, the provides find_last_dir_sep() to get dirname from a given path. Let's use it instead of loop for the code simplification. Signed-off-by: Alexander Kuleshov ---

Re: GSoC 2016: applications open, deadline = now => submission

2016-02-19 Thread Jeff King
On Fri, Feb 19, 2016 at 09:09:50AM +0100, Matthieu Moy wrote: > Hi, > > The deadline is tonight (19:00 UTC). I don't want to miss it, so I'll > submit the application very soon based on > http://git.github.io/SoC-2016-Org-Application/. I think we can continue to modify up to the deadline (at

Re: GSoC 2016: applications open, deadline = now => submission

2016-02-19 Thread Matthieu Moy
Hi, The deadline is tonight (19:00 UTC). I don't want to miss it, so I'll submit the application very soon based on http://git.github.io/SoC-2016-Org-Application/. Other pages can still be modified afterwards. -- Matthieu Moy http://www-verimag.imag.fr/~moy/ -- To unsubscribe from this list:

Re: GSoC 2016: applications open, libgit2 and git.git

2016-02-19 Thread Matthieu Moy
Carlos Martín Nieto writes: > We still have most of the same things open as for the 2014 list. I'll > ask around to see if we have. Last year I wasn't involved in the > candidate selection but IIRC we didn't do a project as none of the > applications showed the candidates would be

  1   2   >