Re: The different EOL behavior between libgit2-based software and official Git

2014-06-19 Thread Torsten Bögershausen
On 06/19/2014 04:59 AM, Yue Lin Ho wrote: Hi: ^_^ I did some test on the EOL behavior between official git and libgit2-based software(TortoiseGit). Then, I got that they have different EOL behavior. The blob stored in repository is a text file with mixed EOLs. Even set core.autocrlf = true,

Re: The different EOL behavior between libgit2-based software and official Git

2014-06-19 Thread Yue Lin Ho
Hi Torsten Bögershausen: Since you mail to msysGit first, I reply there. (https://groups.google.com/forum/#!topic/msysgit/EDD3RipNeBQ) Thank you again. ^_^ Yue Lin Ho -- View this message in context:

Re: [PATCH v3 2/5] tree-walk.c: remove name_compare() function

2014-06-19 Thread Jeremiah Mahler
Jonathan, On Wed, Jun 18, 2014 at 12:03:59PM -0700, Jonathan Nieder wrote: Jeremiah Mahler wrote: Remove the duplicate name_compare() function and use the one provided by read-cache.c. I'd squash this into patch 1/5. --- Notes: There is one small difference between the old

Re: [PATCH v3 0/5] cleanup duplicate name_compare() functions

2014-06-19 Thread Jeremiah Mahler
Jonathan, On Wed, Jun 18, 2014 at 12:14:07PM -0700, Jonathan Nieder wrote: Jeremiah Mahler wrote: Jeremiah Mahler (5): cache: rename cache_name_compare() to name_compare() tree-walk.c: remove name_compare() function unpack-trees.c: remove name_compare() function dir.c: rename

[PATCH v4] cleanup duplicate name_compare() functions

2014-06-19 Thread Jeremiah Mahler
Version 4 of the patch series to cleanup the duplicate name_compare() functions. The previous patch series would have left the system in a broken state if only part of the patches were applied. This version condenses all the patches in to a single working patch as Jonathan Nieder suggested [1].

[PATCH v4] cleanup duplicate name_compare() functions

2014-06-19 Thread Jeremiah Mahler
Both unpack-trees.c and read-cache.c have their own name_compare() function, which are identical. And read-cache.c has a cache_name_compare() function which is nearly identical to name_compare() [1]. The cache_name_compare() function is not specific to a cache, other than by being part of

Re: [PATCH v3 0/5] cleanup duplicate name_compare() functions

2014-06-19 Thread Jeff King
On Thu, Jun 19, 2014 at 01:04:32AM -0700, Jeremiah Mahler wrote: After looking at the patches I suspect this should be a single patch. That way it's bisectable, and the changes outside of read-cache.c are small enough that it's not too much of a burden to review as a single patch.

Re: [PATCH 1/2] strbuf: add xstrdup_fmt helper

2014-06-19 Thread Jeff King
On Wed, Jun 18, 2014 at 03:32:08PM -0700, Junio C Hamano wrote: str = xstrdup_fmt(fmt, some, args); --- I'm open to suggestions on the name. This really is the same thing conceptually as the GNU asprintf(), but the interface is different (that function takes a pointer-to-pointer as an

Re: [PATCH] alloc.c: remove alloc_raw_commit_node() function

2014-06-19 Thread Jeff King
On Wed, Jun 18, 2014 at 11:30:50PM +0100, Ramsay Jones wrote: So, the patch below is a slight variation on the original patch. I'm still slightly concerned about portability, but given that it has been at least a decade since I last used a (pre-ANSI) compiler which had a problem with this ...

Re: [PATCH] alloc.c: remove alloc_raw_commit_node() function

2014-06-19 Thread Ramsay Jones
On 19/06/14 10:19, Jeff King wrote: On Wed, Jun 18, 2014 at 11:30:50PM +0100, Ramsay Jones wrote: So, the patch below is a slight variation on the original patch. I'm still slightly concerned about portability, but given that it has been at least a decade since I last used a (pre-ANSI)

Re: What's cooking in git.git (Jun 2014, #04; Tue, 17)

2014-06-19 Thread Duy Nguyen
On Thu, Jun 19, 2014 at 12:25 AM, Junio C Hamano gits...@pobox.com wrote: [Stalled] * nd/multiple-work-trees (2014-03-25) 28 commits - count-objects: report unused files in $GIT_DIR/repos/... - gc: support prune --repos - gc: style change -- no SP before closing bracket - prune:

Tool/Scripts - For maintaining different branches on a repo

2014-06-19 Thread Jagan Teki
Hi, I have a single repo with different kinds of branches say 4 branches. Developers will send a patches wrt to specific branch. Is there any opensource tool/script that does applying patches/maintaining the branches in repo w/o manual intervention? thanks! -- Jagan. -- To unsubscribe from

Re: [RFC] rebase --root: Empty root commit is replaced with sentinel

2014-06-19 Thread Michael Haggerty
On 06/18/2014 02:10 PM, Fabian Ruch wrote: `rebase` supports the option `--root` both with and without `--onto`. The case where `--onto` is not specified is handled by creating a sentinel commit and squashing the root commit into it. The sentinel commit refers to the empty tree and does not

Re: [PATCH 4/4] diff: mark any file larger than core.bigfilethreshold binary

2014-06-19 Thread Thomas Braun
Am Donnerstag, den 29.05.2014, 19:57 +0700 schrieb Nguyễn Thái Ngọc Duy: Hi, sorry for chiming in so late. I've just played around with patch 3 and 4 of that series. And I like it very much as I work often with large files so any further enhancement in that area is really nice. (see comments

Re: [RFC] rebase --root: Empty root commit is replaced with sentinel

2014-06-19 Thread Fabian Ruch
Hi Michael, thanks for your reply. On 06/19/2014 01:35 PM, Michael Haggerty wrote: On 06/18/2014 02:10 PM, Fabian Ruch wrote: `rebase` supports the option `--root` both with and without `--onto`. The case where `--onto` is not specified is handled by creating a sentinel commit and squashing

Re: [RFC] rebase --root: Empty root commit is replaced with sentinel

2014-06-19 Thread Michael Haggerty
On 06/19/2014 02:39 PM, Fabian Ruch wrote: Hi Michael, thanks for your reply. On 06/19/2014 01:35 PM, Michael Haggerty wrote: On 06/18/2014 02:10 PM, Fabian Ruch wrote: `rebase` supports the option `--root` both with and without `--onto`. The case where `--onto` is not specified is

search for equivalent commits by patch-id

2014-06-19 Thread vicentiu . neagoe
Hello, Is there a way to find all equivalent commits by patch-id? Something similar to: git branch -a --commit commit but instead of commit to search by patch-id. thanks Vicentiu -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to

Surprising 'git-describe --all --match' behavior.

2014-06-19 Thread Sergei Organov
Hello, Just playing with it, got some surprises: $ git --version git version 1.9.3 $ git describe --all heads/v3.5 $ git describe --all --match 'v*' tags/v3.5.6b2-4-gab4bf78 $ git describe --all --match 'heads/v*' fatal: No names found, cannot describe anything. ... heads/v3.5 matches neither

[PATCH v19 03/48] refs.c: constify the sha arguments for ref_transaction_create|delete|update

2014-06-19 Thread Ronnie Sahlberg
ref_transaction_create|delete|update has no need to modify the sha1 arguments passed to it so it should use const unsigned char* instead of unsigned char*. Some functions, such as fast_forward_to(), already have its old/new sha1 arguments as consts. This function will at some point need to use

[PATCH v19 00/48] Use ref transactions

2014-06-19 Thread Ronnie Sahlberg
This patch series can also be found at https://github.com/rsahlberg/git/tree/ref-transactions This patch series is based on current master 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 makes most of

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

2014-06-19 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 jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff

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

2014-06-19 Thread Ronnie Sahlberg
No external users call write_ref_sha1 any more so lets declare it static. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 10 -- refs.h | 3 --- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/refs.c b/refs.c index f4234b9..1529a26 100644 --- a/refs.c +++

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

2014-06-19 Thread Ronnie Sahlberg
Update replace.c to use ref transactions for updates. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/replace.c | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/builtin/replace.c

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

2014-06-19 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 jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg

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

2014-06-19 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

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

2014-06-19 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 v19 30/48] refs.c: change update_ref to use a transaction

2014-06-19 Thread Ronnie Sahlberg
Change the update_ref helper function to use a ref transaction internally. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 25 + 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/refs.c b/refs.c

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

2014-06-19 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

[PATCH v19 40/48] refs.c: add an err argument to delete_ref_loose

2014-06-19 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

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

2014-06-19 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

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

2014-06-19 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 v19 41/48] refs.c: pass the ref log message to _create/delete/update instead of _commit

2014-06-19 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 jrnie...@gmail.com Signed-off-by: Ronnie

[PATCH v19 35/48] refs.c: remove the update_ref_lock function

2014-06-19 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 jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 30

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

2014-06-19 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 jrnie...@gmail.com Signed-off-by:

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

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

[PATCH v19 37/48] refs.c: remove lock_ref_sha1

2014-06-19 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

[PATCH v19 33/48] walker.c: use ref transaction for ref updates

2014-06-19 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

[PATCH v19 04/48] refs.c: allow passing NULL to ref_transaction_free

2014-06-19 Thread Ronnie Sahlberg
Allow ref_transaction_free(NULL) as a no-op. This makes ref_transaction_free easier to use and more similar to plain 'free'. In particular, it lets us rollback unconditionally as part of cleanup code after setting 'transaction = NULL' if a transaction has been committed or rolled back already.

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

2014-06-19 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 jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 2 +- 1 file changed, 1

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

2014-06-19 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 sahlb...@google.com

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

2014-06-19 Thread Ronnie Sahlberg
Wrap all the ref updates inside a transaction. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/receive-pack.c | 96 +- 1 file changed, 63 insertions(+), 33 deletions(-) diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c

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

2014-06-19 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 sahlb...@google.com --- refs.c | 40 +++- 1

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

2014-06-19 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

[PATCH v19 39/48] refs.c: make delete_ref use a transaction

2014-06-19 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.

[PATCH v19 27/48] sequencer.c: use ref transactions for all ref updates

2014-06-19 Thread Ronnie Sahlberg
Change to use ref transactions for all updates to refs. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- sequencer.c | 24 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/sequencer.c b/sequencer.c index

[PATCH v19 26/48] commit.c: use ref transactions for updates

2014-06-19 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 jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/commit.c | 24 +++- 1

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

2014-06-19 Thread Ronnie Sahlberg
Change update_branch() to use ref transactions for updates. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- fast-import.c | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/fast-import.c

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

2014-06-19 Thread Ronnie Sahlberg
Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- fast-import.c | 29 +++-- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/fast-import.c b/fast-import.c index cd929dc..191fc47 100644 --- a/fast-import.c

[PATCH v19 18/48] refs.c: remove the onerr argument to ref_transaction_commit

2014-06-19 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 jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/update-ref.c | 3

[PATCH v19 24/48] tag.c: use ref transactions when doing updates

2014-06-19 Thread Ronnie Sahlberg
Change tag.c to use ref transactions for all ref updates. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/tag.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/builtin/tag.c b/builtin/tag.c index

[PATCH v19 22/48] refs.c: make ref_transaction_begin take an err argument

2014-06-19 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

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

2014-06-19 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

[PATCH v19 36/48] refs.c: remove the update_ref_write function

2014-06-19 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 v19 01/48] refs.c: remove ref_transaction_rollback

2014-06-19 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

[PATCH v19 34/48] refs.c: make lock_ref_sha1 static

2014-06-19 Thread Ronnie Sahlberg
No external callers reference lock_ref_sha1 any more so lets declare it static. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 2 +- refs.h | 6 -- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/refs.c b/refs.c

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

2014-06-19 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 sahlb...@google.com --- cache.h | 2 +- refs.c | 19

[PATCH v19 29/48] branch.c: use ref transaction for all ref updates

2014-06-19 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

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

2014-06-19 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

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

2014-06-19 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 sahlb...@google.com --- refs.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff

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

2014-06-19 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

[PATCH v19 17/48] update-ref: use err argument to get error from ref_transaction_commit

2014-06-19 Thread Ronnie Sahlberg
Call ref_transaction_commit with QUIET_ON_ERR and use the strbuf that is returned to print a log message if/after the transaction fails. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/update-ref.c | 10 +- 1 file changed, 5

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

2014-06-19 Thread Ronnie Sahlberg
Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- 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

[PATCH v19 12/48] refs.c: commit_packed_refs to return a meaningful errno on failure

2014-06-19 Thread Ronnie Sahlberg
Making errno when returning from commit_packed_refs() meaningful, which should fix * a bug in git clone where it prints strerror(errno) based on errno, despite errno possibly being zero and potentially having been clobbered by that point * the same kind of bug in git pack-refs and

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

2014-06-19 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

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

2014-06-19 Thread Ronnie Sahlberg
I have resent v19 that does 1, remove the spurios redundant errno line 2, fixes the type and 3, reorders the patch as mentioned previously in this thread. This I hope will be the final version of the series we will need. regards ronnie sahlberg On Wed, Jun 18, 2014 at 3:38 PM, Michael Haggerty

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

2014-06-19 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 sahlb...@google.com --- cache.h| 2 ++ lockfile.c | 22 -- 2 files changed, 14 insertions(+), 10

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

2014-06-19 Thread Ronnie Sahlberg
Making errno when returning from log_ref_setup() meaningful, Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 27 +++ refs.h | 4 +++- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/refs.c b/refs.c index 67a0217..9ea519c 100644 ---

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

2014-06-19 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

Re: [PATCH 1/2] strbuf: add xstrdup_fmt helper

2014-06-19 Thread Junio C Hamano
Jeff King p...@peff.net writes: On Wed, Jun 18, 2014 at 03:32:08PM -0700, Junio C Hamano wrote: str = xstrdup_fmt(fmt, some, args); --- I'm open to suggestions on the name. This really is the same thing conceptually as the GNU asprintf(), but the interface is different (that

Re: [PATCH 1/2] strbuf: add xstrdup_fmt helper

2014-06-19 Thread René Scharfe
Am 19.06.2014 11:05, schrieb Jeff King: On Wed, Jun 18, 2014 at 03:32:08PM -0700, Junio C Hamano wrote: str = xstrdup_fmt(fmt, some, args); --- I'm open to suggestions on the name. This really is the same thing conceptually as the GNU asprintf(), but the interface is different (that

Re: Conventions on struct copying?

2014-06-19 Thread Junio C Hamano
brian m. carlson sand...@crustytoothpaste.net writes: I don't know of any place we explicitly copy structs like this,... which should be a reason enough. The first concrete guideline is just imitate the existing code. but I don't know of any prohibition against it, either. So now you know

Re: Surprising 'git-describe --all --match' behavior.

2014-06-19 Thread Junio C Hamano
Sergei Organov o...@javad.com writes: Just playing with it, got some surprises: $ git --version git version 1.9.3 $ git describe --all heads/v3.5 $ git describe --all --match 'v*' tags/v3.5.6b2-4-gab4bf78 $ git describe --all --match 'heads/v*' fatal: No names found, cannot describe

RE: Conventions on struct copying?

2014-06-19 Thread Jason Pyeron
-Original Message- From: Junio C Hamano Sent: Thursday, June 19, 2014 13:11 brian m. carlson sand...@crustytoothpaste.net writes: I don't know of any place we explicitly copy structs like this,... which should be a reason enough. The first concrete guideline is just

Re: [PATCH v4] cleanup duplicate name_compare() functions

2014-06-19 Thread Junio C Hamano
Jeremiah Mahler jmmah...@gmail.com writes: Both unpack-trees.c and read-cache.c have their own name_compare() function, which are identical. And read-cache.c has a cache_name_compare() function which is nearly identical to name_compare() [1]. The cache_name_compare() function is not

Re: [PATCH v4] cleanup duplicate name_compare() functions

2014-06-19 Thread Junio C Hamano
On Thu, Jun 19, 2014 at 11:03 AM, Junio C Hamano gits...@pobox.com wrote: You chose to use the one that loses the information by unifying these two into the variant that only returns -1/0/+1. We know that it does not matter for the current callers, but is it expected that no future callers

Re: Surprising 'git-describe --all --match' behavior.

2014-06-19 Thread Junio C Hamano
Sergei Organov o...@javad.com writes: Will something break if it won't helpfully prepend refs/tags/ once --all is given? describe --all --match 'v*' will no longer match a tag v1.2.3, and forces the users to say describe --match 'refs/tags/v*', and these users will probably see it as a new

[PATCH v2 07/14] bisect: add t6041 for submodule updates

2014-06-19 Thread Jens Lehmann
Test that the bisect command updates the work tree as expected. To make that work with the new submodule test framework a git_bisect helper function is added. This adds a commit after the one given to be switched to and makes that one the bad commit. The starting point is then given to bisect as

Re: Surprising 'git-describe --all --match' behavior.

2014-06-19 Thread Sergei Organov
Junio C Hamano gits...@pobox.com writes: Sergei Organov o...@javad.com writes: Will something break if it won't helpfully prepend refs/tags/ once --all is given? describe --all --match 'v*' will no longer match a tag v1.2.3, and forces the users to say describe --match 'refs/tags/v*', No,

[PATCH v2 01/14] test-lib: add test_dir_is_empty()

2014-06-19 Thread Jens Lehmann
For the upcoming submodule test framework we often need to assert that an empty directory exists in the work tree. Add the test_dir_is_empty() function which asserts that the given argument is an empty directory. Signed-off-by: Jens Lehmann jens.lehm...@web.de --- Changes to v1: *) Added -n to

[PATCH v2 02/14] submodules: Add the lib-submodule-update.sh test library

2014-06-19 Thread Jens Lehmann
Add this test library to simplify covering all combinations of submodule update scenarios without having to add those to a test of each work tree manipulating command over and over again. The functions test_submodule_switch() and test_submodule_forced_switch() are intended to be called from a

[PATCH v2 13/14] stash: add t3906 for submodule updates

2014-06-19 Thread Jens Lehmann
Test that the stash apply command updates the work tree as expected for changes which don't result in conflicts. To make that work add a helper function that uses read-tree to apply the changes of the target commit to the work tree, then stashes these changes and at last applies that stash.

[PATCH v2 09/14] rebase: add t3426 for submodule updates

2014-06-19 Thread Jens Lehmann
Test that the rebase command updates the work tree as expected for changes which don't result in conflicts. To make that work add two helper functions that add a commit only touching files and then revert it. This allows to rebase the target commit over these two and to compare the result. Set

[PATCH v2 14/14] revert: add t3513 for submodule updates

2014-06-19 Thread Jens Lehmann
Test that the revert command updates the work tree as expected (for submodule changes which don't result in conflicts). Add a helper function to first revert the checked out target commit to make the last revert produce the to-be-tested work tree. Set the

Re: What's cooking in git.git (Jun 2014, #04; Tue, 17)

2014-06-19 Thread Junio C Hamano
Duy Nguyen pclo...@gmail.com writes: On Thu, Jun 19, 2014 at 12:25 AM, Junio C Hamano gits...@pobox.com wrote: [Stalled] * nd/multiple-work-trees (2014-03-25) 28 commits - count-objects: report unused files in $GIT_DIR/repos/... - gc: support prune --repos - gc: style change -- no SP

Re: [PATCH v4] cleanup duplicate name_compare() functions

2014-06-19 Thread Jeremiah Mahler
Junio, On Thu, Jun 19, 2014 at 11:03:03AM -0700, Junio C Hamano wrote: Jeremiah Mahler jmmah...@gmail.com writes: Both unpack-trees.c and read-cache.c have their own name_compare() function, which are identical. And read-cache.c has a cache_name_compare() function which is nearly

[PATCH v2] dropping manual malloc calculations

2014-06-19 Thread Jeff King
On Thu, Jun 19, 2014 at 09:49:41AM -0700, Junio C Hamano wrote: If we twist the logic behind the 'mkpathdup' name a little bit, perhaps we can call it sprintf_dup or something. That is, sprintf wants a fixed preallocated piece of memory to print into, and we relieve the callers of having to

[PATCH v2 01/10] strbuf: add xstrfmt helper

2014-06-19 Thread Jeff King
You can use a strbuf to build up a string from parts, and then detach it. In the general case, you might use multiple strbuf_add* functions to do the building. However, in many cases, a single strbuf_addf is sufficient, and we end up with: struct strbuf buf = STRBUF_INIT; ...

[PATCH v2 03/10] use xstrdup instead of xmalloc + strcpy

2014-06-19 Thread Jeff King
This is one line shorter, and makes sure the length in the malloc and copy steps match. Signed-off-by: Jeff King p...@peff.net --- builtin/receive-pack.c | 5 + http-push.c| 6 ++ http-walker.c | 3 +-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git

[PATCH v2 02/10] use xstrfmt in favor of manual size calculations

2014-06-19 Thread Jeff King
In many parts of the code, we do an ugly and error-prone malloc like: const char *fmt = something %s; buf = xmalloc(strlen(foo) + 10 + 1); sprintf(buf, fmt, foo); This makes the code brittle, and if we ever get the allocation wrong, is a potential heap overflow. Let's instead favor

[PATCH v2 04/10] use xstrfmt to replace xmalloc + sprintf

2014-06-19 Thread Jeff King
This is one line shorter, and makes sure the length in the malloc and sprintf steps match. These conversions are very straightforward; we can drop the malloc entirely, and replace the sprintf with xstrfmt. Signed-off-by: Jeff King p...@peff.net --- Just a note on one thing I would look for as a

[PATCH v2 05/10] use xstrfmt to replace xmalloc + strcpy/strcat

2014-06-19 Thread Jeff King
It's easy to get manual allocation calculations wrong, and the use of strcpy/strcat raise red flags for people looking for buffer overflows (though in this case each site was fine). It's also shorter to use xstrfmt, and the printf-format tends to be easier for a reader to see what the final

[PATCH v2 06/10] setup_git_env: use git_pathdup instead of xmalloc + sprintf

2014-06-19 Thread Jeff King
This is shorter, harder to get wrong, and more clearly captures the intent. Signed-off-by: Jeff King p...@peff.net --- I wondered if there was a reason to avoid this (because we are in setup_git_env, which can potentially be called by git_pathdup). But the git_graft_file initialization below

[PATCH v2 07/10] sequencer: use argv_array_pushf

2014-06-19 Thread Jeff King
This avoids a manual allocation calculation, and is shorter to boot. Signed-off-by: Jeff King p...@peff.net --- sequencer.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sequencer.c b/sequencer.c index 0a80c58..2fea824 100644 --- a/sequencer.c +++ b/sequencer.c @@

[PATCH v2 08/10] merge: use argv_array when spawning merge strategy

2014-06-19 Thread Jeff King
This is shorter, and avoids a rather complicated set of allocation and free steps. Signed-off-by: Jeff King p...@peff.net --- merge.c | 42 +- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/merge.c b/merge.c index 70f1000..1fa6e52 100644

[PATCH v2 09/10] walker_fetch: fix minor memory leak

2014-06-19 Thread Jeff King
We sometimes allocate msg on the heap, but will fail to free it if we hit the failure code path. We can instead keep a separate variable that is safe to be freed no matter how we get to the failure code path. While we're here, we can also do two readability improvements: 1. Use xstrfmt instead

[PATCH v2 10/10] unique_path: fix unlikely heap overflow

2014-06-19 Thread Jeff King
When merge-recursive creates a unique filename, it uses a template like: path~branch_%d where the final _%d is filled by an incrementing counter until we find a unique name. We allocate 8 characters for the counter, but there is no logic to limit the size of the integer. Of course, this is

Should branches be objects?

2014-06-19 Thread Nico Williams
[I'm a list newbie here, but a git power user.] If branches were objects... - one could see the history of branches, including - how commits were grouped when pushed/pulled (push 5 commits, and the branch object will record that its head moved by those five commits at once) - rebase history

Re: Surprising 'git-describe --all --match' behavior.

2014-06-19 Thread Junio C Hamano
Sergei Organov o...@javad.com writes: Junio C Hamano gits...@pobox.com writes: Sergei Organov o...@javad.com writes: Will something break if it won't helpfully prepend refs/tags/ once --all is given? describe --all --match 'v*' will no longer match a tag v1.2.3, and forces the users to

[PATCH 17/16] http-push: refactor parsing of remote object names

2014-06-19 Thread Jeff King
We get loose object names like objects/??/... from the remote side, and need to convert them to their hex representation. The code to do so is rather hard to follow, as it uses some calculated lengths whose origins are hard to understand and verify (e.g., the path must be exactly 49 characters

Re: [PATCH 17/16] http-push: refactor parsing of remote object names

2014-06-19 Thread Jeff King
On Thu, Jun 19, 2014 at 05:58:10PM -0400, Jeff King wrote: It's still a little more magical than I would like, but I think this is the best we can do while still building on get_sha1_hex. Parsing it left-to-right would be better, but we would essentially end up reimplementing get_sha1_hex.

  1   2   >