Re: Should branches be objects?

2014-06-19 Thread Jonathan Nieder
Hi, Nico Williams wrote: - one could see the history of branches, including Interesting. 'git log -g' is good for getting that information locally, but the protocol doesn't have a way to get it from a remote server so you have to ssh in. Ronnie (cc-ed) and I were talking recently about

Re: Should branches be objects?

2014-06-19 Thread Nico Williams
On Thu, Jun 19, 2014 at 6:46 PM, Jonathan Nieder jrnie...@gmail.com wrote: Nico Williams wrote: - one could see the history of branches, including Interesting. 'git log -g' is good for getting that information locally, but the protocol doesn't have a way to get it from a remote server so

Re: Should branches be objects?

2014-06-19 Thread Nico Williams
Another thing is that branches as objects could store a lot more information, like: - the merge-base and HEAD for a rebase (and the --onto) - the interactive rebase plan! (and diffs to what would have been the non-interactive plan) - the would-be no-op non-interactive rebase plan post

Re: Should branches be objects?

2014-06-19 Thread Jonathan Nieder
Nico Williams wrote: a) reflogs include information about what's done to the workspace (checkout...) that's not relevant to any branch, Nope, reflogs just record changes to refs and information about why they happened. b) reflogs aren't objects, which ISTM has caused transactional issued

Re: Conventions on struct copying?

2014-06-19 Thread brian m. carlson
On Thu, Jun 19, 2014 at 01:22:44PM -0400, Jason Pyeron wrote: -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

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

2014-06-19 Thread Jeremiah Mahler
Junio, On Thu, Jun 19, 2014 at 11:29:21AM -0700, Junio C Hamano wrote: 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

Re: [PATCH 04/16] refactor skip_prefix to return a boolean

2014-06-19 Thread Eric Sunshine
On Wed, Jun 18, 2014 at 3:44 PM, Jeff King p...@peff.net wrote: The skip_prefix function returns a pointer to the content past the prefix, or NULL if the prefix was not found. While this is nice and simple, in practice it makes it hard to use for two reasons: 1. When you want to

[PATCH v5 0/2] cleanup duplicate name_compare() functions

2014-06-19 Thread Jeremiah Mahler
Version 5 of the patch series to cleanup the duplicate name_compare() functions. - name-hash.c had a call to cache_name_compare() but it required that the lengths were equal. Since cache_name_compare() is equivalent to memcmp() when the lengths are equal, replace it with memcmp().

[PATCH v5 1/2] name-hash.c: replace cache_name_compare() with memcmp()

2014-06-19 Thread Jeremiah Mahler
When cache_name_compare() is used on counted strings of the same length, it is equivalent to a memcmp(). Since the one use of cache_name_compare() in name-hash.c requires that the lengths are equal, just replace it with memcmp(). Signed-off-by: Jeremiah Mahler jmmah...@gmail.com --- name-hash.c

[PATCH v5 2/2] cleanup duplicate name_compare() functions

2014-06-19 Thread Jeremiah Mahler
We often represent our strings as a counted string, i.e. a pair of the pointer to the beginning of the string and its length, and the string may not be NUL terminated to that length. To compare a pair of such counted strings, unpack-trees.c and read-cache.c implement their own name_compare()

Re: [PATCH 04/16] refactor skip_prefix to return a boolean

2014-06-19 Thread Jeff King
On Thu, Jun 19, 2014 at 09:59:39PM -0400, Eric Sunshine wrote: diff --git a/git-compat-util.h b/git-compat-util.h index b6f03b3..556c839 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -349,13 +349,31 @@ extern void set_die_is_recursing_routine(int (*routine)(void));

Re: Should branches be objects?

2014-06-19 Thread Jeff King
On Thu, Jun 19, 2014 at 06:01:47PM -0700, Jonathan Nieder wrote: Speaking of which: are there any power failure corruption cases left in git? How is this tested? What kind of power failure corruption are you talking about? Git usually updates files by writing a completely new file and

Re: [PATCH 04/16] refactor skip_prefix to return a boolean

2014-06-19 Thread Eric Sunshine
On Thu, Jun 19, 2014 at 10:08 PM, Jeff King p...@peff.net wrote: On Thu, Jun 19, 2014 at 09:59:39PM -0400, Eric Sunshine wrote: diff --git a/git-compat-util.h b/git-compat-util.h index b6f03b3..556c839 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -349,13 +349,31 @@ extern

Re: [PATCH 04/16] refactor skip_prefix to return a boolean

2014-06-19 Thread Jeff King
On Thu, Jun 19, 2014 at 10:30:36PM -0400, Eric Sunshine wrote: diff --git a/git-compat-util.h b/git-compat-util.h index 556c839..1187e1a 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -350,8 +350,9 @@ extern int starts_with(const char *str, const char *prefix); extern

Re: [PATCH 10/16] fast-import: use skip_prefix for parsing input

2014-06-19 Thread Eric Sunshine
On Wed, Jun 18, 2014 at 3:49 PM, Jeff King p...@peff.net wrote: Fast-import does a lot of parsing of commands and dispatching to sub-functions. For example, given option foo, we might recognize option using starts_with, and then hand it off to parse_option() to do the rest. However, we do

Re: [PATCH 14/16] fetch-pack: refactor parsing in get_ack

2014-06-19 Thread Eric Sunshine
On Wed, Jun 18, 2014 at 3:56 PM, Jeff King p...@peff.net wrote: There are several uses of the magic number line+45 when parsing ACK lines from the server, and it's rather unclear why 45 is the correct number. We can make this more clear by keeping a running pointer as we parse, using

Re: [PATCH 10/16] fast-import: use skip_prefix for parsing input

2014-06-19 Thread Jeff King
On Thu, Jun 19, 2014 at 11:19:09PM -0400, Eric Sunshine wrote: - if (starts_with(command_buf.buf, M )) - file_change_m(b); - else if (starts_with(command_buf.buf, D )) - file_change_d(b); - else if

<    1   2