Commit Graph

18625 Commits

Author SHA1 Message Date
Junio C Hamano
e82f625416 Merge branch 'ar/merge-one-file-diag' into maint
* ar/merge-one-file-diag:
  Clarify kind of conflict in merge-one-file helper
2009-05-25 19:01:59 -07:00
Junio C Hamano
2c5942dbae Merge branch 'ar/unlink-err' into maint
* ar/unlink-err:
  print unlink(2) errno in copy_or_link_directory
  replace direct calls to unlink(2) with unlink_or_warn
  Introduce an unlink(2) wrapper which gives warning if unlink failed
2009-05-25 19:01:50 -07:00
Junio C Hamano
43f8f560c0 Merge branch 'jk/maint-add-empty' into maint
* jk/maint-add-empty:
  add: don't complain when adding empty project root
2009-05-25 19:01:41 -07:00
Jeff King
0e5168fd18 fix cat-file usage message and documentation
cat-file with an object on the command line requires an
option to tell it what to output (type, size, pretty-print,
etc). However, the square brackets in the usage imply that
those options are not required. This patch switches them to
parentheses to indicate "required but grouped-OR" (curly
braces might also work, but this follows the convention used
already by "git stash").

While we're at it, let's change the <sha1> specifier in the
usage to <object>. That's what the documentation uses, and
it does actually use the regular object lookup.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 12:08:15 -07:00
Jeff King
fa25075979 fetch: report ref storage DF errors more accurately
When we fail to store a fetched ref, we recommend that the
user try running "git prune" to remove up any old refs that
have been deleted by the remote, which would clear up any DF
conflicts. However, ref storage might fail for other
reasons (e.g., permissions problems) in which case the
advice is useless and misleading.

This patch detects when there is an actual DF situation and
only issues the advice when one is found.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 12:07:07 -07:00
Jeff King
f475e08edb lock_ref: inform callers of unavailable ref
One of the ways that locking might fail is that there is a
DF conflict between two refs (e.g., you want to lock
"foo/bar" but "foo" already exists). In this case, we return
an error, but there is no way for the caller to know the
specific problem.

This patch sets errno to ENOTDIR, which is the most sensible
code. It's what we would see if the refs were stored purely
in the filesystem (but these days we must check the
namespace manually due to packed refs).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 12:06:54 -07:00
Michael J Gruber
f5d4c4d0f1 merge-options.txt: Clarify merge --squash
With the --squash option, merge sets up the index just like for a real
merge, but without the merge info (stages). Say so.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 11:23:18 -07:00
Junio C Hamano
f5b223abfd Merge branch 'maint-1.6.2' into maint
* maint-1.6.2:
  http-push.c::remove_locks(): fix use after free
2009-05-24 15:29:33 -07:00
Junio C Hamano
34ab57df97 Merge branch 'maint-1.6.1' into maint-1.6.2
* maint-1.6.1:
  http-push.c::remove_locks(): fix use after free
2009-05-24 15:29:23 -07:00
Junio C Hamano
ff6e93fe60 Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  http-push.c::remove_locks(): fix use after free
2009-05-24 15:29:13 -07:00
Alex Riesen
6589ebf107 http-push.c::remove_locks(): fix use after free
Noticed and reported by Serhat Şevki Dinçer.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Acked-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-24 11:08:31 -07:00
René Scharfe
e701fadb9e grep: fix word-regexp colouring
As noticed by Dmitry Gryazin: When a pattern is found but it doesn't
start and end at word boundaries, bol is forwarded to after the match and
the pattern is searched again.  When a pattern is finally found between
word boundaries, the match offsets are off by the number of characters
that have been skipped.

This patch corrects the offsets to be relative to the value of bol as
passed to match_one_pattern() by its caller.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-20 18:49:20 -07:00
Giuseppe Bilotta
8dfb17e1fd completion: use git rev-parse to detect bare repos
Its check is more robust than a config check for core.bare

Trivially-Acked-by: Shawn O. Pearce <spearce@spearce.org>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-20 18:35:23 -07:00
Johannes Schindelin
fd73ccf279 Cope better with a _lot_ of packs
You might end up with a situation where you have tons of pack files, e.g.
when using hg2git.  In this situation, all kinds of operations may
end up with a "too many files open" error.  Let's recover gracefully from
that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Looks-right-to-me-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-20 18:23:06 -07:00
Jeff King
e64c1b0053 for-each-ref: fix segfault in copy_email
You can trigger a segfault in git.git by doing:

  git for-each-ref --format='%(taggeremail)' refs/tags/v0.99

The v0.99 tag is special in that it contains no "tagger"
header.

The bug is obvious in copy_email, which carefully checks to
make sure the result of a strchr is non-NULL, but only after
already having used it to perform other work. The fix is to
move the check up.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-20 00:06:19 -07:00
Stephen Boyd
5acb3e5012 show-branch: Fix die message in parse_reflog_param()
Commit 76a44c5 (show-branch --reflog: show the reflog message at the
top, 2007-01-19) introduced parse_reflog_param(). The die() call was
incorrectly passed arg + 9, when it should have been passed arg.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-17 12:05:22 -07:00
Stephen Boyd
076c32370d completion: add missing options to show-branch and show
Add --oneline and --abbrev-commit to show and --sparse to show-branch.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 22:46:22 -07:00
Linus Torvalds
da4b3e8c28 dir.c: clean up handling of 'path' parameter in read_directory_recursive()
Right now we pass two different pathnames ('path' and 'base') down to
read_directory_recursive(), and the only real reason for that is that we
want to allow an empty 'base' parameter, but when we do so, we need the
pathname to "opendir()" to be "." rather than the empty string.

And rather than handle that confusion in the caller, we can just fix
read_directory_recursive() to handle the case of an empty path itself,
by just passing opendir() a "." ourselves if the path is empty.

This would allow us to then drop one of the pathnames entirely from the
calling convention, but rather than do that, we'll start separating them
out as a "filesystem pathname" (the one we use for filesystem accesses)
and a "git internal base name" (which is the name that we use for git
internally).

That will eventually allow us to do things like handle different
encodings (eg the filesystem pathnames might be Latin1, while git itself
would use UTF-8 for filename information).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 22:41:46 -07:00
Dan McGee
b867d324ce Fix type-punning issues
In these two places we are casting part of our unsigned char sha1 array into
an unsigned int, which violates GCCs strict-aliasing rules (and probably
other compilers).

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 22:41:18 -07:00
Nanako Shiraishi
e4b09dad9f test: checkout shouldn't say that HEAD has moved if it didn't
Signed-off-by: しらいしななこ <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 19:49:25 -07:00
Junio C Hamano
dd42c2f015 completion: enhance "current branch" display
Introduce GIT_PS1_DESCRIBE option you can set to "contains", "branch", or
"describe" to tweak the way how a detached HEAD is described.

The default behaviour is to describe only exact match with some tag
(otherwise use the first 7 hexdigits) as before.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 19:46:31 -07:00
Junio C Hamano
ff790b6a4b completion: simplify "current branch" in __git_ps1()
As I very often work on a detached HEAD, I found it pretty confusing
when __git_ps1() said 'some-name'.  Did I create a branch with that name
by mistake, or do I happen to be on a commit with that exact tag?

This patch fixes the issue by enclosing non branch names in a pair of
parentheses when used to substitute %s token in __git_ps1() argument.

It also fixes a small bug where the branch part is left empty when
.git/HEAD is unreadable for whatever reason.  The output now says
"(unknown)".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 19:46:31 -07:00
Junio C Hamano
8763dbb1b2 completion: fix PS1 display during a merge on detached HEAD
If your merge stops in a conflict while on a detached HEAD, recent
completion code fails to show anything.  This was because various cases
added to support the operation-in-progress markers (e.g. REBASE, MERGING)
forgot that they need to set the variable "b" to something for the result
they computed to be displayed at all.

Probably not many people make trial merges on a detached HEAD (which is
tremendously useful feature of git, by the way), and that may be why this
was not noticed for a long time.

Acked-By: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 19:46:31 -07:00
Daniel Cordero
77ebd56dc3 builtin-checkout: Don't tell user that HEAD has moved before it has
Previously, checkout would tell the user this message before moving HEAD,
without regard to whether the upcoming move will result in success.
If the move failed, this causes confusion.

Show the message after the move, unless the move failed.

Signed-off-by: Daniel Cordero <theappleman@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 12:51:58 -07:00
Jim Meyering
c646217e13 pre-commit.sample: don't print incidental SHA1
Make the sample pre-commit hook script discard
all git-rev-parse output, not just stderr.
Otherwise, it would print an SHA1.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 11:57:17 -07:00
Stephen Boyd
f044fe2de6 tests: Add tests for missing format-patch long options
Exercise format-patch's --signoff, --in-reply-to and --start-number long
options.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 11:47:19 -07:00
Stephen Boyd
ca156cfcc2 api-parse-options.txt: use 'func' instead of 'funct'
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 11:47:10 -07:00
Tony Kemp
90f2e6526b Turn on USE_ST_TIMESPEC for OpenBSD
Like Darwin, OpenBSD's stat struct uses st_ctimespec and st_mtimestruct
rather than st_ctim and st_mtim.

Signed-off-by: Tony Kemp <tony.kemp@newcastle.edu.au>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 10:23:26 -07:00
Junio C Hamano
13c5833c09 Merge branch 'maint-1.6.2' into maint
* maint-1.6.2:
  ls-tree manpage: output of ls-tree is compatible with update-index
  ls-tree manpage: use "unless" instead of "when ... is not"
2009-05-16 00:12:58 -07:00
Junio C Hamano
213195185c Merge branch 'maint-1.6.1' into maint-1.6.2
* maint-1.6.1:
  ls-tree manpage: output of ls-tree is compatible with update-index
  ls-tree manpage: use "unless" instead of "when ... is not"
2009-05-13 21:06:11 -07:00
Junio C Hamano
58066bec5a Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  ls-tree manpage: output of ls-tree is compatible with update-index
  ls-tree manpage: use "unless" instead of "when ... is not"
2009-05-13 21:05:59 -07:00
Junio C Hamano
4774780ab1 GIT 1.6.3.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-12 22:30:29 -07:00
Junio C Hamano
235236c83d Merge branch 'maint-1.6.2' into maint
* maint-1.6.2:
  Revert "checkout branch: prime cache-tree fully"
2009-05-12 09:58:34 -07:00
Junio C Hamano
a83502f8e5 Merge branch 'jc/maint-read-tree-multi' into maint-1.6.2
* jc/maint-read-tree-multi:
  Revert "checkout branch: prime cache-tree fully"
2009-05-12 09:58:21 -07:00
Junio C Hamano
49d833dc07 Revert "checkout branch: prime cache-tree fully"
The logic in 83ae209 (checkout branch: prime cache-tree fully,
2009-04-20) is bogus; checkout can switch branches with a dirty
index and in such a case the tree won't match HEAD.

Add t2014-switch to catch this breakage.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-12 09:57:21 -07:00
Alex Riesen
c98a95eea8 ls-tree manpage: output of ls-tree is compatible with update-index
Such format relationships are very useful things to remember for
script writers.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-10 09:32:30 -07:00
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
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
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
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
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