Tools that do an automatic fetch defeat "git push --force-with-lease"

2017-04-07 Thread Matt McCutchen
When I'm rewriting history, "git push --force-with-lease" is a nice safeguard compared to "git push --force", but it still assumes the remote-tracking ref gives the old state the user wants to overwrite. Tools that do an implicit fetch, assuming it to be a safe operation, may break this

Re: [PATCH 3/3] reset.c: update files when using sparse to avoid data loss.

2017-04-07 Thread Stefan Beller
On Fri, Apr 7, 2017 at 12:23 PM, Kevin Willford wrote: > When using the sparse checkout feature the git reset command will add > entries to the index that will have the skip-worktree bit off but will > leave the working directory empty. File data is lost because the index >

Re: [PATCH 2/3] apply.c: do not checkout file when skip-worktree bit set

2017-04-07 Thread Stefan Beller
On Fri, Apr 7, 2017 at 12:23 PM, Kevin Willford wrote: > When using the sparse-checkout feature git should not write to > the working directory for files with the skip-worktree bit on. > With the skip-worktree bit on the file may or may not be in > the working directory and

[PATCH v7 1/3] read-cache: add strcmp_offset function

2017-04-07 Thread git
From: Jeff Hostetler Add strcmp_offset() function to also return the offset of the first change. Add unit test and helper to verify. Signed-off-by: Jeff Hostetler --- Makefile | 1 + cache.h | 1 +

[PATCH v7 2/3] p0004-read-tree: perf test to time read-tree

2017-04-07 Thread git
From: Jeff Hostetler Signed-off-by: Jeff Hostetler --- t/perf/p0004-read-tree.sh | 117 ++ 1 file changed, 117 insertions(+) create mode 100755 t/perf/p0004-read-tree.sh diff --git

[PATCH v7 3/3] read-cache: speed up add_index_entry during checkout

2017-04-07 Thread git
From: Jeff Hostetler Teach add_index_entry_with_check() and has_dir_name() to see if the path of the new item is greater than the last path in the index array before attempting to search for it. During checkout, merge_working_tree() populates the new index in sorted

[PATCH v7 0/3] read-cache: speed up add_index_entry

2017-04-07 Thread git
From: Jeff Hostetler Version 7 addresses size_t and casting issues in strcmp_offset() and replaces shell test function with an awk expression to make the perf test run faster. Teach add_index_entry_with_check() and has_dir_name() to avoid index lookups

Re: [PATCH] pathspec: fix segfault in clear_pathspec

2017-04-07 Thread Stefan Beller
On Fri, Apr 7, 2017 at 12:29 PM, Brandon Williams wrote: > In 'clear_pathspec()' the incorrect index parameter is used to bound an > inner-loop which is used to free a 'struct attr_match' value field. > Using the incorrect index parameter (in addition to being incorrect) >

[PATCH] pathspec: fix segfault in clear_pathspec

2017-04-07 Thread Brandon Williams
In 'clear_pathspec()' the incorrect index parameter is used to bound an inner-loop which is used to free a 'struct attr_match' value field. Using the incorrect index parameter (in addition to being incorrect) occasionally causes segmentation faults when attempting to free an invalid pointer. Fix

Re: [PATCH 0/3] fix working directory file issues while using sparse-checkout

2017-04-07 Thread Stefan Beller
This time for real. On Fri, Apr 7, 2017 at 12:27 PM, Stefan Beller wrote: > + Duy, for sparse checkout > > On Fri, Apr 7, 2017 at 12:23 PM, Kevin Willford wrote: >> While using the sparse-checkout feature there are scenarios where >> the working

Re: [PATCH 0/3] fix working directory file issues while using sparse-checkout

2017-04-07 Thread Stefan Beller
+ Duy, for sparse checkout On Fri, Apr 7, 2017 at 12:23 PM, Kevin Willford wrote: > While using the sparse-checkout feature there are scenarios where > the working directory should and should not be updated. This patch > series addresses issues found in reset, apply, and

[PATCH 2/3] apply.c: do not checkout file when skip-worktree bit set

2017-04-07 Thread Kevin Willford
When using the sparse-checkout feature git should not write to the working directory for files with the skip-worktree bit on. With the skip-worktree bit on the file may or may not be in the working directory and if it is not we don't want or need to create it by calling checkout_entry. There are

[PATCH 3/3] reset.c: update files when using sparse to avoid data loss.

2017-04-07 Thread Kevin Willford
When using the sparse checkout feature the git reset command will add entries to the index that will have the skip-worktree bit off but will leave the working directory empty. File data is lost because the index version of the files has been changed but there is nothing that is in the working

[PATCH 0/3] fix working directory file issues while using sparse-checkout

2017-04-07 Thread Kevin Willford
While using the sparse-checkout feature there are scenarios where the working directory should and should not be updated. This patch series addresses issues found in reset, apply, and merge conflicts. Kevin Willford (3): merge-recursive.c: conflict using sparse should update file apply.c:

[PATCH 1/3] merge-recursive.c: conflict using sparse should update file

2017-04-07 Thread Kevin Willford
Update the file when there is a conflict with a modify/delete scenario when using the sparse-checkout feature since the file might not be on disk because the skip-worktree bit is on and the user will need the file and content to determine how to resolve the conflict. Signed-off-by: Kevin Willford

Re: [PATCH v6 0/3] read-cache: speed up add_index_entry

2017-04-07 Thread Jeff Hostetler
On 4/7/2017 12:46 AM, Jeff King wrote: On Thu, Apr 06, 2017 at 04:34:39PM +, g...@jeffhostetler.com wrote: Teach add_index_entry_with_check() and has_dir_name() to avoid index lookups if the given path sorts after the last entry in the index. This saves at least 2 binary searches per

Re: [PATCH v6 1/3] read-cache: add strcmp_offset function

2017-04-07 Thread Jeff Hostetler
On 4/6/2017 7:07 PM, René Scharfe wrote: Am 06.04.2017 um 18:34 schrieb g...@jeffhostetler.com: diff --git a/read-cache.c b/read-cache.c index 9054369..e8f1900 100644 --- a/read-cache.c +++ b/read-cache.c @@ -887,6 +887,26 @@ static int has_file_name(struct index_state *istate, return

Re: [PATCH v1] unpack-trees: avoid duplicate ODB lookups during checkout

2017-04-07 Thread Jeff Hostetler
On 4/6/2017 6:48 PM, Stefan Beller wrote: On Thu, Apr 6, 2017 at 1:37 PM, wrote: From: Jeff Hostetler Teach traverse_trees_recursive() to not do redundant ODB lookups when both directories refer to the same OID. And the reason for this is

Re: [PATCH] submodule: prevent backslash expantion in submodule names

2017-04-07 Thread Joachim Durchholz
Thanks!

[PATCH] submodule: prevent backslash expantion in submodule names

2017-04-07 Thread Brandon Williams
When attempting to add a submodule with backslashes in its name 'git submodule' fails in a funny way. We can see that some of the backslashes are expanded resulting in a bogus path: git -C main submodule add ../sub\\with\\backslash fatal: repository '/tmp/test/sub\witackslash' does not exist

Re: problem with backslash in directory name

2017-04-07 Thread Stefan Beller
>> Probably it's "read" which does backslash expansion, but nothing else. >> Just grepping git-submodule.sh, some of the "read" calls should probably >> be "read -r" (I also don't know how some of those loops would cope with >> a submodule name that needed quoting). > > So I blindly converted all

Re: problem with backslash in directory name

2017-04-07 Thread Brandon Williams
On 04/07, Jeff King wrote: > On Fri, Apr 07, 2017 at 08:12:49AM +0200, Joachim Durchholz wrote: > > > So... something inside "git submodule add" is replacing the \b with a > > backspace control code. > > [...] > > Whatever that "something" is, it is not doing shell expansion, otherwise it > >

Re: [PATCH] status: show in-progress info for short status

2017-04-07 Thread Jacob Keller
On Fri, Mar 31, 2017 at 11:14 AM, Junio C Hamano wrote: > Michael J Gruber writes: > >> Ordinary (long) status shows information about bisect, revert, am, >> rebase, cherry-pick in progress, and so does git-prompt.sh. status >> --short currently shows none of

Re: [PATCH] Documentation/git-worktree: use working tree for trees on the file system

2017-04-07 Thread Jacob Keller
On Fri, Apr 7, 2017 at 6:59 AM, Michael J Gruber wrote: > Duy Nguyen venit, vidit, dixit 25.03.2017 13:07: >> On Fri, Mar 24, 2017 at 12:55 AM, Junio C Hamano wrote: >>> Michael J Gruber writes: >>> Are we at a point where we

[PATCH v2] unpack-trees: avoid duplicate ODB lookups during checkout

2017-04-07 Thread git
From: Jeff Hostetler Version 2 simplifies this and just copies the tree_descriptor data and borrows the underlying buffer without mallocing. It also handles the n=3 cases, so merges shold be helped too. I've updated the p0004 perf times in the commit message. The V2

[PATCH v2] unpack-trees: avoid duplicate ODB lookups during checkout

2017-04-07 Thread git
From: Jeff Hostetler Teach traverse_trees_recursive() to not do redundant ODB lookups when both directories refer to the same OID. In operations such as read-tree, checkout, and merge when the differences between the commits are relatively small, there will likely be

Re: [BUG?] Issue with merging from another branch after replacing subdirectory with submodule

2017-04-07 Thread Ben Nason
Hi Stefan, Thanks for the reply. Is there any known workaround for this situation, so that a manual resolve isn't needed for every single merge in this scenario? Thanks, Benbuck On Thu, Apr 6, 2017 at 4:05 PM, Stefan Beller wrote: > On Wed, Apr 5, 2017 at 11:10 PM, Ben

[PATCH 2/2] use MOVE_ARRAY

2017-04-07 Thread René Scharfe
Add a semantic patch for converting certain calls of memmove(3) to MOVE_ARRAY() and apply that transformation to the code base. The result is shorter and safer code. Signed-off-by: Rene Scharfe --- apply.c| 7 +++ builtin/ls-files.c | 3

Re: [PATCH v3 1/2] Fix nonnull errors reported by UBSAN with GCC 7.

2017-04-07 Thread René Scharfe
Am 07.04.2017 um 16:23 schrieb Martin Liška: On 04/06/2017 10:49 PM, Johannes Sixt wrote: Am 06.04.2017 um 19:31 schrieb René Scharfe: Am 06.04.2017 um 18:33 schrieb Johannes Sixt: Am 06.04.2017 um 17:42 schrieb Martin Liška: +static inline void *sane_memmove(void *dest, const void *src,

[PATCH 1/2] add MOVE_ARRAY

2017-04-07 Thread René Scharfe
Add MOVE_ARRAY to complement COPY_ARRAY, which was added in 60566cbb. It provides the same convenience, safety and support for NULL pointers as representations of empty arrays, just as a wrapper for memmove(3) instead of memcpy(3). Inspired-by: Martin Liska Signed-off-by: Rene

Re: [PATCH] notes: Fix note_tree_consolidate not to break the note_tree structure

2017-04-07 Thread Johan Herland
On Sun, Mar 26, 2017 at 3:52 AM, Mike Hommey wrote: > After a note is removed, note_tree_consolidate is called to eliminate > some useless nodes. The typical case is that if you had an int_node > with 2 PTR_TYPE_NOTEs in it, and remove one of them, then the > PTR_TYPE_INTERNAL

Re: [PATCH v3 1/2] Fix nonnull errors reported by UBSAN with GCC 7.

2017-04-07 Thread Martin Liška
On 04/06/2017 10:49 PM, Johannes Sixt wrote: > Am 06.04.2017 um 19:31 schrieb René Scharfe: >> Am 06.04.2017 um 18:33 schrieb Johannes Sixt: >>> Am 06.04.2017 um 17:42 schrieb Martin Liška: +static inline void *sane_memmove(void *dest, const void *src, size_t n) +{ +if (n > 0)

Re: [PATCH] status: show in-progress info for short status

2017-04-07 Thread Michael J Gruber
Junio C Hamano venit, vidit, dixit 31.03.2017 20:14: > Michael J Gruber writes: > >> Ordinary (long) status shows information about bisect, revert, am, >> rebase, cherry-pick in progress, and so does git-prompt.sh. status >> --short currently shows none of this information. >> >>

Re: [PATCH] status: show in-progress info for short status

2017-04-07 Thread Michael J Gruber
SZEDER Gábor venit, vidit, dixit 06.04.2017 16:33: >> @@ -1779,6 +1780,31 @@ static void wt_shortstatus_print_tracking(struct >> wt_status *s) >> } >> >> color_fprintf(s->fp, header_color, "]"); >> + >> + inprogress: >> +if (!s->show_inprogress) >> +goto conclude; >> +

Re: [PATCH] Documentation/git-worktree: use working tree for trees on the file system

2017-04-07 Thread Michael J Gruber
Duy Nguyen venit, vidit, dixit 25.03.2017 13:07: > On Fri, Mar 24, 2017 at 12:55 AM, Junio C Hamano wrote: >> Michael J Gruber writes: >> >>> Are we at a point where we can still rename the new feature at least? If >>> yes, and keeping everything

Re: [PATCH v1] unpack-trees: avoid duplicate ODB lookups during checkout

2017-04-07 Thread Jeff Hostetler
On 4/6/2017 8:32 PM, René Scharfe wrote: Am 06.04.2017 um 22:37 schrieb g...@jeffhostetler.com: From: Jeff Hostetler Teach traverse_trees_recursive() to not do redundant ODB lookups when both directories refer to the same OID. In operations such as read-tree,

Re: [PATCH v1] unpack-trees: avoid duplicate ODB lookups during checkout

2017-04-07 Thread Jeff Hostetler
On 4/7/2017 1:19 AM, Jeff King wrote: On Thu, Apr 06, 2017 at 03:48:07PM -0700, Stefan Beller wrote: On Thu, Apr 6, 2017 at 1:37 PM, wrote: From: Jeff Hostetler Teach traverse_trees_recursive() to not do redundant ODB lookups when both

Re: [PATCH v7 19/28] files-backend: replace submodule_allowed check in files_downcast()

2017-04-07 Thread Duy Nguyen
I'll mark this mail and do a follow-up patch once this topic graduates to master. It's less review burden and mail traffic. On Sat, Apr 1, 2017 at 11:02 AM, Michael Haggerty wrote: > On 03/26/2017 04:42 AM, Nguyễn Thái Ngọc Duy wrote: >> files-backend.c is unlearning

Re: [PATCH v7 22/28] refs: new transaction related ref-store api

2017-04-07 Thread Duy Nguyen
On Sat, Apr 1, 2017 at 11:54 AM, Michael Haggerty wrote: > On 03/26/2017 04:42 AM, Nguyễn Thái Ngọc Duy wrote: >> The transaction struct now takes a ref store at creation and will >> operate on that ref store alone. > > Having worked downstream of this patch series for a

[PATCH v5 2/8] convert: move packet_write_list() into pkt-line as packet_writel()

2017-04-07 Thread Ben Peart
Add packet_writel() which writes multiple lines in a single call and then calls packet_flush_gently(). Update convert.c to use the new packet_writel() function from pkt-line. Signed-off-by: Ben Peart --- convert.c | 23 ++- pkt-line.c | 19

[PATCH v5 0/8] refactor the filter process code into a reusable module

2017-04-07 Thread Ben Peart
Hopefully final spin. Updates patch 6 to rename additional instances of "filter" in comment and error messages. Refactor the filter..process code into a separate sub-process module that can be used to reduce the cost of starting up a sub-process for multiple commands. It does this by keeping

[PATCH v5 3/8] convert: Split start_multi_file_filter into two separate functions

2017-04-07 Thread Ben Peart
To enable future reuse of the filter..process infrastructure, split start_multi_file_filter into two separate parts. start_multi_file_filter will now only contain the generic logic to manage the creation and tracking of the child process in a hashmap. start_multi_file_filter_fn is a protocol

[PATCH v5 1/8] pkt-line: add packet_read_line_gently()

2017-04-07 Thread Ben Peart
Add packet_read_line_gently() to enable reading a line without dying on EOF. Signed-off-by: Ben Peart --- pkt-line.c | 12 pkt-line.h | 10 ++ 2 files changed, 22 insertions(+) diff --git a/pkt-line.c b/pkt-line.c index d4b6bfe076..58842544b4 100644

[PATCH v5 4/8] convert: Separate generic structures and variables from the filter specific ones

2017-04-07 Thread Ben Peart
To enable future reuse of the filter..process infrastructure, split the cmd2process structure into two separate parts. subprocess_entry will now contain the generic data required to manage the creation and tracking of the child process in a hashmap. Also move all knowledge of the hashmap into the

[PATCH v5 8/8] convert: Update subprocess_read_status to not die on EOF

2017-04-07 Thread Ben Peart
Enable sub-processes to gracefully handle when the process dies by updating subprocess_read_status to return an error on EOF instead of dying. Update apply_multi_file_filter to take advantage of the revised subprocess_read_status. Signed-off-by: Ben Peart --- convert.c

[PATCH v5 5/8] convert: Update generic functions to only use generic data structures

2017-04-07 Thread Ben Peart
Update all functions that are going to be moved into a reusable module so that they only work with the reusable data structures. Move code that is specific to the filter out into the filter specific functions. Signed-off-by: Ben Peart --- convert.c | 46

[PATCH v5 6/8] convert: rename reusable sub-process functions

2017-04-07 Thread Ben Peart
Do a mechanical rename of the functions that will become the reusable sub-process module. Signed-off-by: Ben Peart --- convert.c | 53 +++-- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/convert.c

[PATCH v5 7/8] sub-process: move sub-process functions into separate files

2017-04-07 Thread Ben Peart
Move the sub-proces functions into sub-process.h/c. Add documentation for the new module in Documentation/technical/api-sub-process.txt Signed-off-by: Ben Peart --- Documentation/technical/api-sub-process.txt | 54 + Makefile

Re: [PATCH v2 00/20] Separate `ref_cache` into a separate module

2017-04-07 Thread Duy Nguyen
On Wed, Apr 5, 2017 at 9:03 PM, Duy Nguyen wrote: > On Sat, Apr 1, 2017 at 12:16 PM, Michael Haggerty > wrote: >> Duy, have you looked over my patch series? Since you've been working in >> the area, your feedback would be very welcome, if you have the

Re: [PATCH v2 19/20] files_pack_refs(): use reference iteration

2017-04-07 Thread Duy Nguyen
On Fri, Mar 31, 2017 at 9:11 PM, Michael Haggerty wrote: > Use reference iteration rather than do_for_each_entry_in_dir() in the > definition of files_pack_refs(). A "why" is missing here. My guess is readability/maintainability because it's easier to follow the code with

Re: [PATCH v2 11/20] refs: record the ref_store in ref_cache, not ref_dir

2017-04-07 Thread Duy Nguyen
On Fri, Mar 31, 2017 at 9:11 PM, Michael Haggerty wrote: > Instead of keeping a pointer to the ref_store in every ref_dir entry, > store it once in `struct ref_cache`, and change `struct ref_dir` to > include a pointer to its containing `ref_cache` instead. This makes it >

Re: [PATCH v2 10/20] ref-cache: introduce a new type, ref_cache

2017-04-07 Thread Duy Nguyen
On Fri, Mar 31, 2017 at 9:11 PM, Michael Haggerty wrote: > +void free_ref_cache(struct ref_cache *cache) > +{ > + free_ref_entry(cache->root); > + free(cache); > +} free(NULL) is no-op (and safe). Maybe we should follow the same pattern for free_ref_cache().

Re: [PATCH v2 04/20] refs_verify_refname_available(): implement once for all backends

2017-04-07 Thread Duy Nguyen
On Fri, Mar 31, 2017 at 9:11 PM, Michael Haggerty wrote: > It turns out that we can now implement > `refs_verify_refname_available()` based on the other virtual > functions, so there is no need for it to be defined at the backend > level. Instead, define it once in `refs.c`

Re: [RFC] dropping support for ancient versions of curl

2017-04-07 Thread Johannes Schindelin
Hi Peff, On Thu, 6 Apr 2017, Jeff King wrote: > And it's not like people on ancient mission-critical systems get cut > off. They can still run the version of Git they were running when their > OS went out of support. You keep baiting me, so I'll bite, after resisting the urge for so long. Let

Re: Git branch deletion not based on HEAD branch anymore

2017-04-07 Thread Javier Domingo Cansino
> There's "branch --merged" already. And in recent versions of git, the > scriptable for-each-ref knows it, too. So you could do something like: > > git for-each-ref --format='delete %(refname)' --merged HEAD refs/heads/ | > grep -v 'any-branches-you-want-saved' | > git update-ref --stdin

Re: [PATCH v2 03/20] refs_ref_iterator_begin(): new function

2017-04-07 Thread Duy Nguyen
On Fri, Mar 31, 2017 at 9:11 PM, Michael Haggerty wrote: > Extract a new function from `do_for_each_ref()`. It will be useful > elsewhere. > > Signed-off-by: Michael Haggerty > --- > refs.c | 15 +-- > refs/refs-internal.h |

Re: problem with backslash in directory name

2017-04-07 Thread Joachim Durchholz
Am 07.04.2017 um 08:30 schrieb Jeff King: I also don't know how some of those loops would cope with a submodule name that needed quoting). "git submodule add" worked fine with most of the following names: "sub" # potentially confusing the shell "sub with blanks", "sub

Re: problem with backslash in directory name

2017-04-07 Thread Joachim Durchholz
Am 07.04.2017 um 08:30 schrieb Jeff King: Probably it's "read" which does backslash expansion, but nothing else. Just grepping git-submodule.sh, some of the "read" calls should probably be "read -r" http://wiki.bash-hackers.org/commands/builtin/read has this to say: Essentially all you need

Re: Git branch deletion not based on HEAD branch anymore

2017-04-07 Thread Jeff King
On Thu, Apr 06, 2017 at 10:31:55PM +0200, Javier Domingo Cansino wrote: > I understand it's not possible / convenient anymore to go back, but > would it be possible to have an option such as `--merged` to support > the old usecase? There's "branch --merged" already. And in recent versions of

Re: [BUG?] Issue with branch -avv command

2017-04-07 Thread Jeff King
On Fri, Apr 07, 2017 at 01:08:23PM +0800, diguazhi...@gmail.com wrote: > Hi, all, > > I have a problem when I use command 'git branch -avv', the result is > like below: > > my_test_branchd67ab86 fix some problem > * master 27c4e0b

Re: problem with backslash in directory name

2017-04-07 Thread Jeff King
On Fri, Apr 07, 2017 at 08:12:49AM +0200, Joachim Durchholz wrote: > So... something inside "git submodule add" is replacing the \b with a > backspace control code. > [...] > Whatever that "something" is, it is not doing shell expansion, otherwise it > would have started an interactive calculator

problem with backslash in directory name

2017-04-07 Thread Joachim Durchholz
Hi all, I'm having a problem with submodules that reside in directories that (unwisely) contain a backslash in their name. Transcript: ### Arrange $ git init main Initialized empty Git repository in /tmp/test/main/.git/ $ git init sub\\with\\backslash Initialized empty Git repository in