Commit graph

16309 commits

Author SHA1 Message Date
René Scharfe 59c69c0c65 make alloc_ref_from_str() the new alloc_ref()
With all calls to alloc_ref() gone, we can remove it and then we're free
to give alloc_ref_from_str() the shorter name.  It's a much nicer
interface, as the callers always need to have a name string when they
allocate a ref anyway and don't need to calculate and pass its length+1
any more.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-18 06:53:47 -07:00
René Scharfe b0b44bc7b2 use alloc_ref_from_str() everywhere
Replace pairs of alloc_ref() and strcpy() with alloc_ref_from_str(),
simplifying the code.

In connect.c, also a pair of alloc_ref() and memcpy() is replaced --
the additional cost of a strlen() call should not have too much of an
impact.  Consistency and simplicity are more important.

In remote.c, the code was allocating 11 bytes more than needed for
the name part, but I couldn't see them being used for anything.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-18 06:53:47 -07:00
René Scharfe 8009768e89 add alloc_ref_with_prefix()
In three cases in remote.c, a "raw" ref is allocated using alloc_ref()
and then its is constructed using sprintf().  Clean it up by adding a
helper function, alloc_ref_with_prefix(), which creates a composite
name.  Use it in alloc_ref_from_str(), too, as it simplifies the code.

Open code alloc_ref() in alloc_ref_with_prefix(), as the former is
going to be removed in the patch after the next.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-18 06:53:46 -07:00
Junio C Hamano 46dc1b0e33 Merge branch 'maint'
* maint:
  t1301-shared-repo.sh: don't let a default ACL interfere with the test
  git-check-attr(1): add output and example sections
  xdiff-interface.c: strip newline (and cr) from line before pattern matching
  t4018-diff-funcname: demonstrate end of line funcname matching flaw
  t4018-diff-funcname: rework negated last expression test
  Typo "does not exists" when git remote update remote.
  remote.c: correct the check for a leading '/' in a remote name
  Add testcase to ensure merging an early part of a branch is done properly

Conflicts:
	t/t7600-merge.sh
2008-10-17 01:52:32 -07:00
Matt McCutchen 8ed0a740dd t1301-shared-repo.sh: don't let a default ACL interfere with the test
This test creates files with several different umasks and expects their
permissions to be initialized according to the umask, so a default ACL on the
trash directory (which overrides the umask for files created in that directory)
causes the test to fail.  To avoid that, remove the default ACL if possible with
setfacl(1).

Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-16 19:37:27 -07:00
Jonas Fonseca 5782566d7f git-check-attr(1): add output and example sections
Plumbing tools should document what output can be expected.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-16 08:40:25 -07:00
Brandon Casey 563d5a2c84 xdiff-interface.c: strip newline (and cr) from line before pattern matching
POSIX doth sayeth:

   "In the regular expression processing described in IEEE Std 1003.1-2001,
    the <newline> is regarded as an ordinary character and both a period and
    a non-matching list can match one. ... Those utilities (like grep) that
    do not allow <newline>s to match are responsible for eliminating any
    <newline> from strings before matching against the RE."

Thus far git has not been removing the trailing newline from strings matched
against regular expression patterns. This has the effect that (quoting
Jonathan del Strother) "... a line containing just 'FUNCNAME' (terminated by
a newline) will be matched by the pattern '^(FUNCNAME.$)' but not
'^(FUNCNAME$)'", and more simply not '^FUNCNAME$'.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-16 08:31:56 -07:00
Brandon Casey b19d288b4d t4018-diff-funcname: demonstrate end of line funcname matching flaw
Since the newline is not removed from lines before pattern matching, a
pattern cannot match to the end of the line using the '$' operator without
using an additional operator which will indirectly match the '\n' character.

Introduce a test which should pass, but which does not due to this flaw.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-16 08:31:56 -07:00
Brandon Casey 16b2672536 t4018-diff-funcname: rework negated last expression test
This test used the non-zero exit status of 'git diff' to indicate that a
negated funcname pattern, when placed last, was correctly rejected.

The problem with this is that 'git diff' always returns non-zero if it
finds differences in the files it is comparing, and the files must
contain differences in order to trigger the funcname pattern codepath.

Instead of checking for non-zero exit status, make sure the expected
error message is printed.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-16 08:31:56 -07:00
Mikael Magnusson 6c2a6022db Typo "does not exists" when git remote update remote. 2008-10-16 08:20:15 -07:00
Brandon Casey c82efafcfa remote.c: correct the check for a leading '/' in a remote name
This test is supposed to disallow remote entries in the config file of the
form:

   [remote "/foobar"]
      ...

The leading slash in '/foobar' is not acceptable.

Instead it was incorrectly testing that the subkey had no leading '/', which
had no effect since the subkey pointer was made to point at a '.' in the
preceding lines.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-14 17:18:29 -07:00
Miklos Vajna 4e6d4bc0f0 Add testcase to ensure merging an early part of a branch is done properly
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-14 16:52:09 -07:00
Miklos Vajna 84ed4c5d11 Add Linux PPC support to the pre-auto-gc example hook
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-14 16:50:09 -07:00
Brandon Casey aef405dd50 t4018-diff-funcname: add objective-c xfuncname pattern to syntax test
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-14 16:49:13 -07:00
Junio C Hamano 67faaaba83 Update draft release notes to 1.6.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-13 17:05:45 -07:00
Junio C Hamano 769b008e0e Merge branch 'maint'
* maint:
  Update draft release notes to 1.6.0.3
2008-10-13 15:41:49 -07:00
Junio C Hamano 6c1679254c Update draft release notes to 1.6.0.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-13 15:41:36 -07:00
Jeff King 80bfd76af7 tests: shell negation portability fix
Commit 969c8775 introduced a test which uses the non-portable construct:

  command1 && ! command2 | command3

which must be

  command1 && ! (command2 | command3)

to work on bsd shells (this is another example of bbf08124, which fixed
several similar cases).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-13 08:43:04 -07:00
Shawn O. Pearce 5c283eb13c Merge branch 'maint'
* maint:
  test-lib: fix broken printf
  git apply --directory broken for new files
2008-10-12 13:21:17 -07:00
Shawn O. Pearce 72d404deba test-lib: fix broken printf
b8eecafd88 introduced usage of
printf without a format string.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-12 13:13:59 -07:00
Matt McCutchen b75271d93a "git diff <tree>{3,}": do not reverse order of arguments
According to the message of commit 0fe7c1de16,
"git diff" with three or more trees expects the merged tree first followed by
the parents, in order.  However, this command reversed the order of its
arguments, resulting in confusing diffs.  A comment /* Again, the revs are all
reverse */ suggested there was a reason for this, but I can't figure out the
reason, so I removed the reversal of the arguments.  Test case included.

Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-12 12:36:19 -07:00
Brandon Casey f285a2d7ed Replace calls to strbuf_init(&foo, 0) with STRBUF_INIT initializer
Many call sites use strbuf_init(&foo, 0) to initialize local
strbuf variable "foo" which has not been accessed since its
declaration. These can be replaced with a static initialization
using the STRBUF_INIT macro which is just as readable, saves a
function call, and takes up fewer lines.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-12 12:36:19 -07:00
Dmitry Potapov 7e7abea96b print an error message for invalid path
If verification of path failed, it is always better to print an
error message saying this than relying on the caller function to
print a meaningful error message (especially when the callee already
prints error message for another situation).

Because the callers of add_index_entry_with_check() did not print
any error message, it resulted that the user would not notice the
problem when checkout of an invalid path failed.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-12 12:36:19 -07:00
Thomas Rast 616ab43737 Documentation: remove stale howto/rebase-and-edit.txt
The "rebase and edit" howto predates the much easier solution 'git
rebase -i' by two years.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-12 11:31:55 -07:00
Brandon Casey 3fee1fe871 t9001: use older Getopt::Long boolean prefix '--no' rather than '--no-'
Since dbf5e1e9, the '--no-validate' option is a Getopt::Long boolean
option. The '--no-' prefix (as in --no-validate) for boolean options
is not supported in Getopt::Long version 2.32 which was released with
Perl 5.8.0. This version only supports '--no' as in '--novalidate'.
More recent versions of Getopt::Long, such as version 2.34, support
either prefix. So use the older form in the tests.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-12 11:21:29 -07:00
Jeff King 969c877506 git apply --directory broken for new files
We carefully verify that the input to git-apply is sane,
including cross-checking that the filenames we see in "+++"
headers match what was provided on the command line of "diff
--git". When --directory is used, however, we ended up
comparing the unadorned name to one with the prepended root,
causing us to complain about a mismatch.

We simply need to prepend the root directory, if any, when
pulling the name out of the git header.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-12 11:09:41 -07:00
Shawn O. Pearce e782e12f89 Merge branch 'maint'
* maint:
  rebase -i: do not fail when there is no commit to cherry-pick
  test-lib: fix color reset in say_color()
  fix pread()'s short read in index-pack

Conflicts:
	csum-file.c
2008-10-10 08:39:20 -07:00
Johannes Schindelin ff74126c03 rebase -i: do not fail when there is no commit to cherry-pick
In case there is no commit to apply (for example because you rebase to
upstream and all your local patches have been applied there), do not
fail.  The non-interactive rebase already behaves that way.

Do this by introducing a new command, "noop", which is substituted for
an empty commit list, so that deleting the commit list can still abort
as before.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-10 08:32:03 -07:00
Miklos Vajna b8eecafd88 test-lib: fix color reset in say_color()
When executing a single test with colors enabled, the cursor was not set
back to the previous one, and you had to hit an extra enter to get it
back.

Work around this problem by calling 'tput sgr0' before printing the
final newline.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-10 08:01:40 -07:00
Nicolas Pitre 838cd34664 fix pread()'s short read in index-pack
Since v1.6.0.2~13^2~ the completion of a thin pack uses sha1write() for
its ability to compute a SHA1 on the written data.  This also provides
data buffering which, along with commit 92392b4a45, will confuse pread()
whenever an appended object is 1) freed due to memory pressure because
of the depth-first delta processing, and 2) needed again because it has
many delta children, and 3) its data is still buffered by sha1write().

Let's fix the issue by simply forcing cached data out when such an
object is written so it can be pread()'d at leisure.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-10 07:09:30 -07:00
Shawn O. Pearce 23abd3f48c Merge branch 'js/objc-funchdr'
* js/objc-funchdr:
  Teach git diff about Objective-C syntax
2008-10-09 11:01:51 -07:00
Shawn O. Pearce 01ed1079f3 Merge branch 'pb/gitweb'
* pb/gitweb:
  gitweb: Support for simple project search form
  gitweb: Make the by_tag filter delve in forks as well
  gitweb: Support for tag clouds
  gitweb: Add support for extending the action bar with custom links
  gitweb: Sort the list of forks on the summary page by age
  gitweb: Clean-up sorting of project list
2008-10-09 10:52:04 -07:00
Shawn O. Pearce 52a73116a5 Merge branch 'dm/svn-branch'
* dm/svn-branch:
  Add git-svn branch to allow branch creation in SVN repositories
2008-10-09 10:39:00 -07:00
Shawn O. Pearce bc36540e6e Merge branch 'bc/xdiffnl'
* bc/xdiffnl:
  xdiff-interface.c: strip newline (and cr) from line before pattern matching
2008-10-09 10:24:24 -07:00
Shawn O. Pearce ed187bd593 Merge branch 'dp/cywginstat'
* dp/cywginstat:
  cygwin: Use native Win32 API for stat
  mingw: move common functionality to win32.h
  add have_git_dir() function
2008-10-09 10:24:14 -07:00
Shawn O. Pearce 78a935d48b Merge branch 'lt/time-reject-fractional-seconds'
* lt/time-reject-fractional-seconds:
  date/time: do not get confused by fractional seconds
2008-10-09 10:23:55 -07:00
Shawn O. Pearce a3c76f2858 Merge branch 'jc/add-ita'
* jc/add-ita:
  git-add --intent-to-add (-N)
2008-10-09 10:21:25 -07:00
Shawn O. Pearce d5c527448d Merge branch 'mw/sendemail'
* mw/sendemail:
  bash completion: Add --[no-]validate to "git send-email"
  send-email: signedoffcc -> signedoffbycc, but handle both
  Docs: send-email: Create logical groupings for man text
  Docs: send-email: Create logical groupings for --help text
  Docs: send-email: Remove unnecessary config variable description
  Docs: send-email: --chain_reply_to -> --[no-]chain-reply-to
  send-email: change --no-validate to boolean --[no-]validate
  Docs: send-email: Man page option ordering
  Docs: send-email usage text much sexier
  Docs: send-email's usage text and man page mention same options
2008-10-09 10:19:51 -07:00
Shawn O. Pearce 76c3fb1f84 Merge branch 'mv/merge-refresh'
* mv/merge-refresh:
  builtin-merge: refresh the index before calling a strategy
2008-10-09 10:19:23 -07:00
Shawn O. Pearce c9618ff939 Merge branch 'ph/parseopt'
* ph/parseopt:
  parse-opt: migrate builtin-merge-file.
  parse-opt: migrate git-merge-base.
  parse-opt: migrate fmt-merge-msg.
2008-10-09 10:19:08 -07:00
Shawn O. Pearce 86193807cf Merge branch 'rz/grepz'
* rz/grepz:
  git grep: Add "-z/--null" option as in GNU's grep.
2008-10-09 10:18:59 -07:00
Shawn O. Pearce e4fff5ce65 Merge branch 'mg/verboseprune'
* mg/verboseprune:
  make prune report removed objects on -v
2008-10-09 10:18:41 -07:00
Shawn O. Pearce 635536488c Merge branch 'maint'
* maint:
  builtin-apply: fix typo leading to stack corruption
  git-stash.sh: fix flawed fix of invalid ref handling (commit da65e7c1)
  builtin-merge.c: allocate correct amount of memory
  Makefile: do not set NEEDS_LIBICONV for Solaris 8
  rebase -i: remove leftover debugging
  rebase -i: proper prepare-commit-msg hook argument when squashing
2008-10-09 10:18:32 -07:00
Shawn O. Pearce 44c33a5b96 Merge branch 'sg/maint-intrebase-msghook' into maint
* sg/maint-intrebase-msghook:
  rebase -i: remove leftover debugging
  rebase -i: proper prepare-commit-msg hook argument when squashing
2008-10-09 09:33:23 -07:00
Imre Deak b8ebe08b9a builtin-apply: fix typo leading to stack corruption
This typo led to stack corruption for lines with whitespace fixes
and length > 1024.

Signed-off-by: Imre Deak <imre.deak@gmail.com>
Looks-good-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-09 09:21:50 -07:00
Brandon Casey 875471c510 git-stash.sh: fix flawed fix of invalid ref handling (commit da65e7c1)
The referenced commit tried to fix a flaw in stash's handling of a user
supplied invalid ref. i.e. 'git stash apply fake_ref@{0}' should fail
instead of applying stash@{0}. But, it did so in a naive way by avoiding the
use of the --default option of rev-parse, and instead manually supplied the
default revision if the user supplied an empty command line. This prevented
a common usage scenario of supplying flags on the stash command line (i.e.
non-empty command line) which would be parsed by lower level git commands,
without supplying a specific revision. This should fall back to the default
revision, but now it causes an error. e.g. 'git stash show -p'

The correct fix is to use the --verify option of rev-parse, which fails
properly if an invalid ref is supplied, and still allows falling back to a
default ref when one is not supplied.

Convert stash-drop to use --verify while we're at it, since specifying
multiple revisions for any of these commands is also an error and --verify
makes it so.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-09 09:09:50 -07:00
Shawn O. Pearce 027b5a4f3e Merge branch 'jk/maint-soliconv' into maint
* jk/maint-soliconv:
  Makefile: do not set NEEDS_LIBICONV for Solaris 8
2008-10-09 09:08:43 -07:00
Miklos Vajna 749bc58c5e Cleanup in sha1_file.c::cache_or_unpack_entry()
This patch just removes an unnecessary goto which makes the code easier
to read and shorter.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-09 08:55:42 -07:00
Brandon Casey 36e40535dc builtin-merge.c: allocate correct amount of memory
Fix two memory allocation errors which allocate space for a pointer
rather than enough space for the structure itself.

This:

    struct commit_list *parent = xmalloc(sizeof(struct commit_list *));

should have been this:

    struct commit_list *parent = xmalloc(sizeof(struct commit_list));

But while we're at it, change the allocation to reference the
variable it is allocating memory for to try to prevent a similar
mistake, for example if the type is changed, in the future.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Acked-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-09 08:13:29 -07:00
Shawn O. Pearce c4f6a48969 Merge branch 'maint'
* maint:
  Do not use errno when pread() returns 0
  git init: --bare/--shared overrides system/global config
  git-push.txt: Describe --repo option in more detail
  git rm: refresh index before up-to-date check
  Fix a few typos in relnotes
2008-10-08 08:05:43 -07:00