Commit graph

18834 commits

Author SHA1 Message Date
Alex Riesen 713697b34f ls-tree manpage: use "unless" instead of "when ... is not"
Delayed negation in a statement is harder to spot and keep in mind.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-10 09:32:29 -07:00
Christian Couder 47c9739e5e am: simplify "sq" function by using "git rev-parse --sq-quote"
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-10 00:30:29 -07:00
Christian Couder de52f5a806 bisect: use "git rev-parse --sq-quote" instead of a custom "sq" function
As the "sq" function was the only place using Perl in "git-bisect.sh",
this removes the Perl dependency in this script.

While at it, we also remove the sed instruction in the Makefile that
substituted @@PERL@@ with the Perl path in shell scripts, as this is
not needed anymore. (It is now only needed in "git-instaweb.sh" but
this command is dealt with separately in the Makefile.)

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-10 00:30:28 -07:00
Christian Couder 503253771e rev-parse: add --sq-quote to shell quote arguments
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-10 00:30:28 -07:00
Christian Couder 38ef7507d1 rev-list: remove stringed output flag from "show_bisect_vars"
Because it was used only by "git bisect--helper --next-vars" but
the "--next-vars" option has been removed.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-10 00:30:28 -07:00
Christian Couder c99f069de2 bisect--helper: remove "--next-vars" option as it is now useless
Because it has been replaced by "--next-exit".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-10 00:30:28 -07:00
Christian Couder 5a1d31c7e4 bisect: use "git bisect--helper --next-exit" in "git-bisect.sh"
instead of "git bisect--helper --next-vars".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-10 00:30:28 -07:00
Christian Couder ef24c7ca05 bisect--helper: add "--next-exit" to output bisect results
The goal of this patch is to port more shell code from the "bisect_next"
function in "git-bisect.sh" to C code in "builtin-bisect--helper.c".

So we port the code that interprets the bisection result and stops or
continues (by checking out the next revision) the bisection process.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-10 00:30:28 -07:00
Christian Couder 2ace9727be bisect: move common bisect functionality to "bisect_common"
So we can easily reuse the code in a later patch.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-10 00:30:28 -07:00
Christian Couder 280e65cbd8 rev-list: refactor printing bisect vars
This simplifies the code, and while at it we create the
"print_commit_list" function that will be reused later.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-10 00:30:28 -07:00
Christian Couder 1c876546bd rev-list: make "estimate_bisect_steps" non static
Because it will be used from "bisect.c" too.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-10 00:30:28 -07:00
Dave Olszewski bf74106a5b merge-recursive: never leave index unmerged while recursing
When you are trying to come up with the final result (i.e. depth=0), you
want to record how the conflict arose by registering the state of the
common ancestor, your branch and the other branch in the index, hence you
want to do update_stages().

When you are merging with positive depth, that is because of a criss-cross
merge situation.  In such a case, you would need to record the tentative
result, with conflict markers and all, as if the merge went cleanly, even
if there are conflicts, in order to write it out as a tree object later to
be used as a common ancestor tree.

update_file() calls update_file_flags() with update_cache=1 to signal that
the result needs to be written to the index at stage #0 (i.e. merged), and
the code should not clobber the index further by calling update_stages().

The codepath to deal with rename/delete conflict in a recursive merge
however left the index unmerged.

Signed-off-by: Dave Olszewski <cxreg@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 21:05:52 -07:00
Linus Torvalds 53996fe539 Teach 'git checkout' to preload the index contents
This makes git checkout know to use the threaded index preloading if it
is enabled in the config file. You need to have

	[core]
		preloadindex = true

in your config file to see it, and for that feature to make sense your
filesystem needs to be able to do concurrent 'lstat()' lookups, but when
that is the case (especially NFS over a high-latency network), this can
be a noticeable performance win.

But with a low-latency network and at least older Linux NFS clients, this
will clearly potentially cause a lot of lock contention. It may still
speed up the uncached case, but the threading and locking overhead will
result in the cached case likely slowing down.

That was almost certainly fixed by Linux commit fc0f684c2 ("NFS: Remove
BKL from NFS lookup code"), but that one got merged into 2.6.27-rc1, so
older kernel versions than 2.6.27 will not scale very well.

But regardless, it's the right thing to do. If your filesystem doesn't
scale, don't enable index preloading.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 20:42:39 -07:00
Linus Torvalds 658dd48c85 Avoid unnecessary 'lstat()' calls in 'get_stat_data()'
When we ask get_stat_data() to get the mode and size of an index entry,
we can avoid the lstat() call if we have marked the index entry as being
uptodate due to earlier lstat() calls.

This avoids a lot of unnecessary lstat() calls in eg 'git checkout',
where the last phase shows the differences to the working tree
(requiring a diff), but earlier phases have already verified the index.

On the kernel repo (with a fast machine and everything cached), this
changes timings of a nul 'git checkout' from

 - Before (best of ten):

	0.14user 0.05system 0:00.19elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+13237minor)pagefaults 0swaps

 - After
	0.11user 0.03system 0:00.15elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+13235minor)pagefaults 0swaps

so it can obviously be noticeable, although equally obviously it's not a
show-stopper on this particular machine. The difference is likely larger
on slower machines, or with operating systems that don't do as good a job
of name caching.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 20:42:19 -07:00
Junio C Hamano 6345d7a0d1 Merge branch 'maint'
* maint:
  Documentation: cloning to empty directory is allowed
  Clarify kind of conflict in merge-one-file helper
  git config: clarify --add and --get-color
  archive-tar.c: squelch a type mismatch warning
2009-05-09 09:27:43 -07:00
Sitaram Chamarty be427d758b allow -t abbreviation for --track in git branch
also makes it consistent with git-checkout

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 08:32:14 -07:00
Michael S. Tsirkin d92a39590d Add --reference option to git submodule.
This adds --reference option to git submodule add and
git submodule update commands, which is passed to git clone.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 08:27:52 -07:00
Jeff King 07d7bedda8 add: don't complain when adding empty project root
We try to warn the user if one of their pathspecs caused no
matches, as it may have been a typo. However, we disable the
warning if the pathspec points to an existing file, since
that means it is not a typo but simply an empty directory.

Unfortunately, the file_exists() test was broken for one
special case: the pathspec of the project root is just "".
This patch detects this special case and acts as if the file
exists (which it must, since it is the project root).

The user-visible effect is that this:

  $ mkdir repo && cd repo && git init && git add .

used to complain like:

  fatal: pathspec '' did not match any files

but now is a silent no-op.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 08:27:11 -07:00
Frank Lichtenheld fe53bbc9be Git.pm: Always set Repository to absolute path if autodetecting
So far we only set it to absolute paths in some cases which lead
to problems like wc_chdir not working.

Signed-off-by: Frank Lichtenheld <flichtenheld@astaro.com>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 08:25:55 -07:00
Frank Lichtenheld da159c7759 Git.pm: Set GIT_WORK_TREE if we set GIT_DIR
Otherwise git will use the current directory as work tree which will
lead to unexpected results if we operate in sub directory of the
work tree.

Signed-off-by: Frank Lichtenheld <flichtenheld@astaro.com>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 08:25:55 -07:00
David Aguilar 4481ff048d mergetool--lib: specialize diff options for emerge and ecmerge
The ecmerge documentation mentions the following form:

	ecmerge --mode=diff2 $1 $2

Since git-difftool is about diffing, we should use that instead
of --mode=merge2.  Likewise, this drops the $MERGED argument to
emerge, as discussed on the git list ($gmane/117930).

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 08:25:22 -07:00
Jim Meyering ca6b91d29b format-patch let -k override a config-specified format.numbered
Let a command-line --keep-subject (-k) override a config-specified
format.numbered (--numbered (-n)), rather than provoking the
"-n and -k are mutually exclusive" failure.
* t4021-format-patch-numbered.sh: Test for the above

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 08:10:15 -07:00
Jeff King 27d5438d9f fix GIT_TRACE segfault with shell-quoted aliases
The alias argv comes from the split_cmdline function, which
splits the config text for the alias into an array of
strings. It returns the number of elements in the array, but
does not actually put a NULL at the end of the array.
Later, the trace function tries to print this argv and
assumes that it has the trailing NULL.

The split_cmdline function is probably at fault, since argv
lists almost always end with a NULL signal. This patch adds
one, in addition to the returned count; this doesn't hurt
the other callers at all, since they were presumably using
the count already (and will never look at the NULL).

While we're there and using ALLOC_GROW, let's clean up the
other manual grow.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 01:39:40 -07:00
Robin Rosenberg a4c2e69936 Disallow '\' in ref names
This is asking for trouble since '\' is a directory separator in
Windows and thus may produce unpredictable results.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 01:35:49 -07:00
Jakub Narebski 74fd8728e2 gitweb: Remove function prototypes (cleanup)
Use of function prototypes is considered bad practice in Perl.  The
ones used here didn't accomplish anything anyhow, so they've been
removed.

>From perlsub(1):

  [...] the intent of this feature [prototypes] is primarily to let
  you define subroutines that work like built-in functions [...]
  you can generate new syntax with it [...]

We don't want to have subroutines behaving exactly like built-in
functions, we don't want to define new syntax / syntactic sugar, so
prototypes in gitweb are not needed... and they can have unintended
consequences.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 01:35:15 -07:00
Alexander Potashev ec00d6e003 Documentation: cloning to empty directory is allowed
Cloning into an existing empty directory is now allowed:
commit 55892d2398
("Allow cloning to an existing empty directory")

Signed-off-by: Alexander Potashev <aspotashev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 01:28:08 -07:00
Heiko Voigt 7742c65ba5 Extend sample update hook, disable modifying of existing tags
Because no special rule for this existed it was allowed by default

Signed-off-by: Heiko Voigt <heiko.voigt@mahr.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 00:31:00 -07:00
René Scharfe 3e230fa1b2 grep: use parseopt
Convert git-grep to parseopt.

The bitfields in struct grep_opt are converted to full ints,
increasing its size.  This shouldn't be a problem as there is only a
single instance in memory.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 00:29:56 -07:00
René Scharfe 1b5fb44ad1 grep: remove global variable builtin_grep
Replace the only global variable in builtin-grep.c, builtin_grep, by a
local one and a function parameter with reversed meaning.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 00:29:53 -07:00
René Scharfe 51a9949eda parseopt: add PARSE_OPT_NODASH
Add support for options that don't start with a dash.  Initially, they
don't accept arguments and can only be short options, i.e. consist of a
single character.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 00:29:50 -07:00
René Scharfe e0319ff5ed parseopt: add OPT_NUMBER_CALLBACK
Add a way to recognize numerical options.  The number is passed to
a callback function as a string.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 00:29:47 -07:00
Jeff King e9008b9a44 parseopt: add OPT_NEGBIT
On Thu, May 07, 2009 at 09:44:17PM +0200, René Scharfe wrote:
Subject: [PATCH] ls-files: make --no-empty-directory properly negatable

This option was specified to parseopt as an OPT_BIT; however, we
actually want to _set_ the bit on --no-empty-directory. Thus the
existing implementation used --no-empty-directory, and required
--no-no-empty-directory to negate it.

Now that OPT_NEGBIT exists, we can properly support it as
--empty-directory and --no-empty-directory (but of course
still defaulting to showing empty directories).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 00:29:07 -07:00
René Scharfe 2f4b97f910 parseopt: add OPT_NEGBIT
Add OPTION_NEGBIT and OPT_NEGBIT, mirroring OPTION_BIT and OPT_BIT.
OPT_NEGBIT can be used together with OPT_BIT to define two options
that cancel each other out.

Note: this patch removes the reminder from the test script because
it adds a test for --no-or4 and there already was one for --or4.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 00:28:53 -07:00
Alex Riesen 718135e3b6 Clarify kind of conflict in merge-one-file helper
Not as verbose as the recursive merge driver, but better still.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 00:27:39 -07:00
Felipe Contreras ac9f71cf76 git config: clarify --add and --get-color
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 00:19:25 -07:00
Junio C Hamano 3e1629f5a6 archive-tar.c: squelch a type mismatch warning
On some systems, giving a value of type time_t to printf "%lo" that
expects an unsigned long would give a type mismatch warning.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-08 23:57:29 -07:00
Junio C Hamano 5a0e4a2a32 Start 1.6.4 development
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-08 21:57:02 -07:00
Junio C Hamano 6207011ae3 Start 1.6.3.1 maintenance series.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-08 21:49:14 -07:00
Junio C Hamano 58e93fa357 Merge branch 'maint-1.6.1' into maint-1.6.2
* maint-1.6.1:
2009-05-08 21:13:47 -07:00
Junio C Hamano f29d669a91 Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  dir.c: Fix two minor grammatical errors in comments
2009-05-08 21:12:41 -07:00
Junio C Hamano f01f1099f4 GIT 1.6.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-06 18:16:40 -07:00
Nguyễn Thái Ngọc Duy c5ae7cb6d9 t4029: use sh instead of bash
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-06 18:16:26 -07:00
Brandon Casey 5e16488edc t4200: convert sed expression which operates on non-text file to perl
POSIX only requires sed to work on text files and MERGE_RR is not a text
file.  Some versions of sed complain that this file is not newline
terminated, and exit non-zero.  Use perl instead which does not have a
problem with it.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-06 16:43:29 -07:00
Brandon Casey 9eda0e980a t4200: remove two unnecessary lines
These two lines appear to be unnecessary.  They set variables which are not
used afterwards.  The primary motivation to remove them is that the sed
invocation exits non-zero for seds which require newline termination of
input files.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-06 16:43:28 -07:00
Brandon Casey d8b69ecb4c t/annotate-tests.sh: avoid passing a non-newline terminated file to sed
Some versions of sed exit non-zero if the file they are supplied is not
newline terminated.  Solaris's /usr/xpg4/bin/sed is one such sed.  So
rework this test to avoid doing so.

This affects tests t8001-annotate.sh and t8002-blame.sh.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-06 11:50:44 -07:00
Brandon Casey 325fb15104 t4118: avoid sed invocation on file without terminating newline
Some versions of sed exit non-zero if the file they are supplied is not
newline terminated. Solaris's /usr/xpg4/bin/sed is one such sed.  In
this case the sed invocation can be avoided entirely since the resulting
file is equivalent to a previously created file.  So, just copy that file
into place instead.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-06 11:49:14 -07:00
Brandon Casey 723570469f t4118: add missing '&&'
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-06 11:49:05 -07:00
Brandon Casey 0b05dc2b7e t8005: use egrep when extended regular expressions are required
Not all versions of grep understand backslashed extended regular
expressions.  Possibly only gnu grep does.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-06 11:48:58 -07:00
Junio C Hamano 6a260f53ad git-clean doc: the command only affects paths under $(cwd)
Fredrik Skolmli and Thomas Rast noticed that it was left unstated that
"git clean" ran from a subdirectory will not affect anything outside it,
with or without path limiters.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-06 10:51:34 -07:00
Junio C Hamano 8146f19762 Merge branch 'maint'
* maint:
  improve error message in config.c
  t4018-diff-funcname: add cpp xfuncname pattern to syntax test
  Work around BSD whose typeof(tv.tv_sec) != time_t
  git-am.txt: reword extra headers in message body
  git-am.txt: Use date or value instead of time or timestamp
  git-am.txt: add an 'a', say what 'it' is, simplify a sentence
  dir.c: Fix two minor grammatical errors in comments
  git-svn: fix a sloppy Getopt::Long usage
2009-05-05 22:52:17 -07:00