Git development
 help / color / mirror / Atom feed
* Re: Many gits are offline this week
From: alan @ 2007-10-05  1:59 UTC (permalink / raw)
  To: Randal L. Schwartz; +Cc: Shawn O. Pearce, git
In-Reply-To: <863awq5p1y.fsf@blue.stonehenge.com>

On Thu, 4 Oct 2007, Randal L. Schwartz wrote:

>>>>>> "Shawn" == Shawn O Pearce <spearce@spearce.org> writes:
>
> Shawn> Dscho and I will be (at least mostly) offline for the next four
> Shawn> days as we travel to San Jose for the 2007 Google Summer of Code
> Shawn> Mentor Summit.
>
> Oddly enough, I'm giving my "Intro to Git" talk at Google HQ on
> 12 october.  Too bad you're just going to miss that. :)

Are you going to have the same heckler as the Advanced Topics meeting? ]:>

-- 
Never trust a queue structure designed by a cryptographer.

^ permalink raw reply

* Re: Git User's Survey 2007 unfinished summary (long)
From: David Tweed @ 2007-10-05  1:48 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Johannes Schindelin, Jakub Narebski, git
In-Reply-To: <20071005012726.GR2137@spearce.org>

On 10/5/07, Shawn O. Pearce <spearce@spearce.org> wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > On Thu, 4 Oct 2007, Jakub Narebski wrote:
> > > 26. Which porcelains do you use?
> > >
> > > Multiple answers (one can use more than one porcelain).
> > >
> > >   Answer (multiple choice)       | Count
> ...
> > >   other                          | 14

FWIW, I answered other there because I use my chronoversion
hacky-scripts (in addition to doing some other fine-level work with at
the low level git command line). Obviously it's not a general purpose
porcelain and it's "deliberately not using" normal development
practice because I do lots of loosely related speculative research
rather than working on a well-defined "product". I was initially
confused by what the index does (particularly since in those days it
was often referred to as a cache) and so wrote the whole routines
using low-level commands; if I was to do it again I'd have my script
just call "git add" and then using the vanilla "git commit".

-- 
cheers, dave tweed__________________________
david.tweed@gmail.com
Rm 124, School of Systems Engineering, University of Reading.
"we had no idea that when we added templates we were adding a Turing-
complete compile-time language." -- C++ standardisation committee

^ permalink raw reply

* Re: Many gits are offline this week
From: Shawn O. Pearce @ 2007-10-05  1:43 UTC (permalink / raw)
  To: Randal L. Schwartz; +Cc: git
In-Reply-To: <863awq5p1y.fsf@blue.stonehenge.com>

"Randal L. Schwartz" <merlyn@stonehenge.com> wrote:
> >>>>> "Shawn" == Shawn O Pearce <spearce@spearce.org> writes:
> 
> Shawn> Dscho and I will be (at least mostly) offline for the next four
> Shawn> days as we travel to San Jose for the 2007 Google Summer of Code
> Shawn> Mentor Summit.
> 
> Oddly enough, I'm giving my "Intro to Git" talk at Google HQ on
> 12 october.  Too bad you're just going to miss that. :)

Yea, seeing as how I've never had the chance to see you give a
talk I am quite disappointed by the poor timing.  I'll just have
to catch the talk on Google Video.  And shout questions at my wall
to see if you can answer them.

-- 
Shawn.

^ permalink raw reply

* Re: Many gits are offline this week
From: Johannes Schindelin @ 2007-10-05  1:43 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git
In-Reply-To: <20071005010448.GQ2137@spearce.org>

Hi,

On Thu, 4 Oct 2007, Shawn O. Pearce wrote:

> Dscho and I will be (at least mostly) offline for the next four days as 
> we travel to San Jose for the 2007 Google Summer of Code Mentor Summit.

While at it, we thought that we'd have a little git-together on Sunday, a 
few hours before we're (or at least I'm) sober again from Saturday night.  
So everybody who is in the area of San Jose: Sunday is Talk Like A Git 
Day.

Sadly, Junio is not able to attend, but I will hoist a drink or three to 
him.

Ciao,
Dscho

^ permalink raw reply

* Re: Git User's Survey 2007 unfinished summary (long)
From: Shawn O. Pearce @ 2007-10-05  1:42 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Benoit SIGOURE, git
In-Reply-To: <8fe92b430710040759r5777264aj5ecb09e0252fef9a@mail.gmail.com>

Jakub Narebski <jnareb@gmail.com> wrote:
> On 10/4/07, Benoit SIGOURE <tsuna@lrde.epita.fr> wrote:
> > On Oct 4, 2007, at 11:12 AM, Jakub Narebski wrote:
> > > Note that Git is GPLv2, and it will probably stay that forever, so you
> > > are _free_ to start a commercial support scheme for Git, but others
> > > are free not to choose it. This question is to get to know if there is
> > > sufficient demand for commercial Git support for it to be viable.
> >
> > Once again (AFAIR this was already raised during one of the previous
> > summary) what's the link between GPLv2 and commercial support?  You
> > seem to imply that because Git won't move to GPLv3, it's a good thing
> > for potential paid support, or something.  I don't quite see how
> > GPLvX comes into play with commercial support.  I'm not a license
> > expert though.
> 
> The only link between GPL and commercial support is that GPL does not
> prohibit commercial support (like noncommercial-free licenses for example),
> and that having commercial support doesn't mean that license would change
> to proprietary (it cannot).

Right.  There has been some discussion in the past about forming
"The Git Company".

When this survey question was first posed there was some concern that
Git might move to a commerical license of some sort and perhaps not
be GPLvX anymore.  That concern is a non-issue; the copyrights for
Git are held by over 300 people, many of whom are kernel hackers and
strong believers in the value of GPLv2.  I'm not a kernel hacker,
but I also believe strongly in the value of the GPLv2 license.
You won't see me agreeing to move code I wrote to a non-GPL license
anytime soon.  Most (if not all!) of Git's authors feel the same way.

There's several reasons why forming "The Git Company" might help
the overall Git cause, and this question was a feeler to see if
the community was interested in acquiring support through it.  Many
other open source projects seem to get some benefit from having a
company loosely affiliated with them, not the least of which are
things like:

  - some of the developers can focus more time on the project and
    still keep food on the table;

  - there are people focused on advertising/marketing the project
    and its benfits to potential end-users;

  - companies that feel warm-and-fuzzy by having a phone number they
    can call for help are more likely to want to use the project
    for critical services;

  - companies that want training or short-term consulting services
    know who they can contact for expertise.

and the list goes on.  The problem with said company is it costs
money to keep the lights on and employees fed; money which obviously
cannot be extorted from users through arcane licensing agreements.
:-)

-- 
Shawn.

^ permalink raw reply

* Re: Many gits are offline this week
From: Johannes Schindelin @ 2007-10-05  1:36 UTC (permalink / raw)
  To: Randal L. Schwartz; +Cc: Shawn O. Pearce, git
In-Reply-To: <863awq5p1y.fsf@blue.stonehenge.com>

Hi,

On Thu, 4 Oct 2007, Randal L. Schwartz wrote:

> >>>>> "Shawn" == Shawn O Pearce <spearce@spearce.org> writes:
> 
> Shawn> Dscho and I will be (at least mostly) offline for the next four
> Shawn> days as we travel to San Jose for the 2007 Google Summer of Code
> Shawn> Mentor Summit.
> 
> Oddly enough, I'm giving my "Intro to Git" talk at Google HQ on
> 12 october.  Too bad you're just going to miss that. :)

We will not.  I'll watch the YouTube video a hundred times.

Ciao,
Dscho

^ permalink raw reply

* Re: Git User's Survey 2007 unfinished summary (long)
From: Shawn O. Pearce @ 2007-10-05  1:27 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Jakub Narebski, git
In-Reply-To: <Pine.LNX.4.64.0710041712120.4174@racer.site>

Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> On Thu, 4 Oct 2007, Jakub Narebski wrote:
> > 26. Which porcelains do you use?
> > 
> > Multiple answers (one can use more than one porcelain).
> > 
> >   Answer (multiple choice)       | Count
...
> >   other                          | 14
...
> > Those 14 "other" answers make me wish to have provided "if other,
> > what it was?" (sub)question; actually not only for this question.
> 
> git-gui, of course.  I consider it porcelain, because it uses core-git as 
> backend.

I tried to get git-gui into this list as a choice as I really do
consider it porcelain but Jakub thought it wasn't and wanted to
have a specific category for GUIs.  Whatever.  Its probably all
git-gui and qgit users that picked other here.  Probably in about
the same ratio too, so 8 git-gui's and 6 qgit's.

For the most part git-gui tries to only ever invoke plumbing.  I
break that rule in only three places:

  - git-merge: I'm lazy and didn't have time yet to rewrite this
               properly using Tcl.  I already do about half of the
               work anyway (e.g. merge base testing, fast-forward
               detection, message formatting).

  - git-fetch: Now that this is in C I'm going to call it plumbing
               even if nobody else does.  Especially for say HTTP
               as git-fetch process does all of the HTTP requests
               directly.  I won't reimplement it in Tcl, it would
               be slower and suck more.  So git-gui won't be calling
               git-fetch-pack anytime soon.

  - git push: Same as the above reason for git-fetch.

IMHO, porcelain is anything that only invokes plumbing.  Seats
however can sit above porcelain to make the position slightly
more comfortable.  :-)

> In the same vein, I should consider gitk porcelain now, since it has 
> rebase capabilities.  I will not, and I am not very happy that this viewer 
> got a non-view-only capability, instead of git-gui, where that feature 
> should have belonged (as suggested by at least one answer to a later 
> question in the survey -- not by me).

I agree.  I actually never use the modification features of gitk.
They are so hidden that most users don't even know they are there.
Of course that's just as hidden as the hunk selection in git-gui
is so I shouldn't be complaining.

I'm seriously looking at implementing those modification features
into git-gui and will probably start work on some of that during
the trip.  I got plenty of time in a sealed tube at 30,000 feet
to kill.  More time than I got battery packs for the laptop.  :-\

I think the first thing to implement is cherry-pick and revert as
those are easy and co-workers have been asking about them.  That way
you can then rebase using cherry-pick and the Mark I wetware loop.
Then we need a cool graph thing that you can drag the nodes around
on to create a visual `rebase -i`.

-- 
Shawn.

^ permalink raw reply

* Re: Many gits are offline this week
From: Randal L. Schwartz @ 2007-10-05  1:27 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git
In-Reply-To: <20071005010448.GQ2137@spearce.org>

>>>>> "Shawn" == Shawn O Pearce <spearce@spearce.org> writes:

Shawn> Dscho and I will be (at least mostly) offline for the next four
Shawn> days as we travel to San Jose for the 2007 Google Summer of Code
Shawn> Mentor Summit.

Oddly enough, I'm giving my "Intro to Git" talk at Google HQ on
12 october.  Too bad you're just going to miss that. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

^ permalink raw reply

* Many gits are offline this week
From: Shawn O. Pearce @ 2007-10-05  1:04 UTC (permalink / raw)
  To: git

Dscho and I will be (at least mostly) offline for the next four
days as we travel to San Jose for the 2007 Google Summer of Code
Mentor Summit.

We also just received word from Junio that he is also likely to be
offline this next week.  Junio has some business that needs his
immediate attention, so he won't be his usual attentive self on
the mailing list.

With three gits offline for at least the next few days perhaps
someone would be willing to step up and collect patches so that Junio
has a reasonable place to pick up from when he can get back online?

-- 
Shawn.

^ permalink raw reply

* [PATCH 2/2] Run garbage collection with loose object pruning after svn dcommit
From: Steven Grimm @ 2007-10-05  0:15 UTC (permalink / raw)
  To: git

git-svn dcommit, by virtue of rewriting history to insert svn revision IDs,
leaves old commits dangling.  Since dcommit is already unsafe to run
concurrently with other git commands, no additional risk is introduced
by making it prune those old objects as needed.

Signed-off-by: Steven Grimm <koreth@midwinter.com>
---

This is in response to a colleague who complained that, after I
installed the latest git release, he was getting lots of "too many
unreachable loose objects" errors from the new "git gc --auto" run.
Those objects turned out to be dangling commits from a year's worth of
git-svn usage, since every git-svn commit will abandon at least one
existing commit in order to rewrite it with the svn version data.

 git-svn.perl |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 777e436..be62ee1 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -441,6 +441,12 @@ sub cmd_dcommit {
 			}
 			command_noisy(@finish, $gs->refname);
 			$last_rev = $cmt_rev;
+
+			# rebase will have made the just-committed revisions
+			# unreachable; over time that can build up lots of
+			# loose objects in the repo. prune is unsafe to run
+			# concurrently but so is dcommit.
+			command_noisy(qw/gc --auto --prune/);
 		}
 	}
 }
-- 
1.5.3.4.203.gcc61a

^ permalink raw reply related

* [PATCH 1/2] git-gc: allow --prune to be specified with --auto
From: Steven Grimm @ 2007-10-05  0:12 UTC (permalink / raw)
  To: git

This will run git-prune only if there are still lots of loose objects
after the repack finishes. Obviously the caveats about pruning not being
a safe operation to run concurrently with other git commands still apply.

Signed-off-by: Steven Grimm <koreth@midwinter.com>
---
 Documentation/git-gc.txt |    4 +++-
 builtin-gc.c             |   18 +++++++++++++-----
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index b9d5660..60731e9 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -33,7 +33,9 @@ OPTIONS
 	done by default.  Pass this option if you want it, and only
 	when you know nobody else is creating new objects in the
 	repository at the same time (e.g. never use this option
-	in a cron script).
+	in a cron script). If used with the `--auto` option,
+	pruning will only be done if there are many loose objects
+	in the repository after gitlink:git-repack[1] is finished.
 
 --aggressive::
 	Usually 'git-gc' runs very quickly while providing good disk
diff --git a/builtin-gc.c b/builtin-gc.c
index 23ad2b6..b65cacc 100644
--- a/builtin-gc.c
+++ b/builtin-gc.c
@@ -208,7 +208,6 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
 		/*
 		 * Auto-gc should be least intrusive as possible.
 		 */
-		prune = 0;
 		if (!need_to_gc())
 			return 0;
 	}
@@ -222,15 +221,24 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
 	if (run_command_v_opt(argv_repack, RUN_GIT_CMD))
 		return error(FAILED_RUN, argv_repack[0]);
 
+	if (auto_gc) {
+		if (too_many_loose_objects()) {
+			if (! prune) {
+				warning("There are too many unreachable loose "
+					"objects; run 'git gc --prune' to "
+					"remove them.");
+			}
+			// else we will run the prune next
+		} else {
+			prune = 0;
+		}
+	}
+
 	if (prune && run_command_v_opt(argv_prune, RUN_GIT_CMD))
 		return error(FAILED_RUN, argv_prune[0]);
 
 	if (run_command_v_opt(argv_rerere, RUN_GIT_CMD))
 		return error(FAILED_RUN, argv_rerere[0]);
 
-	if (auto_gc && too_many_loose_objects())
-		warning("There are too many unreachable loose objects; "
-			"run 'git prune' to remove them.");
-
 	return 0;
 }
-- 
1.5.3.4.203.gcc61a

^ permalink raw reply related

* Re: Question about "git commit -a"
From: Johannes Schindelin @ 2007-10-04 23:19 UTC (permalink / raw)
  To: David Soria; +Cc: git
In-Reply-To: <fe3pp3$8p1$1@sea.gmane.org>

Hi,

On Thu, 4 Oct 2007, David Soria wrote:

> Am Thu, 04 Oct 2007 17:38:25 +0200 schrieb Paolo Ciarrocchi:
> 
> > Hi all,
> > I was just wondering why git commit doesn't default to "-a" (yes, it's
> > another question that came up during a chat with a mercurial user) and
> > I didn't find an answer to that.
> 
> 
> in fact i do just a git-config alias.commit 'commit -a' in my repository

Which will not work, because we do not allow overriding of 
programs/builtins by aliases.

This has technical reasons and cannot be fixed.

Ciao,
Dscho

^ permalink raw reply

* Re: Question about "git commit -a"
From: Alex Riesen @ 2007-10-04 23:03 UTC (permalink / raw)
  To: David Soria; +Cc: git
In-Reply-To: <fe3pp3$8p1$1@sea.gmane.org>

David Soria, Fri, Oct 05, 2007 00:34:11 +0200:
> Am Thu, 04 Oct 2007 17:38:25 +0200 schrieb Paolo Ciarrocchi:
> 
> > Hi all,
> > I was just wondering why git commit doesn't default to "-a" (yes, it's
> > another question that came up during a chat with a mercurial user) and
> > I didn't find an answer to that.
> 
> 
> in fact i do just a git-config alias.commit 'commit -a' in my repository
> 

Either you have a specially modified git (the alias expansion code) or
you just said not exactly truth. You can't alias the git commands (see
git.c's main).

^ permalink raw reply

* Re: WIP: asciidoc replacement
From: Martin Langhoff @ 2007-10-04 22:49 UTC (permalink / raw)
  To: David Kastrup
  Cc: Junio C Hamano, Wincent Colaiuta, Johannes Schindelin, git,
	msysgit
In-Reply-To: <85tzp6oavq.fsf@lola.goethe.zz>

On 10/5/07, David Kastrup <dak@gnu.org> wrote:
> "Martin Langhoff" <martin.langhoff@gmail.com> writes:
>
> > With AsciiDoc we've managed to avoid the arcane format, but we are
> > still laden with a horrid toolchain.
>
> Let's put this somewhat into perspective: the toolchain is horrid with
> regard to the complexity and documentation

Exactly. I'm not complaining about asciidoc itself. But the toolchain
is very fragile, and not crossplatform. Git compiles and works on many
unixen, win32, and some embedded posixy OSs if IIRC.

OTOH asciidoc can be pretty hard to get going even on modern
linuxen.The asciidoc toolchain doesn't even work on Debian Sarge,
which isn't *that* old, while I'm pretty sure git itself can be built
and used on older linuxen. That's where a good old regex-insanity
Perl-based parser beats anything else: no dependencies, works
everywhere.

In that sense, this is close to being a rehash of the "let's use
autoconf" argument...

cheers



martin

^ permalink raw reply

* [PATCH] git-archive: document --exec
From: Michele Ballabio @ 2007-10-04 22:41 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
---
 Documentation/git-archive.txt |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt
index e1e2d60..7cbd1c7 100644
--- a/Documentation/git-archive.txt
+++ b/Documentation/git-archive.txt
@@ -10,7 +10,8 @@ SYNOPSIS
 --------
 [verse]
 'git-archive' --format=<fmt> [--list] [--prefix=<prefix>/] [<extra>]
-	      [--remote=<repo>] <tree-ish> [path...]
+	      [--remote=<repo> [--exec=<git-upload-archive>]] <tree-ish>
+	      [path...]
 
 DESCRIPTION
 -----------
@@ -52,6 +53,10 @@ OPTIONS
 	Instead of making a tar archive from local repository,
 	retrieve a tar archive from a remote repository.
 
+--exec=<git-upload-archive>::
+	Used with --remote to specify the path to the
+	git-upload-archive executable on the remote side.
+
 <tree-ish>::
 	The tree or commit to produce an archive for.
 
-- 
1.5.3.4

^ permalink raw reply related

* [PATCH] git-reflog: document --verbose
From: Michele Ballabio @ 2007-10-04 12:26 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
---
 Documentation/git-reflog.txt |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-reflog.txt b/Documentation/git-reflog.txt
index 5180f68..5c7316c 100644
--- a/Documentation/git-reflog.txt
+++ b/Documentation/git-reflog.txt
@@ -16,7 +16,7 @@ The command takes various subcommands, and different options
 depending on the subcommand:
 
 [verse]
-git reflog expire [--dry-run] [--stale-fix]
+git reflog expire [--dry-run] [--stale-fix] [--verbose]
 	[--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...
 
 git reflog [show] [log-options]
@@ -68,6 +68,9 @@ them.
 --all::
 	Instead of listing <refs> explicitly, prune all refs.
 
+--verbose::
+	Print extra information on screen.
+
 Author
 ------
 Written by Junio C Hamano <junkio@cox.net>
-- 
1.5.3.4

^ permalink raw reply related

* Re: Question about "git commit -a"
From: David Soria @ 2007-10-04 22:34 UTC (permalink / raw)
  To: git
In-Reply-To: <4d8e3fd30710040838t48bb590erbd90a8c4a1c6e932@mail.gmail.com>

Am Thu, 04 Oct 2007 17:38:25 +0200 schrieb Paolo Ciarrocchi:

> Hi all,
> I was just wondering why git commit doesn't default to "-a" (yes, it's
> another question that came up during a chat with a mercurial user) and
> I didn't find an answer to that.


in fact i do just a git-config alias.commit 'commit -a' in my repository

^ permalink raw reply

* Re: [PATCH/RFT] cvsserver: only allow checkout of branches
From: Shawn O. Pearce @ 2007-10-04 21:55 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0710042248330.4174@racer.site>

Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> On Thu, 4 Oct 2007, Frank Lichtenheld wrote:
> > 
> > Should I sent a patch on top of this one or as a replacement?
> 
> Better a replacement.  Otherwise I have to fly to California with a brown 
> paper bag over my HEAD.

That may be the safer way to travel.  If your head is in a bag you
have no idea what sort of wait in the security line you are about
to face.  Or what horrible movie they are showing you on the flight
both over *and* back.

-- 
Shawn.

^ permalink raw reply

* [PATCH] Do not remove distributed configure script
From: Mathias Megyei @ 2007-10-04 21:49 UTC (permalink / raw)
  To: git

Before this patch the clean target has removed the
configure script that comes with Git tar file.
That made compiling Git for different architectures
inconvenient.
This patch excludes configure from the files to be
deleted by 'make clean' and adds new target 'distclean'
to preserve old functionality.

Signed-off-by: Mathias Megyei <mathias@mnet-mail.de>
---
 Makefile |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 8db4dbe..dbe68bc 100644
--- a/Makefile
+++ b/Makefile
@@ -1088,6 +1088,9 @@ dist-doc:
 
 ### Cleaning rules
 
+distclean: clean
+	$(RM) configure
+
 clean:
 	$(RM) *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o xdiff/*.o \
 		$(LIB_FILE) $(XDIFF_LIB)
@@ -1095,7 +1098,7 @@ clean:
 	$(RM) $(TEST_PROGRAMS)
 	$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags
 	$(RM) -r autom4te.cache
-	$(RM) configure config.log config.mak.autogen config.mak.append config.status config.cache
+	$(RM) config.log config.mak.autogen config.mak.append config.status config.cache
 	$(RM) -r $(GIT_TARNAME) .doc-tmp-dir
 	$(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
 	$(RM) $(htmldocs).tar.gz $(manpages).tar.gz
-- 
1.5.3.4.203.gcc61a-dirty

^ permalink raw reply related

* Re: [PATCH/RFT] cvsserver: only allow checkout of branches
From: Johannes Schindelin @ 2007-10-04 21:49 UTC (permalink / raw)
  To: Frank Lichtenheld; +Cc: Junio C Hamano, Martin Langhoff, git
In-Reply-To: <20071004211555.GG31659@planck.djpig.de>

Hi,

On Thu, 4 Oct 2007, Frank Lichtenheld wrote:

> On Thu, Oct 04, 2007 at 04:29:04PM +0100, Johannes Schindelin wrote:
> > diff --git a/git-cvsserver.perl b/git-cvsserver.perl
> > index 13dbd27..869690c 100755
> > --- a/git-cvsserver.perl
> > +++ b/git-cvsserver.perl
> > @@ -770,6 +770,14 @@ sub req_co
> >  
> >      $log->debug("req_co : " . ( defined($data) ? $data : "[NULL]" ) );
> >  
> > +    if( system("git", "rev-parse", "--verify", "refs/heads/$module" ) != 0 )
> > +    {
> > +	$log->warn("Checkout failed: $module is not a branch");
> > +	print "error 1 Checkout failed: $module is not a branch\n";
> > +	chdir "/";
> > +	exit;
> > +    }
> > +
> >      $log->info("Checking out module '$module' ($state->{CVSROOT}) to '$checkout_path'");
> >  
> >      $ENV{GIT_DIR} = $state->{CVSROOT} . "/";
> 
> I've found a problem with the patch. Since git-rev-parse will produce
> output (which will end up at the client and confuse it), we will have to use a fork/exec
> combination instead of system to be able to close STDOUT and STDERR of the child.
> 
> Should I sent a patch on top of this one or as a replacement?

Better a replacement.  Otherwise I have to fly to California with a brown 
paper bag over my HEAD.

Ciao,
Dscho

^ permalink raw reply

* Re: Question about "git commit -a"
From: Shawn O. Pearce @ 2007-10-04 21:26 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Nguyen Thai Ngoc Duy, Wincent Colaiuta, Paolo Ciarrocchi,
	Git Mailing List
In-Reply-To: <Pine.LNX.4.64.0710042209410.4174@racer.site>

Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> On Fri, 5 Oct 2007, Nguyen Thai Ngoc Duy wrote:
> 
> > On 10/4/07, Wincent Colaiuta <win@wincent.com> wrote:
> > > > Am I wrong?
> > >
> > > About it being a majority, yes, I suspect so.
> > >
> > 
> > Maybe in the next survey we should include question "do you usually do 
> > 'git commit' or 'git commit -a'" :-)
> 
> Not meaning to discourage you, but it is a known fact that Linus does "git 
> commit" without "-a" quite often.
> 
> And if that were not bad enough for your plan, I myself omit "-a" 
> regularly.  So you would get a veto from me, too.

Ditto.  I use `git commit` more often than `git commit -a`.

Actually scratch that, I use `git gui` more often than I use `git
commit -a` but the point holds.  I stage things long before I ever
think about what the commit message should say.  Its very rare that
I am committing without staging something first, usually its a one
liner fix for something and the -a just is the shorter way to stage
the change.

Early on in my Git days I didn't grasp how *useful* it is to stage
first.  Now I can't work without it.  At least for any change more
than 1 line.  :)

-- 
Shawn.

^ permalink raw reply

* Re: Question about "git commit -a"
From: Andy Parkins @ 2007-10-04 21:25 UTC (permalink / raw)
  To: git; +Cc: Paolo Ciarrocchi
In-Reply-To: <4d8e3fd30710040838t48bb590erbd90a8c4a1c6e932@mail.gmail.com>

On Thursday 2007, October 04, Paolo Ciarrocchi wrote:
> Hi all,
> I was just wondering why git commit doesn't default to "-a" (yes, it's
> another question that came up during a chat with a mercurial user) and
> I didn't find an answer to that.
>
> It's not a big deal but I strongly suspect that the large majority of
> the git users never user git commit without the option "-a".
>
> Am I wrong?

Yes, I think you are.  I suspect that most users start out using git 
commit -a, because that's the workflow they were used to with their 
previous SCM.  What happened to me was I started with

 git commit -a

Then I started adding files one at a time

 git add <file>

Now I cherry pick hunks together in coherent groups 

 git add -i

Once you figure out that git lets you turn your development history from a 
simple snapshotter to telling the story of the project's development, 
you'll find you want finer and finer control over what you're committing.



Andy

-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com

^ permalink raw reply

* Re: [PATCH/RFT] cvsserver: only allow checkout of branches
From: Frank Lichtenheld @ 2007-10-04 21:15 UTC (permalink / raw)
  To: Johannes Schindelin, Junio C Hamano; +Cc: Martin Langhoff, git
In-Reply-To: <Pine.LNX.4.64.0710041622070.4174@racer.site>

On Thu, Oct 04, 2007 at 04:29:04PM +0100, Johannes Schindelin wrote:
> diff --git a/git-cvsserver.perl b/git-cvsserver.perl
> index 13dbd27..869690c 100755
> --- a/git-cvsserver.perl
> +++ b/git-cvsserver.perl
> @@ -770,6 +770,14 @@ sub req_co
>  
>      $log->debug("req_co : " . ( defined($data) ? $data : "[NULL]" ) );
>  
> +    if( system("git", "rev-parse", "--verify", "refs/heads/$module" ) != 0 )
> +    {
> +	$log->warn("Checkout failed: $module is not a branch");
> +	print "error 1 Checkout failed: $module is not a branch\n";
> +	chdir "/";
> +	exit;
> +    }
> +
>      $log->info("Checking out module '$module' ($state->{CVSROOT}) to '$checkout_path'");
>  
>      $ENV{GIT_DIR} = $state->{CVSROOT} . "/";

I've found a problem with the patch. Since git-rev-parse will produce
output (which will end up at the client and confuse it), we will have to use a fork/exec
combination instead of system to be able to close STDOUT and STDERR of the child.

Should I sent a patch on top of this one or as a replacement?

Gruesse,
-- 
Frank Lichtenheld <frank@lichtenheld.de>
www: http://www.djpig.de/

^ permalink raw reply

* Re: Question about "git commit -a"
From: Nguyen Thai Ngoc Duy @ 2007-10-04 21:16 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Wincent Colaiuta, Paolo Ciarrocchi, Git Mailing List
In-Reply-To: <Pine.LNX.4.64.0710042209410.4174@racer.site>

On 10/5/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Fri, 5 Oct 2007, Nguyen Thai Ngoc Duy wrote:
>
> > On 10/4/07, Wincent Colaiuta <win@wincent.com> wrote:
> > > > Am I wrong?
> > >
> > > About it being a majority, yes, I suspect so.
> > >
> >
> > Maybe in the next survey we should include question "do you usually do
> > 'git commit' or 'git commit -a'" :-)
>
> Not meaning to discourage you, but it is a known fact that Linus does "git
> commit" without "-a" quite often.
>
> And if that were not bad enough for your plan, I myself omit "-a"
> regularly.  So you would get a veto from me, too.

I obviously forgot to mention I do use git-commit without -a. I just
wanted to know which way the real majority of git users prefers.
-- 
Duy

^ permalink raw reply

* [PATCH 3/3] Change all instances of memcmp(buffer, CONSTANT, strlen(CONSTANT) for prefixcmp()
From: Andy Parkins @ 2007-10-04 21:10 UTC (permalink / raw)
  To: git

Revision cc44c7655 changed most strncmp() instances for prefixcmp().
That patch missed the functionally equivalent memcmp() calls, that were
candidates for the same change.

This patch changes every memcmp() call where one of the compared strings
is a constant for an appropriate call to prefixcmp().

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
 builtin-apply.c                           |   20 ++++++++++----------
 builtin-cat-file.c                        |    2 +-
 builtin-fetch--tool.c                     |    2 +-
 builtin-fsck.c                            |    6 +++---
 builtin-mailinfo.c                        |   22 +++++++++++-----------
 builtin-mailsplit.c                       |    2 +-
 builtin-tar-tree.c                        |    2 +-
 combine-diff.c                            |    2 +-
 commit.c                                  |   14 +++++++-------
 connect.c                                 |    8 ++++----
 contrib/convert-objects/convert-objects.c |    6 +++---
 convert.c                                 |    4 ++--
 fast-import.c                             |    2 +-
 fetch-pack.c                              |    2 +-
 http-fetch.c                              |    4 ++--
 imap-send.c                               |   10 +++++-----
 mktag.c                                   |    8 ++++----
 patch-id.c                                |   10 +++++-----
 path.c                                    |    8 ++++----
 receive-pack.c                            |    2 +-
 refs.c                                    |    4 ++--
 send-pack.c                               |    8 ++++----
 tag.c                                     |    6 +++---
 xdiff-interface.c                         |    2 +-
 24 files changed, 78 insertions(+), 78 deletions(-)

diff --git a/builtin-apply.c b/builtin-apply.c
index 05c6bc3..cac5d65 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -205,7 +205,7 @@ static unsigned long linelen(const char *buffer, unsigned long size)
 
 static int is_dev_null(const char *str)
 {
-	return !memcmp("/dev/null", str, 9) && isspace(str[9]);
+	return !prefixcmp(str, "/dev/null") && isspace(str[9]);
 }
 
 #define TERM_SPACE	1
@@ -411,7 +411,7 @@ static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name,
 	}
 	else {
 		/* expect "/dev/null" */
-		if (memcmp("/dev/null", line, 9) || line[9] != '\n')
+		if (prefixcmp(line, "/dev/null") || line[9] != '\n')
 			die("git-apply: bad git-diff - expected /dev/null on line %d", linenr);
 		return NULL;
 	}
@@ -839,7 +839,7 @@ static int find_header(char *line, unsigned long size, int *hdrsize, struct patc
 		 * That's a sign that we didn't find a header, and that a
 		 * patch has become corrupted/broken up.
 		 */
-		if (!memcmp("@@ -", line, 4)) {
+		if (!prefixcmp(line, "@@ -")) {
 			struct fragment dummy;
 			if (parse_fragment_header(line, len, &dummy) < 0)
 				continue;
@@ -854,7 +854,7 @@ static int find_header(char *line, unsigned long size, int *hdrsize, struct patc
 		 * Git patch? It might not have a real patch, just a rename
 		 * or mode change, so we handle that specially
 		 */
-		if (!memcmp("diff --git ", line, 11)) {
+		if (!prefixcmp(line, "diff --git ")) {
 			int git_hdr_len = parse_git_header(line, len, size, patch);
 			if (git_hdr_len <= len)
 				continue;
@@ -869,7 +869,7 @@ static int find_header(char *line, unsigned long size, int *hdrsize, struct patc
 		}
 
 		/** --- followed by +++ ? */
-		if (memcmp("--- ", line,  4) || memcmp("+++ ", line + len, 4))
+		if (prefixcmp(line, "--- ") || prefixcmp(line + len, "+++ "))
 			continue;
 
 		/*
@@ -878,7 +878,7 @@ static int find_header(char *line, unsigned long size, int *hdrsize, struct patc
 		 * minimum
 		 */
 		nextlen = linelen(line + len, size - len);
-		if (size < nextlen + 14 || memcmp("@@ -", line + len + nextlen, 4))
+		if (size < nextlen + 14 || prefixcmp(line + len + nextlen, "@@ -"))
 			continue;
 
 		/* Ok, we'll consider it a patch */
@@ -1003,7 +1003,7 @@ static int parse_fragment(char *line, unsigned long size, struct patch *patch, s
 		 * l10n of "\ No newline..." is at least that long.
 		 */
 		case '\\':
-			if (len < 12 || memcmp(line, "\\ ", 2))
+			if (len < 12 || prefixcmp(line, "\\ "))
 				return -1;
 			break;
 		}
@@ -1017,7 +1017,7 @@ static int parse_fragment(char *line, unsigned long size, struct patch *patch, s
 	 * it in the above loop because we hit oldlines == newlines == 0
 	 * before seeing it.
 	 */
-	if (12 < size && !memcmp(line, "\\ ", 2))
+	if (12 < size && !prefixcmp(line, "\\ "))
 		offset += linelen(line, size);
 
 	patch->lines_added += added;
@@ -1036,7 +1036,7 @@ static int parse_single_patch(char *line, unsigned long size, struct patch *patc
 	unsigned long oldlines = 0, newlines = 0, context = 0;
 	struct fragment **fragp = &patch->fragments;
 
-	while (size > 4 && !memcmp(line, "@@ -", 4)) {
+	while (size > 4 && !prefixcmp(line, "@@ -")) {
 		struct fragment *fragment;
 		int len;
 
@@ -1316,7 +1316,7 @@ static int parse_chunk(char *buffer, unsigned long size, struct patch *patch)
 			else
 				patchsize = 0;
 		}
-		else if (!memcmp(" differ\n", buffer + hd + llen - 8, 8)) {
+		else if (!prefixcmp(buffer + hd + llen - 8, " differ\n")) {
 			for (i = 0; binhdr[i]; i++) {
 				int len = strlen(binhdr[i]);
 				if (len < size - hd &&
diff --git a/builtin-cat-file.c b/builtin-cat-file.c
index f132d58..4f91c31 100644
--- a/builtin-cat-file.c
+++ b/builtin-cat-file.c
@@ -19,7 +19,7 @@ static void pprint_tag(const unsigned char *sha1, const char *buf, unsigned long
 		char c = *cp++;
 		if (c != '\n')
 			continue;
-		if (7 <= endp - cp && !memcmp("tagger ", cp, 7)) {
+		if (7 <= endp - cp && !prefixcmp(cp, "tagger ")) {
 			const char *tagger = cp;
 
 			/* Found the tagger line.  Copy out the contents
diff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c
index cdb64cc..3362618 100644
--- a/builtin-fetch--tool.c
+++ b/builtin-fetch--tool.c
@@ -384,7 +384,7 @@ static int expand_refs_wildcard(const char *ls_remote_result, int numrefs,
 				ls++;
 			next = strchr(ls, '\n');
 			eol = !next ? (ls + strlen(ls)) : next;
-			if (!memcmp("^{}", eol-3, 3))
+			if (!prefixcmp(eol-3, "^{}"))
 				continue;
 			if (eol - ls < 40)
 				continue;
diff --git a/builtin-fsck.c b/builtin-fsck.c
index 83a2d0c..2229ea9 100644
--- a/builtin-fsck.c
+++ b/builtin-fsck.c
@@ -359,17 +359,17 @@ static int fsck_commit(struct commit *commit)
 		fprintf(stderr, "Checking commit %s\n",
 			sha1_to_hex(commit->object.sha1));
 
-	if (memcmp(buffer, "tree ", 5))
+	if (prefixcmp(buffer, "tree "))
 		return objerror(&commit->object, "invalid format - expected 'tree' line");
 	if (get_sha1_hex(buffer+5, tree_sha1) || buffer[45] != '\n')
 		return objerror(&commit->object, "invalid 'tree' line format - bad sha1");
 	buffer += 46;
-	while (!memcmp(buffer, "parent ", 7)) {
+	while (!prefixcmp(buffer, "parent ")) {
 		if (get_sha1_hex(buffer+7, sha1) || buffer[47] != '\n')
 			return objerror(&commit->object, "invalid 'parent' line format - bad sha1");
 		buffer += 48;
 	}
-	if (memcmp(buffer, "author ", 7))
+	if (prefixcmp(buffer, "author "))
 		return objerror(&commit->object, "invalid format - expected 'author' line");
 	free(commit->buffer);
 	commit->buffer = NULL;
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index d7cb11d..d2d25f8 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -242,7 +242,7 @@ static char *cleanup_subject(char *subject)
 		int len, remove;
 		switch (*subject) {
 		case 'r': case 'R':
-			if (!memcmp("e:", subject+1, 2)) {
+			if (!prefixcmp(subject+1, "e:")) {
 				subject += 3;
 				continue;
 			}
@@ -330,11 +330,11 @@ static int check_header(char *line, unsigned linesize, char **hdr_data, int over
 	}
 
 	/* for inbody stuff */
-	if (!memcmp(">From", line, 5) && isspace(line[5]))
+	if (!prefixcmp(line, ">From") && isspace(line[5]))
 		return 1;
-	if (!memcmp("[PATCH]", line, 7) && isspace(line[7])) {
+	if (!prefixcmp(line, "[PATCH]") && isspace(line[7])) {
 		for (i = 0; header[i]; i++) {
-			if (!memcmp("Subject: ", header[i], 9)) {
+			if (!prefixcmp(header[i], "Subject: ")) {
 				if (! handle_header(line, hdr_data[i], 0)) {
 					return 1;
 				}
@@ -360,7 +360,7 @@ static int is_rfc2822_header(char *line)
 	char *cp = line;
 
 	/* Count mbox From headers as headers */
-	if (!memcmp(line, "From ", 5) || !memcmp(line, ">From ", 6))
+	if (!prefixcmp(line, "From ") || !prefixcmp(line, ">From "))
 		return 1;
 
 	while ((ch = *cp++)) {
@@ -656,7 +656,7 @@ static int handle_boundary(void)
 {
 	char newline[]="\n";
 again:
-	if (!memcmp(line+content_top->boundary_len, "--", 2)) {
+	if (!prefixcmp(line+content_top->boundary_len, "--")) {
 		/* we hit an end boundary */
 		/* pop the current boundary off the stack */
 		free(content_top->boundary);
@@ -693,18 +693,18 @@ again:
 static inline int patchbreak(const char *line)
 {
 	/* Beginning of a "diff -" header? */
-	if (!memcmp("diff -", line, 6))
+	if (!prefixcmp(line, "diff -"))
 		return 1;
 
 	/* CVS "Index: " line? */
-	if (!memcmp("Index: ", line, 7))
+	if (!prefixcmp(line, "Index: "))
 		return 1;
 
 	/*
 	 * "--- <filename>" starts patches without headers
 	 * "---<sp>*" is a manual separator
 	 */
-	if (!memcmp("---", line, 3)) {
+	if (!prefixcmp(line, "---")) {
 		line += 3;
 		/* space followed by a filename? */
 		if (line[0] == ' ' && !isspace(line[1]))
@@ -892,7 +892,7 @@ static void handle_info(void)
 		else
 			continue;
 
-		if (!memcmp(header[i], "Subject", 7)) {
+		if (!prefixcmp(header[i], "Subject")) {
 			if (keep_subject)
 				sub = hdr;
 			else {
@@ -900,7 +900,7 @@ static void handle_info(void)
 				cleanup_space(sub);
 			}
 			output_header_lines(fout, "Subject", sub);
-		} else if (!memcmp(header[i], "From", 4)) {
+		} else if (!prefixcmp(header[i], "From")) {
 			handle_from(hdr);
 			fprintf(fout, "Author: %s\n", name);
 			fprintf(fout, "Email: %s\n", email);
diff --git a/builtin-mailsplit.c b/builtin-mailsplit.c
index 43fc373..0d10798 100644
--- a/builtin-mailsplit.c
+++ b/builtin-mailsplit.c
@@ -15,7 +15,7 @@ static int is_from_line(const char *line, int len)
 {
 	const char *colon;
 
-	if (len < 20 || memcmp("From ", line, 5))
+	if (len < 20 || prefixcmp(line, "From "))
 		return 0;
 
 	colon = line + len - 2;
diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c
index b04719e..0f9f03c 100644
--- a/builtin-tar-tree.c
+++ b/builtin-tar-tree.c
@@ -79,7 +79,7 @@ int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix)
 		die("git-get-tar-commit-id: read error");
 	if (header->typeflag[0] != 'g')
 		return 1;
-	if (memcmp(content, "52 comment=", 11))
+	if (prefixcmp(content, "52 comment="))
 		return 1;
 
 	n = write_in_full(1, content + 11, 41);
diff --git a/combine-diff.c b/combine-diff.c
index fe5a2a1..bdfb033 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -156,7 +156,7 @@ struct combine_diff_state {
 static void consume_line(void *state_, char *line, unsigned long len)
 {
 	struct combine_diff_state *state = state_;
-	if (5 < len && !memcmp("@@ -", line, 4)) {
+	if (5 < len && !prefixcmp(line, "@@ -")) {
 		if (parse_hunk_header(line, len,
 				      &state->ob, &state->on,
 				      &state->nb, &state->nn))
diff --git a/commit.c b/commit.c
index 20fb220..6de2e3b 100644
--- a/commit.c
+++ b/commit.c
@@ -109,11 +109,11 @@ static unsigned long parse_commit_date(const char *buf)
 {
 	unsigned long date;
 
-	if (memcmp(buf, "author", 6))
+	if (prefixcmp(buf, "author"))
 		return 0;
 	while (*buf++ != '\n')
 		/* nada */;
-	if (memcmp(buf, "committer", 9))
+	if (prefixcmp(buf, "committer"))
 		return 0;
 	while (*buf++ != '>')
 		/* nada */;
@@ -293,7 +293,7 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size)
 		return 0;
 	item->object.parsed = 1;
 	tail += size;
-	if (tail <= bufptr + 5 || memcmp(bufptr, "tree ", 5))
+	if (tail <= bufptr + 5 || prefixcmp(bufptr, "tree "))
 		return error("bogus commit object %s", sha1_to_hex(item->object.sha1));
 	if (tail <= bufptr + 45 || get_sha1_hex(bufptr + 5, parent) < 0)
 		return error("bad tree pointer in commit %s",
@@ -305,7 +305,7 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size)
 	pptr = &item->parents;
 
 	graft = lookup_commit_graft(item->object.sha1);
-	while (bufptr + 48 < tail && !memcmp(bufptr, "parent ", 7)) {
+	while (bufptr + 48 < tail && !prefixcmp(bufptr, "parent ")) {
 		struct commit *new_parent;
 
 		if (tail <= bufptr + 48 ||
@@ -915,7 +915,7 @@ static void pp_header(enum cmit_fmt fmt,
 			continue;
 		}
 
-		if (!memcmp(line, "parent ", 7)) {
+		if (!prefixcmp(line, "parent ")) {
 			if (linelen != 48)
 				die("bad parent line in commit");
 			continue;
@@ -939,11 +939,11 @@ static void pp_header(enum cmit_fmt fmt,
 		 * FULL shows both authors but not dates.
 		 * FULLER shows both authors and dates.
 		 */
-		if (!memcmp(line, "author ", 7)) {
+		if (!prefixcmp(line, "author ")) {
 			strbuf_grow(sb, linelen + 80);
 			add_user_info("Author", fmt, sb, line + 7, dmode, encoding);
 		}
-		if (!memcmp(line, "committer ", 10) &&
+		if (!prefixcmp(line, "committer ") &&
 		    (fmt == CMIT_FMT_FULL || fmt == CMIT_FMT_FULLER)) {
 			strbuf_grow(sb, linelen + 80);
 			add_user_info("Commit", fmt, sb, line + 10, dmode, encoding);
diff --git a/connect.c b/connect.c
index 94c2d60..7c24711 100644
--- a/connect.c
+++ b/connect.c
@@ -13,7 +13,7 @@ static int check_ref(const char *name, int len, unsigned int flags)
 	if (!flags)
 		return 1;
 
-	if (len < STRLEN_PATH_REFS || memcmp(name, PATH_REFS, STRLEN_PATH_REFS))
+	if (len < STRLEN_PATH_REFS || prefixcmp(name, PATH_REFS))
 		return 0;
 
 	/* Skip the "refs/" part */
@@ -25,11 +25,11 @@ static int check_ref(const char *name, int len, unsigned int flags)
 		return 0;
 
 	/* REF_HEADS means that we want regular branch heads */
-	if ((flags & REF_HEADS) && !memcmp(name, PATH_HEADS, STRLEN_PATH_HEADS))
+	if ((flags & REF_HEADS) && !prefixcmp(name, PATH_HEADS))
 		return 1;
 
 	/* REF_TAGS means that we want tags */
-	if ((flags & REF_TAGS) && !memcmp(name, PATH_TAGS, STRLEN_PATH_TAGS))
+	if ((flags & REF_TAGS) && !prefixcmp(name, PATH_TAGS))
 		return 1;
 
 	/* All type bits clear means that we are ok with anything */
@@ -391,7 +391,7 @@ static int git_proxy_command_options(const char *var, const char *value)
 		if (0 <= matchlen) {
 			/* core.gitproxy = none for kernel.org */
 			if (matchlen == 4 &&
-			    !memcmp(value, "none", 4))
+			    !prefixcmp(value, "none"))
 				matchlen = 0;
 			git_proxy_command = xmemdupz(value, matchlen);
 		}
diff --git a/contrib/convert-objects/convert-objects.c b/contrib/convert-objects/convert-objects.c
index 90e7900..08c1961 100644
--- a/contrib/convert-objects/convert-objects.c
+++ b/contrib/convert-objects/convert-objects.c
@@ -245,7 +245,7 @@ static void convert_date(void *buffer, unsigned long size, unsigned char *result
 	size -= 46;
 
 	/* "parent <sha1>\n" */
-	while (!memcmp(buffer, "parent ", 7)) {
+	while (!prefixcmp(buffer, "parent ")) {
 		memcpy(new + newlen, buffer, 48);
 		newlen += 48;
 		buffer = (char *) buffer + 48;
@@ -270,11 +270,11 @@ static void convert_commit(void *buffer, unsigned long size, unsigned char *resu
 	void *orig_buffer = buffer;
 	unsigned long orig_size = size;
 
-	if (memcmp(buffer, "tree ", 5))
+	if (prefixcmp(buffer, "tree "))
 		die("Bad commit '%s'", (char*) buffer);
 	convert_ascii_sha1((char *) buffer + 5);
 	buffer = (char *) buffer + 46;    /* "tree " + "hex sha1" + "\n" */
-	while (!memcmp(buffer, "parent ", 7)) {
+	while (!prefixcmp(buffer, "parent ")) {
 		convert_ascii_sha1((char *) buffer + 7);
 		buffer = (char *) buffer + 48;
 	}
diff --git a/convert.c b/convert.c
index 0d5e909..cf11235 100644
--- a/convert.c
+++ b/convert.c
@@ -389,7 +389,7 @@ static int count_ident(const char *cp, unsigned long size)
 			continue;
 		if (size < 3)
 			break;
-		if (memcmp("Id", cp, 2))
+		if (prefixcmp(cp, "Id"))
 			continue;
 		ch = cp[2];
 		cp += 3;
@@ -433,7 +433,7 @@ static int ident_to_git(const char *path, const char *src, size_t len,
 		len -= dollar + 1 - src;
 		src  = dollar + 1;
 
-		if (len > 3 && !memcmp(src, "Id:", 3)) {
+		if (len > 3 && !prefixcmp(src, "Id:")) {
 			dollar = memchr(src + 3, '$', len - 3);
 			if (!dollar)
 				break;
diff --git a/fast-import.c b/fast-import.c
index e9c80be..ead3392 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1903,7 +1903,7 @@ static void cmd_from_commit(struct branch *b, char *buf, unsigned long size)
 {
 	if (!buf || size < 46)
 		die("Not a valid commit: %s", sha1_to_hex(b->sha1));
-	if (memcmp("tree ", buf, 5)
+	if (prefixcmp(buf, "tree ")
 		|| get_sha1_hex(buf + 5, b->branch_tree.versions[1].sha1))
 		die("The commit %s is corrupt", sha1_to_hex(b->sha1));
 	hashcpy(b->branch_tree.versions[0].sha1,
diff --git a/fetch-pack.c b/fetch-pack.c
index c3b7ef6..bf5e84d 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -344,7 +344,7 @@ static void filter_refs(struct ref **refs, int nr_match, char **match)
 
 	for (ref = *refs; ref; ref = next) {
 		next = ref->next;
-		if (!memcmp(ref->name, PATH_REFS, STRLEN_PATH_REFS) &&
+		if (!prefixcmp(ref->name, PATH_REFS) &&
 		    check_ref_format(ref->name + STRLEN_PATH_REFS))
 			; /* trash */
 		else if (fetch_all &&
diff --git a/http-fetch.c b/http-fetch.c
index 2680fbd..9583579 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -528,7 +528,7 @@ static void process_alternates_response(void *callback_data)
 						     - base);
 					okay = 1;
 				}
-			} else if (!memcmp(data + i, "../", 3)) {
+			} else if (!prefixcmp(data + i, "../")) {
 				/* Relative URL; chop the corresponding
 				 * number of subpath from base (and ../
 				 * from data), and concatenate the result.
@@ -549,7 +549,7 @@ static void process_alternates_response(void *callback_data)
 				i += 3;
 				serverlen = strlen(base);
 				while (i + 2 < posn &&
-				       !memcmp(data + i, "../", 3)) {
+				       !prefixcmp(data + i, "../")) {
 					do {
 						serverlen--;
 					} while (serverlen &&
diff --git a/imap-send.c b/imap-send.c
index a429a76..6d924fc 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -464,7 +464,7 @@ v_issue_imap_cmd( imap_store_t *ctx, struct imap_cmd_cb *cb,
 	if (Verbose) {
 		if (imap->num_in_progress)
 			printf( "(%d in progress) ", imap->num_in_progress );
-		if (memcmp( cmd->cmd, "LOGIN", 5 ))
+		if (prefixcmp( cmd->cmd, "LOGIN" ))
 			printf( ">>> %s", buf );
 		else
 			printf( ">>> %d LOGIN <user> <pass>\n", cmd->tag );
@@ -644,7 +644,7 @@ parse_imap_list_l( imap_t *imap, char **sp, list_t **curp, int level )
 				if (level && *s == ')')
 					break;
 			cur->len = s - p;
-			if (cur->len == 3 && !memcmp ("NIL", p, 3)) {
+			if (cur->len == 3 && !prefixcmp(p, "NIL")) {
 				cur->val = NIL;
 			} else {
 				cur->val = xmemdupz(p, cur->len);
@@ -824,7 +824,7 @@ get_cmd_result( imap_store_t *ctx, struct imap_cmd *tcmd )
 				resp = DRV_OK;
 			else {
 				if (!strcmp( "NO", arg )) {
-					if (cmdp->cb.create && cmd && (cmdp->cb.trycreate || !memcmp( cmd, "[TRYCREATE]", 11 ))) { /* SELECT, APPEND or UID COPY */
+					if (cmdp->cb.create && cmd && (cmdp->cb.trycreate || !prefixcmp( cmd, "[TRYCREATE]" ))) { /* SELECT, APPEND or UID COPY */
 						p = strchr( cmdp->cmd, '"' );
 						if (!issue_imap_cmd( ctx, NULL, "CREATE \"%.*s\"", strchr( p + 1, '"' ) - p + 1, p )) {
 							resp = RESP_BAD;
@@ -849,7 +849,7 @@ get_cmd_result( imap_store_t *ctx, struct imap_cmd *tcmd )
 				} else /*if (!strcmp( "BAD", arg ))*/
 					resp = RESP_BAD;
 				fprintf( stderr, "IMAP command '%s' returned response (%s) - %s\n",
-					 memcmp (cmdp->cmd, "LOGIN", 5) ?
+					 prefixcmp(cmdp->cmd, "LOGIN") ?
 							cmdp->cmd : "LOGIN <user> <pass>",
 							arg, cmd ? cmd : "");
 			}
@@ -1079,7 +1079,7 @@ imap_store_msg( store_t *gctx, msg_data_t *data, int *uid )
 					sbreak = ebreak = i - 2 + nocr;
 					goto mktid;
 				}
-				if (!memcmp( fmap + start, "X-TUID: ", 8 )) {
+				if (!prefixcmp( fmap + start, "X-TUID: " )) {
 					extra -= (ebreak = i) - (sbreak = start) + nocr;
 					goto mktid;
 				}
diff --git a/mktag.c b/mktag.c
index b05260c..7a19110 100644
--- a/mktag.c
+++ b/mktag.c
@@ -52,7 +52,7 @@ static int verify_tag(char *buffer, unsigned long size)
 
 	/* Verify object line */
 	object = buffer;
-	if (memcmp(object, "object ", 7))
+	if (prefixcmp(object, "object "))
 		return error("char%d: does not start with \"object \"", 0);
 
 	if (get_sha1_hex(object + 7, sha1))
@@ -60,7 +60,7 @@ static int verify_tag(char *buffer, unsigned long size)
 
 	/* Verify type line */
 	type_line = object + 48;
-	if (memcmp(type_line - 1, "\ntype ", 6))
+	if (prefixcmp(type_line - 1, "\ntype "))
 		return error("char%d: could not find \"\\ntype \"", 47);
 
 	/* Verify tag-line */
@@ -68,7 +68,7 @@ static int verify_tag(char *buffer, unsigned long size)
 	if (!tag_line)
 		return error("char" PD_FMT ": could not find next \"\\n\"", type_line - buffer);
 	tag_line++;
-	if (memcmp(tag_line, "tag ", 4) || tag_line[4] == '\n')
+	if (prefixcmp(tag_line, "tag ") || tag_line[4] == '\n')
 		return error("char" PD_FMT ": no \"tag \" found", tag_line - buffer);
 
 	/* Get the actual type */
@@ -97,7 +97,7 @@ static int verify_tag(char *buffer, unsigned long size)
 	/* Verify the tagger line */
 	tagger_line = tag_line;
 
-	if (memcmp(tagger_line, "tagger", 6) || (tagger_line[6] == '\n'))
+	if (prefixcmp(tagger_line, "tagger") || (tagger_line[6] == '\n'))
 		return error("char" PD_FMT ": could not find \"tagger\"", tagger_line - buffer);
 
 	/* TODO: check for committer info + blank line? */
diff --git a/patch-id.c b/patch-id.c
index 9349bc5..390f7a7 100644
--- a/patch-id.c
+++ b/patch-id.c
@@ -40,9 +40,9 @@ static void generate_id_list(void)
 		char *p = line;
 		int len;
 
-		if (!memcmp(line, "diff-tree ", 10))
+		if (!prefixcmp(line, "diff-tree "))
 			p += 10;
-		else if (!memcmp(line, "commit ", 7))
+		else if (!prefixcmp(line, "commit "))
 			p += 7;
 
 		if (!get_sha1_hex(p, n)) {
@@ -53,15 +53,15 @@ static void generate_id_list(void)
 		}
 
 		/* Ignore commit comments */
-		if (!patchlen && memcmp(line, "diff ", 5))
+		if (!patchlen && prefixcmp(line, "diff "))
 			continue;
 
 		/* Ignore git-diff index header */
-		if (!memcmp(line, "index ", 6))
+		if (!prefixcmp(line, "index "))
 			continue;
 
 		/* Ignore line numbers when computing the SHA1 of the patch */
-		if (!memcmp(line, "@@ -", 4))
+		if (!prefixcmp(line, "@@ -"))
 			continue;
 
 		/* Compute the sha without whitespace */
diff --git a/path.c b/path.c
index d330bbc..037f2ef 100644
--- a/path.c
+++ b/path.c
@@ -25,7 +25,7 @@ static char *get_pathname(void)
 static char *cleanup_path(char *path)
 {
 	/* Clean it up */
-	if (!memcmp(path, "./", 2)) {
+	if (!prefixcmp(path, "./")) {
 		path += 2;
 		while (*path == '/')
 			path++;
@@ -100,7 +100,7 @@ int validate_headref(const char *path)
 	/* Make sure it is a "refs/.." symlink */
 	if (S_ISLNK(st.st_mode)) {
 		len = readlink(path, buffer, sizeof(buffer)-1);
-		if (len >= STRLEN_PATH_REFS && !memcmp(PATH_REFS, buffer, STRLEN_PATH_REFS))
+		if (len >= STRLEN_PATH_REFS && !prefixcmp(PATH_REFS, buffer))
 			return 0;
 		return -1;
 	}
@@ -119,12 +119,12 @@ int validate_headref(const char *path)
 	 */
 	if (len < 4)
 		return -1;
-	if (!memcmp("ref:", buffer, 4)) {
+	if (!prefixcmp(buffer, "ref:")) {
 		buf = buffer + 4;
 		len -= 4;
 		while (len && isspace(*buf))
 			buf++, len--;
-		if (len >= STRLEN_PATH_REFS && !memcmp(PATH_REFS, buf, STRLEN_PATH_REFS))
+		if (len >= STRLEN_PATH_REFS && !prefixcmp(PATH_REFS, buf))
 			return 0;
 	}
 
diff --git a/receive-pack.c b/receive-pack.c
index 114ea38..c8e94b6 100644
--- a/receive-pack.c
+++ b/receive-pack.c
@@ -415,7 +415,7 @@ static const char *unpack(void)
 		     len < 46 && (s = xread(ip.out, packname+len, 46-len)) > 0;
 		     len += s);
 		if (len == 46 && packname[45] == '\n' &&
-		    memcmp(packname, "keep\t", 5) == 0) {
+		    prefixcmp(packname, "keep\t") == 0) {
 			char path[PATH_MAX];
 			packname[45] = 0;
 			snprintf(path, sizeof(path), "%s/pack/pack-%s.keep",
diff --git a/refs.c b/refs.c
index 5891609..ba3b5c8 100644
--- a/refs.c
+++ b/refs.c
@@ -409,7 +409,7 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
 		/* Follow "normalized" - ie "refs/.." symlinks by hand */
 		if (S_ISLNK(st.st_mode)) {
 			len = readlink(path, buffer, sizeof(buffer)-1);
-			if (len >= STRLEN_PATH_REFS && !memcmp(PATH_REFS, buffer, STRLEN_PATH_REFS)) {
+			if (len >= STRLEN_PATH_REFS && !prefixcmp(buffer, PATH_REFS)) {
 				buffer[len] = 0;
 				strcpy(ref_buffer, buffer);
 				ref = ref_buffer;
@@ -438,7 +438,7 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
 		/*
 		 * Is it a symbolic ref?
 		 */
-		if (len < 4 || memcmp("ref:", buffer, 4))
+		if (len < 4 || prefixcmp(buffer, "ref:"))
 			break;
 		buf = buffer + 4;
 		len -= 4;
diff --git a/send-pack.c b/send-pack.c
index f74e66a..efafab1 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -151,11 +151,11 @@ static int receive_status(int in)
 	char line[1000];
 	int ret = 0;
 	int len = packet_read_line(in, line, sizeof(line));
-	if (len < 10 || memcmp(line, "unpack ", 7)) {
+	if (len < 10 || prefixcmp(line, "unpack ")) {
 		fprintf(stderr, "did not receive status back\n");
 		return -1;
 	}
-	if (memcmp(line, "unpack ok\n", 10)) {
+	if (prefixcmp(line, "unpack ok\n")) {
 		fputs(line, stderr);
 		ret = -1;
 	}
@@ -164,12 +164,12 @@ static int receive_status(int in)
 		if (!len)
 			break;
 		if (len < 3 ||
-		    (memcmp(line, "ok", 2) && memcmp(line, "ng", 2))) {
+		    (prefixcmp(line, "ok") && prefixcmp(line, "ng"))) {
 			fprintf(stderr, "protocol error: %s\n", line);
 			ret = -1;
 			break;
 		}
-		if (!memcmp(line, "ok", 2))
+		if (!prefixcmp(line, "ok"))
 			continue;
 		fputs(line, stderr);
 		ret = -1;
diff --git a/tag.c b/tag.c
index f62bcdd..305529b 100644
--- a/tag.c
+++ b/tag.c
@@ -46,15 +46,15 @@ int parse_tag_buffer(struct tag *item, void *data, unsigned long size)
 
 	if (size < 64)
 		return -1;
-	if (memcmp("object ", data, 7) || get_sha1_hex((char *) data + 7, sha1))
+	if (prefixcmp(data, "object ") || get_sha1_hex((char *) data + 7, sha1))
 		return -1;
 
 	type_line = (char *) data + 48;
-	if (memcmp("\ntype ", type_line-1, 6))
+	if (prefixcmp(type_line-1, "\ntype "))
 		return -1;
 
 	tag_line = strchr(type_line, '\n');
-	if (!tag_line || memcmp("tag ", ++tag_line, 4))
+	if (!tag_line || prefixcmp(++tag_line, "tag "))
 		return -1;
 
 	sig_line = strchr(tag_line, '\n');
diff --git a/xdiff-interface.c b/xdiff-interface.c
index be866d1..06d4f8b 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -44,7 +44,7 @@ int parse_hunk_header(char *line, int len,
 	}
 	else
 		*nn = 1;
-	return -!!memcmp(cp, " @@", 3);
+	return -!!prefixcmp(cp, " @@");
 }
 
 static void consume_one(void *priv_, char *s, unsigned long size)
-- 
1.5.3.rc5.11.g312e

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox