Re: [PATCH v4 02/14] add a hashtable implementation that supports O(1) removal

2013-11-08 Thread Karsten Blees
Am 07.11.2013 22:40, schrieb Junio C Hamano:
 Karsten Blees karsten.bl...@gmail.com writes:
 
 +`void hashmap_add(struct hashmap *map, void *entry)`::
 +
 +Adds a hashmap entry. This allows to add duplicate entries (i.e.
 +separate values with the same key according to hashmap_cmp_fn).
 ++
 +`map` is the hashmap structure.
 ++
 +`entry` is the entry to add.
 +
 +`void *hashmap_put(struct hashmap *map, void *entry)`::
 +
 +Adds or replaces a hashmap entry.
 ++
 +`map` is the hashmap structure.
 ++
 +`entry` is the entry to add or update.
 ++
 +Returns the previous entry, or NULL if not found (i.e. the entry was added).
 
 What happens when there were duplicate entries previously added?
 All are replaced?  One of them is randomly chosen and gets replaced?
 
 With s/replaced/removed/, the same question applies to hashmap_remove().
 
 I am guessing that we pick one at random and pretend as if other
 duplicates do not exist is the answer, 

Exactly, however, you won't have duplicates if you use put exclusively.

 and I do not immediately
 have an objection to that semantics, but whatever the rule is, it
 needs to be spelled out.
 

I'll clarify this.

 +`void *hashmap_remove(struct hashmap *map, const void *key, const void 
 *keydata)`::
 +
 +Removes a hashmap entry matching the specified key.
 ...
 +Usage example
 +-
 +
 +Here's a simple usage example that maps long keys to double values.
 +[source,c]
 +
 +struct hashmap map;
 +
 +struct long2double {
 +struct hashmap_entry ent; /* must be the first member! */
 +long key;
 +double value;
 +};
 +
 +static int long2double_cmp(const struct long2double *e1, const struct 
 long2double *e2, const void *unused)
 +{
 +return !(e1-key == e2-key);
 +}
 +
 +void long2double_init()
 
 void long2double_init(void)
 
 +{
 +hashmap_init(map, (hashmap_cmp_fn) long2double_cmp, 0);
 +}
 +
 +void long2double_free()
 
 Likewise.
 
 diff --git a/hashmap.c b/hashmap.c
 new file mode 100644
 index 000..3a9f8c1
 --- /dev/null
 +++ b/hashmap.c
 ...
 +unsigned int memhash(const void *buf, size_t len)
 +{
 +unsigned int hash = FNV32_BASE;
 +unsigned char *ucbuf = (unsigned char*) buf;
 
 (unsigned char *)buf; pointer-asterisk does not stick to type.
 

Ok, I'll recheck all casts.

 +while (len--) {
 +unsigned int c = *ucbuf++;
 +hash = (hash * FNV32_PRIME) ^ c;
 +}
 +return hash;
 +}
 +
 +unsigned int memihash(const void *buf, size_t len)
 +{
 +unsigned int hash = FNV32_BASE;
 +unsigned char *ucbuf = (unsigned char*) buf;
 +while (len--) {
 +unsigned int c = *ucbuf++;
 +if (c = 'a'  c = 'z')
 +c -= 'a' - 'A';
 +hash = (hash * FNV32_PRIME) ^ c;
 +}
 +return hash;
 +}
 +
 +#define HASHMAP_INITIAL_SIZE 64
 +/* grow / shrink by 2^2 */
 +#define HASHMAP_GROW 2
 +/* grow if  80% full (to 20%) */
 +#define HASHMAP_GROW_AT 1.25
 +/* shrink if  16.6% full (to 66.6%) */
 +#define HASHMAP_SHRINK_AT 6
 
 May be I am too old fashioned, but seeing a floating-point constant
 in our otherwise pretty-much integer-only code makes me feel uneasy.
 gcc -S -O2 does seem to generate floating point instruction for
 i but not for j:
 
 extern void inspect(unsigned int i, unsigned int j);
 
 void grow(unsigned int i, unsigned int j)
 {
 i *= 1.25;
 j += j  2;
 inspect(i, j);
 }
 

I guess there's no more i486SXs around, so using floating point should not be a 
problem (at least performance-wise...).

However, defining the constants inversely is a bit unintuitive (i.e. 1.25 
instead of 0.8, 6 instead of 0.166). Perhaps the thresholds should also be 
calculated once on resize, not on every add / remove.

What about this:

#define HASHMAP_GROW_AT 80
#define HASHMAP_SHRINK_AT 16

...in rehash:

map-grow_at = (unsigned int)((uint64_t) map-tablesize * HASHMAP_GROW_AT / 
100);
map-shrink_at = (unsigned int)((uint64_t) map-tablesize * HASHMAP_SHRINK_AT / 
100);

...in add:

size++;
if (map-size  map-grow_at)

...in remove:

size--;
if (map-size  map-shrink_at)

 Perhaps
 
 #define HASHMAP_GROW_AT(current) ((current) + (current)  2)
 #define HASHMAP_SHRINK_AT(current) ((current) * 6)
 #define HASHMAP_GROW(current) ((current)  2)
 #define HASHMAP_SHRINK(current) ((current)  2)
 
 may alleviate my worries; I dunno.
 
 +
 +static inline int entry_equals(const struct hashmap *map,
 +const struct hashmap_entry *e1, const struct hashmap_entry *e2,
 +const void *keydata)
 +{
 +return (e1 == e2) || (e1-hash == e2-hash  !(*map-cmpfn)(e1, e2, 
 keydata));
 
 Our code tends not to say this is a pointer to a function
 explicitly, i.e.
 
   !map-cmpfn(e1, e2, keydata)
 
 is more in-line with our code and should also be sufficient.
 
 +}
 +
 +static inline unsigned int bucket(const struct hashmap *map,
 +const struct hashmap_entry *key)
 +{
 +return 

Re: [PATCH v4 12/14] fix 'git update-index --verbose --again' output

2013-11-08 Thread Karsten Blees
Am 07.11.2013 23:12, schrieb Junio C Hamano:
 Karsten Blees karsten.bl...@gmail.com writes:
 
 'git update-index --verbose' consistently reports paths relative to the
 work-tree root. The only exception is the '--again' option, which reports
 paths relative to the current working directory.

 Change do_reupdate to use non-prefixed paths.
 
 Interesting.
 
 This looks like a genuine fix unrelated to the use of the new hashmap.
 

Indeed, #13 as well (and #4, #5, for that matter). I stumbled across this when 
analysing Thomas' last valgrind report.

Note that #12, #13 are prequels to #14, which adds a char *path = 
xstrdup(ce-name); ... free(path) around the update_one call.


 Signed-off-by: Karsten Blees bl...@dcon.de
 ---
  builtin/update-index.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/builtin/update-index.c b/builtin/update-index.c
 index e3a10d7..d180d80 100644
 --- a/builtin/update-index.c
 +++ b/builtin/update-index.c
 @@ -579,7 +579,7 @@ static int do_reupdate(int ac, const char **av,
   * or worse yet 'allow_replace', active_nr may decrease.
   */
  save_nr = active_nr;
 -update_one(ce-name + prefix_length, prefix, prefix_length);
 +update_one(ce-name, NULL, 0);
  if (save_nr != active_nr)
  goto redo;
  }

--
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


Selectively commit/publish files to GIT

2013-11-08 Thread Thomas Manson
Hi,

  I've converting my Bazaar repository to GIT.

 I've successfully done this conversion and I now want to publish my
source code to github.

  The problem is that in Bazaar, I've commited some big files (63MB 
173MB), but this files are no longer in my project, only in the
revisions files of Bazaar and now Git.

  I don't need this files to be pushed on Github.

  How can I search git history for big files and remove them, or mark
them to be not published ?

I've tryed this solution found on the link in the error:

git filter-branch --force --index-filter   'git rm --cached
--ignore-unmatch giant_file'   --prune-empty --tag-name-filter cat --
--all
git commit --amend -CHEAD

Then I've tryed to Commit  Push from Github mac  application and I
had several network error, and finally get the same error on giant
files (maybe my multiple commit  push did override something, but I
understood that the git rm command would remove things once for
good...

can anybody help me ?
I'm blocked in my dev because of this, I can't share my project with a friend.
I'm publishing here : https://github.com/dev-mansonthomas/crf-rdp.git
(paying for storage is an option as I'm quite fed up loosing time for
filesize...)

Regards,
Thomas.

here is the error I have using the GitHub application on Mac :
(after that I intend to use Eclipse)

File Ressources/dwr/dwr-3.0.0.110.dev-src.zip is 67.69 MB; this is
larger than GitHub's recommended maximum file size of 50 MB
GH001: Large files detected.
Trace: 8f0259b29260f0c4d7ae4d4ae70e0306
See http://git.io/iEPt8g for more information.
File .bzr/repository/packs/a7bcd6ba235114ab88c80fe8a97adcfa.pack is
178.76 MB; this exceeds GitHub's file size limit of 100 MB
--
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 1/3] for-each-ref: introduce %C(...) for color

2013-11-08 Thread Ramkumar Ramachandra
Junio C Hamano wrote:
 If %(authordate) is I want to see the author date here, and
 %(authordate:short) is I want to see the author date here in the
 short form, you would expect I want colored output in green to be
 spelled as %(color:green), or something, perhaps?

Last time, we almost managed a unification: tokens like %authordate in
f-e-r correspond to tokens like %ae in pretty-formats; %C(...) is
different in that it doesn't actually output anything, but changes the
color of tokens following it. While I'm not opposed to %(color:...), I
would prefer a color syntax that is different from other-token syntax,
like in pretty-formats.
--
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: Selectively commit/publish files to GIT

2013-11-08 Thread Magnus Bäck
On Friday, November 08, 2013 at 05:52 EST,
 Thomas Manson dev.mansontho...@gmail.com wrote:

[...]

   How can I search git history for big files and remove them, or mark
 them to be not published ?
 
 I've tryed this solution found on the link in the error:
 
 git filter-branch --force --index-filter   'git rm --cached
 --ignore-unmatch giant_file'   --prune-empty --tag-name-filter cat --
 --all
 git commit --amend -CHEAD

[...]

 here is the error I have using the GitHub application on Mac :
 (after that I intend to use Eclipse)
 
 File Ressources/dwr/dwr-3.0.0.110.dev-src.zip is 67.69 MB; this is
 larger than GitHub's recommended maximum file size of 50 MB
 GH001: Large files detected.
 Trace: 8f0259b29260f0c4d7ae4d4ae70e0306
 See http://git.io/iEPt8g for more information.
 File .bzr/repository/packs/a7bcd6ba235114ab88c80fe8a97adcfa.pack is
 178.76 MB; this exceeds GitHub's file size limit of 100 MB

Did you actually replace the 'giant_file' placeholder with the path to
*your* giant file? The error message indicates that you didn't, or that
something else went wrong during the filtering.

You can use 'git log' to look for commits touching particular pathnames,
making it easy to verify that a file has been eradicated.

git log --all -- path/to/big-honking-file.zip

-- 
Magnus Bäck
ba...@google.com
--
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 v4 02/14] add a hashtable implementation that supports O(1) removal

2013-11-08 Thread Philip Oakley

From: Karsten Blees karsten.bl...@gmail.com

However, defining the constants inversely is a bit unintuitive (i.e. 
1.25 instead of 0.8, 6 instead of 0.166). Perhaps the thresholds 
should also be calculated once on resize, not on every add / remove.


What about this:

#define HASHMAP_GROW_AT 80
#define HASHMAP_SHRINK_AT 16


mico-bikeshed adding a code comment...

#define HASHMAP_GROW_AT 80/* percent */
#define HASHMAP_SHRINK_AT 16/* percent */



...in rehash:

map-grow_at = (unsigned int)((uint64_t) map-tablesize * 
HASHMAP_GROW_AT / 100);
map-shrink_at = (unsigned int)((uint64_t) map-tablesize * 
HASHMAP_SHRINK_AT / 100);




[No need to add to cc...]

regards

Philip 


--
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 v4 02/14] add a hashtable implementation that supports O(1) removal

2013-11-08 Thread Junio C Hamano
Karsten Blees karsten.bl...@gmail.com writes:

 What about this:

 #define HASHMAP_GROW_AT 80
 #define HASHMAP_SHRINK_AT 16

I am not too enthused for three reasons. The fact that these are
100-based numbers is not written down anywhere other than the place
they are used, the places that use these need to consistently divide
by 100, which invites unnecessary bugs, and compared to the
original, you now require 16/100 but you didn't even want the exact
16% in the first plae (i.e. a simple 1/6 was good enough, and it
still is).

 Perhaps
 
 #define HASHMAP_GROW_AT(current) ((current) + (current)  2)
 #define HASHMAP_SHRINK_AT(current) ((current) * 6)
 #define HASHMAP_GROW(current) ((current)  2)
 #define HASHMAP_SHRINK(current) ((current)  2)
 
 may alleviate my worries; I dunno.

 +
 +void hashmap_free(struct hashmap *map, hashmap_free_fn free_function)
 +{
 
 Why is free_function not part of the constants defiend at
 hashmap_init() time?  Your API allows the same hashmap, depending on
 the way it has been used, to be cleaned up with different
 free_function, but I am not sure if that flexibility is intended
 (and in what application it would be useful).
 

 The free_function is a convenience so you don't have to loop over
 the entries yourself. ...
 ...a simple 'to free or not to free' boolean would suffice.

That is not the flexibility I was talking about. Your API allows
omne to write a single program that does this:

struct hashmap map;

hashmap_init(map, compare_fn);
add/put/remove on map;

if (phase_of_moon())
hashmap_free(map, free_them_in_one_way);
else
hashmap_free(map, free_them_in_another_way);

Just like your _init takes a comparison function to make it clear
that all entries will be compared using the same function throughout
the life of the map, if it takes a free function (and you can use
NULL to mean do not free, I am managing elements myself), I would
think that it will make it clear that the elements in that map will
be freed the same way.

And it will allow your _put to call that free function when you
replace an existing entry with a new one, if that becomes necessary.
The API in the posted version seems to make it responsibility of the
caller of _put to do whatever necessary clean-up to the returned
value (which is the entry that was replaced and no longer in the
hashmap), but within the context of a patch series whose later patch
changes the API to replace or remove an entry from the index in such
a way to shift the responsibility of freeing it from the caller to
the callee, such a change to this API to make _put and _remove
responsible for calling per-element free is a possiblity you may
want to consider, no?

 +   if (map-tablesize  HASHMAP_INITIAL_SIZE 
 +   map-size * HASHMAP_SHRINK_AT  map-tablesize)
 +   rehash(map, map-tablesize  HASHMAP_GROW);
 
 This we shrink by the same amount looks inconsistent with the use
 of separate grow-at and shrink-at constants (see above for four
 suggested #define's).
 

 These values account for a small hysteresis so that there is no size at which 
 a sequence of add, remove, add, remove (or put, put, put, put) results in 
 permanent resizes.

I was commenting on the two bottom lines of the above three line
quote from the patch.  You use SHIRNK_AT to decide if you want to
shrink, and you use GROW to do the actual shrinking.  Why isn't it
like this instead?

if (map-tablesize  HASHMAP_INITIAL_SIZE 
HASHMAP_SHIRNK_AT(map-size)  map-tablesize)
rehash(map, map-tablesize  HASHMAP_SHRINK);

The fact that constant used for shrinking was not called SHRINK but
GROW was what caught my attention.
--
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] fix up 'jk/pack-bitmap' branch

2013-11-08 Thread Torsten Bögershausen
On 2013-11-07 23.19, Jeff King wrote:
 On Thu, Nov 07, 2013 at 09:58:02PM +, Ramsay Jones wrote:
 
 These patches fix various errors/warnings on the cygwin, MinGW and
 msvc builds, provoked by the jk/pack-bitmap branch.
 
 Thanks. Your timing is impeccable, as I was just sitting down to
 finalize the next re-roll. I'll add these in.
 
 -Peff

Side question:
Do we have enough test coverage for htonll()/ntohll(),
or do we want do the module test which I send a couple of days before ?
/Torsten


--
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 1/3] for-each-ref: introduce %C(...) for color

2013-11-08 Thread Junio C Hamano
Ramkumar Ramachandra artag...@gmail.com writes:

 ... %C(...) is
 different in that it doesn't actually output anything, but changes the
 color of tokens following it. While I'm not opposed to %(color:...), I
 would prefer a color syntax that is different from other-token syntax,
 like in pretty-formats.

You may prefer it, but I do not see why users prefer to memorize
that a magic that consumes no display output columns uses a syntax
different from all the other magic introducers that follows %(name
of the magic with string after colon to give more specifics to the
magic) syntax.

In all honesty, the %XY mnemonic syntax in pretty-format is a
syntactic disaster.  It is perfectly OK to have a set of often used
shorthand, but because we started without a consistent long-hand, we
ended up with %Cred and %C(yellow), leading us to a nonsense like
this (try it yourself and weep):

$ git show -s --format='%CredAnd%CyellowAreNotTheSameColor'

It would have been much saner if we started from %(color:yellow),
%(subject), etc., i.e. have a single long-hand magic introducer
%(...), and added a set of often-used short-hands like %s.

I am not opposed to unify the internal implementations and the
external interfaces of pretty, for-each-ref and friends, but
modelling the external UI after the mnemonic only with ad hoc
additions mess the pretty-format uses is a huge mistake.

--
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


[PATCH] git-fetch-pack uses URLs like git-fetch

2013-11-08 Thread Torsten Bögershausen
git fetch-pack allows [host:]directory to point out the source
repository.
Use the term repository, which is already used in git fetch or git pull
to describe URLs supported by Git.
---
 Documentation/git-fetch-pack.txt | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/Documentation/git-fetch-pack.txt b/Documentation/git-fetch-pack.txt
index 444b805..93b5067 100644
--- a/Documentation/git-fetch-pack.txt
+++ b/Documentation/git-fetch-pack.txt
@@ -12,7 +12,7 @@ SYNOPSIS
 'git fetch-pack' [--all] [--quiet|-q] [--keep|-k] [--thin] [--include-tag]
[--upload-pack=git-upload-pack]
[--depth=n] [--no-progress]
-   [-v] [host:]directory [refs...]
+   [-v] repository [refs...]
 
 DESCRIPTION
 ---
@@ -97,19 +97,18 @@ be in a separate packet, and the list must end with a flush 
packet.
 -v::
Run verbosely.
 
-host::
-   A remote host that houses the repository.  When this
-   part is specified, 'git-upload-pack' is invoked via
-   ssh.
-
-directory::
-   The repository to sync from.
+repository::
+   The URL to the remote repository.
 
 refs...::
The remote heads to update from. This is relative to
$GIT_DIR (e.g. HEAD, refs/heads/master).  When
unspecified, update from all heads the remote side has.
 
+SEE ALSO
+
+linkgit:git-fetch[1]
+
 GIT
 ---
 Part of the linkgit:git[1] suite
-- 
1.8.4.457.g424cb08

--
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 v3] push: Enhance unspecified push default warning

2013-11-08 Thread Junio C Hamano
Matthieu Moy matthieu@grenoble-inp.fr writes:

 Jonathan Nieder jrnie...@gmail.com writes:

  When push.default is set to 'matching', git will push local branches
  to remote branches that already exist with the same (matching) name.

 Yes, that's better than the original patch (and remains two lines).
 ...

  In Git 2.0, git will default to a more conservative 'simple' behavior
  that only pushes the current branch.

 That's an option too, but I think mentionning git pull was a good
 idea.

OK, I'll tentatively update the draft to read like this, redo the
endgame patch on top and requeue.

 builtin/push.c | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/builtin/push.c b/builtin/push.c
index 5393e28..27c5754 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -174,14 +174,12 @@ N_(push.default is unset; its implicit value is changing 
in\n
\n
  git config --global push.default simple\n
\n
-   When push.default is set to 'matching', git will push all local branches\n
-   to the remote branches with the same (matching) name.  This will no\n
-   longer be the default in Git 2.0 because a branch could be\n
-   unintentionally pushed to a remote.\n
+   When push.default is set to 'matching', git will push local branches\n
+   to the remote branches that already exist with the same name.\n
\n
-   In Git 2.0 the new push.default of 'simple' will push only the current\n
-   branch to the same remote branch used by git pull.   A push will\n
-   only succeed if the remote and local branches have the same name.\n
+   In Git 2.0, Git will default to the more conservative 'simple'\n
+   behavior that only pushes the current branch to the corresponding\n
+   remote branch used by 'git pull' to update the current branch from.\n
\n
See 'git help config' and search for 'push.default' for further 
information.\n
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode\n
--
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] fix up 'jk/pack-bitmap' branch

2013-11-08 Thread Ramsay Jones
On 08/11/13 17:10, Torsten Bögershausen wrote:
 On 2013-11-07 23.19, Jeff King wrote:
 On Thu, Nov 07, 2013 at 09:58:02PM +, Ramsay Jones wrote:

 These patches fix various errors/warnings on the cygwin, MinGW and
 msvc builds, provoked by the jk/pack-bitmap branch.

 Thanks. Your timing is impeccable, as I was just sitting down to
 finalize the next re-roll. I'll add these in.

 -Peff
 
 Side question:
 Do we have enough test coverage for htonll()/ntohll(),
 or do we want do the module test which I send a couple of days before ?

Yes, sorry for not bringing that up; I didn't get to try (or even look at)
your test patch, because I couldn't 'git am' it. :(

I've been meaning to look into why that is, but just haven't had time yet.
(I think it may have something to do with your name - I've noticed in the
past that any mail with utf8 characters causes problems.)

However, I should have alerted Jeff to your patch; sorry about that!

ATB,
Ramsay Jones



--
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 v3] push: Enhance unspecified push default warning

2013-11-08 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes:

 OK, I'll tentatively update the draft to read like this, redo the
 endgame patch on top and requeue.

... and the corresponding part of the endgame patch now reads like
this.  I suspect that we may want a bigger change to unstress
'simple' at that phase of the transition, though, by perhaps
rewording the 'matching' part to make it more explicit that the
setting is primarily for those who want to keep the traditional
behaviour.

diff --git a/builtin/push.c b/builtin/push.c
index 27c5754..a0534d0 100644
--- a/builtin/push.c
+++ b/builtin/push.c
 ...
@@ -164,9 +163,9 @@ static void setup_push_current(struct remote *remote, 
struct branch *branch)
 }
 
 static char warn_unspecified_push_default_msg[] =
-N_(push.default is unset; its implicit value is changing in\n
+N_(push.default is unset; its implicit value has changed in\n
Git 2.0 from 'matching' to 'simple'. To squelch this message\n
-   and maintain the current behavior after the default changes, use:\n
+   and maintain the traditional behavior, use:\n
\n
  git config --global push.default matching\n
\n
@@ -177,7 +176,7 @@ N_(push.default is unset; its implicit value is changing 
in\n
When push.default is set to 'matching', git will push local branches\n
to the remote branches that already exist with the same name.\n
\n
-   In Git 2.0, Git will default to the more conservative 'simple'\n
+   Since Git 2.0, Git defaults to the more conservative 'simple'\n
behavior that only pushes the current branch to the corresponding\n
remote branch used by 'git pull' to update the current branch from.\n
\n
@@ -207,14 +206,14 @@ static void setup_default_push_refspecs(struct remote 
*remote)
 ... 
--
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


[PATCH] l10n: de.po: translate 68 new messages

2013-11-08 Thread Ralf Thielow
Translate 68 new messages came from git.pot update in 727b957
(l10n: git.pot: v1.8.5 round 1 (68 new, 9 removed)).

Signed-off-by: Ralf Thielow ralf.thie...@gmail.com
---
 po/de.po | 191 ---
 1 file changed, 86 insertions(+), 105 deletions(-)

diff --git a/po/de.po b/po/de.po
index f43d673..a005dcc 100644
--- a/po/de.po
+++ b/po/de.po
@@ -902,51 +902,49 @@ msgid -NUM
 msgstr -NUM
 
 #: pathspec.c:118
-#, fuzzy
 msgid global 'glob' and 'noglob' pathspec settings are incompatible
-msgstr Die Optionen --bare und --origin %s sind inkompatibel.
+msgstr Globale Einstellungen zur Pfadspezifikation 'glob' und 'noglob' sind 
inkompatibel.
 
 #: pathspec.c:128
-#, fuzzy
 msgid 
 global 'literal' pathspec setting is incompatible with all other global 
 pathspec settings
-msgstr --patch ist inkompatibel mit allen anderen Optionen
+msgstr Globale Einstellung zur Pfadspezifikation 'literal' ist inkompatibel\n
+mit allen anderen Optionen.
 
 #: pathspec.c:158
 msgid invalid parameter for pathspec magic 'prefix'
-msgstr 
+msgstr ungültiger Parameter für Pfadspezifikationsangabe 'prefix'
 
 #: pathspec.c:164
-#, fuzzy, c-format
+#, c-format
 msgid Invalid pathspec magic '%.*s' in '%s'
-msgstr ungültige Pfadspezifikation
+msgstr ungültige Pfadspezifikationsangabe '%.*s' in '%s'
 
 #: pathspec.c:168
 #, c-format
 msgid Missing ')' at the end of pathspec magic in '%s'
-msgstr 
+msgstr Fehlendes ')' am Ende der Pfadspezifikationsangabe in '%s'
 
 #: pathspec.c:186
 #, c-format
 msgid Unimplemented pathspec magic '%c' in '%s'
-msgstr 
+msgstr nicht unterstützte Pfadspezifikationsangabe '%c' in '%s'
 
 #: pathspec.c:211
-#, fuzzy, c-format
+#, c-format
 msgid %s: 'literal' and 'glob' are incompatible
-msgstr Die Optionen --all und --tags sind inkompatibel.
+msgstr %s: 'literal' und 'glob' sind inkompatibel
 
 #: pathspec.c:222
-#, fuzzy, c-format
+#, c-format
 msgid %s: '%s' is outside repository
-msgstr 
-Die Option --index kann nicht außerhalb eines Repositories verwendet werden.
+msgstr %s: '%s' liegt außerhalb des Repositories
 
 #: pathspec.c:278
-#, fuzzy, c-format
+#, c-format
 msgid Pathspec '%s' is in submodule '%.*s'
-msgstr Pfad '%s' befindet sich in Submodul '%.*s'
+msgstr Pfadspezifikation '%s' befindet sich in Submodul '%.*s'
 
 #.
 #. * We may want to substitute this command with a command
@@ -956,27 +954,26 @@ msgstr Pfad '%s' befindet sich in Submodul '%.*s'
 #: pathspec.c:340
 #, c-format
 msgid %s: pathspec magic not supported by this command: %s
-msgstr 
+msgstr %s: Pfadspezifikationsangabe wird von diesem Kommando nicht 
unterstützt: %s
 
 #: pathspec.c:415
-#, fuzzy, c-format
+#, c-format
 msgid pathspec '%s' is beyond a symbolic link
-msgstr '%s' ist hinter einem symbolischen Verweis
+msgstr Pfadspezifikation '%s' ist hinter einem symbolischen Verweis
 
 #: remote.c:1833
-#, fuzzy, c-format
+#, c-format
 msgid Your branch is based on '%s', but the upstream is gone.\n
-msgstr Ihr Branch ist vor '%s' um %d Commit.\n
+msgstr Ihr Branch basiert auf '%s', aber Upstream-Branch wurde entfernt.\n
 
 #: remote.c:1837
-#, fuzzy
 msgid   (use \git branch --unset-upstream\ to fixup)\n
-msgstr git branch --set-upstream-to %s\n
+msgstr (benutzen Sie \git branch --unset-upstream\ zum Beheben)\n
 
 #: remote.c:1840
-#, fuzzy, c-format
+#, c-format
 msgid Your branch is up-to-date with '%s'.\n
-msgstr Ihr Branch ist vor '%s' um %d Commit.\n
+msgstr Ihr Branch ist auf dem selben Stand wie '%s'.\n
 
 #: remote.c:1844
 #, c-format
@@ -1329,54 +1326,49 @@ msgstr Upstream-Branch '%s' ist nicht als 
Remote-Tracking-Branch gespeichert
 
 #: submodule.c:64 submodule.c:98
 msgid Cannot change unmerged .gitmodules, resolve merge conflicts first
-msgstr 
+msgstr Kann nicht zusammengeführte .gitmodules-Datei nicht ändern, lösen\n
+Sie zuerst die Konflikte auf
 
 #: submodule.c:68 submodule.c:102
 #, c-format
 msgid Could not find section in .gitmodules where path=%s
-msgstr 
+msgstr Konnte keine Sektion in .gitmodules mit Pfad \%s\ finden
 
 #. Maybe the user already did that, don't error out here
 #: submodule.c:76
-#, fuzzy, c-format
+#, c-format
 msgid Could not update .gitmodules entry %s
-msgstr Konnte git-Verweis %s nicht erstellen
+msgstr Konnte Eintrag '%s' in .gitmodules nicht aktualisieren
 
 #. Maybe the user already did that, don't error out here
 #: submodule.c:109
-#, fuzzy, c-format
+#, c-format
 msgid Could not remove .gitmodules entry for %s
-msgstr Konnte Sektion '%s' nicht aus Konfiguration entfernen
+msgstr Konnte Sektion '%s' nicht aus .gitmodules entfernen
 
 #: submodule.c:127
-#, fuzzy
 msgid could not find .gitmodules in index
-msgstr Konnte die Staging-Area nicht lesen
+msgstr Konnte .gitmodules nicht in der Staging-Area finden
 
 #: submodule.c:133
-#, fuzzy
 msgid reading updated .gitmodules failed
-msgstr Hinzufügen von Dateien fehlgeschlagen
+msgstr Lesen der aktualisierten .gitmodules-Datei fehlgeschlagen
 
 #: submodule.c:135
-#, fuzzy

[PATCH] po/TEAMS: update Thomas Rast's email address

2013-11-08 Thread Ralf Thielow
Signed-off-by: Ralf Thielow ralf.thie...@gmail.com
---
 po/TEAMS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/po/TEAMS b/po/TEAMS
index 107aa59..f9a99ed 100644
--- a/po/TEAMS
+++ b/po/TEAMS
@@ -8,7 +8,7 @@ Leader: Byrial Jensen byr...@vip.cybercity.dk
 Language:  de (German)
 Repository:https://github.com/ralfth/git-po-de
 Leader:Ralf Thielow ralf.thie...@googlemail.com
-Members:   Thomas Rast tr...@student.ethz.ch
+Members:   Thomas Rast t...@thomasrast.ch
Jan Krüger j...@jk.gs
Christian Stimming stimm...@tuhh.de
 
-- 
1.8.5.rc1.303.g27c0606

--
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


[PATCH] l10n: de.po: improve error message when pushing to unknown upstream

2013-11-08 Thread Ralf Thielow
Signed-off-by: Ralf Thielow ralf.thie...@gmail.com
---
 po/de.po | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/po/de.po b/po/de.po
index a005dcc..8b824cc 100644
--- a/po/de.po
+++ b/po/de.po
@@ -7923,7 +7923,7 @@ msgid 
 to update which remote branch.
 msgstr 
 Sie versenden nach '%s', welches kein Upstream-Repository Ihres aktuellen\n
-Branches '%s' ist, ohne mir mitzuteilen, was ich versenden soll, um welchen\n
+Branches '%s' ist, ohne anzugeben, was versendet werden soll, um welchen\n
 Remote-Branch zu aktualisieren.
 
 #: builtin/push.c:167
-- 
1.8.5.rc1.303.g27c0606

--
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


[PATCHv2] l10n: de.po: translate 68 new messages

2013-11-08 Thread Ralf Thielow
Translate 68 new messages came from git.pot update in 727b957
(l10n: git.pot: v1.8.5 round 1 (68 new, 9 removed)).

Signed-off-by: Ralf Thielow ralf.thie...@gmail.com
---
v2 fixed a typo in the translation of the message from builtin/repack.c:161.
s/Fenster/Fensters

 po/de.po | 191 ---
 1 file changed, 86 insertions(+), 105 deletions(-)

diff --git a/po/de.po b/po/de.po
index f43d673..dada26d 100644
--- a/po/de.po
+++ b/po/de.po
@@ -902,51 +902,49 @@ msgid -NUM
 msgstr -NUM
 
 #: pathspec.c:118
-#, fuzzy
 msgid global 'glob' and 'noglob' pathspec settings are incompatible
-msgstr Die Optionen --bare und --origin %s sind inkompatibel.
+msgstr Globale Einstellungen zur Pfadspezifikation 'glob' und 'noglob' sind 
inkompatibel.
 
 #: pathspec.c:128
-#, fuzzy
 msgid 
 global 'literal' pathspec setting is incompatible with all other global 
 pathspec settings
-msgstr --patch ist inkompatibel mit allen anderen Optionen
+msgstr Globale Einstellung zur Pfadspezifikation 'literal' ist inkompatibel\n
+mit allen anderen Optionen.
 
 #: pathspec.c:158
 msgid invalid parameter for pathspec magic 'prefix'
-msgstr 
+msgstr ungültiger Parameter für Pfadspezifikationsangabe 'prefix'
 
 #: pathspec.c:164
-#, fuzzy, c-format
+#, c-format
 msgid Invalid pathspec magic '%.*s' in '%s'
-msgstr ungültige Pfadspezifikation
+msgstr ungültige Pfadspezifikationsangabe '%.*s' in '%s'
 
 #: pathspec.c:168
 #, c-format
 msgid Missing ')' at the end of pathspec magic in '%s'
-msgstr 
+msgstr Fehlendes ')' am Ende der Pfadspezifikationsangabe in '%s'
 
 #: pathspec.c:186
 #, c-format
 msgid Unimplemented pathspec magic '%c' in '%s'
-msgstr 
+msgstr nicht unterstützte Pfadspezifikationsangabe '%c' in '%s'
 
 #: pathspec.c:211
-#, fuzzy, c-format
+#, c-format
 msgid %s: 'literal' and 'glob' are incompatible
-msgstr Die Optionen --all und --tags sind inkompatibel.
+msgstr %s: 'literal' und 'glob' sind inkompatibel
 
 #: pathspec.c:222
-#, fuzzy, c-format
+#, c-format
 msgid %s: '%s' is outside repository
-msgstr 
-Die Option --index kann nicht außerhalb eines Repositories verwendet werden.
+msgstr %s: '%s' liegt außerhalb des Repositories
 
 #: pathspec.c:278
-#, fuzzy, c-format
+#, c-format
 msgid Pathspec '%s' is in submodule '%.*s'
-msgstr Pfad '%s' befindet sich in Submodul '%.*s'
+msgstr Pfadspezifikation '%s' befindet sich in Submodul '%.*s'
 
 #.
 #. * We may want to substitute this command with a command
@@ -956,27 +954,26 @@ msgstr Pfad '%s' befindet sich in Submodul '%.*s'
 #: pathspec.c:340
 #, c-format
 msgid %s: pathspec magic not supported by this command: %s
-msgstr 
+msgstr %s: Pfadspezifikationsangabe wird von diesem Kommando nicht 
unterstützt: %s
 
 #: pathspec.c:415
-#, fuzzy, c-format
+#, c-format
 msgid pathspec '%s' is beyond a symbolic link
-msgstr '%s' ist hinter einem symbolischen Verweis
+msgstr Pfadspezifikation '%s' ist hinter einem symbolischen Verweis
 
 #: remote.c:1833
-#, fuzzy, c-format
+#, c-format
 msgid Your branch is based on '%s', but the upstream is gone.\n
-msgstr Ihr Branch ist vor '%s' um %d Commit.\n
+msgstr Ihr Branch basiert auf '%s', aber Upstream-Branch wurde entfernt.\n
 
 #: remote.c:1837
-#, fuzzy
 msgid   (use \git branch --unset-upstream\ to fixup)\n
-msgstr git branch --set-upstream-to %s\n
+msgstr (benutzen Sie \git branch --unset-upstream\ zum Beheben)\n
 
 #: remote.c:1840
-#, fuzzy, c-format
+#, c-format
 msgid Your branch is up-to-date with '%s'.\n
-msgstr Ihr Branch ist vor '%s' um %d Commit.\n
+msgstr Ihr Branch ist auf dem selben Stand wie '%s'.\n
 
 #: remote.c:1844
 #, c-format
@@ -1329,54 +1326,49 @@ msgstr Upstream-Branch '%s' ist nicht als 
Remote-Tracking-Branch gespeichert
 
 #: submodule.c:64 submodule.c:98
 msgid Cannot change unmerged .gitmodules, resolve merge conflicts first
-msgstr 
+msgstr Kann nicht zusammengeführte .gitmodules-Datei nicht ändern, lösen\n
+Sie zuerst die Konflikte auf
 
 #: submodule.c:68 submodule.c:102
 #, c-format
 msgid Could not find section in .gitmodules where path=%s
-msgstr 
+msgstr Konnte keine Sektion in .gitmodules mit Pfad \%s\ finden
 
 #. Maybe the user already did that, don't error out here
 #: submodule.c:76
-#, fuzzy, c-format
+#, c-format
 msgid Could not update .gitmodules entry %s
-msgstr Konnte git-Verweis %s nicht erstellen
+msgstr Konnte Eintrag '%s' in .gitmodules nicht aktualisieren
 
 #. Maybe the user already did that, don't error out here
 #: submodule.c:109
-#, fuzzy, c-format
+#, c-format
 msgid Could not remove .gitmodules entry for %s
-msgstr Konnte Sektion '%s' nicht aus Konfiguration entfernen
+msgstr Konnte Sektion '%s' nicht aus .gitmodules entfernen
 
 #: submodule.c:127
-#, fuzzy
 msgid could not find .gitmodules in index
-msgstr Konnte die Staging-Area nicht lesen
+msgstr Konnte .gitmodules nicht in der Staging-Area finden
 
 #: submodule.c:133
-#, fuzzy
 msgid reading updated .gitmodules failed
-msgstr Hinzufügen von Dateien fehlgeschlagen

[ANNOUNCE] Git v1.8.4.3

2013-11-08 Thread Junio C Hamano
The latest maintenance release Git v1.8.4.3 is now available at
the usual places.

The release tarballs are found at:

http://code.google.com/p/git-core/downloads/list

and their SHA-1 checksums are:

43b1edc95b3ab77f9739d789b906ded0585fe7a2  git-1.8.4.3.tar.gz
eb4eb4991464f44deda19d1435d9721146587661  git-htmldocs-1.8.4.3.tar.gz
3a7e9322a95e0743b902152083366fe97f322ab1  git-manpages-1.8.4.3.tar.gz

The following public repositories all have a copy of the v1.8.4.3
tag and the maint branch that the tag points at:

  url = https://kernel.googlesource.com/pub/scm/git/git
  url = git://repo.or.cz/alt-git.git
  url = https://code.google.com/p/git-core/
  url = git://git.sourceforge.jp/gitroot/git-core/git.git
  url = git://git-core.git.sourceforge.net/gitroot/git-core/git-core
  url = https://github.com/gitster/git

Also, http://www.kernel.org/pub/software/scm/git/ has copies of the
release tarballs.

Git v1.8.4.3 Release Notes


Fixes since v1.8.4.2


 * The interaction between use of Perl in our test suite and NO_PERL
   has been clarified a bit.

 * A fast-import stream expresses a pathname with funny characters by
   quoting them in C style; remote-hg remote helper (in contrib/)
   forgot to unquote such a path.

 * One long-standing flaw in the pack transfer protocol used by git
   clone was that there was no way to tell the other end which branch
   HEAD points at, and the receiving end needed to guess.  A new
   capability has been defined in the pack protocol to convey this
   information so that cloning from a repository with more than one
   branches pointing at the same commit where the HEAD is at now
   reliably sets the initial branch in the resulting repository.

 * We did not handle cases where http transport gets redirected during
   the authorization request (e.g. from http:// to https://).

 * git rev-list --objects ^v1.0^ v1.0 gave v1.0 tag itself in the
   output, but git rev-list --objects v1.0^..v1.0 did not.

 * The fall-back parsing of commit objects with broken author or
   committer lines were less robust than ideal in picking up the
   timestamps.

 * Bash prompting code to deal with an SVN remote as an upstream
   were coded in a way not supported by older Bash versions (3.x).

 * git checkout topic, when there is not yet a local topic branch
   but there is a unique remote-tracking branch for a remote topic
   branch, pretended as if git checkout -t -b topic remote/$r/topic
   (for that unique remote $r) was run. This hack however was not
   implemented for git checkout topic --.

 * Coloring around octopus merges in log --graph output was screwy.

 * We did not generate HTML version of documentation to git subtree
   in contrib/.

 * The synopsis section of git unpack-objects documentation has been
   clarified a bit.

 * An ancient How-To on serving Git repositories on an HTTP server
   lacked a warning that it has been mostly superseded with more
   modern way.

Also contains a handful of trivial code clean-ups, documentation
updates, updates to the test suite, etc.



Changes since v1.8.4.2 are as follows:

Antoine Pelisse (1):
  remote-hg: unquote C-style paths when exporting

Brian Gernhardt (3):
  t5570: Update for symref capability
  t5570: Update for clone-progress-to-stderr branch
  t5570: Update for clone-progress-to-stderr branch

Hemmo Nieminen (1):
  graph: fix coloring around octopus merges

Jeff King (11):
  http_get_file: style fixes
  http_request: factor out curlinfo_strbuf
  http: refactor options to http_get_*
  http: hoist credential request out of handle_curl_result
  http: provide effective url to callers
  http: update base URLs when we see redirects
  remote-curl: make refs_url a strbuf
  remote-curl: store url as a strbuf
  remote-curl: rewrite base url from info/refs redirects
  split_ident: parse timestamp from end of line
  subtree: add makefile target for html docs

Jonathan Nieder (1):
  t/README: tests can use perl even with NO_PERL

Junio C Hamano (10):
  t5505: fix set-head --auto with ambiguous HEAD test
  upload-pack.c: do not pass confusing cb_data to mark_our_ref()
  upload-pack: send symbolic ref information as capability
  upload-pack: send non-HEAD symbolic refs
  connect.c: make parse_feature_value() static
  connect: annotate refs with their symref information in get_remote_head()
  clone: test the new HEAD detection logic
  revision: do not peel tags used in range notation
  Start preparing for 1.8.4.3
  Git 1.8.4.3

Karsten Blees (1):
  gitignore.txt: fix documentation of ** patterns

Matthieu Moy (2):
  checkout: allow dwim for branch creation for git checkout $branch --
  checkout: proper error message on 'git checkout foo bar --'

Ramsay Allan Jones (1):
  http.c: Spell the null pointer as NULL

SZEDER 

Re: [PATCH 1/5] compat/bswap.h: Fix build on cygwin, MinGW and msvc

2013-11-08 Thread Jeff King
On Fri, Nov 08, 2013 at 01:45:50AM +0100, SZEDER Gábor wrote:

 Hi,
 
 On Thu, Nov 07, 2013 at 09:59:38PM +, Ramsay Jones wrote:
  +static inline uint64_t default_bswap64(uint64_t val)
  +{
  +   return (((val  (uint64_t)0x00ffULL)  56) |
  +   ((val  (uint64_t)0xff00ULL)  40) |
  +   ((val  (uint64_t)0x00ffULL)  24) |
  +   ((val  (uint64_t)0xff00ULL)   8) |
  +   ((val  (uint64_t)0x00ffULL)   8) |
  +   ((val  (uint64_t)0xff00ULL)  24) |
  +   ((val  (uint64_t)0x00ffULL)  40) |
  +   ((val  (uint64_t)0xff00ULL)  56));
  +}
 
 This got me thinking.
 To swap 8 bytes this function performs 8 bitwise shifts, 8 bitwise
 ANDs and 7 bitwise ORs plus uses 8 64bit constants.  We could do
 better than that:
 
 static inline uint64_t hacked_bswap64(uint64_t val)
 {
   uint64_t tmp = val  32 | val  32;
   return (((tmp  (uint64_t)0xff00ff00ULL)  24) |
   ((tmp  (uint64_t)0x00ff00ffULL)   8) |
   ((tmp  (uint64_t)0xff00ff00ULL)   8) |
   ((tmp  (uint64_t)0x00ff00ffULL)  24));
 }
 
 This performs only 6 shifts, 4 ANDs, 4 ORs and uses 4 64bit constants.

You can do better still by using the bswap instruction. :)

I tried timing the program below.

With -O0, your version is actually _slower_ than the naive version (14s
versus 13s), and the bswap version is better than either (8s). Oddly, in
an earlier iteration of my test, your version was faster than naive,
with bswap faster still (10s, 8s, 5s, respectively). In that version, I
was not assigning the result of the bswap anywhere.

So I think the timing is highly dependent on the code surrounding the
call, but of course the asm instruction seems to always perform better.

If I turn on -O2, all three take about 1.2s.  Inspecting the generated
assembly, it's because gcc converts the raw-code cases into a bswap
instruction.  We end up with something like:

  .L3:
  subq $1, %rdx
  bswap %rax
  jne .L3

And according to perf, we spend all of our time on the jump. The bswap
hardly registers.

 I doubt that in normal usage git would spend enough time bswap64ing to
 make this noticeable, but it was a fun micro-optimization on a wet
 Thursday evening nevertheless :)

We do a fair number, but it's dwarfed by the real work. And from the
numbers above, I think our best bet is to use the system bswap if it's
there, and then not worry too hard about micro-optimizing the rest.

-Peff

-- 8 --
#include stdint.h
#include stdio.h
#include stdlib.h

#ifdef NAIVE
static inline uint64_t test(uint64_t val)
{
return ((val  (uint64_t)0x00ffULL)  56)
| ((val  (uint64_t)0xff00ULL)  40)
| ((val  (uint64_t)0x00ffULL)  24)
| ((val  (uint64_t)0xff00ULL)   8)
| ((val  (uint64_t)0x00ffULL)   8)
| ((val  (uint64_t)0xff00ULL)  24)
| ((val  (uint64_t)0x00ffULL)  40)
| ((val  (uint64_t)0xff00ULL)  56);
}

#elif defined(OPTIM)
static inline uint64_t test(uint64_t val)
{
uint64_t tmp = val  32 | val  32;
return (((tmp  (uint64_t)0xff00ff00ULL)  24) |
((tmp  (uint64_t)0x00ff00ffULL)   8) |
((tmp  (uint64_t)0xff00ff00ULL)   8) |
((tmp  (uint64_t)0x00ff00ffULL)  24));
}

#elif defined(ASM)
static inline uint64_t test(uint64_t val)
{
register uint64_t v, x = val;
__asm__(bswap %q0 : =r (v) : 0 (x));
return v;
}
#endif

int main(int argc, char **argv)
{
unsigned long i;
uint64_t n = strtoull(argv[1], NULL, 10);

for (i = 0; i  10; i++)
n = test(n);
/* convince gcc that we really want the output value, so
 * it won't optimize out the whole program */
printf(%d\n, (int)n);
return 0;
}
--
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] fix up 'jk/pack-bitmap' branch

2013-11-08 Thread Jeff King
On Fri, Nov 08, 2013 at 06:10:30PM +0100, Torsten Bögershausen wrote:

 Side question:
 Do we have enough test coverage for htonll()/ntohll(),
 or do we want do the module test which I send a couple of days before ?

The series adds tests for building and using the ewah bitmaps, which in
turn rely on the htonll code. So they are being tested in the existing
series.

-Peff
--
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 v3] push: Enhance unspecified push default warning

2013-11-08 Thread Marc Branchaud
On 13-11-08 01:02 PM, Junio C Hamano wrote:
 Matthieu Moy matthieu@grenoble-inp.fr writes:
 
 Jonathan Nieder jrnie...@gmail.com writes:

 When push.default is set to 'matching', git will push local branches
 to remote branches that already exist with the same (matching) name.

 Yes, that's better than the original patch (and remains two lines).
 ...

 In Git 2.0, git will default to a more conservative 'simple' behavior
 that only pushes the current branch.

 That's an option too, but I think mentionning git pull was a good
 idea.
 
 OK, I'll tentatively update the draft to read like this, redo the
 endgame patch on top and requeue.
 
  builtin/push.c | 12 +---
  1 file changed, 5 insertions(+), 7 deletions(-)
 
 diff --git a/builtin/push.c b/builtin/push.c
 index 5393e28..27c5754 100644
 --- a/builtin/push.c
 +++ b/builtin/push.c
 @@ -174,14 +174,12 @@ N_(push.default is unset; its implicit value is 
 changing in\n
 \n
   git config --global push.default simple\n
 \n
 -   When push.default is set to 'matching', git will push all local 
 branches\n
 -   to the remote branches with the same (matching) name.  This will no\n
 -   longer be the default in Git 2.0 because a branch could be\n
 -   unintentionally pushed to a remote.\n
 +   When push.default is set to 'matching', git will push local branches\n
 +   to the remote branches that already exist with the same name.\n
 \n
 -   In Git 2.0 the new push.default of 'simple' will push only the current\n
 -   branch to the same remote branch used by git pull.   A push will\n
 -   only succeed if the remote and local branches have the same name.\n
 +   In Git 2.0, Git will default to the more conservative 'simple'\n
 +   behavior that only pushes the current branch to the corresponding\n
 +   remote branch used by 'git pull' to update the current branch from.\n

That reads a bit awkwardly.  How about:

In Git 2.0, Git will default to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

M.

--
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: Selectively commit/publish files to GIT

2013-11-08 Thread Thomas Manson
Hi Magnus,

 thanks for pointing that out. I must have overlooked the webpage,
when I saw that I thought it was some kind of alias that designated
files greater than a specific files (server side configurated as the
100MB limit)

  I'll try again ;)

Thomas.

On Fri, Nov 8, 2013 at 3:13 PM, Magnus Bäck ba...@google.com wrote:
 On Friday, November 08, 2013 at 05:52 EST,
  Thomas Manson dev.mansontho...@gmail.com wrote:

 [...]

   How can I search git history for big files and remove them, or mark
 them to be not published ?

 I've tryed this solution found on the link in the error:

 git filter-branch --force --index-filter   'git rm --cached
 --ignore-unmatch giant_file'   --prune-empty --tag-name-filter cat --
 --all
 git commit --amend -CHEAD

 [...]

 here is the error I have using the GitHub application on Mac :
 (after that I intend to use Eclipse)

 File Ressources/dwr/dwr-3.0.0.110.dev-src.zip is 67.69 MB; this is
 larger than GitHub's recommended maximum file size of 50 MB
 GH001: Large files detected.
 Trace: 8f0259b29260f0c4d7ae4d4ae70e0306
 See http://git.io/iEPt8g for more information.
 File .bzr/repository/packs/a7bcd6ba235114ab88c80fe8a97adcfa.pack is
 178.76 MB; this exceeds GitHub's file size limit of 100 MB

 Did you actually replace the 'giant_file' placeholder with the path to
 *your* giant file? The error message indicates that you didn't, or that
 something else went wrong during the filtering.

 You can use 'git log' to look for commits touching particular pathnames,
 making it easy to verify that a file has been eradicated.

 git log --all -- path/to/big-honking-file.zip

 --
 Magnus Bäck
 ba...@google.com
--
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: Selectively commit/publish files to GIT

2013-11-08 Thread Thomas Manson
Thanks Magnus, it did solve my issue.

I've noticed by the way that i've accidentally commited the whole .bzr
directory (that hold all my commit in Bazaar style).

I've deleted this folder as well using -r

git filter-branch --force --index-filter   'git rm -r --cached
--ignore-unmatch .bzr'   --prune-empty --tag-name-filter cat -- --all




for reference, an example of working run :

Thomass-MacBook-Pro:crf-rdp tmanson$ git filter-branch --force
--index-filter   'git rm --cached --ignore-unmatch
Ressources/dwr/dwr-3.0.0.110.dev-src.zip'   --prune-empty
--tag-name-filter cat -- --all
Rewrite 58952de4e10bc1df2f8c324e94d249a0366f7512 (65/158)rm
'Ressources/dwr/dwr-3.0.0.110.dev-src.zip'
Rewrite e661d08f1c33d7bd53e2c2231a3296b2ade5a2dd (66/158)rm
'Ressources/dwr/dwr-3.0.0.110.dev-src.zip'
Rewrite 8ff3f3f9ffb901b7cdc1dba220a121bab0698121 (67/158)rm
'Ressources/dwr/dwr-3.0.0.110.dev-src.zip'
Rewrite cfec6341565c35c410f248e5861543ac01b84f40 (158/158)
Ref 'refs/heads/master' was rewritten
Ref 'refs/tags/version-0-1_20081120' was rewritten
Ref 'refs/tags/version-0-5-1_20120512' was rewritten


On Fri, Nov 8, 2013 at 11:51 PM, Thomas Manson
dev.mansontho...@gmail.com wrote:
 Hi Magnus,

  thanks for pointing that out. I must have overlooked the webpage,
 when I saw that I thought it was some kind of alias that designated
 files greater than a specific files (server side configurated as the
 100MB limit)

   I'll try again ;)

 Thomas.

 On Fri, Nov 8, 2013 at 3:13 PM, Magnus Bäck ba...@google.com wrote:
 On Friday, November 08, 2013 at 05:52 EST,
  Thomas Manson dev.mansontho...@gmail.com wrote:

 [...]

   How can I search git history for big files and remove them, or mark
 them to be not published ?

 I've tryed this solution found on the link in the error:

 git filter-branch --force --index-filter   'git rm --cached
 --ignore-unmatch giant_file'   --prune-empty --tag-name-filter cat --
 --all
 git commit --amend -CHEAD

 [...]

 here is the error I have using the GitHub application on Mac :
 (after that I intend to use Eclipse)

 File Ressources/dwr/dwr-3.0.0.110.dev-src.zip is 67.69 MB; this is
 larger than GitHub's recommended maximum file size of 50 MB
 GH001: Large files detected.
 Trace: 8f0259b29260f0c4d7ae4d4ae70e0306
 See http://git.io/iEPt8g for more information.
 File .bzr/repository/packs/a7bcd6ba235114ab88c80fe8a97adcfa.pack is
 178.76 MB; this exceeds GitHub's file size limit of 100 MB

 Did you actually replace the 'giant_file' placeholder with the path to
 *your* giant file? The error message indicates that you didn't, or that
 something else went wrong during the filtering.

 You can use 'git log' to look for commits touching particular pathnames,
 making it easy to verify that a file has been eradicated.

 git log --all -- path/to/big-honking-file.zip

 --
 Magnus Bäck
 ba...@google.com
--
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 v5 06/10] fast-export: add new --refspec option

2013-11-08 Thread Junio C Hamano
Jeff King p...@peff.net writes:

 On Wed, Nov 06, 2013 at 01:00:42PM -0800, Junio C Hamano wrote:

 It follows that the syntax naturally support
 
  git fast-export refs/heads/master:refs/heads/foobar
 
 I would think.
 
 That approach lets you express ref mapping without a new option
 --refspec, which goes contrary to existing UI for any commands in
 Git (I think nobody takes refspec as a value to a dashed-option in
 the transport; both in fetch and push, they are proper operands,
 i.e. command line arguments to the command), no?

 I think that is much nicer for the simple cases, but how do we handle
 more complex rev expressions? ...

 The ^origin is not a refspec, and finding the refspec in the
 dot-expression would involve parsing it into two components. I think you
 can come up with a workable system by parsing the arguments as revision
 specifiers and then applying some rules. E.g

I was thinking about this a bit more today.  It is more or less
trivial to actually teach the setup_revisions() infrastructure to
optionally allow A:B to mean We want a revision A, but with an
extra twist, and leave that extra twist information in the
rev_cmdline machinery.  After all, rev_cmdline was introduced for
doing exactly this kind of thing.

Earlier I said that all the existing transport commands take refspec
as proper operands, not a value to a dashed-option, but I can imagine
that we may in the future want to update git push in a way similar
to what Felipe did to git fast-export so that it allows something
like this:

$ git push mothership \
 --refspec refs/heads/*:refs/remotes/satellite/* master

which would mean I am pushing out 'master', but anything I push out
to the mothership from my refs/heads/ hierarchy should be used to
update the refs/remotes/satellite/ hierarchy over there.  The same
thing can be done in the reverse direction for git fetch.

But such a wildcard refspec cannot be supported naturally by
extending the setup_revisions(); what the wildcarded refspec expands
to will depend on what other things are on the command line (in this
case, 'master').  So I stopped there (I'll attach a toy patch at the
end, but I'll discard it once I send this message out).

If you set remote.*.fetch (or remote.*.push) refspec with the
current system, it tells us two logically separate/separable things:

 (1) what is the set of refs fetched (or pushed); and

 (2) what refs at the receiving end are updated.

git push and git fetch could borrow the independent ref-mapping
UI from git fast-export to allow us to dissociate these two
concepts.  In the above mothership-satelite example, the master
specifies what is pushed out, while the value of --refspec option
specifies the mapping.  It would open a door to even make the
mapping a configuration variable.  In short, nobody uses an
independent refspec mapping parameter does not necessarily mean we
should not have such an independent refspec mapping parameter.

If we were to go that route, however, I would be strongly against
calling that option --refspec; perhaps calling it --refmap would
avoid confusion.

 remote.c   |  5 +
 remote.h   |  2 ++
 revision.c | 67 +-
 revision.h | 10 +-
 4 files changed, 82 insertions(+), 2 deletions(-)

diff --git a/remote.c b/remote.c
index 9f1a8aa..26b86a0 100644
--- a/remote.c
+++ b/remote.c
@@ -653,6 +653,11 @@ static struct refspec *parse_push_refspec(int nr_refspec, 
const char **refspec)
return parse_refspec_internal(nr_refspec, refspec, 0, 0);
 }
 
+struct refspec *parse_push_refspec_verify(int nr_refspec, const char **refspec)
+{
+   return parse_refspec_internal(nr_refspec, refspec, 0, 1);
+}
+
 void free_refspec(int nr_refspec, struct refspec *refspec)
 {
int i;
diff --git a/remote.h b/remote.h
index 131130a..2bc0a7e 100644
--- a/remote.h
+++ b/remote.h
@@ -156,6 +156,8 @@ void ref_remove_duplicates(struct ref *ref_map);
 int valid_fetch_refspec(const char *refspec);
 struct refspec *parse_fetch_refspec(int nr_refspec, const char **refspec);
 
+struct refspec *parse_push_refspec_verify(int nr_refspec, const char 
**refspec);
+
 void free_refspec(int nr_refspec, struct refspec *refspec);
 
 char *apply_refspecs(struct refspec *refspecs, int nr_refspec,
diff --git a/revision.c b/revision.c
index 956040c..17e7b3d 100644
--- a/revision.c
+++ b/revision.c
@@ -16,6 +16,7 @@
 #include line-log.h
 #include mailmap.h
 #include commit-slab.h
+#include remote.h
 
 volatile show_early_output_fn_t show_early_output;
 
@@ -1377,6 +1378,58 @@ static void prepare_show_merge(struct rev_info *revs)
revs-limited = 1;
 }
 
+static int handle_revision_refspec(const char *arg, struct rev_info *revs, 
unsigned revarg_opt)
+{
+   int cant_be_filename = revarg_opt  REVARG_CANNOT_BE_FILENAME;
+   struct refspec *pair;
+   static struct ref *local_refs;
+   struct ref *remote_refs = NULL;
+   struct object *object;
+  

Re: Selectively commit/publish files to GIT

2013-11-08 Thread Keshav Kini
Thomas Manson dev.mansontho...@gmail.com writes:
   The problem is that in Bazaar, I've commited some big files (63MB 
 173MB), but this files are no longer in my project, only in the
 revisions files of Bazaar and now Git.

   I don't need this files to be pushed on Github.

   How can I search git history for big files and remove them, or mark
 them to be not published ?

I see you already solved your problem, but for future reference, there
is a nice tool that is more limited in functionality than git
filter-branch but also much faster and possibly easier to use:

http://rtyley.github.io/bfg-repo-cleaner/

-Keshav

--
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 v5 06/10] fast-export: add new --refspec option

2013-11-08 Thread Jeff King
On Fri, Nov 08, 2013 at 03:44:43PM -0800, Junio C Hamano wrote:

  The ^origin is not a refspec, and finding the refspec in the
  dot-expression would involve parsing it into two components. I think you
  can come up with a workable system by parsing the arguments as revision
  specifiers and then applying some rules. E.g
 
 I was thinking about this a bit more today.  It is more or less
 trivial to actually teach the setup_revisions() infrastructure to
 optionally allow A:B to mean We want a revision A, but with an
 extra twist, and leave that extra twist information in the
 rev_cmdline machinery.  After all, rev_cmdline was introduced for
 doing exactly this kind of thing.

I had wondered at first whether it would be a problem to be
syntactically ambiguous with ref:path. But I don't think so. Doing:

   git fast-export HEAD:Documentation

does not produce any output currently. And the fast-import stream cannot
actually represent trees outside of commits. Something like:

  git fast-export HEAD:Makefile

could produce a blob entry, but it currently does nothing. So I don't
think it's a big deal, as nobody is clamoring for the feature. And
certainly git push suffers from the same problem, and you can work
around it with:

  git push $(git rev-parse HEAD:Makefile):refs/tag/makefile-blob

 Earlier I said that all the existing transport commands take refspec
 as proper operands, not a value to a dashed-option, but I can imagine
 that we may in the future want to update git push in a way similar
 to what Felipe did to git fast-export so that it allows something
 like this:
 
 $ git push mothership \
  --refspec refs/heads/*:refs/remotes/satellite/* master
 
 which would mean I am pushing out 'master', but anything I push out
 to the mothership from my refs/heads/ hierarchy should be used to
 update the refs/remotes/satellite/ hierarchy over there.  The same
 thing can be done in the reverse direction for git fetch.

Yes, though I would expect the --refspec bit would end up in config
(else why would you not just apply it directly to master). And you would
want to be able to override it, like:

  git push mothership \
--refspec refs/heads/*:refs/remotes/satellite/* master:refs/other/master

So I think even with such wildcard magic, you'd still want refspecs,
both for push and for fast-export.

 But such a wildcard refspec cannot be supported naturally by
 extending the setup_revisions(); what the wildcarded refspec expands
 to will depend on what other things are on the command line (in this
 case, 'master').  So I stopped there (I'll attach a toy patch at the
 end, but I'll discard it once I send this message out).

Yes, I think applying such a refspec would be the duty of whoever
expands master into master:master. And that is not a job for
setup_revisions, which should be dealing mostly with the syntax and
telling us I got just 'master' or I got 'master:foo'. The
interpretation is up to the caller.

 If we were to go that route, however, I would be strongly against
 calling that option --refspec; perhaps calling it --refmap would
 avoid confusion.

Agreed.

-Peff
--
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


[PATCH 1/4] Minor grammatical fixes in git log man page

2013-11-08 Thread Jason St. John
git-log.txt: grammatical fixes under --log-size option

Signed-off-by: Jason St. John jstj...@purdue.edu
---
 Documentation/git-log.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index 34097ef..243a9c5 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -56,10 +56,10 @@ Note that this affects all diff-based output types, e.g. 
those
 produced by --stat etc.
 
 --log-size::
-   Before the log message print out its size in bytes. Intended
+   Before the log message, print out its size in bytes. Intended
mainly for porcelain tools consumption. If Git is unable to
-   produce a valid value size is set to zero.
-   Note that only message is considered, if also a diff is shown
+   produce a valid value size, this is set to zero.
+   Note that only message is considered. Also, if a diff is shown,
its size is not included.
 
 -L start,end:file::
-- 
1.8.4.2

--
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


[PATCH 2/4] Emphasize options and force ASCIIDOC escaping of --

2013-11-08 Thread Jason St. John
rev-list-options.txt: replace e.g. `--foo` with '\--foo'
rev-list-options.txt: emphasize, instead of quote, some option arguments
(e.g. foo-option becomes 'foo-option')
rev-list-options.txt: force ASCIIDOC escaping of -- (e.g. '--bar'
becomes '\--bar')
rev-list-options.txt: add single quote chars around options missing them
(e.g. --grep becomes '\--grep')
rev-list-options.txt: replaced one instance of regexp with regular
expressions
rev-list-options.txt: fix typo in --no-walk description (show --
shown)
rev-list-options.txt: replaced some instances of double quotes with
their ASCIIDOC equivalent (e.g. a - character becomes
a ``-'' character,

Signed-off-by: Jason St. John jstj...@purdue.edu
---
Sorry for the messy quoting in the last set of examples in the commit message.
There wasn't really any way to work around it other than omitting the quotes
around the before and after parts, which I didn't want to do.


 Documentation/rev-list-options.txt | 136 ++---
 1 file changed, 68 insertions(+), 68 deletions(-)

diff --git a/Documentation/rev-list-options.txt 
b/Documentation/rev-list-options.txt
index 5bdfb42..32c40ae 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -6,12 +6,12 @@ special notations explained in the description, additional 
commit
 limiting may be applied.
 
 Using more options generally further limits the output (e.g.
-`--since=date1` limits to commits newer than `date1`, and using it
-with `--grep=pattern` further limits to commits whose log message
+'\--since=date1' limits to commits newer than `date1`, and using it
+with '\--grep=pattern' further limits to commits whose log message
 has a line that matches `pattern`), unless otherwise noted.
 
 Note that these are applied before commit
-ordering and formatting options, such as `--reverse`.
+ordering and formatting options, such as '\--reverse'.
 
 --
 
@@ -47,31 +47,31 @@ endif::git-rev-list[]
 
Limit the commits output to ones with author/committer
header lines that match the specified pattern (regular
-   expression).  With more than one `--author=pattern`,
+   expression).  With more than one '\--author=pattern',
commits whose author matches any of the given patterns are
-   chosen (similarly for multiple `--committer=pattern`).
+   chosen (similarly for multiple '\--committer=pattern').
 
 --grep-reflog=pattern::
 
Limit the commits output to ones with reflog entries that
match the specified pattern (regular expression). With
-   more than one `--grep-reflog`, commits whose reflog message
+   more than one '\--grep-reflog', commits whose reflog message
matches any of the given patterns are chosen.  It is an
-   error to use this option unless `--walk-reflogs` is in use.
+   error to use this option unless '\--walk-reflogs' is in use.
 
 --grep=pattern::
 
Limit the commits output to ones with log message that
matches the specified pattern (regular expression).  With
-   more than one `--grep=pattern`, commits whose message
+   more than one '\--grep=pattern', commits whose message
matches any of the given patterns are chosen (but see
-   `--all-match`).
+   '\--all-match').
 +
-When `--show-notes` is in effect, the message from the notes as
+When '\--show-notes' is in effect, the message from the notes as
 if it is part of the log message.
 
 --all-match::
-   Limit the commits output to ones that match all given --grep,
+   Limit the commits output to ones that match all given '\--grep',
instead of ones that match at least one.
 
 -i::
@@ -98,7 +98,7 @@ if it is part of the log message.
 
 --perl-regexp::
 
-   Consider the limiting patterns to be Perl-compatible regexp.
+   Consider the limiting patterns to be Perl-compatible regular 
expressions.
Requires libpcre to be compiled in.
 
 --remove-empty::
@@ -107,12 +107,12 @@ if it is part of the log message.
 
 --merges::
 
-   Print only merge commits. This is exactly the same as `--min-parents=2`.
+   Print only merge commits. This is exactly the same as 
'\--min-parents=2'.
 
 --no-merges::
 
Do not print commits with more than one parent. This is
-   exactly the same as `--max-parents=1`.
+   exactly the same as '\--max-parents=1'.
 
 --min-parents=number::
 --max-parents=number::
@@ -120,13 +120,13 @@ if it is part of the log message.
 --no-max-parents::
 
Show only commits which have at least (or at most) that many parent
-   commits. In particular, `--max-parents=1` is the same as `--no-merges`,
-   `--min-parents=2` is the same as `--merges`.  `--max-parents=0`
-   gives all root commits and `--min-parents=3` all octopus merges.
+   commits. In particular, '\--max-parents=1' is the same as 
'\--no-merges',
+   '\--min-parents=2` is the same as '\--merges'.  '\--max-parents=0'
+  

[PATCH 3/4] Correct word usage of timezone in Documentation directory

2013-11-08 Thread Jason St. John
timezone is two words, not one (i.e. time zone is correct).

Correct this in these files:
-- date-formats.txt
-- git-blame.txt
-- git-cvsimport.txt
-- git-fast-import.txt
-- git-svn.txt
-- gitweb.conf.txt
-- rev-list-options.txt

Signed-off-by: Jason St. John jstj...@purdue.edu
---
Sources:
(1) https://en.wikipedia.org/wiki/Time_zone
(2) 
https://www.google.com/trends/explore?q=%22timezone%22+%22time+zone%22#q=timezone%2C%20time%20zonecmpt=q
(3) A search of Google Scholar (non-patent articles) for each term:
timezone: 8,300 results
time zone: 40,100 results


 Documentation/date-formats.txt |  4 ++--
 Documentation/git-blame.txt|  2 +-
 Documentation/git-cvsimport.txt|  4 ++--
 Documentation/git-fast-import.txt  | 10 +-
 Documentation/git-svn.txt  |  6 +++---
 Documentation/gitweb.conf.txt  | 14 +++---
 Documentation/rev-list-options.txt |  4 ++--
 7 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/Documentation/date-formats.txt b/Documentation/date-formats.txt
index c000f08..ccd1fc8 100644
--- a/Documentation/date-formats.txt
+++ b/Documentation/date-formats.txt
@@ -8,9 +8,9 @@ endif::git-commit[]
 support the following date formats:
 
 Git internal format::
-   It is `unix timestamp timezone offset`, where `unix
+   It is `unix timestamp time zone offset`, where `unix
timestamp` is the number of seconds since the UNIX epoch.
-   `timezone offset` is a positive or negative offset from UTC.
+   `time zone offset` is a positive or negative offset from UTC.
For example CET (which is 2 hours ahead UTC) is `+0200`.
 
 RFC 2822::
diff --git a/Documentation/git-blame.txt b/Documentation/git-blame.txt
index f2c85cc..8e70a61 100644
--- a/Documentation/git-blame.txt
+++ b/Documentation/git-blame.txt
@@ -103,7 +103,7 @@ This header line is followed by the following information
 at least once for each commit:
 
 - the author name (author), email (author-mail), time
-  (author-time), and timezone (author-tz); similarly
+  (author-time), and time zone (author-tz); similarly
   for committer.
 - the filename in the commit that the line is attributed to.
 - the first line of the commit log message (summary).
diff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt
index d1bcda2..2df9953 100644
--- a/Documentation/git-cvsimport.txt
+++ b/Documentation/git-cvsimport.txt
@@ -144,7 +144,7 @@ This option can be used several times to provide several 
detection regexes.
CVS by default uses the Unix username when writing its
commit logs. Using this option and an author-conv-file
maps the name recorded in CVS to author name, e-mail and
-   optional timezone:
+   optional time zone:
 +
 -
exon=Andreas Ericsson a...@op5.se
@@ -154,7 +154,7 @@ This option can be used several times to provide several 
detection regexes.
 +
 'git cvsimport' will make it appear as those authors had
 their GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL set properly
-all along.  If a timezone is specified, GIT_AUTHOR_DATE will
+all along.  If a time zone is specified, GIT_AUTHOR_DATE will
 have the corresponding offset applied.
 +
 For convenience, this data is saved to `$GIT_DIR/cvs-authors`
diff --git a/Documentation/git-fast-import.txt 
b/Documentation/git-fast-import.txt
index 73f9806..fd22a9a 100644
--- a/Documentation/git-fast-import.txt
+++ b/Documentation/git-fast-import.txt
@@ -251,7 +251,7 @@ advisement to help formatting routines display the 
timestamp.
 If the local offset is not available in the source material, use
 ``+'', or the most common local offset.  For example many
 organizations have a CVS repository which has only ever been accessed
-by users who are located in the same location and timezone.  In this
+by users who are located in the same location and time zone.  In this
 case a reasonable offset from UTC could be assumed.
 +
 Unlike the `rfc2822` format, this format is very strict.  Any
@@ -271,7 +271,7 @@ the malformed string.  There are also some types of 
malformed
 strings which Git will parse wrong, and yet consider valid.
 Seriously malformed strings will be rejected.
 +
-Unlike the `raw` format above, the timezone/UTC offset information
+Unlike the `raw` format above, the time zone/UTC offset information
 contained in an RFC 2822 date string is used to adjust the date
 value to UTC prior to storage.  Therefore it is important that
 this information be as accurate as possible.
@@ -287,13 +287,13 @@ format, or its format is easily convertible to it, as 
there is no
 ambiguity in parsing.
 
 `now`::
-   Always use the current time and timezone.  The literal
+   Always use the current time and time zone.  The literal
`now` must always be supplied for `when`.
 +
-This is a toy format.  The current time and timezone of this system
+This is a toy format.  The current time and time zone of this system
 is always copied into the 

[PATCH 4/4] Correct word usage of timezone in Documentation/RelNotes directory

2013-11-08 Thread Jason St. John
timezone is two words, not one (i.e. time zone is correct).

Signed-off-by: Jason St. John jstj...@purdue.edu
---
I broke this off into a separate patch in case the release notes are
essentially fixed in history and typos, misspellings, etc. don't get
corrected.
Sources are provided below the commit message in [PATCH 3/4].


 Documentation/RelNotes/1.5.2.txt| 2 +-
 Documentation/RelNotes/1.7.1.1.txt  | 2 +-
 Documentation/RelNotes/1.7.12.4.txt | 2 +-
 Documentation/RelNotes/1.7.3.4.txt  | 2 +-
 Documentation/RelNotes/1.7.4.2.txt  | 2 +-
 Documentation/RelNotes/1.7.6.5.txt  | 2 +-
 Documentation/RelNotes/1.7.6.txt| 2 +-
 Documentation/RelNotes/1.7.8.txt| 2 +-
 Documentation/RelNotes/1.8.0.txt| 2 +-
 Documentation/RelNotes/1.8.1.txt| 2 +-
 10 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/Documentation/RelNotes/1.5.2.txt b/Documentation/RelNotes/1.5.2.txt
index e8328d0..774eaf4 100644
--- a/Documentation/RelNotes/1.5.2.txt
+++ b/Documentation/RelNotes/1.5.2.txt
@@ -76,7 +76,7 @@ Updates since v1.5.1
 
   - git log family of commands learned --date={local,relative,default}
 option.  --date=relative is synonym to the --relative-date.
---date=local gives the timestamp in local timezone.
+--date=local gives the timestamp in local time zone.
 
 * Updated behavior of existing commands.
 
diff --git a/Documentation/RelNotes/1.7.1.1.txt 
b/Documentation/RelNotes/1.7.1.1.txt
index 3f6b314..1e57365 100644
--- a/Documentation/RelNotes/1.7.1.1.txt
+++ b/Documentation/RelNotes/1.7.1.1.txt
@@ -15,7 +15,7 @@ Fixes since v1.7.1
macro that set/unset one attribute, immediately followed by an
overriding setting; this makes attribute macros much easier to use.
 
- * We didn't recognize timezone Z as a synonym for UTC (75b37e70).
+ * We didn't recognize time zone Z as a synonym for UTC (75b37e70).
 
  * In 1.7.0, read-tree and user commands that use the mechanism such as
checkout and merge were fixed to handle switching between branches one
diff --git a/Documentation/RelNotes/1.7.12.4.txt 
b/Documentation/RelNotes/1.7.12.4.txt
index c6da3cc..9d90d11 100644
--- a/Documentation/RelNotes/1.7.12.4.txt
+++ b/Documentation/RelNotes/1.7.12.4.txt
@@ -10,7 +10,7 @@ Fixes since v1.7.12.3
  * It was possible to give specific paths for asciidoc and other
tools in the documentation toolchain, but not for xmlto.
 
- * gitweb did not give the correct committer timezone in its feed
+ * gitweb did not give the correct committer time zone in its feed
output due to a typo.
 
  * The -Xours (and similarly -Xtheirs) backend option to git
diff --git a/Documentation/RelNotes/1.7.3.4.txt 
b/Documentation/RelNotes/1.7.3.4.txt
index e57f7c1..6223e07 100644
--- a/Documentation/RelNotes/1.7.3.4.txt
+++ b/Documentation/RelNotes/1.7.3.4.txt
@@ -10,7 +10,7 @@ Fixes since v1.7.3.3
  * git apply did not correctly handle patches that only change modes
if told to apply while stripping leading paths with -p option.
 
- * git apply can deal with patches with timezone formatted with a
+ * git apply can deal with patches with time zone formatted with a
colon between the hours and minutes part (e.g. -08:00 instead of
-0800).
 
diff --git a/Documentation/RelNotes/1.7.4.2.txt 
b/Documentation/RelNotes/1.7.4.2.txt
index ef4ce1f..5476344 100644
--- a/Documentation/RelNotes/1.7.4.2.txt
+++ b/Documentation/RelNotes/1.7.4.2.txt
@@ -49,7 +49,7 @@ Fixes since v1.7.4.1
 
  * gitweb's highlight interface mishandled tabs.
 
- * gitweb didn't understand timezones with GMT offset that is not
+ * gitweb didn't understand time zones with GMT offset that is not
multiple of a whole hour.
 
  * gitweb had a few forward-incompatible syntactic constructs and
diff --git a/Documentation/RelNotes/1.7.6.5.txt 
b/Documentation/RelNotes/1.7.6.5.txt
index 6713132..4b237e7 100644
--- a/Documentation/RelNotes/1.7.6.5.txt
+++ b/Documentation/RelNotes/1.7.6.5.txt
@@ -4,7 +4,7 @@ Git v1.7.6.5 Release Notes
 Fixes since v1.7.6.4
 
 
- * The date parser did not accept timezone designators that lack minutes
+ * The date parser did not accept time zone designators that lack minutes
part and also has a colon between hh:mm.
 
  * After fetching from a remote that has very long refname, the reporting
diff --git a/Documentation/RelNotes/1.7.6.txt b/Documentation/RelNotes/1.7.6.txt
index 9ec498e..98bc112 100644
--- a/Documentation/RelNotes/1.7.6.txt
+++ b/Documentation/RelNotes/1.7.6.txt
@@ -7,7 +7,7 @@ Updates since v1.7.5
  * Various git-svn updates.
 
  * Updates the way content tags are handled in gitweb.  Also adds
-   a UI to choose common timezone for displaying the dates.
+   a UI to choose common time zone for displaying the dates.
 
  * Similar to branch names, tagnames that begin with - are now
disallowed.
diff --git a/Documentation/RelNotes/1.7.8.txt b/Documentation/RelNotes/1.7.8.txt
index 2493113..938118e 100644
--- a/Documentation/RelNotes/1.7.8.txt
+++ 

Re: [PATCH 1/4] Minor grammatical fixes in git log man page

2013-11-08 Thread Jonathan Nieder
Hi,

Jason St. John wrote:

 git-log.txt: grammatical fixes under --log-size option

Thanks.

[...]
 --- a/Documentation/git-log.txt
 +++ b/Documentation/git-log.txt
 @@ -56,10 +56,10 @@ Note that this affects all diff-based output types, e.g. 
 those
  produced by --stat etc.
 
  --log-size::
 - Before the log message print out its size in bytes. Intended
 + Before the log message, print out its size in bytes. Intended
   mainly for porcelain tools consumption. If Git is unable to
 - produce a valid value size is set to zero.
 - Note that only message is considered, if also a diff is shown
 + produce a valid value size, this is set to zero.
 + Note that only message is considered. Also, if a diff is shown,
   its size is not included.

I have no idea what this option does, before or after the change.

The commit that introduced --log-size says the following in its
change description:

$ git log --grep=--log-size
commit 9fa3465d6be83c08ed24762c82eb33cb005729f3
Author: Marco Costalba mcosta...@gmail.com
Date:   Fri Jul 20 20:15:13 2007 +0200

Add --log-size to git log to print message size

With this option git-log prints log message size
just before the corresponding message.

Porcelain tools could use this to speedup parsing
of git-log output.

Note that size refers to log message only. If also
patch content is shown its size is not included.

Perhaps some of the above could make it into a clearer description?
E.g.,

--log-size::
Include a line log size number in the output for each
commit, where number is the length of that commit's
message in bytes.  Intended to speed up tools that
read log messages from 'git log' output by allowing them
to allocate space in advance.

The commit introducing --log-size also says:

In case it is not possible to know the size upfront
size value is set to zero.

Is this still true?  When is it not possible to know the size up
front?

The implementation of --log-size is

if (opt-show_log_size) {
printf(log size %i\n, (int)msgbuf.len);
graph_show_oneline(opt-graph);
}

What happens if the commit message is long enough to overflow a 32-bit
integer?  Is that impossible for other reasons?  If it is possible,
(not about this patch) should this be using a 64-bit integer to print
instead?

Thanks and hope that helps,
Jonathan
--
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 4/4] Correct word usage of timezone in Documentation/RelNotes directory

2013-11-08 Thread Jonathan Nieder
Jason St. John wrote:

 I broke this off into a separate patch in case the release notes are
 essentially fixed in history and typos, misspellings, etc. don't get
 corrected.

Yeah, I'd prefer not to retroactively fix release notes for cases
like this.

Thanks,
Jonathan
--
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


[PATCH] git-remote-mediawiki: do not remove installed files in clean target

2013-11-08 Thread Jonathan Nieder
Running make clean after a successful make install should not
result in a broken mediawiki remote helper.

Reported-by: Thorsten Glaser t.gla...@tarent.de
Signed-off-by: Jonathan Nieder jrnie...@gmail.com
---
Thanks for the very pleasant mediawiki remote helper.

 contrib/mw-to-git/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile
index f206f96..c5547f9 100644
--- a/contrib/mw-to-git/Makefile
+++ b/contrib/mw-to-git/Makefile
@@ -43,7 +43,6 @@ install: install_pm
 clean:
$(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=$(SCRIPT_PERL_FULL) \
 clean-perl-script
-   rm $(INSTLIBDIR)/$(GIT_MEDIAWIKI_PM)
 
 perlcritic:
perlcritic -5 $(SCRIPT_PERL)
-- 
1.8.4.1

--
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


[PATCH 20/86] http: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 http.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/http.c b/http.c
index f3e1439..f2621cd 100644
--- a/http.c
+++ b/http.c
@@ -422,7 +422,7 @@ void http_init(struct remote *remote, const char *url, int 
proactive_auth)
credential_from_url(http_auth, url);
if (!ssl_cert_password_required 
getenv(GIT_SSL_CERT_PASSWORD_PROTECTED) 
-   !prefixcmp(url, https://;))
+   has_prefix(url, https://;))
ssl_cert_password_required = 1;
}
 
@@ -985,7 +985,7 @@ int http_fetch_ref(const char *base, struct ref *ref)
strbuf_rtrim(buffer);
if (buffer.len == 40)
ret = get_sha1_hex(buffer.buf, ref-old_sha1);
-   else if (!prefixcmp(buffer.buf, ref: )) {
+   else if (has_prefix(buffer.buf, ref: )) {
ref-symref = xstrdup(buffer.buf + 5);
ret = 0;
}
@@ -1084,8 +1084,8 @@ int http_get_info_packs(const char *base_url, struct 
packed_git **packs_head)
case 'P':
i++;
if (i + 52 = buf.len 
-   !prefixcmp(data + i,  pack-) 
-   !prefixcmp(data + i + 46, .pack\n)) {
+   has_prefix(data + i,  pack-) 
+   has_prefix(data + i + 46, .pack\n)) {
get_sha1_hex(data + i + 6, sha1);
fetch_and_setup_pack_index(packs_head, sha1,
  base_url);
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 23/86] log-tree: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 log-tree.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/log-tree.c b/log-tree.c
index 8534d91..25b46a9 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -98,7 +98,7 @@ static int add_ref_decoration(const char *refname, const 
unsigned char *sha1, in
struct object *obj;
enum decoration_type type = DECORATION_NONE;
 
-   if (!prefixcmp(refname, refs/replace/)) {
+   if (has_prefix(refname, refs/replace/)) {
unsigned char original_sha1[20];
if (!read_replace_refs)
return 0;
@@ -116,11 +116,11 @@ static int add_ref_decoration(const char *refname, const 
unsigned char *sha1, in
if (!obj)
return 0;
 
-   if (!prefixcmp(refname, refs/heads/))
+   if (has_prefix(refname, refs/heads/))
type = DECORATION_REF_LOCAL;
-   else if (!prefixcmp(refname, refs/remotes/))
+   else if (has_prefix(refname, refs/remotes/))
type = DECORATION_REF_REMOTE;
-   else if (!prefixcmp(refname, refs/tags/))
+   else if (has_prefix(refname, refs/tags/))
type = DECORATION_REF_TAG;
else if (!strcmp(refname, refs/stash))
type = DECORATION_REF_STASH;
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 24/86] merge-recursive: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 merge-recursive.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/merge-recursive.c b/merge-recursive.c
index dbb7104..9043362 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -2063,13 +2063,13 @@ int parse_merge_opt(struct merge_options *o, const char 
*s)
o-recursive_variant = MERGE_RECURSIVE_THEIRS;
else if (!strcmp(s, subtree))
o-subtree_shift = ;
-   else if (!prefixcmp(s, subtree=))
+   else if (has_prefix(s, subtree=))
o-subtree_shift = s + strlen(subtree=);
else if (!strcmp(s, patience))
o-xdl_opts = DIFF_WITH_ALG(o, PATIENCE_DIFF);
else if (!strcmp(s, histogram))
o-xdl_opts = DIFF_WITH_ALG(o, HISTOGRAM_DIFF);
-   else if (!prefixcmp(s, diff-algorithm=)) {
+   else if (has_prefix(s, diff-algorithm=)) {
long value = parse_algorithm_value(s + 
strlen(diff-algorithm=));
if (value  0)
return -1;
@@ -2088,7 +2088,7 @@ int parse_merge_opt(struct merge_options *o, const char 
*s)
o-renormalize = 1;
else if (!strcmp(s, no-renormalize))
o-renormalize = 0;
-   else if (!prefixcmp(s, rename-threshold=)) {
+   else if (has_prefix(s, rename-threshold=)) {
const char *score = s + strlen(rename-threshold=);
if ((o-rename_score = parse_rename_score(score)) == -1 || 
*score != 0)
return -1;
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 17/86] tag: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 tag.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tag.c b/tag.c
index 78d272b..0b00c76 100644
--- a/tag.c
+++ b/tag.c
@@ -86,7 +86,7 @@ int parse_tag_buffer(struct tag *item, const void *data, 
unsigned long size)
return -1;
bufptr += 48; /* object  + sha1 + \n */
 
-   if (prefixcmp(bufptr, type ))
+   if (!has_prefix(bufptr, type ))
return -1;
bufptr += 5;
nl = memchr(bufptr, '\n', tail - bufptr);
@@ -109,7 +109,7 @@ int parse_tag_buffer(struct tag *item, const void *data, 
unsigned long size)
item-tagged = NULL;
}
 
-   if (bufptr + 4  tail  !prefixcmp(bufptr, tag ))
+   if (bufptr + 4  tail  has_prefix(bufptr, tag ))
;   /* good */
else
return -1;
@@ -120,7 +120,7 @@ int parse_tag_buffer(struct tag *item, const void *data, 
unsigned long size)
item-tag = xmemdupz(bufptr, nl - bufptr);
bufptr = nl + 1;
 
-   if (bufptr + 7  tail  !prefixcmp(bufptr, tagger ))
+   if (bufptr + 7  tail  has_prefix(bufptr, tagger ))
item-date = parse_tag_date(bufptr, tail);
else
item-date = 0;
@@ -160,8 +160,8 @@ size_t parse_signature(const char *buf, unsigned long size)
 {
char *eol;
size_t len = 0;
-   while (len  size  prefixcmp(buf + len, PGP_SIGNATURE) 
-   prefixcmp(buf + len, PGP_MESSAGE)) {
+   while (len  size  !has_prefix(buf + len, PGP_SIGNATURE) 
+   !has_prefix(buf + len, PGP_MESSAGE)) {
eol = memchr(buf + len, '\n', size - len);
len += eol ? eol - (buf + len) + 1 : size - len;
}
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 01/86] strbuf: add has_prefix() to be used instead of prefixcmp()

2013-11-08 Thread Christian Couder
prefixcmp() cannot be really used as a comparison function as
it is not antisymmetric:

prefixcmp(foo, foobar)  0
prefixcmp(foobar, foo) == 0

So it is not suitable as a function for passing to qsort.
And in fact it is used nowhere as a comparison function.

So we should replace it with a function that just checks for
equality.

As a first step toward this goal, this patch introduces
has_prefix().

Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 git-compat-util.h | 1 +
 strbuf.c  | 9 +
 2 files changed, 10 insertions(+)

diff --git a/git-compat-util.h b/git-compat-util.h
index 0f6a31e..7930f49 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -351,6 +351,7 @@ extern void set_error_routine(void (*routine)(const char 
*err, va_list params));
 extern void set_die_is_recursing_routine(int (*routine)(void));
 
 extern int prefixcmp(const char *str, const char *prefix);
+extern int has_prefix(const char *str, const char *prefix);
 extern int has_suffix(const char *str, const char *suffix);
 
 static inline const char *skip_prefix(const char *str, const char *prefix)
diff --git a/strbuf.c b/strbuf.c
index 0d784b5..748be6d 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -10,6 +10,15 @@ int prefixcmp(const char *str, const char *prefix)
return (unsigned char)*prefix - (unsigned char)*str;
 }
 
+int has_prefix(const char *str, const char *prefix)
+{
+   for (; ; str++, prefix++)
+   if (!*prefix)
+   return 1;
+   else if (*str != *prefix)
+   return 0;
+}
+
 int has_suffix(const char *str, const char *suffix)
 {
int len = strlen(str), suflen = strlen(suffix);
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 18/86] sequencer: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 sequencer.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sequencer.c b/sequencer.c
index 06e52b4..64cc6f0 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -41,7 +41,7 @@ static int is_cherry_picked_from_line(const char *buf, int 
len)
 * We only care that it looks roughly like (cherry picked from ...)
 */
return len  strlen(cherry_picked_prefix) + 1 
-   !prefixcmp(buf, cherry_picked_prefix)  buf[len - 1] == ')';
+   has_prefix(buf, cherry_picked_prefix)  buf[len - 1] == ')';
 }
 
 /*
@@ -180,7 +180,7 @@ static char *get_encoding(const char *message)
while (*p  *p != '\n') {
for (eol = p + 1; *eol  *eol != '\n'; eol++)
; /* do nothing */
-   if (!prefixcmp(p, encoding )) {
+   if (has_prefix(p, encoding )) {
char *result = xmalloc(eol - 8 - p);
strlcpy(result, p + 9, eol - 8 - p);
return result;
@@ -705,10 +705,10 @@ static struct commit *parse_insn_line(char *bol, char 
*eol, struct replay_opts *
char *end_of_object_name;
int saved, status, padding;
 
-   if (!prefixcmp(bol, pick)) {
+   if (has_prefix(bol, pick)) {
action = REPLAY_PICK;
bol += strlen(pick);
-   } else if (!prefixcmp(bol, revert)) {
+   } else if (has_prefix(bol, revert)) {
action = REPLAY_REVERT;
bol += strlen(revert);
} else
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 14/86] parse-options: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 parse-options.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/parse-options.c b/parse-options.c
index 62e9b1c..4f7fddc 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -273,13 +273,13 @@ is_abbreviated:
if (options-flags  PARSE_OPT_NONEG)
continue;
/* negated and abbreviated very much? */
-   if (!prefixcmp(no-, arg)) {
+   if (has_prefix(no-, arg)) {
flags |= OPT_UNSET;
goto is_abbreviated;
}
/* negated? */
-   if (prefixcmp(arg, no-)) {
-   if (!prefixcmp(long_name, no-)) {
+   if (!has_prefix(arg, no-)) {
+   if (has_prefix(long_name, no-)) {
long_name += 3;
opt_flags |= OPT_UNSET;
goto again;
@@ -289,7 +289,7 @@ is_abbreviated:
flags |= OPT_UNSET;
rest = skip_prefix(arg + 3, long_name);
/* abbreviated and negated? */
-   if (!rest  !prefixcmp(long_name, arg + 3))
+   if (!rest  has_prefix(long_name, arg + 3))
goto is_abbreviated;
if (!rest)
continue;
@@ -334,7 +334,7 @@ static void check_typos(const char *arg, const struct 
option *options)
if (strlen(arg)  3)
return;
 
-   if (!prefixcmp(arg, no-)) {
+   if (has_prefix(arg, no-)) {
error (did you mean `--%s` (with two dashes ?), arg);
exit(129);
}
@@ -342,7 +342,7 @@ static void check_typos(const char *arg, const struct 
option *options)
for (; options-type != OPTION_END; options++) {
if (!options-long_name)
continue;
-   if (!prefixcmp(options-long_name, arg)) {
+   if (has_prefix(options-long_name, arg)) {
error (did you mean `--%s` (with two dashes ?), arg);
exit(129);
}
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 27/86] setup: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/setup.c b/setup.c
index f08dd64..6ed292a 100644
--- a/setup.c
+++ b/setup.c
@@ -82,7 +82,7 @@ int check_filename(const char *prefix, const char *arg)
const char *name;
struct stat st;
 
-   if (!prefixcmp(arg, :/)) {
+   if (has_prefix(arg, :/)) {
if (arg[2] == '\0') /* :/ is root dir, always exists */
return 1;
name = arg + 2;
@@ -307,7 +307,7 @@ const char *read_gitfile(const char *path)
if (len != st.st_size)
die(Error reading %s, path);
buf[len] = '\0';
-   if (prefixcmp(buf, gitdir: ))
+   if (!has_prefix(buf, gitdir: ))
die(Invalid gitfile format: %s, path);
while (buf[len - 1] == '\n' || buf[len - 1] == '\r')
len--;
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 31/86] send-pack: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 send-pack.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/send-pack.c b/send-pack.c
index b228d65..c90049a 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -109,7 +109,7 @@ static int receive_status(int in, struct ref *refs)
struct ref *hint;
int ret = 0;
char *line = packet_read_line(in, NULL);
-   if (prefixcmp(line, unpack ))
+   if (!has_prefix(line, unpack ))
return error(did not receive remote status);
if (strcmp(line, unpack ok)) {
error(unpack failed: %s, line + 7);
@@ -122,7 +122,7 @@ static int receive_status(int in, struct ref *refs)
line = packet_read_line(in, NULL);
if (!line)
break;
-   if (prefixcmp(line, ok )  prefixcmp(line, ng )) {
+   if (!has_prefix(line, ok )  !has_prefix(line, ng )) {
error(invalid ref status from remote: %s, line);
ret = -1;
break;
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 00/86] replace prefixcmp() with has_prefix()

2013-11-08 Thread Christian Couder
Here is a big patch series to replace prefixcmp() with a new
has_prefix() function.

So the first patch of this series introduces has_prefix()
and the last patch removes prefixcmp().

Except in a few cases, I used a script that does basically
the following to generate the commits in between:

===
#!/bin/bash

perl -pi -e 's/!prefixcmp\(/has_prefix\(/g' $1
perl -pi -e 's/prefixcmp\(/!has_prefix\(/g' $1

git commit -m $1: replace prefixcmd() with has_prefix() $1
===

The few special cases are the following ones:

- remote*: replace prefixcmd() with has_prefix()
- transport*: replace prefixcmd() with has_prefix()
- environment: replace prefixcmd() with has_prefix()

In first 2 cases above, I processed a few files at the same
time instead of just one.

In the case of environment, I removed  != 0 after
!has_prefix(...) as it is not necessary and makes it
more difficult to understand the logic.

Of course it's possible to squash many of the commits
together if it is prefered.

Christian Couder (86):
  strbuf: add has_prefix() to be used instead of prefixcmp()
  diff: replace prefixcmd() with has_prefix()
  fast-import: replace prefixcmd() with has_prefix()
  remote*: replace prefixcmd() with has_prefix()
  daemon: replace prefixcmd() with has_prefix()
  pretty: replace prefixcmd() with has_prefix()
  revision: replace prefixcmd() with has_prefix()
  transport*: replace prefixcmd() with has_prefix()
  config: replace prefixcmd() with has_prefix()
  sha1_name: replace prefixcmd() with has_prefix()
  wt-status: replace prefixcmd() with has_prefix()
  upload-pack: replace prefixcmd() with has_prefix()
  test-line-buffer: replace prefixcmd() with has_prefix()
  parse-options: replace prefixcmd() with has_prefix()
  fetch-pack: replace prefixcmd() with has_prefix()
  git: replace prefixcmd() with has_prefix()
  tag: replace prefixcmd() with has_prefix()
  sequencer: replace prefixcmd() with has_prefix()
  commit: replace prefixcmd() with has_prefix()
  http: replace prefixcmd() with has_prefix()
  imap-send: replace prefixcmd() with has_prefix()
  help: replace prefixcmd() with has_prefix()
  log-tree: replace prefixcmd() with has_prefix()
  merge-recursive: replace prefixcmd() with has_prefix()
  notes: replace prefixcmd() with has_prefix()
  refs: replace prefixcmd() with has_prefix()
  setup: replace prefixcmd() with has_prefix()
  bisect: replace prefixcmd() with has_prefix()
  branch: replace prefixcmd() with has_prefix()
  http-push: replace prefixcmd() with has_prefix()
  send-pack: replace prefixcmd() with has_prefix()
  http-backend: replace prefixcmd() with has_prefix()
  notes-utils: replace prefixcmd() with has_prefix()
  pkt-line: replace prefixcmd() with has_prefix()
  alias: replace prefixcmd() with has_prefix()
  attr: replace prefixcmd() with has_prefix()
  connect: replace prefixcmd() with has_prefix()
  pager: replace prefixcmd() with has_prefix()
  convert: replace prefixcmd() with has_prefix()
  environment: replace prefixcmd() with has_prefix()
  shell: replace prefixcmd() with has_prefix()
  pathspec: replace prefixcmd() with has_prefix()
  submodule: replace prefixcmd() with has_prefix()
  test-string-list: replace prefixcmd() with has_prefix()
  builtin/apply: replace prefixcmd() with has_prefix()
  builtin/archive: replace prefixcmd() with has_prefix()
  builtin/branch: replace prefixcmd() with has_prefix()
  builtin/checkout: replace prefixcmd() with has_prefix()
  builtin/clean: replace prefixcmd() with has_prefix()
  builtin/clone: replace prefixcmd() with has_prefix()
  builtin/column: replace prefixcmd() with has_prefix()
  builtin/commit: replace prefixcmd() with has_prefix()
  builtin/describe: replace prefixcmd() with has_prefix()
  builtin/fast-export: replace prefixcmd() with has_prefix()
  builtin/fetch-pack: replace prefixcmd() with has_prefix()
  builtin/fetch: replace prefixcmd() with has_prefix()
  builtin/fmt-merge-msg: replace prefixcmd() with has_prefix()
  builtin/for-each-ref: replace prefixcmd() with has_prefix()
  builtin/fsck: replace prefixcmd() with has_prefix()
  builtin/help: replace prefixcmd() with has_prefix()
  builtin/index-pack: replace prefixcmd() with has_prefix()
  builtin/init-db: replace prefixcmd() with has_prefix()
  builtin/log: replace prefixcmd() with has_prefix()
  builtin/ls-remote: replace prefixcmd() with has_prefix()
  builtin/mailinfo: replace prefixcmd() with has_prefix()
  builtin/merge-recursive: replace prefixcmd() with has_prefix()
  builtin/merge: replace prefixcmd() with has_prefix()
  builtin/name-rev: replace prefixcmd() with has_prefix()
  builtin/notes: replace prefixcmd() with has_prefix()
  builtin/pack-objects: replace prefixcmd() with has_prefix()
  builtin/prune: replace prefixcmd() with has_prefix()
  builtin/receive-pack: replace prefixcmd() with has_prefix()
  builtin/reflog: replace prefixcmd() with has_prefix()
  builtin/remote: replace prefixcmd() with has_prefix()
  builtin/rev-parse: replace 

[PATCH 34/86] pkt-line: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 pkt-line.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkt-line.c b/pkt-line.c
index 70f1950..d967727 100644
--- a/pkt-line.c
+++ b/pkt-line.c
@@ -24,8 +24,8 @@ static void packet_trace(const char *buf, unsigned int len, 
int write)
strbuf_addf(out, packet: %12s%c ,
packet_trace_prefix, write ? '' : '');
 
-   if ((len = 4  !prefixcmp(buf, PACK)) ||
-   (len = 5  !prefixcmp(buf+1, PACK))) {
+   if ((len = 4  has_prefix(buf, PACK)) ||
+   (len = 5  has_prefix(buf+1, PACK))) {
strbuf_addstr(out, PACK ...);
unsetenv(trace_key);
}
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 26/86] refs: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 refs.c | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/refs.c b/refs.c
index 3710748..3dc38df 100644
--- a/refs.c
+++ b/refs.c
@@ -637,7 +637,7 @@ static int do_one_ref(struct ref_entry *entry, void 
*cb_data)
struct ref_entry *old_current_ref;
int retval;
 
-   if (prefixcmp(entry-name, data-base))
+   if (!has_prefix(entry-name, data-base))
return 0;
 
if (!(data-flags  DO_FOR_EACH_INCLUDE_BROKEN) 
@@ -1049,7 +1049,7 @@ static void read_packed_refs(FILE *f, struct ref_dir *dir)
if (refname) {
last = create_ref_entry(refname, sha1, REF_ISPACKED, 1);
if (peeled == PEELED_FULLY ||
-   (peeled == PEELED_TAGS  !prefixcmp(refname, 
refs/tags/)))
+   (peeled == PEELED_TAGS  has_prefix(refname, 
refs/tags/)))
last-flag |= REF_KNOWS_PEELED;
add_ref(dir, last);
continue;
@@ -1383,7 +1383,7 @@ const char *resolve_ref_unsafe(const char *refname, 
unsigned char *sha1, int rea
return NULL;
}
buffer[len] = 0;
-   if (!prefixcmp(buffer, refs/) 
+   if (has_prefix(buffer, refs/) 
!check_refname_format(buffer, 0)) {
strcpy(refname_buffer, buffer);
refname = refname_buffer;
@@ -1422,7 +1422,7 @@ const char *resolve_ref_unsafe(const char *refname, 
unsigned char *sha1, int rea
/*
 * Is it a symbolic ref?
 */
-   if (prefixcmp(buffer, ref:)) {
+   if (!has_prefix(buffer, ref:)) {
/*
 * Please note that FETCH_HEAD has a second
 * line containing other data.
@@ -1844,7 +1844,7 @@ int for_each_glob_ref_in(each_ref_fn fn, const char 
*pattern,
struct ref_filter filter;
int ret;
 
-   if (!prefix  prefixcmp(pattern, refs/))
+   if (!prefix  !has_prefix(pattern, refs/))
strbuf_addstr(real_pattern, refs/);
else if (prefix)
strbuf_addstr(real_pattern, prefix);
@@ -1881,9 +1881,9 @@ int for_each_rawref(each_ref_fn fn, void *cb_data)
 const char *prettify_refname(const char *name)
 {
return name + (
-   !prefixcmp(name, refs/heads/) ? 11 :
-   !prefixcmp(name, refs/tags/) ? 10 :
-   !prefixcmp(name, refs/remotes/) ? 13 :
+   has_prefix(name, refs/heads/) ? 11 :
+   has_prefix(name, refs/tags/) ? 10 :
+   has_prefix(name, refs/remotes/) ? 13 :
0);
 }
 
@@ -2251,7 +2251,7 @@ static int pack_if_possible_fn(struct ref_entry *entry, 
void *cb_data)
struct pack_refs_cb_data *cb = cb_data;
enum peel_status peel_status;
struct ref_entry *packed_entry;
-   int is_tag_ref = !prefixcmp(entry-name, refs/tags/);
+   int is_tag_ref = has_prefix(entry-name, refs/tags/);
 
/* ALWAYS pack tags */
if (!(cb-flags  PACK_REFS_ALL)  !is_tag_ref)
@@ -2686,9 +2686,9 @@ int log_ref_setup(const char *refname, char *logfile, int 
bufsize)
 
git_snpath(logfile, bufsize, logs/%s, refname);
if (log_all_ref_updates 
-   (!prefixcmp(refname, refs/heads/) ||
-!prefixcmp(refname, refs/remotes/) ||
-!prefixcmp(refname, refs/notes/) ||
+   (has_prefix(refname, refs/heads/) ||
+has_prefix(refname, refs/remotes/) ||
+has_prefix(refname, refs/notes/) ||
 !strcmp(refname, HEAD))) {
if (safe_create_leading_directories(logfile)  0)
return error(unable to create directory for %s,
@@ -2758,7 +2758,7 @@ static int log_ref_write(const char *refname, const 
unsigned char *old_sha1,
 
 static int is_branch(const char *refname)
 {
-   return !strcmp(refname, HEAD) || !prefixcmp(refname, refs/heads/);
+   return !strcmp(refname, HEAD) || has_prefix(refname, refs/heads/);
 }
 
 int write_ref_sha1(struct ref_lock *lock,
@@ -3457,7 +3457,7 @@ int parse_hide_refs_config(const char *var, const char 
*value, const char *secti
 {
if (!strcmp(transfer.hiderefs, var) ||
/* NEEDSWORK: use parse_config_key() once both are merged */
-   (!prefixcmp(var, section)  var[strlen(section)] == '.' 
+   (has_prefix(var, section)  var[strlen(section)] == '.' 
 !strcmp(var + strlen(section), .hiderefs))) {
char *ref;
int len;
@@ -3485,7 +3485,7 @@ int ref_is_hidden(const char *refname)
return 0;
for_each_string_list_item(item, hide_refs) {
  

[PATCH 49/86] builtin/clean: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/clean.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin/clean.c b/builtin/clean.c
index 615cd57..98887cd 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -100,7 +100,7 @@ static int parse_clean_color_slot(const char *var)
 
 static int git_clean_config(const char *var, const char *value, void *cb)
 {
-   if (!prefixcmp(var, column.))
+   if (has_prefix(var, column.))
return git_column_config(var, value, clean, colopts);
 
/* honors the color.interactive* config variables which also
@@ -109,7 +109,7 @@ static int git_clean_config(const char *var, const char 
*value, void *cb)
clean_use_color = git_config_colorbool(var, value);
return 0;
}
-   if (!prefixcmp(var, color.interactive.)) {
+   if (has_prefix(var, color.interactive.)) {
int slot = parse_clean_color_slot(var +
  strlen(color.interactive.));
if (slot  0)
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 25/86] notes: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 notes.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/notes.c b/notes.c
index b69c0b8..e23d38a 100644
--- a/notes.c
+++ b/notes.c
@@ -1243,9 +1243,9 @@ static void format_note(struct notes_tree *t, const 
unsigned char *object_sha1,
if (!ref || !strcmp(ref, GIT_NOTES_DEFAULT_REF)) {
strbuf_addstr(sb, \nNotes:\n);
} else {
-   if (!prefixcmp(ref, refs/))
+   if (has_prefix(ref, refs/))
ref += 5;
-   if (!prefixcmp(ref, notes/))
+   if (has_prefix(ref, notes/))
ref += 6;
strbuf_addf(sb, \nNotes (%s):\n, ref);
}
@@ -1293,9 +1293,9 @@ int copy_note(struct notes_tree *t,
 
 void expand_notes_ref(struct strbuf *sb)
 {
-   if (!prefixcmp(sb-buf, refs/notes/))
+   if (has_prefix(sb-buf, refs/notes/))
return; /* we're happy */
-   else if (!prefixcmp(sb-buf, notes/))
+   else if (has_prefix(sb-buf, notes/))
strbuf_insert(sb, 0, refs/, 5);
else
strbuf_insert(sb, 0, refs/notes/, 11);
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 04/86] remote*: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 remote-curl.c| 14 +++---
 remote-testsvn.c | 10 +-
 remote.c | 46 +++---
 3 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/remote-curl.c b/remote-curl.c
index b5ebe01..437b863 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -212,7 +212,7 @@ static struct discovery* discover_refs(const char *service, 
int for_push)
free_discovery(last);
 
strbuf_addf(buffer, %sinfo/refs, url);
-   if ((!prefixcmp(url, http://;) || !prefixcmp(url, https://;)) 
+   if ((has_prefix(url, http://;) || has_prefix(url, https://;)) 
 git_env_bool(GIT_SMART_HTTP, 1)) {
maybe_smart = 1;
if (!strchr(url, '?'))
@@ -740,7 +740,7 @@ static void parse_fetch(struct strbuf *buf)
int alloc_heads = 0, nr_heads = 0;
 
do {
-   if (!prefixcmp(buf-buf, fetch )) {
+   if (has_prefix(buf-buf, fetch )) {
char *p = buf-buf + strlen(fetch );
char *name;
struct ref *ref;
@@ -863,7 +863,7 @@ static void parse_push(struct strbuf *buf)
int alloc_spec = 0, nr_spec = 0, i, ret;
 
do {
-   if (!prefixcmp(buf-buf, push )) {
+   if (has_prefix(buf-buf, push )) {
ALLOC_GROW(specs, nr_spec + 1, alloc_spec);
specs[nr_spec++] = xstrdup(buf-buf + 5);
}
@@ -928,19 +928,19 @@ int main(int argc, const char **argv)
}
if (buf.len == 0)
break;
-   if (!prefixcmp(buf.buf, fetch )) {
+   if (has_prefix(buf.buf, fetch )) {
if (nongit)
die(Fetch attempted without a local repo);
parse_fetch(buf);
 
-   } else if (!strcmp(buf.buf, list) || !prefixcmp(buf.buf, 
list )) {
+   } else if (!strcmp(buf.buf, list) || has_prefix(buf.buf, 
list )) {
int for_push = !!strstr(buf.buf + 4, for-push);
output_refs(get_refs(for_push));
 
-   } else if (!prefixcmp(buf.buf, push )) {
+   } else if (has_prefix(buf.buf, push )) {
parse_push(buf);
 
-   } else if (!prefixcmp(buf.buf, option )) {
+   } else if (has_prefix(buf.buf, option )) {
char *name = buf.buf + strlen(option );
char *value = strchr(name, ' ');
int result;
diff --git a/remote-testsvn.c b/remote-testsvn.c
index d7cd5d2..7a5d4c8 100644
--- a/remote-testsvn.c
+++ b/remote-testsvn.c
@@ -82,7 +82,7 @@ static int parse_rev_note(const char *msg, struct rev_note 
*res)
len = end ? end - msg : strlen(msg);
 
key = Revision-number: ;
-   if (!prefixcmp(msg, key)) {
+   if (has_prefix(msg, key)) {
long i;
char *end;
value = msg + strlen(key);
@@ -154,7 +154,7 @@ static void check_or_regenerate_marks(int latestrev)
} else {
strbuf_addf(sb, :%d , latestrev);
while (strbuf_getline(line, marksfile, '\n') != EOF) {
-   if (!prefixcmp(line.buf, sb.buf)) {
+   if (has_prefix(line.buf, sb.buf)) {
found++;
break;
}
@@ -264,7 +264,7 @@ static int do_command(struct strbuf *line)
return 1;   /* end of command stream, quit */
}
if (batch_cmd) {
-   if (prefixcmp(batch_cmd-name, line-buf))
+   if (!has_prefix(batch_cmd-name, line-buf))
die(Active %s batch interrupted by %s, 
batch_cmd-name, line-buf);
/* buffer batch lines */
string_list_append(batchlines, line-buf);
@@ -272,7 +272,7 @@ static int do_command(struct strbuf *line)
}
 
for (p = input_command_list; p-name; p++) {
-   if (!prefixcmp(line-buf, p-name)  (strlen(p-name) == 
line-len ||
+   if (has_prefix(line-buf, p-name)  (strlen(p-name) == 
line-len ||
line-buf[strlen(p-name)] == ' ')) {
if (p-batchable) {
batch_cmd = p;
@@ -304,7 +304,7 @@ int main(int argc, char **argv)
remote = remote_get(argv[1]);
url_in = (argc == 3) ? argv[2] : remote-url[0];
 
-   if (!prefixcmp(url_in, file://)) {
+   if (has_prefix(url_in, file://)) {
dump_from_file = 1;
url = url_decode(url_in + sizeof(file://)-1);
} else {
diff --git a/remote.c b/remote.c
index e9fedfa..84c0d9f 100644
--- a/remote.c
+++ b/remote.c
@@ -76,7 +76,7 

[PATCH 35/86] alias: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 alias.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/alias.c b/alias.c
index eb9f08b..0933c87 100644
--- a/alias.c
+++ b/alias.c
@@ -5,7 +5,7 @@ static char *alias_val;
 
 static int alias_lookup_cb(const char *k, const char *v, void *cb)
 {
-   if (!prefixcmp(k, alias.)  !strcmp(k+6, alias_key)) {
+   if (has_prefix(k, alias.)  !strcmp(k+6, alias_key)) {
if (!v)
return config_error_nonbool(k);
alias_val = xstrdup(v);
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 12/86] upload-pack: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 upload-pack.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/upload-pack.c b/upload-pack.c
index a6c54e0..ce4ae75 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -394,7 +394,7 @@ static int get_common_commits(void)
got_other = 0;
continue;
}
-   if (!prefixcmp(line, have )) {
+   if (has_prefix(line, have )) {
switch (got_sha1(line+5, sha1)) {
case -1: /* they have what we do not */
got_other = 1;
@@ -540,7 +540,7 @@ static void receive_needs(void)
if (!line)
break;
 
-   if (!prefixcmp(line, shallow )) {
+   if (has_prefix(line, shallow )) {
unsigned char sha1[20];
struct object *object;
if (get_sha1_hex(line + 8, sha1))
@@ -556,14 +556,14 @@ static void receive_needs(void)
}
continue;
}
-   if (!prefixcmp(line, deepen )) {
+   if (has_prefix(line, deepen )) {
char *end;
depth = strtol(line + 7, end, 0);
if (end == line + 7 || depth = 0)
die(Invalid deepen: %s, line);
continue;
}
-   if (prefixcmp(line, want ) ||
+   if (!has_prefix(line, want ) ||
get_sha1_hex(line+5, sha1_buf))
die(git upload-pack: protocol error, 
expected to get sha, not '%s', line);
@@ -777,7 +777,7 @@ int main(int argc, char **argv)
strict = 1;
continue;
}
-   if (!prefixcmp(arg, --timeout=)) {
+   if (has_prefix(arg, --timeout=)) {
timeout = atoi(arg+10);
daemon_mode = 1;
continue;
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 07/86] revision: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 revision.c | 38 +++---
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/revision.c b/revision.c
index 0173e01..968320a 100644
--- a/revision.c
+++ b/revision.c
@@ -1576,9 +1576,9 @@ static int handle_revision_opt(struct rev_info *revs, int 
argc, const char **arg
!strcmp(arg, --tags) || !strcmp(arg, --remotes) ||
!strcmp(arg, --reflog) || !strcmp(arg, --not) ||
!strcmp(arg, --no-walk) || !strcmp(arg, --do-walk) ||
-   !strcmp(arg, --bisect) || !prefixcmp(arg, --glob=) ||
-   !prefixcmp(arg, --branches=) || !prefixcmp(arg, --tags=) ||
-   !prefixcmp(arg, --remotes=) || !prefixcmp(arg, --no-walk=))
+   !strcmp(arg, --bisect) || has_prefix(arg, --glob=) ||
+   has_prefix(arg, --branches=) || has_prefix(arg, --tags=) ||
+   has_prefix(arg, --remotes=) || has_prefix(arg, --no-walk=))
{
unkv[(*unkc)++] = arg;
return 1;
@@ -1601,7 +1601,7 @@ static int handle_revision_opt(struct rev_info *revs, int 
argc, const char **arg
revs-max_count = atoi(argv[1]);
revs-no_walk = 0;
return 2;
-   } else if (!prefixcmp(arg, -n)) {
+   } else if (has_prefix(arg, -n)) {
revs-max_count = atoi(arg + 2);
revs-no_walk = 0;
} else if ((argcount = parse_long_opt(max-age, argv, optarg))) {
@@ -1661,7 +1661,7 @@ static int handle_revision_opt(struct rev_info *revs, int 
argc, const char **arg
} else if (!strcmp(arg, --author-date-order)) {
revs-sort_order = REV_SORT_BY_AUTHOR_DATE;
revs-topo_order = 1;
-   } else if (!prefixcmp(arg, --early-output)) {
+   } else if (has_prefix(arg, --early-output)) {
int count = 100;
switch (arg[14]) {
case '=':
@@ -1686,13 +1686,13 @@ static int handle_revision_opt(struct rev_info *revs, 
int argc, const char **arg
revs-min_parents = 2;
} else if (!strcmp(arg, --no-merges)) {
revs-max_parents = 1;
-   } else if (!prefixcmp(arg, --min-parents=)) {
+   } else if (has_prefix(arg, --min-parents=)) {
revs-min_parents = atoi(arg+14);
-   } else if (!prefixcmp(arg, --no-min-parents)) {
+   } else if (has_prefix(arg, --no-min-parents)) {
revs-min_parents = 0;
-   } else if (!prefixcmp(arg, --max-parents=)) {
+   } else if (has_prefix(arg, --max-parents=)) {
revs-max_parents = atoi(arg+14);
-   } else if (!prefixcmp(arg, --no-max-parents)) {
+   } else if (has_prefix(arg, --no-max-parents)) {
revs-max_parents = -1;
} else if (!strcmp(arg, --boundary)) {
revs-boundary = 1;
@@ -1742,7 +1742,7 @@ static int handle_revision_opt(struct rev_info *revs, int 
argc, const char **arg
revs-verify_objects = 1;
} else if (!strcmp(arg, --unpacked)) {
revs-unpacked = 1;
-   } else if (!prefixcmp(arg, --unpacked=)) {
+   } else if (has_prefix(arg, --unpacked=)) {
die(--unpacked=packfile no longer supported.);
} else if (!strcmp(arg, -r)) {
revs-diff = 1;
@@ -1767,7 +1767,7 @@ static int handle_revision_opt(struct rev_info *revs, int 
argc, const char **arg
revs-verbose_header = 1;
revs-pretty_given = 1;
get_commit_format(arg+8, revs);
-   } else if (!prefixcmp(arg, --pretty=) || !prefixcmp(arg, 
--format=)) {
+   } else if (has_prefix(arg, --pretty=) || has_prefix(arg, 
--format=)) {
/*
 * Detached form (--pretty X as opposed to --pretty=X)
 * not allowed, since the argument is optional.
@@ -1781,12 +1781,12 @@ static int handle_revision_opt(struct rev_info *revs, 
int argc, const char **arg
revs-notes_opt.use_default_notes = 1;
} else if (!strcmp(arg, --show-signature)) {
revs-show_signature = 1;
-   } else if (!prefixcmp(arg, --show-notes=) ||
-  !prefixcmp(arg, --notes=)) {
+   } else if (has_prefix(arg, --show-notes=) ||
+  has_prefix(arg, --notes=)) {
struct strbuf buf = STRBUF_INIT;
revs-show_notes = 1;
revs-show_notes_given = 1;
-   if (!prefixcmp(arg, --show-notes)) {
+   if (has_prefix(arg, --show-notes)) {
if (revs-notes_opt.use_default_notes  0)
revs-notes_opt.use_default_notes = 1;
strbuf_addstr(buf, arg+13);
@@ -1829,7 +1829,7 @@ static int handle_revision_opt(struct rev_info *revs, int 
argc, const char **arg
revs-abbrev = 0;
} else if (!strcmp(arg, --abbrev)) {
revs-abbrev = 

[PATCH 43/86] submodule: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 submodule.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/submodule.c b/submodule.c
index 1905d75..21fe14e 100644
--- a/submodule.c
+++ b/submodule.c
@@ -201,7 +201,7 @@ void set_diffopt_flags_from_submodule_config(struct 
diff_options *diffopt,
 
 int submodule_config(const char *var, const char *value, void *cb)
 {
-   if (!prefixcmp(var, submodule.))
+   if (has_prefix(var, submodule.))
return parse_submodule_config_option(var, value);
else if (!strcmp(var, fetch.recursesubmodules)) {
config_fetch_recurse_submodules = 
parse_fetch_recurse_submodules_arg(var, value);
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 47/86] builtin/branch: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/branch.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index ad0f86d..c4cb81c 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -81,13 +81,13 @@ static int parse_branch_color_slot(const char *var, int ofs)
 
 static int git_branch_config(const char *var, const char *value, void *cb)
 {
-   if (!prefixcmp(var, column.))
+   if (has_prefix(var, column.))
return git_column_config(var, value, branch, colopts);
if (!strcmp(var, color.branch)) {
branch_use_color = git_config_colorbool(var, value);
return 0;
}
-   if (!prefixcmp(var, color.branch.)) {
+   if (has_prefix(var, color.branch.)) {
int slot = parse_branch_color_slot(var, 13);
if (slot  0)
return 0;
@@ -862,7 +862,7 @@ int cmd_branch(int argc, const char **argv, const char 
*prefix)
if (!strcmp(head, HEAD)) {
detached = 1;
} else {
-   if (prefixcmp(head, refs/heads/))
+   if (!has_prefix(head, refs/heads/))
die(_(HEAD not found below refs/heads!));
head += 11;
}
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 44/86] test-string-list: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 test-string-list.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test-string-list.c b/test-string-list.c
index 00ce6c9..e04a37c 100644
--- a/test-string-list.c
+++ b/test-string-list.c
@@ -38,7 +38,7 @@ static void write_list_compact(const struct string_list *list)
 static int prefix_cb(struct string_list_item *item, void *cb_data)
 {
const char *prefix = (const char *)cb_data;
-   return !prefixcmp(item-string, prefix);
+   return has_prefix(item-string, prefix);
 }
 
 int main(int argc, char **argv)
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 51/86] builtin/column: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/column.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/column.c b/builtin/column.c
index e125a55..3664cc1 100644
--- a/builtin/column.c
+++ b/builtin/column.c
@@ -34,7 +34,7 @@ int cmd_column(int argc, const char **argv, const char 
*prefix)
};
 
/* This one is special and must be the first one */
-   if (argc  1  !prefixcmp(argv[1], --command=)) {
+   if (argc  1  has_prefix(argv[1], --command=)) {
command = argv[1] + 10;
git_config(column_config, (void *)command);
} else
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 50/86] builtin/clone: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/clone.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/builtin/clone.c b/builtin/clone.c
index 84fb1bd..49b7a08 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -508,7 +508,7 @@ static void write_followtags(const struct ref *refs, const 
char *msg)
 {
const struct ref *ref;
for (ref = refs; ref; ref = ref-next) {
-   if (prefixcmp(ref-name, refs/tags/))
+   if (!has_prefix(ref-name, refs/tags/))
continue;
if (has_suffix(ref-name, ^{}))
continue;
@@ -578,7 +578,7 @@ static void update_remote_refs(const struct ref *refs,
 static void update_head(const struct ref *our, const struct ref *remote,
const char *msg)
 {
-   if (our  !prefixcmp(our-name, refs/heads/)) {
+   if (our  has_prefix(our-name, refs/heads/)) {
/* Local default branch link */
create_symref(HEAD, our-name, NULL);
if (!option_bare) {
@@ -625,7 +625,7 @@ static int checkout(void)
if (advice_detached_head)
detach_advice(sha1_to_hex(sha1));
} else {
-   if (prefixcmp(head, refs/heads/))
+   if (!has_prefix(head, refs/heads/))
die(_(HEAD not found below refs/heads!));
}
free(head);
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 33/86] notes-utils: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 notes-utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/notes-utils.c b/notes-utils.c
index 9107c37..0a4c3de 100644
--- a/notes-utils.c
+++ b/notes-utils.c
@@ -70,7 +70,7 @@ static combine_notes_fn parse_combine_notes_fn(const char *v)
 static int notes_rewrite_config(const char *k, const char *v, void *cb)
 {
struct notes_rewrite_cfg *c = cb;
-   if (!prefixcmp(k, notes.rewrite.)  !strcmp(k+14, c-cmd)) {
+   if (has_prefix(k, notes.rewrite.)  !strcmp(k+14, c-cmd)) {
c-enabled = git_config_bool(k, v);
return 0;
} else if (!c-mode_from_env  !strcmp(k, notes.rewritemode)) {
@@ -85,7 +85,7 @@ static int notes_rewrite_config(const char *k, const char *v, 
void *cb)
} else if (!c-refs_from_env  !strcmp(k, notes.rewriteref)) {
/* note that a refs/ prefix is implied in the
 * underlying for_each_glob_ref */
-   if (!prefixcmp(v, refs/notes/))
+   if (has_prefix(v, refs/notes/))
string_list_add_refs_by_glob(c-refs, v);
else
warning(_(Refusing to rewrite notes in %s
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 32/86] http-backend: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 http-backend.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/http-backend.c b/http-backend.c
index 8c464bd..d0183b1 100644
--- a/http-backend.c
+++ b/http-backend.c
@@ -226,7 +226,7 @@ static int http_config(const char *var, const char *value, 
void *cb)
return 0;
}
 
-   if (!prefixcmp(var, http.)) {
+   if (has_prefix(var, http.)) {
int i;
 
for (i = 0; i  ARRAY_SIZE(rpc_service); i++) {
@@ -247,7 +247,7 @@ static struct rpc_service *select_service(const char *name)
struct rpc_service *svc = NULL;
int i;
 
-   if (prefixcmp(name, git-))
+   if (!has_prefix(name, git-))
forbidden(Unsupported service: '%s', name);
 
for (i = 0; i  ARRAY_SIZE(rpc_service); i++) {
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 55/86] builtin/fetch-pack: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/fetch-pack.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index c8e8582..29a3b33 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -48,11 +48,11 @@ int cmd_fetch_pack(int argc, const char **argv, const char 
*prefix)
for (i = 1; i  argc  *argv[i] == '-'; i++) {
const char *arg = argv[i];
 
-   if (!prefixcmp(arg, --upload-pack=)) {
+   if (has_prefix(arg, --upload-pack=)) {
args.uploadpack = arg + 14;
continue;
}
-   if (!prefixcmp(arg, --exec=)) {
+   if (has_prefix(arg, --exec=)) {
args.uploadpack = arg + 7;
continue;
}
@@ -85,7 +85,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char 
*prefix)
args.verbose = 1;
continue;
}
-   if (!prefixcmp(arg, --depth=)) {
+   if (has_prefix(arg, --depth=)) {
args.depth = strtol(arg + 8, NULL, 0);
continue;
}
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 19/86] commit: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 commit.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/commit.c b/commit.c
index de16a3c..35b276d 100644
--- a/commit.c
+++ b/commit.c
@@ -559,7 +559,7 @@ static void record_author_date(struct author_date_slab 
*author_date,
 buf;
 buf = line_end + 1) {
line_end = strchrnul(buf, '\n');
-   if (prefixcmp(buf, author )) {
+   if (!has_prefix(buf, author )) {
if (!line_end[0] || line_end[1] == '\n')
return; /* end of header */
continue;
@@ -1106,7 +1106,7 @@ int parse_signed_commit(const unsigned char *sha1,
next = next ? next + 1 : tail;
if (in_signature  line[0] == ' ')
sig = line + 1;
-   else if (!prefixcmp(line, gpg_sig_header) 
+   else if (has_prefix(line, gpg_sig_header) 
 line[gpg_sig_header_len] == ' ')
sig = line + gpg_sig_header_len + 1;
if (sig) {
@@ -1186,7 +1186,7 @@ static void parse_gpg_output(struct signature_check *sigc)
for (i = 0; i  ARRAY_SIZE(sigcheck_gpg_status); i++) {
const char *found, *next;
 
-   if (!prefixcmp(buf, sigcheck_gpg_status[i].check + 1)) {
+   if (has_prefix(buf, sigcheck_gpg_status[i].check + 1)) {
/* At the very beginning of the buffer */
found = buf + strlen(sigcheck_gpg_status[i].check + 1);
} else {
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 52/86] builtin/commit: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/commit.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index 6ab4605..a8c46c6 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -733,7 +733,7 @@ static int prepare_to_commit(const char *index_file, const 
char *prefix,
eol = nl - sb.buf;
else
eol = sb.len;
-   if (!prefixcmp(sb.buf + previous, \nConflicts:\n)) {
+   if (has_prefix(sb.buf + previous, \nConflicts:\n)) {
ignore_footer = sb.len - previous;
break;
}
@@ -904,7 +904,7 @@ static int rest_is_empty(struct strbuf *sb, int start)
eol = sb-len;
 
if (strlen(sign_off_header) = eol - i 
-   !prefixcmp(sb-buf + i, sign_off_header)) {
+   has_prefix(sb-buf + i, sign_off_header)) {
i = eol;
continue;
}
@@ -1183,7 +1183,7 @@ static int git_status_config(const char *k, const char 
*v, void *cb)
 {
struct wt_status *s = cb;
 
-   if (!prefixcmp(k, column.))
+   if (has_prefix(k, column.))
return git_column_config(k, v, status, s-colopts);
if (!strcmp(k, status.submodulesummary)) {
int is_bool;
@@ -1211,7 +1211,7 @@ static int git_status_config(const char *k, const char 
*v, void *cb)
s-display_comment_prefix = git_config_bool(k, v);
return 0;
}
-   if (!prefixcmp(k, status.color.) || !prefixcmp(k, color.status.)) {
+   if (has_prefix(k, status.color.) || has_prefix(k, color.status.)) {
int slot = parse_status_slot(k, 13);
if (slot  0)
return 0;
@@ -1377,7 +1377,7 @@ static void print_summary(const char *prefix, const 
unsigned char *sha1,
 
head = resolve_ref_unsafe(HEAD, junk_sha1, 0, NULL);
printf([%s%s ,
-   !prefixcmp(head, refs/heads/) ?
+   has_prefix(head, refs/heads/) ?
head + 11 :
!strcmp(head, HEAD) ?
_(detached HEAD) :
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 02/86] diff: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 diff.c | 56 
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/diff.c b/diff.c
index a04a34d..b42523a 100644
--- a/diff.c
+++ b/diff.c
@@ -235,7 +235,7 @@ int git_diff_basic_config(const char *var, const char 
*value, void *cb)
if (userdiff_config(var, value)  0)
return -1;
 
-   if (!prefixcmp(var, diff.color.) || !prefixcmp(var, color.diff.)) {
+   if (has_prefix(var, diff.color.) || has_prefix(var, color.diff.)) {
int slot = parse_diff_color_slot(var, 11);
if (slot  0)
return 0;
@@ -264,7 +264,7 @@ int git_diff_basic_config(const char *var, const char 
*value, void *cb)
return 0;
}
 
-   if (!prefixcmp(var, submodule.))
+   if (has_prefix(var, submodule.))
return parse_submodule_config_option(var, value);
 
return git_default_config(var, value, cb);
@@ -1215,7 +1215,7 @@ static void fn_out_consume(void *priv, char *line, 
unsigned long len)
diff_words_append(line, len,
  ecbdata-diff_words-plus);
return;
-   } else if (!prefixcmp(line, \\ )) {
+   } else if (has_prefix(line, \\ )) {
/*
 * Eat the no newline at eof marker as if we
 * saw a + or - line with nothing on it,
@@ -2387,9 +2387,9 @@ static void builtin_diff(const char *name_a,
xdiff_set_find_func(xecfg, pe-pattern, pe-cflags);
if (!diffopts)
;
-   else if (!prefixcmp(diffopts, --unified=))
+   else if (has_prefix(diffopts, --unified=))
xecfg.ctxlen = strtoul(diffopts + 10, NULL, 10);
-   else if (!prefixcmp(diffopts, -u))
+   else if (has_prefix(diffopts, -u))
xecfg.ctxlen = strtoul(diffopts + 2, NULL, 10);
if (o-word_diff)
init_diff_words_data(ecbdata, o, one, two);
@@ -3388,7 +3388,7 @@ int parse_long_opt(const char *opt, const char **argv,
if (arg[0] != '-' || arg[1] != '-')
return 0;
arg += strlen(--);
-   if (prefixcmp(arg, opt))
+   if (!has_prefix(arg, opt))
return 0;
arg += strlen(opt);
if (*arg == '=') { /* sticked form: --option=value */
@@ -3419,7 +3419,7 @@ static int stat_opt(struct diff_options *options, const 
char **av)
 
switch (*arg) {
case '-':
-   if (!prefixcmp(arg, -width)) {
+   if (has_prefix(arg, -width)) {
arg += strlen(-width);
if (*arg == '=')
width = strtoul(arg + 1, end, 10);
@@ -3429,7 +3429,7 @@ static int stat_opt(struct diff_options *options, const 
char **av)
width = strtoul(av[1], end, 10);
argcount = 2;
}
-   } else if (!prefixcmp(arg, -name-width)) {
+   } else if (has_prefix(arg, -name-width)) {
arg += strlen(-name-width);
if (*arg == '=')
name_width = strtoul(arg + 1, end, 10);
@@ -3439,7 +3439,7 @@ static int stat_opt(struct diff_options *options, const 
char **av)
name_width = strtoul(av[1], end, 10);
argcount = 2;
}
-   } else if (!prefixcmp(arg, -graph-width)) {
+   } else if (has_prefix(arg, -graph-width)) {
arg += strlen(-graph-width);
if (*arg == '=')
graph_width = strtoul(arg + 1, end, 10);
@@ -3449,7 +3449,7 @@ static int stat_opt(struct diff_options *options, const 
char **av)
graph_width = strtoul(av[1], end, 10);
argcount = 2;
}
-   } else if (!prefixcmp(arg, -count)) {
+   } else if (has_prefix(arg, -count)) {
arg += strlen(-count);
if (*arg == '=')
count = strtoul(arg + 1, end, 10);
@@ -3611,15 +3611,15 @@ int diff_opt_parse(struct diff_options *options, const 
char **av, int ac)
options-output_format |= DIFF_FORMAT_SHORTSTAT;
else if (!strcmp(arg, -X) || !strcmp(arg, --dirstat))
return parse_dirstat_opt(options, );
-   else if (!prefixcmp(arg, -X))
+   else if (has_prefix(arg, -X))
return parse_dirstat_opt(options, arg + 2);
-   else if (!prefixcmp(arg, --dirstat=))
+   else if (has_prefix(arg, --dirstat=))

[PATCH 40/86] environment: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 environment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/environment.c b/environment.c
index 378254c..827c6e8 100644
--- a/environment.c
+++ b/environment.c
@@ -176,7 +176,7 @@ const char *get_git_namespace(void)
 
 const char *strip_namespace(const char *namespaced_ref)
 {
-   if (prefixcmp(namespaced_ref, get_git_namespace()) != 0)
+   if (!has_prefix(namespaced_ref, get_git_namespace()))
return NULL;
return namespaced_ref + namespace_len;
 }
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 29/86] branch: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 branch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/branch.c b/branch.c
index 9e6c68e..fc3a61d 100644
--- a/branch.c
+++ b/branch.c
@@ -50,7 +50,7 @@ static int should_setup_rebase(const char *origin)
 void install_branch_config(int flag, const char *local, const char *origin, 
const char *remote)
 {
const char *shortname = remote + 11;
-   int remote_is_branch = !prefixcmp(remote, refs/heads/);
+   int remote_is_branch = has_prefix(remote, refs/heads/);
struct strbuf key = STRBUF_INIT;
int rebasing = should_setup_rebase(origin);
 
@@ -272,7 +272,7 @@ void create_branch(const char *head,
break;
case 1:
/* Unique completion -- good, only if it is a real branch */
-   if (prefixcmp(real_ref, refs/heads/) 
+   if (!has_prefix(real_ref, refs/heads/) 
validate_remote_tracking_branch(real_ref)) {
if (explicit_tracking)
die(_(upstream_not_branch), start_name);
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 59/86] builtin/fsck: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/fsck.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/builtin/fsck.c b/builtin/fsck.c
index 97ce678..a80e51f 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -442,7 +442,7 @@ static void fsck_dir(int i, char *path)
add_sha1_list(sha1, DIRENT_SORT_HINT(de));
continue;
}
-   if (!prefixcmp(de-d_name, tmp_obj_))
+   if (has_prefix(de-d_name, tmp_obj_))
continue;
fprintf(stderr, bad sha1 file: %s/%s\n, path, de-d_name);
}
@@ -484,7 +484,7 @@ static int fsck_handle_reflog(const char *logname, const 
unsigned char *sha1, in
 
 static int is_branch(const char *refname)
 {
-   return !strcmp(refname, HEAD) || !prefixcmp(refname, refs/heads/);
+   return !strcmp(refname, HEAD) || has_prefix(refname, refs/heads/);
 }
 
 static int fsck_handle_ref(const char *refname, const unsigned char *sha1, int 
flag, void *cb_data)
@@ -566,7 +566,7 @@ static int fsck_head_link(void)
if (!strcmp(head_points_at, HEAD))
/* detached HEAD */
null_is_error = 1;
-   else if (prefixcmp(head_points_at, refs/heads/))
+   else if (!has_prefix(head_points_at, refs/heads/))
return error(HEAD points to something strange (%s),
 head_points_at);
if (is_null_sha1(head_sha1)) {
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 10/86] sha1_name: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 sha1_name.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/sha1_name.c b/sha1_name.c
index 0e5fe7f..3224a39 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -547,7 +547,7 @@ static int get_sha1_basic(const char *str, int len, 
unsigned char *sha1)
if (read_ref_at(real_ref, at_time, nth, sha1, NULL,
co_time, co_tz, co_cnt)) {
if (!len) {
-   if (!prefixcmp(real_ref, refs/heads/)) {
+   if (has_prefix(real_ref, refs/heads/)) {
str = real_ref + 11;
len = strlen(real_ref + 11);
} else {
@@ -677,15 +677,15 @@ static int peel_onion(const char *name, int len, unsigned 
char *sha1)
return -1;
 
sp++; /* beginning of type name, or closing brace for empty */
-   if (!prefixcmp(sp, commit}))
+   if (has_prefix(sp, commit}))
expected_type = OBJ_COMMIT;
-   else if (!prefixcmp(sp, tag}))
+   else if (has_prefix(sp, tag}))
expected_type = OBJ_TAG;
-   else if (!prefixcmp(sp, tree}))
+   else if (has_prefix(sp, tree}))
expected_type = OBJ_TREE;
-   else if (!prefixcmp(sp, blob}))
+   else if (has_prefix(sp, blob}))
expected_type = OBJ_BLOB;
-   else if (!prefixcmp(sp, object}))
+   else if (has_prefix(sp, object}))
expected_type = OBJ_ANY;
else if (sp[0] == '}')
expected_type = OBJ_NONE;
@@ -912,7 +912,7 @@ static int grab_nth_branch_switch(unsigned char *osha1, 
unsigned char *nsha1,
const char *match = NULL, *target = NULL;
size_t len;
 
-   if (!prefixcmp(message, checkout: moving from )) {
+   if (has_prefix(message, checkout: moving from )) {
match = message + strlen(checkout: moving from );
target = strstr(match,  to );
}
@@ -1305,7 +1305,7 @@ static void diagnose_invalid_index_path(int stage,
 
 static char *resolve_relative_path(const char *rel)
 {
-   if (prefixcmp(rel, ./)  prefixcmp(rel, ../))
+   if (!has_prefix(rel, ./)  !has_prefix(rel, ../))
return NULL;
 
if (!startup_info)
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 11/86] wt-status: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 wt-status.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/wt-status.c b/wt-status.c
index b4e44ba..47806d1 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -803,7 +803,7 @@ static void wt_status_print_tracking(struct wt_status *s)
int i;
 
assert(s-branch  !s-is_initial);
-   if (prefixcmp(s-branch, refs/heads/))
+   if (!has_prefix(s-branch, refs/heads/))
return;
branch = branch_get(s-branch + 11);
if (!format_tracking_info(branch, sb))
@@ -1062,9 +1062,9 @@ static char *read_and_strip_branch(const char *path)
strbuf_setlen(sb, sb.len - 1);
if (!sb.len)
goto got_nothing;
-   if (!prefixcmp(sb.buf, refs/heads/))
+   if (has_prefix(sb.buf, refs/heads/))
strbuf_remove(sb,0, strlen(refs/heads/));
-   else if (!prefixcmp(sb.buf, refs/))
+   else if (has_prefix(sb.buf, refs/))
;
else if (!get_sha1_hex(sb.buf, sha1)) {
const char *abbrev;
@@ -1094,7 +1094,7 @@ static int grab_1st_switch(unsigned char *osha1, unsigned 
char *nsha1,
struct grab_1st_switch_cbdata *cb = cb_data;
const char *target = NULL, *end;
 
-   if (prefixcmp(message, checkout: moving from ))
+   if (!has_prefix(message, checkout: moving from ))
return 0;
message += strlen(checkout: moving from );
target = strstr(message,  to );
@@ -1129,9 +1129,9 @@ static void wt_status_get_detached_from(struct 
wt_status_state *state)
 ((commit = lookup_commit_reference_gently(sha1, 1)) != NULL 
  !hashcmp(cb.nsha1, commit-object.sha1 {
int ofs;
-   if (!prefixcmp(ref, refs/tags/))
+   if (has_prefix(ref, refs/tags/))
ofs = strlen(refs/tags/);
-   else if (!prefixcmp(ref, refs/remotes/))
+   else if (has_prefix(ref, refs/remotes/))
ofs = strlen(refs/remotes/);
else
ofs = 0;
@@ -1220,7 +1220,7 @@ void wt_status_print(struct wt_status *s)
if (s-branch) {
const char *on_what = _(On branch );
const char *branch_name = s-branch;
-   if (!prefixcmp(branch_name, refs/heads/))
+   if (has_prefix(branch_name, refs/heads/))
branch_name += 11;
else if (!strcmp(branch_name, HEAD)) {
branch_status_color = color(WT_STATUS_NOBRANCH, s);
@@ -1421,7 +1421,7 @@ static void wt_shortstatus_print_tracking(struct 
wt_status *s)
return;
branch_name = s-branch;
 
-   if (!prefixcmp(branch_name, refs/heads/))
+   if (has_prefix(branch_name, refs/heads/))
branch_name += 11;
else if (!strcmp(branch_name, HEAD)) {
branch_name = _(HEAD (no branch));
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 28/86] bisect: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 bisect.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bisect.c b/bisect.c
index 1e46a4f..4819091 100644
--- a/bisect.c
+++ b/bisect.c
@@ -406,9 +406,9 @@ static int register_ref(const char *refname, const unsigned 
char *sha1,
if (!strcmp(refname, bad)) {
current_bad_sha1 = xmalloc(20);
hashcpy(current_bad_sha1, sha1);
-   } else if (!prefixcmp(refname, good-)) {
+   } else if (has_prefix(refname, good-)) {
sha1_array_append(good_revs, sha1);
-   } else if (!prefixcmp(refname, skip-)) {
+   } else if (has_prefix(refname, skip-)) {
sha1_array_append(skipped_revs, sha1);
}
 
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 48/86] builtin/checkout: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/checkout.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/builtin/checkout.c b/builtin/checkout.c
index 0f57397..7ce15dd 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -781,7 +781,7 @@ static int switch_branches(const struct checkout_opts *opts,
if (!(flag  REF_ISSYMREF))
old.path = NULL;
 
-   if (old.path  !prefixcmp(old.path, refs/heads/))
+   if (old.path  has_prefix(old.path, refs/heads/))
old.name = old.path + strlen(refs/heads/);
 
if (!new-name) {
@@ -816,7 +816,7 @@ static int git_checkout_config(const char *var, const char 
*value, void *cb)
return 0;
}
 
-   if (!prefixcmp(var, submodule.))
+   if (has_prefix(var, submodule.))
return parse_submodule_config_option(var, value);
 
return git_xmerge_config(var, value, NULL);
@@ -1108,9 +1108,9 @@ int cmd_checkout(int argc, const char **argv, const char 
*prefix)
const char *argv0 = argv[0];
if (!argc || !strcmp(argv0, --))
die (_(--track needs a branch name));
-   if (!prefixcmp(argv0, refs/))
+   if (has_prefix(argv0, refs/))
argv0 += 5;
-   if (!prefixcmp(argv0, remotes/))
+   if (has_prefix(argv0, remotes/))
argv0 += 8;
argv0 = strchr(argv0, '/');
if (!argv0 || !argv0[1])
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 39/86] convert: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 convert.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/convert.c b/convert.c
index 11a95fc..dc5d3ed 100644
--- a/convert.c
+++ b/convert.c
@@ -1121,7 +1121,7 @@ static int is_foreign_ident(const char *str)
 {
int i;
 
-   if (prefixcmp(str, $Id: ))
+   if (!has_prefix(str, $Id: ))
return 0;
for (i = 5; str[i]; i++) {
if (isspace(str[i])  str[i+1] != '$')
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 45/86] builtin/apply: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/apply.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/builtin/apply.c b/builtin/apply.c
index ef32e4f..49028da 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -1409,10 +1409,10 @@ static void recount_diff(const char *line, int size, 
struct fragment *fragment)
case '\\':
continue;
case '@':
-   ret = size  3 || prefixcmp(line, @@ );
+   ret = size  3 || !has_prefix(line, @@ );
break;
case 'd':
-   ret = size  5 || prefixcmp(line, diff );
+   ret = size  5 || !has_prefix(line, diff );
break;
default:
ret = -1;
@@ -1798,11 +1798,11 @@ static struct fragment *parse_binary_hunk(char **buf_p,
 
*status_p = 0;
 
-   if (!prefixcmp(buffer, delta )) {
+   if (has_prefix(buffer, delta )) {
patch_method = BINARY_DELTA_DEFLATED;
origlen = strtoul(buffer + 6, NULL, 10);
}
-   else if (!prefixcmp(buffer, literal )) {
+   else if (has_prefix(buffer, literal )) {
patch_method = BINARY_LITERAL_DEFLATED;
origlen = strtoul(buffer + 8, NULL, 10);
}
@@ -3627,12 +3627,12 @@ static int preimage_sha1_in_gitlink_patch(struct patch 
*p, unsigned char sha1[20
hunk-oldpos == 1  hunk-oldlines == 1 
/* does preimage begin with the heading? */
(preimage = memchr(hunk-patch, '\n', hunk-size)) != NULL 
-   !prefixcmp(++preimage, heading) 
+   has_prefix(++preimage, heading) 
/* does it record full SHA-1? */
!get_sha1_hex(preimage + sizeof(heading) - 1, sha1) 
preimage[sizeof(heading) + 40 - 1] == '\n' 
/* does the abbreviated name on the index line agree with it? */
-   !prefixcmp(preimage + sizeof(heading) - 1, p-old_sha1_prefix))
+   has_prefix(preimage + sizeof(heading) - 1, p-old_sha1_prefix))
return 0; /* it all looks fine */
 
/* we may have full object name on the index line */
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 13/86] test-line-buffer: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 test-line-buffer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test-line-buffer.c b/test-line-buffer.c
index ef1d7ba..ed0d681 100644
--- a/test-line-buffer.c
+++ b/test-line-buffer.c
@@ -19,7 +19,7 @@ static void handle_command(const char *command, const char 
*arg, struct line_buf
 {
switch (*command) {
case 'b':
-   if (!prefixcmp(command, binary )) {
+   if (has_prefix(command, binary )) {
struct strbuf sb = STRBUF_INIT;
strbuf_addch(sb, '');
buffer_read_binary(buf, sb, strtouint32(arg));
@@ -28,12 +28,12 @@ static void handle_command(const char *command, const char 
*arg, struct line_buf
return;
}
case 'c':
-   if (!prefixcmp(command, copy )) {
+   if (has_prefix(command, copy )) {
buffer_copy_bytes(buf, strtouint32(arg));
return;
}
case 's':
-   if (!prefixcmp(command, skip )) {
+   if (has_prefix(command, skip )) {
buffer_skip_bytes(buf, strtouint32(arg));
return;
}
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 58/86] builtin/for-each-ref: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/for-each-ref.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index 1d4083c..c22f200 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -432,7 +432,7 @@ static void grab_person(const char *who, struct atom_value 
*val, int deref, stru
if (name[wholen] != 0 
strcmp(name + wholen, name) 
strcmp(name + wholen, email) 
-   prefixcmp(name + wholen, date))
+   !has_prefix(name + wholen, date))
continue;
if (!wholine)
wholine = find_wholine(who, wholen, buf, sz);
@@ -444,7 +444,7 @@ static void grab_person(const char *who, struct atom_value 
*val, int deref, stru
v-s = copy_name(wholine);
else if (!strcmp(name + wholen, email))
v-s = copy_email(wholine);
-   else if (!prefixcmp(name + wholen, date))
+   else if (has_prefix(name + wholen, date))
grab_date(wholine, v, name);
}
 
@@ -466,7 +466,7 @@ static void grab_person(const char *who, struct atom_value 
*val, int deref, stru
if (deref)
name++;
 
-   if (!prefixcmp(name, creatordate))
+   if (has_prefix(name, creatordate))
grab_date(wholine, v, name);
else if (!strcmp(name, creator))
v-s = copy_line(wholine);
@@ -646,14 +646,14 @@ static void populate_value(struct refinfo *ref)
name++;
}
 
-   if (!prefixcmp(name, refname))
+   if (has_prefix(name, refname))
refname = ref-refname;
-   else if (!prefixcmp(name, symref))
+   else if (has_prefix(name, symref))
refname = ref-symref ? ref-symref : ;
-   else if (!prefixcmp(name, upstream)) {
+   else if (has_prefix(name, upstream)) {
struct branch *branch;
/* only local branches may have an upstream */
-   if (prefixcmp(ref-refname, refs/heads/))
+   if (!has_prefix(ref-refname, refs/heads/))
continue;
branch = branch_get(ref-refname + 11);
 
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 05/86] daemon: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 daemon.c | 40 
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/daemon.c b/daemon.c
index 34916c5..4b23800 100644
--- a/daemon.c
+++ b/daemon.c
@@ -235,7 +235,7 @@ static int service_enabled;
 
 static int git_daemon_config(const char *var, const char *value, void *cb)
 {
-   if (!prefixcmp(var, daemon.) 
+   if (has_prefix(var, daemon.) 
!strcmp(var + 7, service_looking_at-config_name)) {
service_enabled = git_config_bool(var, value);
return 0;
@@ -633,7 +633,7 @@ static int execute(void)
for (i = 0; i  ARRAY_SIZE(daemon_service); i++) {
struct daemon_service *s = (daemon_service[i]);
int namelen = strlen(s-name);
-   if (!prefixcmp(line, git-) 
+   if (has_prefix(line, git-) 
!strncmp(s-name, line + 4, namelen) 
line[namelen + 4] == ' ') {
/*
@@ -1165,11 +1165,11 @@ int main(int argc, char **argv)
for (i = 1; i  argc; i++) {
char *arg = argv[i];
 
-   if (!prefixcmp(arg, --listen=)) {
+   if (has_prefix(arg, --listen=)) {
string_list_append(listen_addr, xstrdup_tolower(arg + 
9));
continue;
}
-   if (!prefixcmp(arg, --port=)) {
+   if (has_prefix(arg, --port=)) {
char *end;
unsigned long n;
n = strtoul(arg+7, end, 0);
@@ -1199,19 +1199,19 @@ int main(int argc, char **argv)
export_all_trees = 1;
continue;
}
-   if (!prefixcmp(arg, --access-hook=)) {
+   if (has_prefix(arg, --access-hook=)) {
access_hook = arg + 14;
continue;
}
-   if (!prefixcmp(arg, --timeout=)) {
+   if (has_prefix(arg, --timeout=)) {
timeout = atoi(arg+10);
continue;
}
-   if (!prefixcmp(arg, --init-timeout=)) {
+   if (has_prefix(arg, --init-timeout=)) {
init_timeout = atoi(arg+15);
continue;
}
-   if (!prefixcmp(arg, --max-connections=)) {
+   if (has_prefix(arg, --max-connections=)) {
max_connections = atoi(arg+18);
if (max_connections  0)
max_connections = 0;/* unlimited */
@@ -1221,7 +1221,7 @@ int main(int argc, char **argv)
strict_paths = 1;
continue;
}
-   if (!prefixcmp(arg, --base-path=)) {
+   if (has_prefix(arg, --base-path=)) {
base_path = arg+12;
continue;
}
@@ -1229,7 +1229,7 @@ int main(int argc, char **argv)
base_path_relaxed = 1;
continue;
}
-   if (!prefixcmp(arg, --interpolated-path=)) {
+   if (has_prefix(arg, --interpolated-path=)) {
interpolated_path = arg+20;
continue;
}
@@ -1241,11 +1241,11 @@ int main(int argc, char **argv)
user_path = ;
continue;
}
-   if (!prefixcmp(arg, --user-path=)) {
+   if (has_prefix(arg, --user-path=)) {
user_path = arg + 12;
continue;
}
-   if (!prefixcmp(arg, --pid-file=)) {
+   if (has_prefix(arg, --pid-file=)) {
pid_file = arg + 11;
continue;
}
@@ -1254,35 +1254,35 @@ int main(int argc, char **argv)
log_syslog = 1;
continue;
}
-   if (!prefixcmp(arg, --user=)) {
+   if (has_prefix(arg, --user=)) {
user_name = arg + 7;
continue;
}
-   if (!prefixcmp(arg, --group=)) {
+   if (has_prefix(arg, --group=)) {
group_name = arg + 8;
continue;
}
-   if (!prefixcmp(arg, --enable=)) {
+   if (has_prefix(arg, --enable=)) {
enable_service(arg + 9, 1);
continue;
}
-   if (!prefixcmp(arg, --disable=)) {
+   if (has_prefix(arg, --disable=)) {
enable_service(arg + 10, 0);
continue;
}
-   if (!prefixcmp(arg, 

[PATCH 41/86] shell: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 shell.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/shell.c b/shell.c
index 66350b2..3bbe774 100644
--- a/shell.c
+++ b/shell.c
@@ -15,7 +15,7 @@ static int do_generic_cmd(const char *me, char *arg)
setup_path();
if (!arg || !(arg = sq_dequote(arg)))
die(bad argument);
-   if (prefixcmp(me, git-))
+   if (!has_prefix(me, git-))
die(bad command);
 
my_argv[0] = me + 4;
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 57/86] builtin/fmt-merge-msg: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/fmt-merge-msg.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 1c04070..09a55bf 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -109,7 +109,7 @@ static int handle_line(char *line, struct merge_parents 
*merge_parents)
if (len  43 || line[40] != '\t')
return 1;
 
-   if (!prefixcmp(line + 41, not-for-merge))
+   if (has_prefix(line + 41, not-for-merge))
return 0;
 
if (line[41] != '\t')
@@ -155,16 +155,16 @@ static int handle_line(char *line, struct merge_parents 
*merge_parents)
if (pulling_head) {
origin = src;
src_data-head_status |= 1;
-   } else if (!prefixcmp(line, branch )) {
+   } else if (has_prefix(line, branch )) {
origin_data-is_local_branch = 1;
origin = line + 7;
string_list_append(src_data-branch, origin);
src_data-head_status |= 2;
-   } else if (!prefixcmp(line, tag )) {
+   } else if (has_prefix(line, tag )) {
origin = line;
string_list_append(src_data-tag, origin + 4);
src_data-head_status |= 2;
-   } else if (!prefixcmp(line, remote-tracking branch )) {
+   } else if (has_prefix(line, remote-tracking branch )) {
origin = line + strlen(remote-tracking branch );
string_list_append(src_data-r_branch, origin);
src_data-head_status |= 2;
@@ -605,7 +605,7 @@ int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
resolve_refdup(HEAD, head_sha1, 1, NULL);
if (!current_branch)
die(No current branch);
-   if (!prefixcmp(current_branch, refs/heads/))
+   if (has_prefix(current_branch, refs/heads/))
current_branch += 11;
 
find_merge_parents(merge_parents, in, head_sha1);
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 09/86] config: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 config.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/config.c b/config.c
index e1d66a1..8d5d70c 100644
--- a/config.c
+++ b/config.c
@@ -969,25 +969,25 @@ static int git_default_mailmap_config(const char *var, 
const char *value)
 
 int git_default_config(const char *var, const char *value, void *dummy)
 {
-   if (!prefixcmp(var, core.))
+   if (has_prefix(var, core.))
return git_default_core_config(var, value);
 
-   if (!prefixcmp(var, user.))
+   if (has_prefix(var, user.))
return git_ident_config(var, value, dummy);
 
-   if (!prefixcmp(var, i18n.))
+   if (has_prefix(var, i18n.))
return git_default_i18n_config(var, value);
 
-   if (!prefixcmp(var, branch.))
+   if (has_prefix(var, branch.))
return git_default_branch_config(var, value);
 
-   if (!prefixcmp(var, push.))
+   if (has_prefix(var, push.))
return git_default_push_config(var, value);
 
-   if (!prefixcmp(var, mailmap.))
+   if (has_prefix(var, mailmap.))
return git_default_mailmap_config(var, value);
 
-   if (!prefixcmp(var, advice.))
+   if (has_prefix(var, advice.))
return git_default_advice_config(var, value);
 
if (!strcmp(var, pager.color) || !strcmp(var, color.pager)) {
@@ -1872,7 +1872,7 @@ int parse_config_key(const char *var,
const char *dot;
 
/* Does it start with section. ? */
-   if (prefixcmp(var, section) || var[section_len] != '.')
+   if (!has_prefix(var, section) || var[section_len] != '.')
return -1;
 
/*
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 56/86] builtin/fetch: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/fetch.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/builtin/fetch.c b/builtin/fetch.c
index 8eb6cd0..78d4add 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -313,7 +313,7 @@ static int update_local_ref(struct ref *ref,
}
 
if (!is_null_sha1(ref-old_sha1) 
-   !prefixcmp(ref-name, refs/tags/)) {
+   has_prefix(ref-name, refs/tags/)) {
int r;
r = s_update_ref(updating tag, ref, 0);
strbuf_addf(display, %c %-*s %-*s - %s%s,
@@ -336,10 +336,10 @@ static int update_local_ref(struct ref *ref,
 * more likely to follow a standard layout.
 */
const char *name = remote_ref ? remote_ref-name : ;
-   if (!prefixcmp(name, refs/tags/)) {
+   if (has_prefix(name, refs/tags/)) {
msg = storing tag;
what = _([new tag]);
-   } else if (!prefixcmp(name, refs/heads/)) {
+   } else if (has_prefix(name, refs/heads/)) {
msg = storing head;
what = _([new branch]);
} else {
@@ -471,15 +471,15 @@ static int store_updated_refs(const char *raw_url, const 
char *remote_name,
kind = ;
what = ;
}
-   else if (!prefixcmp(rm-name, refs/heads/)) {
+   else if (has_prefix(rm-name, refs/heads/)) {
kind = branch;
what = rm-name + 11;
}
-   else if (!prefixcmp(rm-name, refs/tags/)) {
+   else if (has_prefix(rm-name, refs/tags/)) {
kind = tag;
what = rm-name + 10;
}
-   else if (!prefixcmp(rm-name, refs/remotes/)) {
+   else if (has_prefix(rm-name, refs/remotes/)) {
kind = remote-tracking branch;
what = rm-name + 13;
}
@@ -644,7 +644,7 @@ static void find_non_local_tags(struct transport *transport,
 
for_each_ref(add_existing, existing_refs);
for (ref = transport_get_remote_refs(transport); ref; ref = ref-next) {
-   if (prefixcmp(ref-name, refs/tags/))
+   if (!has_prefix(ref-name, refs/tags/))
continue;
 
/*
@@ -892,7 +892,7 @@ static int get_remote_group(const char *key, const char 
*value, void *priv)
 {
struct remote_group_data *g = priv;
 
-   if (!prefixcmp(key, remotes.) 
+   if (has_prefix(key, remotes.) 
!strcmp(key + 8, g-name)) {
/* split list by white space */
int space = strcspn(value,  \t\n);
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 37/86] connect: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 connect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/connect.c b/connect.c
index 4086861..1cb4090 100644
--- a/connect.c
+++ b/connect.c
@@ -87,7 +87,7 @@ struct ref **get_remote_heads(int in, char *src_buf, size_t 
src_len,
if (!len)
break;
 
-   if (len  4  !prefixcmp(buffer, ERR ))
+   if (len  4  has_prefix(buffer, ERR ))
die(remote error: %s, buffer + 4);
 
if (len  42 || get_sha1_hex(buffer, old_sha1) || buffer[40] != 
' ')
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 06/86] pretty: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 pretty.c | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/pretty.c b/pretty.c
index b4e32b7..961241a 100644
--- a/pretty.c
+++ b/pretty.c
@@ -40,7 +40,7 @@ static int git_pretty_formats_config(const char *var, const 
char *value, void *c
const char *fmt;
int i;
 
-   if (prefixcmp(var, pretty.))
+   if (!has_prefix(var, pretty.))
return 0;
 
name = var + strlen(pretty.);
@@ -67,7 +67,7 @@ static int git_pretty_formats_config(const char *var, const 
char *value, void *c
commit_format-name = xstrdup(name);
commit_format-format = CMIT_FMT_USERFORMAT;
git_config_string(fmt, var, value);
-   if (!prefixcmp(fmt, format:) || !prefixcmp(fmt, tformat:)) {
+   if (has_prefix(fmt, format:) || has_prefix(fmt, tformat:)) {
commit_format-is_tformat = fmt[0] == 't';
fmt = strchr(fmt, ':') + 1;
} else if (strchr(fmt, '%'))
@@ -115,7 +115,7 @@ static struct cmt_fmt_map 
*find_commit_format_recursive(const char *sought,
for (i = 0; i  commit_formats_len; i++) {
size_t match_len;
 
-   if (prefixcmp(commit_formats[i].name, sought))
+   if (!has_prefix(commit_formats[i].name, sought))
continue;
 
match_len = strlen(commit_formats[i].name);
@@ -151,7 +151,7 @@ void get_commit_format(const char *arg, struct rev_info 
*rev)
rev-commit_format = CMIT_FMT_DEFAULT;
return;
}
-   if (!prefixcmp(arg, format:) || !prefixcmp(arg, tformat:)) {
+   if (has_prefix(arg, format:) || has_prefix(arg, tformat:)) {
save_user_format(rev, strchr(arg, ':') + 1, arg[0] == 't');
return;
}
@@ -840,10 +840,10 @@ static void parse_commit_header(struct 
format_commit_context *context)
 
if (i == eol) {
break;
-   } else if (!prefixcmp(msg + i, author )) {
+   } else if (has_prefix(msg + i, author )) {
context-author.off = i + 7;
context-author.len = eol - i - 7;
-   } else if (!prefixcmp(msg + i, committer )) {
+   } else if (has_prefix(msg + i, committer )) {
context-committer.off = i + 10;
context-committer.len = eol - i - 10;
}
@@ -983,7 +983,7 @@ static size_t parse_color(struct strbuf *sb, /* in UTF-8 */
 
if (!end)
return 0;
-   if (!prefixcmp(begin, auto,)) {
+   if (has_prefix(begin, auto,)) {
if (!want_color(c-pretty_ctx-color))
return end - placeholder + 1;
begin += 5;
@@ -994,16 +994,16 @@ static size_t parse_color(struct strbuf *sb, /* in UTF-8 
*/
strbuf_addstr(sb, color);
return end - placeholder + 1;
}
-   if (!prefixcmp(placeholder + 1, red)) {
+   if (has_prefix(placeholder + 1, red)) {
strbuf_addstr(sb, GIT_COLOR_RED);
return 4;
-   } else if (!prefixcmp(placeholder + 1, green)) {
+   } else if (has_prefix(placeholder + 1, green)) {
strbuf_addstr(sb, GIT_COLOR_GREEN);
return 6;
-   } else if (!prefixcmp(placeholder + 1, blue)) {
+   } else if (has_prefix(placeholder + 1, blue)) {
strbuf_addstr(sb, GIT_COLOR_BLUE);
return 5;
-   } else if (!prefixcmp(placeholder + 1, reset)) {
+   } else if (has_prefix(placeholder + 1, reset)) {
strbuf_addstr(sb, GIT_COLOR_RESET);
return 6;
} else
@@ -1060,11 +1060,11 @@ static size_t parse_padding_placeholder(struct strbuf 
*sb,
end = strchr(start, ')');
if (!end || end == start)
return 0;
-   if (!prefixcmp(start, trunc)))
+   if (has_prefix(start, trunc)))
c-truncate = trunc_right;
-   else if (!prefixcmp(start, ltrunc)))
+   else if (has_prefix(start, ltrunc)))
c-truncate = trunc_left;
-   else if (!prefixcmp(start, mtrunc)))
+   else if (has_prefix(start, mtrunc)))
c-truncate = trunc_middle;
else
return 0;
@@ -1089,7 +1089,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in 
UTF-8 */
/* these are independent of the commit */
switch (placeholder[0]) {
case 'C':
-   if (!prefixcmp(placeholder + 1, (auto))) {
+   if (has_prefix(placeholder + 1, 

[PATCH 36/86] attr: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 attr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/attr.c b/attr.c
index 0e774c6..4c11f30 100644
--- a/attr.c
+++ b/attr.c
@@ -211,7 +211,7 @@ static struct match_attr *parse_attr_line(const char *line, 
const char *src,
name = cp;
namelen = strcspn(name, blank);
if (strlen(ATTRIBUTE_MACRO_PREFIX)  namelen 
-   !prefixcmp(name, ATTRIBUTE_MACRO_PREFIX)) {
+   has_prefix(name, ATTRIBUTE_MACRO_PREFIX)) {
if (!macro_ok) {
fprintf(stderr, %s not allowed: %s:%d\n,
name, src, lineno);
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 54/86] builtin/fast-export: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/fast-export.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 78250ea..8a9136b 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -476,7 +476,7 @@ static void handle_tag(const char *name, struct tag *tag)
}
}
 
-   if (!prefixcmp(name, refs/tags/))
+   if (has_prefix(name, refs/tags/))
name += 10;
printf(tag %s\nfrom :%d\n%.*s%sdata %d\n%.*s\n,
   name, tagged_mark,
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 53/86] builtin/describe: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/describe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/describe.c b/builtin/describe.c
index b9d3603..102d958 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -141,7 +141,7 @@ static void add_to_known_names(const char *path,
 
 static int get_name(const char *path, const unsigned char *sha1, int flag, 
void *cb_data)
 {
-   int is_tag = !prefixcmp(path, refs/tags/);
+   int is_tag = has_prefix(path, refs/tags/);
unsigned char peeled[20];
int is_annotated, prio;
 
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 46/86] builtin/archive: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/archive.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin/archive.c b/builtin/archive.c
index 49178f1..b808bb5 100644
--- a/builtin/archive.c
+++ b/builtin/archive.c
@@ -57,9 +57,9 @@ static int run_remote_archiver(int argc, const char **argv,
if (!buf)
die(_(git archive: expected ACK/NAK, got EOF));
if (strcmp(buf, ACK)) {
-   if (!prefixcmp(buf, NACK ))
+   if (has_prefix(buf, NACK ))
die(_(git archive: NACK %s), buf + 5);
-   if (!prefixcmp(buf, ERR ))
+   if (has_prefix(buf, ERR ))
die(_(remote error: %s), buf + 4);
die(_(git archive: protocol error));
}
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 21/86] imap-send: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 imap-send.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/imap-send.c b/imap-send.c
index 6f5cc4f..670de9f 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1263,7 +1263,7 @@ static int count_messages(struct strbuf *all_msgs)
char *p = all_msgs-buf;
 
while (1) {
-   if (!prefixcmp(p, From )) {
+   if (has_prefix(p, From )) {
p = strstr(p+5, \nFrom: );
if (!p) break;
p = strstr(p+7, \nDate: );
@@ -1297,7 +1297,7 @@ static int split_msg(struct strbuf *all_msgs, struct 
strbuf *msg, int *ofs)
data = all_msgs-buf[*ofs];
len = all_msgs-len - *ofs;
 
-   if (len  5 || prefixcmp(data, From ))
+   if (len  5 || !has_prefix(data, From ))
return 0;
 
p = strchr(data, '\n');
@@ -1339,13 +1339,13 @@ static int git_imap_config(const char *key, const char 
*val, void *cb)
if (!strcmp(folder, key)) {
imap_folder = xstrdup(val);
} else if (!strcmp(host, key)) {
-   if (!prefixcmp(val, imap:))
+   if (has_prefix(val, imap:))
val += 5;
-   else if (!prefixcmp(val, imaps:)) {
+   else if (has_prefix(val, imaps:)) {
val += 6;
server.use_ssl = 1;
}
-   if (!prefixcmp(val, //))
+   if (has_prefix(val, //))
val += 2;
server.host = xstrdup(val);
} else if (!strcmp(user, key))
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 08/86] transport*: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 transport-helper.c | 16 
 transport.c| 28 ++--
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/transport-helper.c b/transport-helper.c
index b32e2d6..bf8d7a0 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -190,7 +190,7 @@ static struct child_process *get_helper(struct transport 
*transport)
data-export = 1;
else if (!strcmp(capname, check-connectivity))
data-check_connectivity = 1;
-   else if (!data-refspecs  !prefixcmp(capname, refspec )) {
+   else if (!data-refspecs  has_prefix(capname, refspec )) {
ALLOC_GROW(refspecs,
   refspec_nr + 1,
   refspec_alloc);
@@ -199,17 +199,17 @@ static struct child_process *get_helper(struct transport 
*transport)
data-connect = 1;
} else if (!strcmp(capname, signed-tags)) {
data-signed_tags = 1;
-   } else if (!prefixcmp(capname, export-marks )) {
+   } else if (has_prefix(capname, export-marks )) {
struct strbuf arg = STRBUF_INIT;
strbuf_addstr(arg, --export-marks=);
strbuf_addstr(arg, capname + strlen(export-marks ));
data-export_marks = strbuf_detach(arg, NULL);
-   } else if (!prefixcmp(capname, import-marks)) {
+   } else if (has_prefix(capname, import-marks)) {
struct strbuf arg = STRBUF_INIT;
strbuf_addstr(arg, --import-marks=);
strbuf_addstr(arg, capname + strlen(import-marks ));
data-import_marks = strbuf_detach(arg, NULL);
-   } else if (!prefixcmp(capname, no-private-update)) {
+   } else if (has_prefix(capname, no-private-update)) {
data-no_private_update = 1;
} else if (mandatory) {
die(Unknown mandatory capability %s. This remote 
@@ -310,7 +310,7 @@ static int set_helper_option(struct transport *transport,
 
if (!strcmp(buf.buf, ok))
ret = 0;
-   else if (!prefixcmp(buf.buf, error)) {
+   else if (has_prefix(buf.buf, error)) {
ret = -1;
} else if (!strcmp(buf.buf, unsupported))
ret = 1;
@@ -374,7 +374,7 @@ static int fetch_with_fetch(struct transport *transport,
while (1) {
recvline(data, buf);
 
-   if (!prefixcmp(buf.buf, lock )) {
+   if (has_prefix(buf.buf, lock )) {
const char *name = buf.buf + 5;
if (transport-pack_lockfile)
warning(%s also locked %s, data-name, name);
@@ -645,10 +645,10 @@ static int push_update_ref_status(struct strbuf *buf,
char *refname, *msg;
int status;
 
-   if (!prefixcmp(buf-buf, ok )) {
+   if (has_prefix(buf-buf, ok )) {
status = REF_STATUS_OK;
refname = buf-buf + 3;
-   } else if (!prefixcmp(buf-buf, error )) {
+   } else if (has_prefix(buf-buf, error )) {
status = REF_STATUS_REMOTE_REJECT;
refname = buf-buf + 6;
} else
diff --git a/transport.c b/transport.c
index 7202b77..24b781c 100644
--- a/transport.c
+++ b/transport.c
@@ -169,13 +169,13 @@ static void set_upstreams(struct transport *transport, 
struct ref *refs,
remotename = ref-name;
tmp = resolve_ref_unsafe(localname, sha, 1, flag);
if (tmp  flag  REF_ISSYMREF 
-   !prefixcmp(tmp, refs/heads/))
+   has_prefix(tmp, refs/heads/))
localname = tmp;
 
/* Both source and destination must be local branches. */
-   if (!localname || prefixcmp(localname, refs/heads/))
+   if (!localname || !has_prefix(localname, refs/heads/))
continue;
-   if (!remotename || prefixcmp(remotename, refs/heads/))
+   if (!remotename || !has_prefix(remotename, refs/heads/))
continue;
 
if (!pretend)
@@ -191,7 +191,7 @@ static void set_upstreams(struct transport *transport, 
struct ref *refs,
 
 static const char *rsync_url(const char *url)
 {
-   return prefixcmp(url, rsync://) ? skip_prefix(url, rsync:) : url;
+   return !has_prefix(url, rsync://) ? skip_prefix(url, rsync:) : url;
 }
 
 static struct ref *get_refs_via_rsync(struct transport *transport, int 
for_push)
@@ -296,8 +296,8 @@ static int write_one_ref(const char *name, const unsigned 
char *sha1,
FILE *f;
 
/* when called via for_each_ref(), flags is non-zero */
-   if 

[PATCH 38/86] pager: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 pager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pager.c b/pager.c
index fa19765..cd7bc43 100644
--- a/pager.c
+++ b/pager.c
@@ -151,7 +151,7 @@ int decimal_width(int number)
 static int pager_command_config(const char *var, const char *value, void *data)
 {
struct pager_config *c = data;
-   if (!prefixcmp(var, pager.)  !strcmp(var + 6, c-cmd)) {
+   if (has_prefix(var, pager.)  !strcmp(var + 6, c-cmd)) {
int b = git_config_maybe_bool(var, value);
if (b = 0)
c-want = b;
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 42/86] pathspec: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 pathspec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pathspec.c b/pathspec.c
index ad1a9f5..182b162 100644
--- a/pathspec.c
+++ b/pathspec.c
@@ -150,7 +150,7 @@ static unsigned prefix_pathspec(struct pathspec_item *item,
magic |= pathspec_magic[i].bit;
break;
}
-   if (!prefixcmp(copyfrom, prefix:)) {
+   if (has_prefix(copyfrom, prefix:)) {
char *endptr;
pathspec_prefix = strtol(copyfrom + 7,
 endptr, 10);
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 15/86] fetch-pack: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 fetch-pack.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fetch-pack.c b/fetch-pack.c
index a0e0350..1526ed1 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -176,9 +176,9 @@ static void consume_shallow_list(struct fetch_pack_args 
*args, int fd)
 */
char *line;
while ((line = packet_read_line(fd, NULL))) {
-   if (!prefixcmp(line, shallow ))
+   if (has_prefix(line, shallow ))
continue;
-   if (!prefixcmp(line, unshallow ))
+   if (has_prefix(line, unshallow ))
continue;
die(git fetch-pack: expected shallow list);
}
@@ -194,7 +194,7 @@ static enum ack_type get_ack(int fd, unsigned char 
*result_sha1)
die(git fetch-pack: expected ACK/NAK, got EOF);
if (!strcmp(line, NAK))
return NAK;
-   if (!prefixcmp(line, ACK )) {
+   if (has_prefix(line, ACK )) {
if (!get_sha1_hex(line+4, result_sha1)) {
if (len  45)
return ACK;
@@ -323,13 +323,13 @@ static int find_common(struct fetch_pack_args *args,
 
send_request(args, fd[1], req_buf);
while ((line = packet_read_line(fd[0], NULL))) {
-   if (!prefixcmp(line, shallow )) {
+   if (has_prefix(line, shallow )) {
if (get_sha1_hex(line + 8, sha1))
die(invalid shallow line: %s, line);
register_shallow(sha1);
continue;
}
-   if (!prefixcmp(line, unshallow )) {
+   if (has_prefix(line, unshallow )) {
if (get_sha1_hex(line + 10, sha1))
die(invalid unshallow line: %s, line);
if (!lookup_object(sha1))
@@ -523,7 +523,7 @@ static void filter_refs(struct fetch_pack_args *args,
}
 
if (!keep  args-fetch_all 
-   (!args-depth || prefixcmp(ref-name, refs/tags/)))
+   (!args-depth || !has_prefix(ref-name, refs/tags/)))
keep = 1;
 
if (keep) {
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 03/86] fast-import: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 fast-import.c | 80 +--
 1 file changed, 40 insertions(+), 40 deletions(-)

diff --git a/fast-import.c b/fast-import.c
index f4d9969..14f69a1 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1877,8 +1877,8 @@ static int read_next_command(void)
return EOF;
 
if (!seen_data_command
-prefixcmp(command_buf.buf, feature )
-prefixcmp(command_buf.buf, option )) {
+!has_prefix(command_buf.buf, feature )
+!has_prefix(command_buf.buf, option )) {
parse_argv();
}
 
@@ -1898,7 +1898,7 @@ static int read_next_command(void)
rc-prev-next = rc;
cmd_tail = rc;
}
-   if (!prefixcmp(command_buf.buf, cat-blob )) {
+   if (has_prefix(command_buf.buf, cat-blob )) {
parse_cat_blob();
continue;
}
@@ -1917,7 +1917,7 @@ static void skip_optional_lf(void)
 
 static void parse_mark(void)
 {
-   if (!prefixcmp(command_buf.buf, mark :)) {
+   if (has_prefix(command_buf.buf, mark :)) {
next_mark = strtoumax(command_buf.buf + 6, NULL, 10);
read_next_command();
}
@@ -1929,10 +1929,10 @@ static int parse_data(struct strbuf *sb, uintmax_t 
limit, uintmax_t *len_res)
 {
strbuf_reset(sb);
 
-   if (prefixcmp(command_buf.buf, data ))
+   if (!has_prefix(command_buf.buf, data ))
die(Expected 'data n' command, found: %s, command_buf.buf);
 
-   if (!prefixcmp(command_buf.buf + 5, )) {
+   if (has_prefix(command_buf.buf + 5, )) {
char *term = xstrdup(command_buf.buf + 5 + 2);
size_t term_len = command_buf.len - 5 - 2;
 
@@ -2306,7 +2306,7 @@ static void file_change_m(struct branch *b)
if (*p == ':') {
oe = find_mark(parse_mark_ref_space(p));
hashcpy(sha1, oe-idx.sha1);
-   } else if (!prefixcmp(p, inline )) {
+   } else if (has_prefix(p, inline )) {
inline_data = 1;
oe = NULL; /* not used with inline_data, but makes gcc happy */
p += strlen(inline);  /* advance to space */
@@ -2479,7 +2479,7 @@ static void note_change_n(struct branch *b, unsigned char 
*old_fanout)
if (*p == ':') {
oe = find_mark(parse_mark_ref_space(p));
hashcpy(sha1, oe-idx.sha1);
-   } else if (!prefixcmp(p, inline )) {
+   } else if (has_prefix(p, inline )) {
inline_data = 1;
oe = NULL; /* not used with inline_data, but makes gcc happy */
p += strlen(inline);  /* advance to space */
@@ -2590,7 +2590,7 @@ static int parse_from(struct branch *b)
const char *from;
struct branch *s;
 
-   if (prefixcmp(command_buf.buf, from ))
+   if (!has_prefix(command_buf.buf, from ))
return 0;
 
if (b-branch_tree.tree) {
@@ -2636,7 +2636,7 @@ static struct hash_list *parse_merge(unsigned int *count)
struct branch *s;
 
*count = 0;
-   while (!prefixcmp(command_buf.buf, merge )) {
+   while (has_prefix(command_buf.buf, merge )) {
from = strchr(command_buf.buf, ' ') + 1;
n = xmalloc(sizeof(*n));
s = lookup_branch(from);
@@ -2687,11 +2687,11 @@ static void parse_new_commit(void)
 
read_next_command();
parse_mark();
-   if (!prefixcmp(command_buf.buf, author )) {
+   if (has_prefix(command_buf.buf, author )) {
author = parse_ident(command_buf.buf + 7);
read_next_command();
}
-   if (!prefixcmp(command_buf.buf, committer )) {
+   if (has_prefix(command_buf.buf, committer )) {
committer = parse_ident(command_buf.buf + 10);
read_next_command();
}
@@ -2712,19 +2712,19 @@ static void parse_new_commit(void)
 
/* file_change* */
while (command_buf.len  0) {
-   if (!prefixcmp(command_buf.buf, M ))
+   if (has_prefix(command_buf.buf, M ))
file_change_m(b);
-   else if (!prefixcmp(command_buf.buf, D ))
+   else if (has_prefix(command_buf.buf, D ))
file_change_d(b);
-   else if (!prefixcmp(command_buf.buf, R ))
+   else if (has_prefix(command_buf.buf, R ))
file_change_cr(b, 1);
-   else if (!prefixcmp(command_buf.buf, C ))
+   else if (has_prefix(command_buf.buf, C ))
file_change_cr(b, 0);
-   else if (!prefixcmp(command_buf.buf, N ))
+   else 

[PATCH 68/86] builtin/name-rev: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/name-rev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/builtin/name-rev.c b/builtin/name-rev.c
index 20fcf8c..2b74220 100644
--- a/builtin/name-rev.c
+++ b/builtin/name-rev.c
@@ -101,9 +101,9 @@ static const char *name_ref_abbrev(const char *refname, int 
shorten_unambiguous)
 {
if (shorten_unambiguous)
refname = shorten_unambiguous_ref(refname, 0);
-   else if (!prefixcmp(refname, refs/heads/))
+   else if (has_prefix(refname, refs/heads/))
refname = refname + 11;
-   else if (!prefixcmp(refname, refs/))
+   else if (has_prefix(refname, refs/))
refname = refname + 5;
return refname;
 }
@@ -149,7 +149,7 @@ static int name_ref(const char *path, const unsigned char 
*sha1, int flags, void
int can_abbreviate_output = data-tags_only  data-name_only;
int deref = 0;
 
-   if (data-tags_only  prefixcmp(path, refs/tags/))
+   if (data-tags_only  !has_prefix(path, refs/tags/))
return 0;
 
if (data-ref_filter) {
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 62/86] builtin/init-db: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/init-db.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/init-db.c b/builtin/init-db.c
index 78aa387..7fe9d8c 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -266,7 +266,7 @@ static int create_default_files(const char *template_path)
/* allow template config file to override the default */
if (log_all_ref_updates == -1)
git_config_set(core.logallrefupdates, true);
-   if (prefixcmp(git_dir, work_tree) ||
+   if (!has_prefix(git_dir, work_tree) ||
strcmp(git_dir + strlen(work_tree), /.git)) {
git_config_set(core.worktree, work_tree);
}
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 75/86] builtin/rev-parse: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/rev-parse.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index c76b89d..b6c92e0 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -508,7 +508,7 @@ int cmd_rev_parse(int argc, const char **argv, const char 
*prefix)
}
continue;
}
-   if (!prefixcmp(arg, -n)) {
+   if (has_prefix(arg, -n)) {
if ((filter  DO_FLAGS)  (filter  DO_REVS))
show(arg);
continue;
@@ -560,7 +560,7 @@ int cmd_rev_parse(int argc, const char **argv, const char 
*prefix)
continue;
}
if (!strcmp(arg, --short) ||
-   !prefixcmp(arg, --short=)) {
+   has_prefix(arg, --short=)) {
filter = ~(DO_FLAGS|DO_NOREV);
verify = 1;
abbrev = DEFAULT_ABBREV;
@@ -588,7 +588,7 @@ int cmd_rev_parse(int argc, const char **argv, const char 
*prefix)
symbolic = SHOW_SYMBOLIC_FULL;
continue;
}
-   if (!prefixcmp(arg, --abbrev-ref) 
+   if (has_prefix(arg, --abbrev-ref) 
(!arg[12] || arg[12] == '=')) {
abbrev_ref = 1;
abbrev_ref_strict = warn_ambiguous_refs;
@@ -606,7 +606,7 @@ int cmd_rev_parse(int argc, const char **argv, const char 
*prefix)
for_each_ref(show_reference, NULL);
continue;
}
-   if (!prefixcmp(arg, --disambiguate=)) {
+   if (has_prefix(arg, --disambiguate=)) {
for_each_abbrev(arg + 15, show_abbrev, NULL);
continue;
}
@@ -615,7 +615,7 @@ int cmd_rev_parse(int argc, const char **argv, const char 
*prefix)
for_each_ref_in(refs/bisect/good, 
anti_reference, NULL);
continue;
}
-   if (!prefixcmp(arg, --branches=)) {
+   if (has_prefix(arg, --branches=)) {
for_each_glob_ref_in(show_reference, arg + 11,
refs/heads/, NULL);
continue;
@@ -624,7 +624,7 @@ int cmd_rev_parse(int argc, const char **argv, const char 
*prefix)
for_each_branch_ref(show_reference, NULL);
continue;
}
-   if (!prefixcmp(arg, --tags=)) {
+   if (has_prefix(arg, --tags=)) {
for_each_glob_ref_in(show_reference, arg + 7,
refs/tags/, NULL);
continue;
@@ -633,11 +633,11 @@ int cmd_rev_parse(int argc, const char **argv, const char 
*prefix)
for_each_tag_ref(show_reference, NULL);
continue;
}
-   if (!prefixcmp(arg, --glob=)) {
+   if (has_prefix(arg, --glob=)) {
for_each_glob_ref(show_reference, arg + 7, 
NULL);
continue;
}
-   if (!prefixcmp(arg, --remotes=)) {
+   if (has_prefix(arg, --remotes=)) {
for_each_glob_ref_in(show_reference, arg + 10,
refs/remotes/, NULL);
continue;
@@ -724,19 +724,19 @@ int cmd_rev_parse(int argc, const char **argv, const char 
*prefix)
: false);
continue;
}
-   if (!prefixcmp(arg, --since=)) {
+   if (has_prefix(arg, --since=)) {
show_datestring(--max-age=, arg+8);
continue;
}
-   if (!prefixcmp(arg, --after=)) {
+   if (has_prefix(arg, --after=)) {
show_datestring(--max-age=, arg+8);
continue;
}
-   if (!prefixcmp(arg, --before=)) {
+   if (has_prefix(arg, --before=)) {
show_datestring(--min-age=, arg+9);

[PATCH 80/86] builtin/symbolic-ref: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/symbolic-ref.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c
index f481959..868fab4 100644
--- a/builtin/symbolic-ref.c
+++ b/builtin/symbolic-ref.c
@@ -65,7 +65,7 @@ int cmd_symbolic_ref(int argc, const char **argv, const char 
*prefix)
break;
case 2:
if (!strcmp(argv[0], HEAD) 
-   prefixcmp(argv[1], refs/))
+   !has_prefix(argv[1], refs/))
die(Refusing to point HEAD outside of refs/);
create_symref(argv[0], argv[1], msg);
break;
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 82/86] builtin/tar-tree: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/tar-tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/tar-tree.c b/builtin/tar-tree.c
index ba3ffe6..7f225cc 100644
--- a/builtin/tar-tree.c
+++ b/builtin/tar-tree.c
@@ -34,7 +34,7 @@ int cmd_tar_tree(int argc, const char **argv, const char 
*prefix)
nargv[nargc++] = archive;
nargv[nargc++] = --format=tar;
 
-   if (2 = argc  !prefixcmp(argv[1], --remote=)) {
+   if (2 = argc  has_prefix(argv[1], --remote=)) {
nargv[nargc++] = argv[1];
argv++;
argc--;
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 85/86] builtin/upload-archive: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/upload-archive.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/upload-archive.c b/builtin/upload-archive.c
index af2da35..298bc76 100644
--- a/builtin/upload-archive.c
+++ b/builtin/upload-archive.c
@@ -37,7 +37,7 @@ int cmd_upload_archive_writer(int argc, const char **argv, 
const char *prefix)
if (sent_argv.argc  MAX_ARGS)
die(Too many options (%d), MAX_ARGS - 1);
 
-   if (prefixcmp(buf, arg_cmd))
+   if (!has_prefix(buf, arg_cmd))
die('argument' token or flush expected);
argv_array_push(sent_argv, buf + strlen(arg_cmd));
}
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 84/86] builtin/update-ref: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/update-ref.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/builtin/update-ref.c b/builtin/update-ref.c
index 702e90d..d81d959 100644
--- a/builtin/update-ref.c
+++ b/builtin/update-ref.c
@@ -229,15 +229,15 @@ static void update_refs_stdin(void)
die(empty command in input);
else if (isspace(*cmd.buf))
die(whitespace before command: %s, cmd.buf);
-   else if (!prefixcmp(cmd.buf, update ))
+   else if (has_prefix(cmd.buf, update ))
parse_cmd_update(cmd.buf + 7);
-   else if (!prefixcmp(cmd.buf, create ))
+   else if (has_prefix(cmd.buf, create ))
parse_cmd_create(cmd.buf + 7);
-   else if (!prefixcmp(cmd.buf, delete ))
+   else if (has_prefix(cmd.buf, delete ))
parse_cmd_delete(cmd.buf + 7);
-   else if (!prefixcmp(cmd.buf, verify ))
+   else if (has_prefix(cmd.buf, verify ))
parse_cmd_verify(cmd.buf + 7);
-   else if (!prefixcmp(cmd.buf, option ))
+   else if (has_prefix(cmd.buf, option ))
parse_cmd_option(cmd.buf + 7);
else
die(unknown command: %s, cmd.buf);
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 86/86] strbuf: remove prefixcmp() as it has been replaced with has_prefix()

2013-11-08 Thread Christian Couder
prefixcmp() is now useless as the previous commit replaced it
everywhere with has_prefix(). So let's now remove it.

Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 git-compat-util.h | 1 -
 strbuf.c  | 9 -
 2 files changed, 10 deletions(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index 7930f49..c5505e6 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -350,7 +350,6 @@ extern void set_die_routine(NORETURN_PTR void 
(*routine)(const char *err, va_lis
 extern void set_error_routine(void (*routine)(const char *err, va_list 
params));
 extern void set_die_is_recursing_routine(int (*routine)(void));
 
-extern int prefixcmp(const char *str, const char *prefix);
 extern int has_prefix(const char *str, const char *prefix);
 extern int has_suffix(const char *str, const char *suffix);
 
diff --git a/strbuf.c b/strbuf.c
index 748be6d..199533c 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -1,15 +1,6 @@
 #include cache.h
 #include refs.h
 
-int prefixcmp(const char *str, const char *prefix)
-{
-   for (; ; str++, prefix++)
-   if (!*prefix)
-   return 0;
-   else if (*str != *prefix)
-   return (unsigned char)*prefix - (unsigned char)*str;
-}
-
 int has_prefix(const char *str, const char *prefix)
 {
for (; ; str++, prefix++)
-- 
1.8.4.1.566.geca833c

--
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


[PATCH 77/86] builtin/shortlog: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/shortlog.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index c226f76..3f35682 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -65,7 +65,7 @@ static void insert_one_record(struct shortlog *log,
eol = strchr(oneline, '\n');
if (!eol)
eol = oneline + strlen(oneline);
-   if (!prefixcmp(oneline, [PATCH)) {
+   if (has_prefix(oneline, [PATCH)) {
char *eob = strchr(oneline, ']');
if (eob  (!eol || eob  eol))
oneline = eob + 1;
@@ -95,7 +95,7 @@ static void read_from_stdin(struct shortlog *log)
 
while (fgets(author, sizeof(author), stdin) != NULL) {
if (!(author[0] == 'A' || author[0] == 'a') ||
-   prefixcmp(author + 1, uthor: ))
+   !has_prefix(author + 1, uthor: ))
continue;
while (fgets(oneline, sizeof(oneline), stdin) 
   oneline[0] != '\n')
@@ -123,7 +123,7 @@ void shortlog_add_commit(struct shortlog *log, struct 
commit *commit)
else
eol++;
 
-   if (!prefixcmp(buffer, author ))
+   if (has_prefix(buffer, author ))
author = buffer + 7;
buffer = eol;
}
-- 
1.8.4.1.566.geca833c


--
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


[PATCH 83/86] builtin/unpack-objects: replace prefixcmd() with has_prefix()

2013-11-08 Thread Christian Couder
Signed-off-by: Christian Couder chrisc...@tuxfamily.org
---
 builtin/unpack-objects.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c
index 2217d7b..dc2dd77 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -523,7 +523,7 @@ int cmd_unpack_objects(int argc, const char **argv, const 
char *prefix)
strict = 1;
continue;
}
-   if (!prefixcmp(arg, --pack_header=)) {
+   if (has_prefix(arg, --pack_header=)) {
struct pack_header *hdr;
char *c;
 
-- 
1.8.4.1.566.geca833c


--
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


  1   2   >