Re: [PATCH v5 2/4] commit test: Use write_script

2014-06-12 Thread Jeff King
On Thu, Jun 12, 2014 at 02:39:00PM -0500, Caleb Thompson wrote: > Use write_script from t/test-lib-functions.sh instead of cat, shebang, > and chmod. This protects us from potential shell meta-characters in the > name of our trash directory, which would be interpreted if we set > $EDITOR directly.

[PATCH v2] reuse cached commit buffer when parsing signatures

2014-06-12 Thread Jeff King
On Tue, Jun 10, 2014 at 05:35:09PM -0400, Jeff King wrote: > Here's a re-roll of the commit-slab series. And here is a re-roll of the --show-signature speedup on top (i.e., the point of the series in the first place), adjusted to use get_commit_buffer. -- >8 -- Subject: reuse cached commit buffe

Re: bug: git merge --no-commit loses track of file modes in the index

2014-06-12 Thread Johannes Sixt
Am 13.06.2014 03:38, schrieb Joey Hess: If git merge --no-commit is used to merge a commit adding a file with an unusual mode -- specifically a symlink which has "mode" 12, it fails to stage the right mode into the index. This only happens when core.symlinks=false. I noticed it on FAT, but h

Re: [PATCH v2 5/6] Win32: Thread-safe windows console output

2014-06-12 Thread Johannes Sixt
Am 07.06.2014 09:57, schrieb Stepan Kasal: From: Karsten Blees Date: Sat, 14 Jan 2012 22:24:19 +0100 Winansi.c has many static variables that are accessed and modified from the [v][f]printf / fputs functions overridden in the file. This may cause multi threaded git commands that print to the co

Re: bug: git merge --no-commit loses track of file modes in the index

2014-06-12 Thread Stefan Haller
Joey Hess wrote: > If git merge --no-commit is used to merge a commit adding a > file with an unusual mode -- specifically a symlink which has "mode" 12, > it fails to stage the right mode into the index. > > This only happens when core.symlinks=false. I noticed it on FAT, but > have manage

Re: [PATCH v7 0/1] refs.c: SSE4.2 optimizations for check_refname_component

2014-06-12 Thread Torsten Bögershausen
On 2014-06-13 03.18, David Turner wrote: [] > > It is too old for my patch because it doesn't support ifunc (and I > suspect that no version of GCC for Windows supports ifunc). But that > does not seem to be what is going on in your error message. Instead, > when we #include , we get compat/cpui

Re: [PATCH v4 1/1] receive-pack: optionally deny case clone refs

2014-06-12 Thread Torsten Bögershausen
On 12.06.14 00:30, David Turner wrote: [] Just a general question: > diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c > index c323081..6431758 100644 > --- a/builtin/receive-pack.c > +++ b/builtin/receive-pack.c > @@ -27,6 +27,7 @@ enum deny_action { > > static int deny_deletes; >

Re: [PATCH v4 0/1] receive-pack: optionally deny case clone refs

2014-06-12 Thread Torsten Bögershausen
On 2014-06-13 01.30, David Turner wrote: > On Thu, 2014-06-12 at 12:47 -0700, Junio C Hamano wrote: >> David Turner writes: >> >>> This issue bit us again recently. >>> >>> In talking with some colleagues, I realized that the previous version >>> of this patch, in addition to being potentially slo

bug: git merge --no-commit loses track of file modes in the index

2014-06-12 Thread Joey Hess
If git merge --no-commit is used to merge a commit adding a file with an unusual mode -- specifically a symlink which has "mode" 12, it fails to stage the right mode into the index. This only happens when core.symlinks=false. I noticed it on FAT, but have managed to reproduce it on ext4. Her

Re: [PATCH v7 0/1] refs.c: SSE4.2 optimizations for check_refname_component

2014-06-12 Thread David Turner
On Tue, 2014-06-10 at 08:04 +0200, Johannes Sixt wrote: > Am 6/10/2014 1:05, schrieb Junio C Hamano: > > Junio C Hamano writes: > > > >> David Turner writes: > >> > >>> Since Junio has picked up the first patch from previous versions of > >>> this series, I'm just going to send the second (SSE)

Re: git rebase --skip stuck in a loop

2014-06-12 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On 06/12/2014 09:02 PM, brian m. carlson wrote: > On Thu, Jun 12, 2014 at 05:01:16PM -0400, Phillip Susi wrote: >> So nobody has any ideas on what to check for or how to debug >> this? > > I'm assuming this works in the general case, because we have

Re: git rebase --skip stuck in a loop

2014-06-12 Thread brian m. carlson
On Thu, Jun 12, 2014 at 05:01:16PM -0400, Phillip Susi wrote: > So nobody has any ideas on what to check for or how to debug this? I'm assuming this works in the general case, because we have tests for it. Do you perhaps have a repository and a set of reproduction steps we could use to try to rep

Re: [PATCH v2 01/19] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
Michael, On Thu, Jun 12, 2014 at 12:21:48PM +0200, Michael Haggerty wrote: > On 06/12/2014 09:10 AM, Jeremiah Mahler wrote: > > On Wed, Jun 11, 2014 at 02:05:35PM +0200, Michael Haggerty wrote: > >> [...] > >> If there were a function like strbuf_grow_to(sb, len): > >> > >> void strbuf_grow_to(str

Re: [PATCH v3 1/2] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
Eric, On Thu, Jun 12, 2014 at 05:48:52PM -0400, Eric Sunshine wrote: > On Thu, Jun 12, 2014 at 3:31 PM, Jeremiah Mahler wrote: > > On Thu, Jun 12, 2014 at 11:50:41AM -0700, Junio C Hamano wrote: > >> I am on the fence. > >> > >> I have this suspicion that the addition of strbuf_set() would *only*

Re: [PATCH v4 0/1] receive-pack: optionally deny case clone refs

2014-06-12 Thread David Turner
On Thu, 2014-06-12 at 12:47 -0700, Junio C Hamano wrote: > David Turner writes: > > > This issue bit us again recently. > > > > In talking with some colleagues, I realized that the previous version > > of this patch, in addition to being potentially slow, was incomplete. > > Specifically, it didn

Re: [PATCH v3 1/2] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
On Thu, Jun 12, 2014 at 05:18:29PM -0400, Eric Sunshine wrote: > On Thu, Jun 12, 2014 at 3:36 PM, Jeremiah Mahler wrote: > > On Thu, Jun 12, 2014 at 11:51:19AM -0700, Junio C Hamano wrote: > >> Jeremiah Mahler writes: > >> > >> > Thomas, > >> > > >> > On Thu, Jun 12, 2014 at 10:11:36AM +0200, Tho

Re: [PATCH v15 00/48] Use ref transactions

2014-06-12 Thread Junio C Hamano
Ronnie Sahlberg writes: > Final version. > > This patch series can also be found at > https://github.com/rsahlberg/git/tree/ref-transactions > > This patch series is based on next and expands on the transaction API. It > converts all ref updates, inside refs.c as well as external, to use the > tr

Our merge bases sometimes suck

2014-06-12 Thread Michael Haggerty
I've been thinking a lot about merge bases lately and think I have discovered something interesting. tl;dr: When two branches have multiple merge bases, git merge-base $master $branch picks one merge base more or less arbitrarily. Here I describe a criterion for picking a "best" merge base

Re: [PATCH 08/17] provide a helper to free commit buffer

2014-06-12 Thread Jeff King
On Thu, Jun 12, 2014 at 04:08:55PM -0400, Jeff King wrote: > So just putting in the safety check is probably the least-disruptive > thing. It doesn't automatically adapt to a change in the underlying > commit_buffer code, but it would at least notice it. Here is that commit with the check you sug

Re: [PATCH 0/5] submodule config lookup API

2014-06-12 Thread Junio C Hamano
Hmph, this seems to conflict in a meaningful (and painful) way with Jens's "jl/submodule-recursive-checkout". -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH 0/5] submodule config lookup API

2014-06-12 Thread Junio C Hamano
Heiko Voigt writes: > t/t7410-submodule-config.sh | 141 We already use 7410 for something else in 'pu'; please avoid dups waiting to happen. > test-hashmap.c | 6 +- > test-submodule-config.c | 74

Re: [PATCH 2/5] implement submodule config cache for lookup of submodule names

2014-06-12 Thread Junio C Hamano
Heiko Voigt writes: > ... > +static int is_cache_init = 0; Please don't initialise variables in the .bss to zero by hand. > + ... > + warning("%s:.gitmodules, multiple configurations found for " > + "submodule.%s.%s. Skipping second one!", > + commit_

Re: [PATCH v3 1/2] add strbuf_set operations

2014-06-12 Thread Eric Sunshine
On Thu, Jun 12, 2014 at 3:31 PM, Jeremiah Mahler wrote: > On Thu, Jun 12, 2014 at 11:50:41AM -0700, Junio C Hamano wrote: >> I am on the fence. >> >> I have this suspicion that the addition of strbuf_set() would *only* >> help when the original written with reset-and-then-add sequence was >> subop

Re: [PATCH v3 1/2] add strbuf_set operations

2014-06-12 Thread Eric Sunshine
On Thu, Jun 12, 2014 at 3:36 PM, Jeremiah Mahler wrote: > On Thu, Jun 12, 2014 at 11:51:19AM -0700, Junio C Hamano wrote: >> Jeremiah Mahler writes: >> >> > Thomas, >> > >> > On Thu, Jun 12, 2014 at 10:11:36AM +0200, Thomas Braun wrote: >> >> Am 12.06.2014 09:29, schrieb Jeremiah Mahler: >> >> >

Re: git rebase --skip stuck in a loop

2014-06-12 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 So nobody has any ideas on what to check for or how to debug this? On 6/10/2014 2:57 PM, Phillip Susi wrote: > I'm in the middle of a long rebase and have had no trouble with > git rebase --skip several times, but now it has become stuck: > > psusi@d

Re: [PATCH v5 0/4] commit: Add commit.verbose configuration

2014-06-12 Thread Jeremiah Mahler
On Thu, Jun 12, 2014 at 02:38:58PM -0500, Caleb Thompson wrote: > This patch allows people to set commit.verbose to implicitly send > --verbose to git-commit. > > This version incorporates changes suggested by Eric Sunshine, Duy > Nguyen, and Jeremiah Mahler. > > It introduces several cleanup pat

Re: [PATCH 08/17] provide a helper to free commit buffer

2014-06-12 Thread Jeff King
On Thu, Jun 12, 2014 at 11:22:31AM -0700, Junio C Hamano wrote: > > Note that we also need to provide a "detach" mechanism for > > the weird case in fsck which passes the buffer back to be > > freed. > > I find that last sentence a bit of white lie ;-). > > The sole caller of "detach" is in inde

[PATCH v5 4/4] commit: Add commit.verbose configuration

2014-06-12 Thread Caleb Thompson
Add a new configuration variable commit.verbose to implicitly pass --verbose to git-commit. Ensure that --no-verbose to git-commit negates that setting. Signed-off-by: Caleb Thompson --- Documentation/config.txt | 5 + Documentation/git-commit.txt | 8 +++- buil

Re: [PATCH 15/17] commit-slab: provide a static initializer

2014-06-12 Thread Jeff King
On Thu, Jun 12, 2014 at 11:15:49AM -0700, Junio C Hamano wrote: > Why do we need an initialiser at this point (in other words, how > have other existing slab users coped without having one)? > > I think they call init_*_slab() when the slab is needed/used the > first time (e.g. it is not even wor

Re: [PATCH v4 0/1] receive-pack: optionally deny case clone refs

2014-06-12 Thread Junio C Hamano
David Turner writes: > This issue bit us again recently. > > In talking with some colleagues, I realized that the previous version > of this patch, in addition to being potentially slow, was incomplete. > Specifically, it didn't handle the case of refs/heads/case/one vs > refs/heads/CASE/two; the

[PATCH v5 3/4] commit test: test_set_editor in each test

2014-06-12 Thread Caleb Thompson
t/t7507-commit-verbose.sh was using a global test_set_editor call to build its environment. Improve robustness against global state changes by having only tests which intend to use the $EDITOR to check for presence of a diff in the editor set up the test-editor to use check-for-diff rather than re

[PATCH v5 1/4] commit test: Use test_config instead of git-config

2014-06-12 Thread Caleb Thompson
Some of the tests in t/t7507-commit-verbose.sh were still using git-config to set configuration. Change them to use the test_config helper. Signed-off-by: Caleb Thompson --- t/t7507-commit-verbose.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t7507-commit-verbose.s

[PATCH v5 2/4] commit test: Use write_script

2014-06-12 Thread Caleb Thompson
Use write_script from t/test-lib-functions.sh instead of cat, shebang, and chmod. This protects us from potential shell meta-characters in the name of our trash directory, which would be interpreted if we set $EDITOR directly. Signed-off-by: Caleb Thompson --- t/t7507-commit-verbose.sh | 6 ++---

[PATCH v5 0/4] commit: Add commit.verbose configuration

2014-06-12 Thread Caleb Thompson
This patch allows people to set commit.verbose to implicitly send --verbose to git-commit. This version incorporates changes suggested by Eric Sunshine, Duy Nguyen, and Jeremiah Mahler. It introduces several cleanup patches to t/t7505-commit-verbose.sh to bring it closer to the current state of t

Re: [PATCH v3 1/2] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
Junio, On Thu, Jun 12, 2014 at 11:51:19AM -0700, Junio C Hamano wrote: > Jeremiah Mahler writes: > > > Thomas, > > > > On Thu, Jun 12, 2014 at 10:11:36AM +0200, Thomas Braun wrote: > >> Am 12.06.2014 09:29, schrieb Jeremiah Mahler: > >> > A common use case with strubfs is to set the buffer to a

Re: [PATCH v3 1/2] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
Junio, Comments below... On Thu, Jun 12, 2014 at 11:50:41AM -0700, Junio C Hamano wrote: > Jeremiah Mahler writes: > > > A common use case with strubfs is to set the buffer to a new value. > > This must be done in two steps: a reset followed by an add. > > > > strbuf_reset(buf); > > strbuf_

Re: [PATCH RFC] git-am: support any number of signatures

2014-06-12 Thread René Scharfe
Am 12.06.2014 18:12, schrieb Michael S. Tsirkin: @@ -136,7 +136,7 @@ fall_back_3way () { eval "$cmd" && GIT_INDEX_FILE="$dotest/patch-merge-tmp-index" \ git write-tree >"$dotest/patch-merge-base+" || -cannot_fallback "$(gettext "Repository lacks necessary blobs to fall back

Re: [PATCH v4 1/4] commit test: Use test_config instead of git-config

2014-06-12 Thread Caleb Thompson
Jeremiah, That looks great. Since I'm not seeing any more feedback on the code for this set of patches, I'll go ahead and send up another set. Thank you for those pointers. Caleb Thompson On Thu, Jun 12, 2014 at 11:46:37AM -0700, Jeremiah Mahler wrote: > Caleb, > > On Thu, Jun 12, 2014 at 01:23

Re: [PATCH 1/5] hashmap: add enum for hashmap free_entries option

2014-06-12 Thread Junio C Hamano
Karsten Blees writes: > Am 10.06.2014 12:17, schrieb Heiko Voigt: >> The intention of Jonathans critique here[1] was that you do not see what >> this parameter does on the callsite. I.e.: >> >> hashmap_free(&map, 1); >> >> compared to >> >> hashmap_free(&map, HASHMAP_FREE_ENTRIES); >

Re: [PATCH RFC] git-am: support any number of signatures

2014-06-12 Thread Junio C Hamano
"Michael S. Tsirkin" writes: > I'm using different signature tags for git am depending on the patch, > project and other factors. > > Sometimes I add multiple tags as well, e.g. QEMU > wants both Reviewed-by and Signed-off-by tags. > > This patch makes it easy to do so: > 1. new parameter am.sig

Re: [PATCH v3 1/2] add strbuf_set operations

2014-06-12 Thread Junio C Hamano
Jeremiah Mahler writes: > Thomas, > > On Thu, Jun 12, 2014 at 10:11:36AM +0200, Thomas Braun wrote: >> Am 12.06.2014 09:29, schrieb Jeremiah Mahler: >> > A common use case with strubfs is to set the buffer to a new value. strubfs??? >> > This must be done in two steps: a reset followed by an ad

Re: [PATCH v3 1/2] add strbuf_set operations

2014-06-12 Thread Junio C Hamano
Jeremiah Mahler writes: > A common use case with strubfs is to set the buffer to a new value. > This must be done in two steps: a reset followed by an add. > > strbuf_reset(buf); > strbuf_add(buf, new_buf, len); > > In cases where the buffer is being built up in steps, these operations > make

[PATCH v2] completion: Handle '!f() { ... }; f' and "!sh -c '...'" aliases

2014-06-12 Thread Steffen Prohaska
'!f() { ... }; f' and "!sh -c ''" are recommended patterns for declaring more complex aliases (see git wiki [1]). This commit teaches the completion to handle them. When determining which completion to use for an alias, an opening brace or single quote is now skipped, and the search for a git

Re: [PATCH v4 1/4] commit test: Use test_config instead of git-config

2014-06-12 Thread Jeremiah Mahler
Caleb, On Thu, Jun 12, 2014 at 01:23:41PM -0500, Caleb Thompson wrote: > Jeremiah, > > On Thu, Jun 12, 2014 at 11:04:59AM -0700, Jeremiah Mahler wrote: > > ... > > > > How are you preparing your patches. 'git format-patch' with a 'git > > send-email'? > > I'm so glad you asked, because I've jus

Re: [PATCH v2] completion: Handle '!f() { ... }; f' aliases

2014-06-12 Thread Steffen Prohaska
On Jun 10, 2014, at 7:27 AM, Junio C Hamano wrote: > Steffen Prohaska writes: > > I tend to prefer writing it like so instead: > >sh -c '...' - > > so that I won't clobber "f" (or any other name). I wonder if you > can help users of this other pattern as well. I'll send an updated patc

Re: [PATCH v5 00/11] add performance tracing facility

2014-06-12 Thread Junio C Hamano
Karsten Blees writes: > Here's v5 of the performance tracing patch series, now including a bunch of > cleanups and adding timestamp, file and line to all trace output. > > I'm particularly interested in feedback for the output format. As file names > have different lengths, printing file:line a

Re: [PATCH v4 1/4] commit test: Use test_config instead of git-config

2014-06-12 Thread Caleb Thompson
Jeremiah, On Thu, Jun 12, 2014 at 11:04:59AM -0700, Jeremiah Mahler wrote: > > Thanks for checking. Unfortunately the problem persists for me. > > It seems to be related to there not being a space at the left most part > of the patch. It is just a tab with no space. So 'git am' has a > problem

Re: [PATCH 08/17] provide a helper to free commit buffer

2014-06-12 Thread Junio C Hamano
Jeff King writes: > This converts two lines into one at each caller. But more > importantly, it abstracts the concept of freeing the buffer, > which will make it easier to change later. > > Note that we also need to provide a "detach" mechanism for > the weird case in fsck which passes the buffer

[PATCH] l10n: de.po: improve message when switching branches

2014-06-12 Thread Ralf Thielow
Suggested-by: Stefan Beller Signed-off-by: Ralf Thielow --- Am 12. Juni 2014 19:59 schrieb Stefan Beller : > On 12.06.2014 18:12, Ralf Thielow wrote: >> Signed-off-by: Ralf Thielow >> #, c-format >> msgid "Switched to a new branch '%s'\n" >> -msgstr "Gewechselt zu einem neuem Branch '%s'\n" >

Re: [PATCH 15/17] commit-slab: provide a static initializer

2014-06-12 Thread Junio C Hamano
Jeff King writes: > Callers currently must use init_foo_slab() at runtime before > accessing a slab. For global slabs, it's much nicer if we > can initialize them in BSS, so that each user does not have > to add code to check-and-initialize. > > Signed-off-by: Jeff King > --- > There was no comm

Re: [PATCH v4 1/4] commit test: Use test_config instead of git-config

2014-06-12 Thread Jeremiah Mahler
On Thu, Jun 12, 2014 at 11:04:59AM -0700, Jeremiah Mahler wrote: > Caleb, > ... > > Thanks for checking. Unfortunately the problem persists for me. > > It seems to be related to there not being a space at the left most part > of the patch. It is just a tab with no space. So 'git am' has a > pr

Re: [git] Re: Relative submodule URLs, and forks that haven't forked the submodule

2014-06-12 Thread W. Trevor King
On Thu, Jun 12, 2014 at 06:05:10PM +0200, Charles Brossollet wrote: > The two problems I'm pointing are: > > 1. After checkout of a branch that tracks /user/main repo, call git >init submodule motors. Git registers it in .git/config with URL >/user/sub, while it should be /central/sub acco

Re: [PATCH v4 1/4] commit test: Use test_config instead of git-config

2014-06-12 Thread Jeremiah Mahler
Caleb, On Thu, Jun 12, 2014 at 08:51:31AM -0500, Caleb Thompson wrote: > I assume that you're running it against master? > > I rebased the branch yesterday, but I'll give it another shot. Obviously I > didn't use git-am, but I can try that. > > Caleb Thompson > > On Thu, Jun 12, 2014 at 01:41:5

Re: [PATCH] l10n: de.po: fix typo

2014-06-12 Thread Stefan Beller
On 12.06.2014 18:12, Ralf Thielow wrote: > Signed-off-by: Ralf Thielow > --- > po/de.po | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/po/de.po b/po/de.po > index b777ef4..d7bc424 100644 > --- a/po/de.po > +++ b/po/de.po > @@ -3503,7 +3503,7 @@ msgstr "Gewechselt zu umg

[PATCH v16 23/48] refs.c: make ref_transaction_begin take an err argument

2014-06-12 Thread Ronnie Sahlberg
Add an err argument to _begin so that on non-fatal failures in future ref backends we can report a nice error back to the caller. While _begin can currently never fail for other reasons than OOM, in which case we die() anyway, we may add other types of backends in the future. For example, a hypothe

[PATCH v16 02/48] refs.c: ref_transaction_commit should not free the transaction

2014-06-12 Thread Ronnie Sahlberg
Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/update-ref.c | 1 + refs.c | 1 - refs.h | 5 ++--- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/builtin/update-ref.c b/builtin/update-ref.c index 405267f..1fd7a89 100644 --- a/b

[PATCH v16 08/48] refs.c: add an err argument to repack_without_refs

2014-06-12 Thread Ronnie Sahlberg
Update repack_without_refs to take an err argument and update it if there is a failure. Pass the err variable from ref_transaction_commit to this function so that callers can print a meaningful error message if _commit fails due to this function. Signed-off-by: Ronnie Sahlberg --- refs.c | 19 ++

[PATCH v16 33/48] fast-import.c: use a ref transaction when dumping tags

2014-06-12 Thread Ronnie Sahlberg
Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- fast-import.c | 29 +++-- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/fast-import.c b/fast-import.c index 4a7b196..587ef4a 100644 --- a/fast-import.c +++ b/fast-import.c @@ -1735,15 +1735,3

[PATCH v16 09/48] refs.c: make sure log_ref_setup returns a meaningful errno

2014-06-12 Thread Ronnie Sahlberg
Making errno when returning from log_ref_setup() meaningful, Signed-off-by: Ronnie Sahlberg --- refs.c | 29 - refs.h | 4 +++- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/refs.c b/refs.c index b4b05bd..6f85bd8 100644 --- a/refs.c +++ b/refs.c @@

[PATCH v16 00/48] Use ref transactions

2014-06-12 Thread Ronnie Sahlberg
Final Final version. This patch series can also be found at https://github.com/rsahlberg/git/tree/ref-transactions This patch series is based on next and expands on the transaction API. It converts all ref updates, inside refs.c as well as external, to use the transaction API for updates. This ma

[PATCH v16 26/48] replace.c: use the ref transaction functions for updates

2014-06-12 Thread Ronnie Sahlberg
Update replace.c to use ref transactions for updates. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/replace.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/builtin/replace.c b/builtin/replace.c index 4b3705d..cf92e5d 100644 --- a/b

[PATCH v16 11/48] refs.c: make remove_empty_directories alwasy set errno to something sane

2014-06-12 Thread Ronnie Sahlberg
Making errno when returning from remove_empty_directories() more obviously meaningful, which should provide some peace of mind for people auditing lock_ref_sha1_basic. Signed-off-by: Ronnie Sahlberg --- refs.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/refs.c b/refs.

[PATCH v16 05/48] refs.c: add a strbuf argument to ref_transaction_commit for error logging

2014-06-12 Thread Ronnie Sahlberg
Add a strbuf argument to _commit so that we can pass an error string back to the caller. So that we can do error logging from the caller instead of from _commit. Longer term plan is to first convert all callers to use onerr==QUIET_ON_ERR and craft any log messages from the callers themselves and f

[PATCH v16 20/48] refs.c: change ref_transaction_update() to do error checking and return status

2014-06-12 Thread Ronnie Sahlberg
Update ref_transaction_update() do some basic error checking and return non-zero on error. Update all callers to check ref_transaction_update() for error. There are currently no conditions in _update that will return error but there will be in the future. Add an err argument that will be updated on

[PATCH v16 35/48] refs.c: make lock_ref_sha1 static

2014-06-12 Thread Ronnie Sahlberg
No external callers reference lock_ref_sha1 any more so lets declare it static. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- refs.c | 2 +- refs.h | 6 -- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/refs.c b/refs.c index 30b5db1..8c0f046 100644 --- a/ref

[PATCH v16 30/48] branch.c: use ref transaction for all ref updates

2014-06-12 Thread Ronnie Sahlberg
Change create_branch to use a ref transaction when creating the new branch. This also fixes a race condition in the old code where two concurrent create_branch could race since the lock_any_ref_for_update/write_ref_sha1 did not protect against the ref already existing. I.e. one thread could end up

[PATCH v16 19/48] refs.c: remove the onerr argument to ref_transaction_commit

2014-06-12 Thread Ronnie Sahlberg
Since all callers now use QUIET_ON_ERR we no longer need to provide an onerr argument any more. Remove the onerr argument from the ref_transaction_commit signature. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/update-ref.c | 3 +-- refs.c | 22 +++--

[PATCH v16 29/48] fast-import.c: change update_branch to use ref transactions

2014-06-12 Thread Ronnie Sahlberg
Change update_branch() to use ref transactions for updates. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- fast-import.c | 25 +++-- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/fast-import.c b/fast-import.c index 6707a66..4a7b196 100644 -

[PATCH v16 44/48] refs.c: call lock_ref_sha1_basic directly from commit

2014-06-12 Thread Ronnie Sahlberg
Skip using the lock_any_ref_for_update wrapper and call lock_ref_sha1_basic directly from the commit function. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- refs.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/refs.c b/refs.c index be618e8..6

[PATCH v16 46/48] refs.c: propagate any errno==ENOTDIR from _commit back to the callers

2014-06-12 Thread Ronnie Sahlberg
In _commit, ENOTDIR can happen in the call to lock_ref_sha1_basic, either when we lstat the new refname and it returns ENOTDIR or if the name checking function reports that the same type of conflict happened. In both cases it means that we can not create the new ref due to a name conflict. For the

Re: [PATCH v2 0/17] store length of commit->buffer

2014-06-12 Thread Junio C Hamano
Jeff King writes: > On Tue, Jun 10, 2014 at 05:35:09PM -0400, Jeff King wrote: > >> Here's a re-roll of the commit-slab series. It fixes the issues pointed >> out by Eric and Christian (thanks, both). > > Side note: I marked this as v2, but forgot to do so in each individual > patch (I write my c

[PATCH v16 25/48] tag.c: use ref transactions when doing updates

2014-06-12 Thread Ronnie Sahlberg
Change tag.c to use ref transactions for all ref updates. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/tag.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/builtin/tag.c b/builtin/tag.c index c6e8a71..c9bfc9a 100644 --- a/builtin/t

[PATCH v16 22/48] refs.c: update ref_transaction_delete to check for error and return status

2014-06-12 Thread Ronnie Sahlberg
Change ref_transaction_delete() to do basic error checking and return non-zero of error. Update all callers to check the return for ref_transaction_delete(). There are currently no conditions in _delete that will return error but there will be in the future. Add an err argument that will be updated

[PATCH v16 32/48] receive-pack.c: use a reference transaction for updating the refs

2014-06-12 Thread Ronnie Sahlberg
Wrap all the ref updates inside a transaction. Free commands when we are finished with them instead of leaking. Signed-off-by: Ronnie Sahlberg --- builtin/receive-pack.c | 74 +++--- 1 file changed, 52 insertions(+), 22 deletions(-) diff --git a/built

[PATCH v16 24/48] refs.c: add transaction.status and track OPEN/CLOSED/ERROR

2014-06-12 Thread Ronnie Sahlberg
Track the status of a transaction in a new status field. Check the field for sanity, i.e. that status must be OPEN when _commit/_create/_delete or _update is called or else die(BUG:...) Signed-off-by: Ronnie Sahlberg --- refs.c | 40 +++- 1 file changed, 39 in

[PATCH v16 41/48] refs.c: pass the ref log message to _create/delete/update instead of _commit

2014-06-12 Thread Ronnie Sahlberg
Change the reference transactions so that we pass the reflog message through to the create/delete/update function instead of the commit message. This allows for individual messages for each change in a multi ref transaction. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- branch

[PATCH v16 34/48] walker.c: use ref transaction for ref updates

2014-06-12 Thread Ronnie Sahlberg
Switch to using ref transactions in walker_fetch(). As part of the refactoring to use ref transactions we also fix a potential memory leak where in the original code if write_ref_sha1() would fail we would end up returning from the function without free()ing the msg string. Note that this function

[PATCH v16 27/48] commit.c: use ref transactions for updates

2014-06-12 Thread Ronnie Sahlberg
Change commit.c to use ref transactions for all ref updates. Make sure we pass a NULL pointer to ref_transaction_update if have_old is false. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/commit.c | 24 +++- 1 file changed, 11 insertions(+), 13 dele

[PATCH v16 14/48] refs.c: log_ref_write should try to return meaningful errno

2014-06-12 Thread Ronnie Sahlberg
Making errno from write_ref_sha1() meaningful, which should fix * a bug in "git checkout -b" where it prints strerror(errno)  despite errno possibly being zero or clobbered * a bug in "git fetch"'s s_update_ref, which trusts the result of an  errno == ENOTDIR check to detect D/F conflicts Sign

[PATCH v16 28/48] sequencer.c: use ref transactions for all ref updates

2014-06-12 Thread Ronnie Sahlberg
Change to use ref transactions for all updates to refs. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- sequencer.c | 24 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/sequencer.c b/sequencer.c index 0a80c58..fd8acaf 100644 --- a/sequenc

[PATCH v16 31/48] refs.c: change update_ref to use a transaction

2014-06-12 Thread Ronnie Sahlberg
Change the update_ref helper function to use a ref transaction internally. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- refs.c | 25 + 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/refs.c b/refs.c index 8523c39..30b5db1 100644 --- a/re

[PATCH v16 13/48] refs.c: make resolve_ref_unsafe set errno to something meaningful on error

2014-06-12 Thread Ronnie Sahlberg
Making errno when returning from resolve_ref_unsafe() meaningful, which should fix * a bug in lock_ref_sha1_basic, where it assumes EISDIR means it failed due to a directory being in the way Signed-off-by: Ronnie Sahlberg --- cache.h | 2 +- refs.c | 19 +++ 2 files change

[PATCH v16 21/48] refs.c: change ref_transaction_create to do error checking and return status

2014-06-12 Thread Ronnie Sahlberg
Do basic error checking in ref_transaction_create() and make it return non-zero on error. Update all callers to check the result of ref_transaction_create(). There are currently no conditions in _create that will return error but there will be in the future. Add an err argument that will be updated

[PATCH v16 36/48] refs.c: remove the update_ref_lock function

2014-06-12 Thread Ronnie Sahlberg
Since we now only call update_ref_lock with onerr==QUIET_ON_ERR we no longer need this function and can replace it with just calling lock_any_ref_for_update directly. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- refs.c | 30 ++ 1 file changed, 6 in

[PATCH v16 17/48] refs.c: make update_ref_write update a strbuf on failure

2014-06-12 Thread Ronnie Sahlberg
Change update_ref_write to also update an error strbuf on failure. This makes the error available to ref_transaction_commit callers if the transaction failed due to update_ref_sha1/write_ref_sha1 failures. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- refs.c | 9 ++--- 1 f

[PATCH v16 45/48] refs.c: pass a skip list to name_conflict_fn

2014-06-12 Thread Ronnie Sahlberg
Allow passing a list of refs to skip checking to name_conflict_fn. There are some conditions where we want to allow a temporary conflict and skip checking those refs. For example if we have a transaction that 1, guarantees that m is a packed refs and there is no loose ref for m 2, the transaction w

[PATCH v16 37/48] refs.c: remove the update_ref_write function

2014-06-12 Thread Ronnie Sahlberg
Since we only call update_ref_write from a single place and we only call it with onerr==QUIET_ON_ERR we can just as well get rid of it and just call write_ref_sha1 directly. This changes the return status for _commit from 1 to -1 on failures when writing to the ref. Eventually we will want _commit

[PATCH v16 48/48] refs.c: make write_ref_sha1 static

2014-06-12 Thread Ronnie Sahlberg
No external users call write_ref_sha1 any more so lets declare it static. Signed-off-by: Ronnie Sahlberg --- refs.c | 10 -- refs.h | 3 --- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/refs.c b/refs.c index 8917832..31d7616 100644 --- a/refs.c +++ b/refs.c @@ -2639,6

[PATCH v16 38/48] refs.c: remove lock_ref_sha1

2014-06-12 Thread Ronnie Sahlberg
lock_ref_sha1 was only called from one place in refc.c and only provided a check that the refname was sane before adding back the initial "refs/" part of the ref path name, the initial "refs/" that this caller had already stripped off before calling lock_ref_sha1. Reviewed-by: Jonathan Nieder Sig

[PATCH v16 40/48] refs.c: make delete_ref use a transaction

2014-06-12 Thread Ronnie Sahlberg
Change delete_ref to use a ref transaction for the deletion. At the same time since we no longer have any callers of repack_without_ref we can now delete this function. Change delete_ref to return 0 on success and 1 on failure instead of the previous 0 on success either 1 or -1 on failure. Review

[PATCH v16 39/48] refs.c: make prune_ref use a transaction to delete the ref

2014-06-12 Thread Ronnie Sahlberg
Change prune_ref to delete the ref using a ref transaction. To do this we also need to add a new flag REF_ISPRUNING that will tell the transaction that we do not want to delete this ref from the packed refs. This flag is private to refs.c and not exposed to external callers. Reviewed-by: Jonathan

[PATCH v16 42/48] refs.c: pass NULL as *flags to read_ref_full

2014-06-12 Thread Ronnie Sahlberg
We call read_ref_full with a pointer to flags from rename_ref but since we never actually use the returned flags we can just pass NULL here instead. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refs.c

[PATCH v16 47/48] fetch.c: change s_update_ref to use a ref transaction

2014-06-12 Thread Ronnie Sahlberg
Change s_update_ref to use a ref transaction for the ref update. Signed-off-by: Ronnie Sahlberg --- builtin/fetch.c | 33 +++-- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/builtin/fetch.c b/builtin/fetch.c index faa1233..52f1ebc 100644 --- a/builti

[PATCH v16 43/48] refs.c: move the check for valid refname to lock_ref_sha1_basic

2014-06-12 Thread Ronnie Sahlberg
Move the check for check_refname_format from lock_any_ref_for_update to lock_ref_sha1_basic. At some later stage we will get rid of lock_any_ref_for_update completely. If lock_ref_sha1_basic fails the check_refname_format test, set errno to EINVAL before returning NULL. This to guarantee that we w

[PATCH v16 07/48] lockfile.c: make lock_file return a meaningful errno on failurei

2014-06-12 Thread Ronnie Sahlberg
Making errno when returning from lock_file() meaningful, which should fix * an existing almost-bug in lock_ref_sha1_basic where it assumes errno==ENOENT is meaningful and could waste some work on retries * an existing bug in repack_without_refs where it prints strerror(errno) and picks ad

[PATCH v16 16/48] refs.c: add an err argument to delete_ref_loose

2014-06-12 Thread Ronnie Sahlberg
Add an err argument to delete_loose_ref so that we can pass a descriptive error string back to the caller. Pass the err argument from transaction commit to this function so that transaction users will have a nice error string if the transaction failed due to delete_loose_ref. Add a new function un

[PATCH v16 10/48] refs.c: verify_lock should set errno to something meaningful

2014-06-12 Thread Ronnie Sahlberg
Making errno when returning from verify_lock() meaningful, which should almost but not completely fix * a bug in "git fetch"'s s_update_ref, which trusts the result of an errno == ENOTDIR check to detect D/F conflicts ENOTDIR makes sense as a sign that a file was in the way of a directory we

[PATCH v16 06/48] lockfile.c: add a new public function unable_to_lock_message

2014-06-12 Thread Ronnie Sahlberg
Introducing a new unable_to_lock_message helper, which has nicer semantics than unable_to_lock_error and cleans up lockfile.c a little. Signed-off-by: Ronnie Sahlberg --- cache.h| 2 ++ lockfile.c | 22 -- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/

[PATCH v16 01/48] refs.c: remove ref_transaction_rollback

2014-06-12 Thread Ronnie Sahlberg
We do not yet need both a rollback and a free function for transactions. Remove ref_transaction_rollback and use ref_transaction_free instead. At a later stage we may reintroduce a rollback function if we want to start adding reusable transactions and similar. Reviewed-by: Jonathan Nieder Signed

[PATCH v16 15/48] refs.c: make ref_update_reject_duplicates take a strbuf argument for errors

2014-06-12 Thread Ronnie Sahlberg
Make ref_update_reject_duplicates return any error that occurs through a new strbuf argument. This means that when a transaction commit fails in this function we will now be able to pass a helpful error message back to the caller. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg ---

  1   2   >