Commit graph

20026 commits

Author SHA1 Message Date
Larry D'Anna 8324b977ae diff: make sure --output=/bad/path is caught
The return value from fopen wasn't being checked.

Signed-off-by: Larry D'Anna <larry@elder-gods.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-15 21:46:01 -08:00
Junio C Hamano 33f0ea42e1 t8003: check exit code of command and error message separately
Shell reports exit status only from the most downstream command
in a pipeline.  In these tests, we want to make sure that the
command fails in a controlled way, and produces a correct error
message.

This issue was known by Jay who submitted the patch, and also was
pointed out by Hannes during the review process, but I forgot to
fix it up before applying.  Sorry about that.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-10 13:42:29 -08:00
Jay Soffian 92f9e273e8 blame: prevent a segv when -L given start > EOF
blame would segv if given -L <lineno> with <lineno> past the end of the file.
While we're fixing the bug, add test cases for an invalid <start> when called
as -L <start>,<end> or -L<start>.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-08 21:52:44 -08:00
Junio C Hamano 153559a964 Merge branch 'sb/maint-octopus' into maint-1.6.5
* sb/maint-octopus:
  octopus: remove dead code
  octopus: reenable fast-forward merges
  octopus: make merge process simpler to follow
2010-02-01 00:06:11 -08:00
Junio C Hamano 4b683658be Merge branch 'bg/maint-add-all-doc' into maint-1.6.5
* bg/maint-add-all-doc:
  git-rm doc: Describe how to sync index & work tree
  git-add/rm doc: Consistently back-quote
  Documentation: 'git add -A' can remove files
2010-02-01 00:04:12 -08:00
Jeff King 65d41d48a4 fix memcpy of overlapping area
Caught by valgrind in t5500, but it is pretty obvious from
reading the code that this is shifting elements of an array
to the left, which needs memmove.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-29 09:52:21 -08:00
Junio C Hamano 35eabd1579 Git 1.6.5.8
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-20 12:44:59 -08:00
Junio C Hamano 806e5c8682 Merge branch 'jk/maint-1.6.5-reset-hard' into maint-1.6.5
* jk/maint-1.6.5-reset-hard:
  reset: unbreak hard resets with GIT_WORK_TREE
2010-01-20 12:22:58 -08:00
Junio C Hamano 91d23be167 Merge branch 'tr/maint-1.6.5-bash-prompt-show-submodule-changes' into maint-1.6.5
* tr/maint-1.6.5-bash-prompt-show-submodule-changes:
  bash completion: factor submodules into dirty state
2010-01-20 12:22:54 -08:00
Junio C Hamano e7706554c5 Merge branch 'dp/maint-1.6.5-fast-import-non-commit-tag' into maint-1.6.5
* dp/maint-1.6.5-fast-import-non-commit-tag:
  fast-import: tag may point to any object type
2010-01-20 12:17:24 -08:00
Junio C Hamano 27132ca85a Merge branch 'jm/maint-1.6.5-grep-NUL-terminate' into maint-1.6.5
* jm/maint-1.6.5-grep-NUL-terminate:
  grep: NUL terminate input from a file
2010-01-20 12:16:46 -08:00
Junio C Hamano 03c6e97f80 Merge branch 'maint-1.6.4' into maint-1.6.5
* maint-1.6.4:
  Fix mis-backport of t7002
  base85: Make the code more obvious instead of explaining the non-obvious
  base85: encode_85() does not use the decode table
  base85 debug code: Fix length byte calculation
  checkout -m: do not try to fall back to --merge from an unborn branch
  branch: die explicitly why when calling "git branch [-a|-r] branchname".
  textconv: stop leaking file descriptors
  commit: --cleanup is a message option
  git count-objects: handle packs bigger than 4G
  t7102: make the test fail if one of its check fails
2010-01-18 21:37:12 -08:00
Junio C Hamano 814035c12a Merge branch 'maint-1.6.3' into maint-1.6.4
* maint-1.6.3:
  base85: Make the code more obvious instead of explaining the non-obvious
  base85: encode_85() does not use the decode table
  base85 debug code: Fix length byte calculation
  checkout -m: do not try to fall back to --merge from an unborn branch
  branch: die explicitly why when calling "git branch [-a|-r] branchname".
  textconv: stop leaking file descriptors
  commit: --cleanup is a message option
  git count-objects: handle packs bigger than 4G
  t7102: make the test fail if one of its check fails

Conflicts:
	builtin-commit.c
2010-01-18 21:37:06 -08:00
Junio C Hamano 011c181cc6 Merge branch 'maint-1.6.2' into maint-1.6.3
* maint-1.6.2:
  base85: Make the code more obvious instead of explaining the non-obvious
  base85: encode_85() does not use the decode table
  base85 debug code: Fix length byte calculation
  checkout -m: do not try to fall back to --merge from an unborn branch
  branch: die explicitly why when calling "git branch [-a|-r] branchname".
  textconv: stop leaking file descriptors
  commit: --cleanup is a message option
  git count-objects: handle packs bigger than 4G
  t7102: make the test fail if one of its check fails

Conflicts:
	diff.c
2010-01-18 21:29:47 -08:00
Junio C Hamano 18d97f5fed Merge commit 'v1.6.4.4-8-g8de6518' into maint-1.6.4
* commit 'v1.6.4.4-8-g8de6518':
  Fix mis-backport of t7002
2010-01-18 21:18:41 -08:00
Junio C Hamano 8de65185e8 Fix mis-backport of t7002
The original patch that became cfe370c (grep: do not segfault when -f is
used, 2009-10-16), was made against "maint" or newer branch back then, but
the fix addressed the issue that was present as far as in 1.6.4 series.

The maintainer backported the patch to the 1.6.4 maintenance branch, but
failed to notice that the new tests assumed the setup done by the script
in "maint", which did quite a lot more than the same test script in 1.6.4
series, and the output didn't match the expected result.

This should fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-18 21:14:49 -08:00
Jim Meyering 34f3999206 grep: NUL terminate input from a file
Internally "git grep" runs regexec(3) that expects its input string
to be NUL terminated.  When searching inside blob data, read_sha1_file()
automatically gives such a buffer, but builtin-grep.c forgot to put
the NUL at the end, even though it allocated enough space for it.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-18 17:01:29 -08:00
Dmitry Potapov 8db751a8f9 fast-import: tag may point to any object type
If you tried to export the official git repository, and then to import it
back then git-fast-import would die complaining that "Mark :1 not a commit".

Accordingly to a generated crash file, Mark 1 is not a commit but a blob,
which is pointed by junio-gpg-pub tag. Because git-tag allows to create such
tags, git-fast-import should import them.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-14 21:51:06 -08:00
Junio C Hamano c5034673fd Merge branch 'maint-1.6.1' into maint-1.6.2
* maint-1.6.1:
  base85: Make the code more obvious instead of explaining the non-obvious
  base85: encode_85() does not use the decode table
  base85 debug code: Fix length byte calculation
  checkout -m: do not try to fall back to --merge from an unborn branch
  branch: die explicitly why when calling "git branch [-a|-r] branchname".
  textconv: stop leaking file descriptors
  commit: --cleanup is a message option
  git count-objects: handle packs bigger than 4G
  t7102: make the test fail if one of its check fails

Conflicts:
	diff.c
2010-01-10 00:49:47 -08:00
Junio C Hamano 96aa7adda3 Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  base85: Make the code more obvious instead of explaining the non-obvious
  base85: encode_85() does not use the decode table
  base85 debug code: Fix length byte calculation
  checkout -m: do not try to fall back to --merge from an unborn branch
  branch: die explicitly why when calling "git branch [-a|-r] branchname".
2010-01-10 00:48:47 -08:00
Andreas Gruenbacher 0606c36a73 base85: Make the code more obvious instead of explaining the non-obvious
Here is another cleanup ...

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-09 22:43:47 -08:00
Andreas Gruenbacher b0bec518aa base85: encode_85() does not use the decode table
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-09 22:43:37 -08:00
Andreas Gruenbacher 75b7e16b6e base85 debug code: Fix length byte calculation
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-09 22:43:27 -08:00
Björn Gustavsson 47b7012024 git-rm doc: Describe how to sync index & work tree
Newcomers to git that want to remove from the index only the
files that have disappeared from the working tree will probably
look for a way to do that in the documentation for 'git rm'.

Therefore, describe how that can be done (even though it involves
other commands than 'git rm'). Based on a suggestion by Junio,
but re-arranged and rewritten to better fit into the style of
command reference.

While at it, change a single occurrence of "work tree" to "working
tree" for consistency.

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-07 15:37:33 -08:00
Junio C Hamano 64da3ae5c1 checkout -m: do not try to fall back to --merge from an unborn branch
If switching from an unborn branch (= empty tree) to a valid commit failed
without -m, it would fail with -m option as well.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-06 23:51:47 -08:00
Matthieu Moy 6e8f993a5a branch: die explicitly why when calling "git branch [-a|-r] branchname".
The -a and -r options used to be silently ignored in such a command.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-31 14:52:05 -08:00
Thomas Rast cf6e7ba1c4 bash completion: factor submodules into dirty state
In the implementation of GIT_PS1_SHOWDIRTYSTATE in 738a94a (bash:
offer to show (un)staged changes, 2009-02-03), I cut&pasted the
git-diff invocations from dirty-worktree checks elsewhere, carrying
along the --ignore-submodules option.

As pointed out by Kevin Ballard, this doesn't really make sense: to
the _user_, a changed submodule counts towards uncommitted changes.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-31 12:40:34 -08:00
Jeff King 70d7099916 textconv: stop leaking file descriptors
We read the output from textconv helpers over a pipe, but we
never actually closed our end of the pipe after using it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-30 01:22:27 -08:00
Jeff King cd0f0f68e1 reset: unbreak hard resets with GIT_WORK_TREE
Commit 952dfc6 tried to tighten the safety valves for doing
a "reset --hard" in a bare repository or outside the work
tree, but accidentally broke the case for GIT_WORK_TREE.
This patch unbreaks it.

Most git commands which need a work tree simply use
NEED_WORK_TREE in git.c to die before they get to their
cmd_* function. Reset, however, only needs a work tree in
some cases, and so must handle the work tree itself. The
error that 952dfc6 made was to simply forbid certain
operations if the work tree was not set up; instead, we need
to do the same thing that NEED_WORK_TREE does, which is to
call setup_work_tree(). We no longer have to worry about dying
in the non-worktree case, as setup_work_tree handles that
for us.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-30 01:05:21 -08:00
Junio C Hamano 799fdb4ed0 Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  commit: --cleanup is a message option
  t7102: make the test fail if one of its check fails
2009-12-29 20:16:34 -08:00
Greg Price e97ca7f41f commit: --cleanup is a message option
In the usage message for "git commit", the --cleanup option appeared
at the end, as one of the "contents options":

usage: git commit [options] [--] <filepattern>...
...
Commit message options
...
Commit contents options
...
    --allow-empty         ok to record an empty change
    --cleanup <default>   how to strip spaces and #comments from message

This is confusing, in part because it makes it ambiguous whether
--allow-empty, just above, refers to an empty diff or an empty message.

Move --cleanup into the 'message options' group.  Also add a pair of
comments to prevent similar oversights in the future.

Signed-off-by: Greg Price <price@ksplice.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-29 20:15:41 -08:00
Andreas Schwab c985ddf318 git count-objects: handle packs bigger than 4G
Use off_t to count sizes of packs and objects to avoid overflow after
4Gb.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-29 19:51:37 -08:00
Nguyễn Thái Ngọc Duy 153bb839aa t7102: make the test fail if one of its check fails
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-29 19:39:27 -08:00
David Reiss c8cba79181 Prevent git blame from segfaulting on a missing author name
The human-readable author and committer name can be missing from
commits imported from foreign SCM interfaces.  Make sure we parse
the "author" and "committer" line a bit more leniently and avoid
segfaulting by assuming the name always exists.

Signed-off-by: David Reiss <dreiss@facebook.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-22 11:51:17 -08:00
Björn Gustavsson e49ca974d6 rebase -i: abort cleanly if the editor fails to launch
If the user's configured editor is emacsclient, the editor
will fail to launch if emacs is not running and the git
command that tried to lanuch the editor will abort. For most
commands, all you have to do is to start emacs and repeat
the command.

The "git rebase -i" command, however, aborts without cleaning
the "$GIT_DIR/rebase-merge" directory if it fails to launch the
editor, so you'll need to do "git rebase --abort" before
repeating the rebase command.

Change "git rebase -i" to terminate using "die_abort" (instead of
with "die") if the initial launch of the editor fails.

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-19 23:20:05 -08:00
Stephen Boyd afab0fe052 technical-docs: document hash API
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-17 21:54:50 -08:00
Stephen Boyd 63b76948e1 api-strbuf.txt: fix typos and document launch_editor()
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-17 21:54:28 -08:00
Junio C Hamano 527b9d704d Git 1.6.5.7
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-16 12:45:25 -08:00
Junio C Hamano b3100fd555 worktree: don't segfault with an absolute pathspec without a work tree
If a command is run with an absolute path as a pathspec inside a bare
repository, e.g. "rev-list HEAD -- /home", the code tried to run strlen()
on NULL, which is the result of get_git_work_tree(), and segfaulted.  It
should just fail instead.

Currently the function returns NULL even inside .git/ in a repository
with a work tree, but that is a separate issue.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-16 12:45:25 -08:00
Jeff King 8b8e862490 ignore unknown color configuration
When parsing the config file, if there is a value that is
syntactically correct but unused, we generally ignore it.
This lets non-core porcelains store arbitrary information in
the config file, and it means that configuration files can
be shared between new and old versions of git (the old
versions might simply ignore certain configuration).

The one exception to this is color configuration; if we
encounter a color.{diff,branch,status}.$slot variable, we
die if it is not one of the recognized slots (presumably as
a safety valve for user misconfiguration). This behavior
has existed since 801235c (diff --color: use
$GIT_DIR/config, 2006-06-24), but hasn't yet caused a
problem. No porcelain has wanted to store extra colors, and
we once a color area (like color.diff) has been introduced,
we've never changed the set of color slots.

However, that changed recently with the addition of
color.diff.func. Now a user with color.diff.func in their
config can no longer freely switch between v1.6.6 and older
versions; the old versions will complain about the existence
of the variable.

This patch loosens the check to match the rest of
git-config; unknown color slots are simply ignored. This
doesn't fix this particular problem, as the older version
(without this patch) is the problem, but it at least
prevents it from happening again in the future.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-16 12:45:16 -08:00
Johannes Sixt 06500a0299 help.autocorrect: do not run a command if the command given is junk
If a given command is not found, then help.c tries to guess which one the
user could have meant. If help.autocorrect is 0 or unset, then a list of
suggestions is given as long as the dissimilarity between the given command
and the candidates is not excessively high. But if help.autocorrect was
non-zero (i.e., a delay after which the command is run automatically), the
latter restriction on dissimilarity was not obeyed.

In my case, this happened:

 $ git ..daab02
 WARNING: You called a Git command named '..daab02', which does not exist.
 Continuing under the assumption that you meant 'read-tree'
 in 4.0 seconds automatically...

The patch reuses the similarity limit that is also applied when the list of
suggested commands is printed.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-15 16:21:51 -08:00
Nanako Shiraishi d79f5d1718 Illustrate "filter" attribute with an example
The example was taken from aa4ed402c9
(Add 'filter' attribute and external filter driver definition).

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-14 22:04:30 -08:00
Stephen Boyd f08aa01767 octopus: remove dead code
MSG, PARENT, and CNT are never used, just assigned to.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-13 23:40:24 -08:00
Stephen Boyd 85bf49f9a5 octopus: reenable fast-forward merges
The fast-forward logic is never being triggered because $common and
$MRC are never equivalent. $common is initialized to a commit id by
merge-base and MRC is initialized to HEAD. Fix this by initializing
$MRC to the commit id for HEAD so that its possible for $MRC and
$common to be equal.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-13 23:40:24 -08:00
Stephen Boyd 81334502ee octopus: make merge process simpler to follow
Its not very easy to understand what heads are being merged given
the current output of an octopus merge. Fix this by replacing the
sha1 with the (usually) better description in GITHEAD_<SHA1>.

Suggested-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-13 23:17:46 -08:00
Junio C Hamano 9861b644e0 Git 1.6.5.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-10 15:42:30 -08:00
Junio C Hamano 782a0005fc Fix archive format with -- on the command line
Giving --format from the command line, or using output file extention to
DWIM the output format, with a pathspec that is disambiguated with an
explicit double-dash on the command line, e.g.

    git archive -o file --format=zip HEAD -- path
    git archive -o file.zip HEAD -- path

didn't work correctly.

This was because the code reordered (when one was given) or added (when
the format was inferred) a --format argument at the end, effectively
making it to "archive HEAD -- path --format=zip", i.e. an extra pathspec
that is unlikely to match anything.

The command line argument list should always be "options, revs and then
paths", and we should set a good example by inserting the --format at the
beginning instead.

Reported-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-10 15:29:05 -08:00
Junio C Hamano 1456b043fc Remove post-upload-hook
This hook runs after "git fetch" in the repository the objects are
fetched from as the user who fetched, and has security implications.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-10 12:21:40 -08:00
Junio C Hamano 5c30b8f7dd Merge branch 'mm/maint-merge-ff-error-message-fix' into maint
* mm/maint-merge-ff-error-message-fix:
  builtin-merge: show user-friendly error messages for fast-forward too.
  merge-recursive: make the error-message generation an extern function

Conflicts:
	merge-recursive.c
2009-12-08 22:42:23 -08:00
Junio C Hamano 389e0baa94 Merge branch 'jn/maint-pull-rebase-error-message' into maint
* jn/maint-pull-rebase-error-message:
  pull: clarify advice for the unconfigured error case
2009-12-08 22:39:20 -08:00