Commit graph

36222 commits

Author SHA1 Message Date
Michael Haggerty 20fcffcc8d t1400: add some more tests involving quoted arguments
Previously there were no good tests of C-quoted arguments.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-04-07 12:09:11 -07:00
Michael Haggerty 697a41519b parse_arg(): really test that argument is properly terminated
The old parse_arg(), when fed an argument

    "refs/heads/a"master

parsed 'refs/heads/a' off of the front of the argument and considered
itself successful.  It was only when parse_next_arg() tried to parse
the *next* argument that a problem was noticed.  But in fact, the
definition of the input format requires arguments to be terminated by
SP or NUL, so *this* argument is already erroneous and parse_arg()
should diagnose the problem.

So teach parse_arg() to verify that C-quoted arguments are terminated
correctly.  If not, emit a more specific error message.

There is no corresponding error case of a non-C-quoted argument that
is not terminated correctly, because the end of a non-quoted argument
is *by definition* a space or NUL, so there is no way to insert other
junk between the "end" of the argument and the argument terminator.

Adjust the tests to expect the new error message.  Add a docstring to
the function, incorporating the comments that were formerly within the
function plus some added information.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-04-07 12:09:11 -07:00
Michael Haggerty c132911088 t1400: provide more usual input to the command
The old version was passing (among other things)

    update SP refs/heads/c NUL NUL 0{40} NUL

to "git update-ref -z --stdin" to test whether the old-value check for
c is working.  But the <newvalue> is empty, which is a bit off the
beaten track.

So, to be sure that we are testing what we want to test, provide an
actual <newvalue> on the "update" line.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-04-07 12:09:10 -07:00
Michael Haggerty b984d333a1 t1400: fix name and expected result of one test
The test

    stdin -z create ref fails with zero new value

actually passes an empty new value, not a zero new value.  So rename
the test s/zero/empty/, and change the expected error from

    fatal: create $c given zero new value

to

    fatal: create $c missing <newvalue>

Of course, this makes the test fail now, because although "git
update-ref" tries to distinguish between these two errors, it does not
succeed in this situation.  Fixing it is more than a one-liner, so
mark the test test_expect_failure for now.  The failure will be fixed
later in this patch series.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-04-07 12:09:10 -07:00
Junio C Hamano 25d1ac0e59 Update draft release notes to 2.0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-31 16:41:23 -07:00
Junio C Hamano 4ab9211ac2 Merge branch 'mm/status-porcelain-format-i18n-fix'
* mm/status-porcelain-format-i18n-fix:
  status: disable translation when --porcelain is used
2014-03-31 16:31:25 -07:00
Junio C Hamano 1d9aaed2fa Merge branch 'an/branch-config-message'
* an/branch-config-message:
  branch.c: install_branch_config: simplify if chain
2014-03-31 16:31:20 -07:00
Junio C Hamano ad4d8911f8 Merge branch 'jk/tests-cleanup'
* jk/tests-cleanup:
  t0001: drop subshells just for "cd"
  t0001: drop useless subshells
  t0001: use test_must_fail
  t0001: use test_config_global
  t0001: use test_path_is_*
  t0001: make symlink reinit test more careful
  t: prefer "git config --file" to GIT_CONFIG
  t: prefer "git config --file" to GIT_CONFIG with test_must_fail
  t: stop using GIT_CONFIG to cross repo boundaries
  t: drop useless sane_unset GIT_* calls
  t/test-lib: drop redundant unset of GIT_CONFIG
  t/Makefile: stop setting GIT_CONFIG
2014-03-31 16:31:17 -07:00
Junio C Hamano 00d4ff1a69 Merge branch 'wt/doc-submodule-name-path-confusion-2'
* wt/doc-submodule-name-path-confusion-2:
  doc: submodule.*.branch config is keyed by name
2014-03-31 16:31:16 -07:00
Junio C Hamano d3badc6eb0 Merge branch 'wt/doc-submodule-name-path-confusion-1'
* wt/doc-submodule-name-path-confusion-1:
  doc: submodule.* config are keyed by submodule names
2014-03-31 16:31:14 -07:00
Junio C Hamano 8456113de5 Merge branch 'mr/msvc-link-with-lcurl'
* mr/msvc-link-with-lcurl:
  MSVC: allow linking with the cURL library
2014-03-31 16:31:07 -07:00
Junio C Hamano 24b9cb1002 Merge branch 'ib/rev-parse-parseopt-argh'
Teaches the "rev-parse --parseopt" mechanism used by scripted
Porcelains to parse command line options and give help text how to
supply argv-help (the placeholder string for an option parameter,
e.g. "key-id" in "--gpg-sign=<key-id>").

* ib/rev-parse-parseopt-argh:
  t1502: protect runs of SPs used in the indentation
  rev-parse --parseopt: option argument name hints
2014-03-31 16:30:59 -07:00
Junio C Hamano a79cbc1368 Merge branch 'dp/makefile-charset-lib-doc'
* dp/makefile-charset-lib-doc:
  Makefile: describe CHARSET_LIB better
2014-03-31 16:30:57 -07:00
Junio C Hamano c228a5c077 Merge branch 'js/userdiff-cc'
Improves the pattern to match the hunk-header for C/C++.

* js/userdiff-cc:
  userdiff: have 'cpp' hunk header pattern catch more C++ anchor points
  t4018: test cases showing that the cpp pattern misses many anchor points
  t4018: test cases for the built-in cpp pattern
  t4018: reduce test files for pattern compilation tests
  t4018: convert custom pattern test to the new infrastructure
  t4018: convert java pattern test to the new infrastructure
  t4018: convert perl pattern tests to the new infrastructure
  t4018: an infrastructure to test hunk headers
  userdiff: support unsigned and long long suffixes of integer constants
  userdiff: support C++ ->* and .* operators in the word regexp
2014-03-31 16:30:54 -07:00
Junio C Hamano e164a8fd79 Merge branch 'dw/doc-status-no-longer-shows-pound-prefix'
* dw/doc-status-no-longer-shows-pound-prefix:
  doc: status, remove leftover statement about '#' prefix
2014-03-31 16:30:52 -07:00
Junio C Hamano 76bc28a3bb Merge branch 'ca/doc-config-third-party'
* ca/doc-config-third-party:
  config.txt: third-party tools may and do use their own variables
2014-03-31 16:30:49 -07:00
Junio C Hamano f7804e250d Merge branch 'hs/simplify-bit-setting-in-fsck-tree'
* hs/simplify-bit-setting-in-fsck-tree:
  fsck: use bitwise-or assignment operator to set flag
2014-03-31 16:30:44 -07:00
Junio C Hamano fa73d35468 Merge branch 'dt/tests-with-env-not-subshell'
* dt/tests-with-env-not-subshell:
  tests: use "env" to run commands with temporary env-var settings
2014-03-31 16:30:40 -07:00
Junio C Hamano 96e67c86f8 Update draft release notes to 2.0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-28 13:56:29 -07:00
Junio C Hamano 40adf520a3 Merge branch 'ys/fsck-commit-parsing'
* ys/fsck-commit-parsing:
  fsck.c:fsck_commit(): use skip_prefix() to verify and skip constant
  fsck.c:fsck_ident(): ident points at a const string
2014-03-28 13:51:24 -07:00
Junio C Hamano 97345145ff Merge branch 'bg/rebase-off-of-previous-branch'
* bg/rebase-off-of-previous-branch:
  rebase: allow "-" short-hand for the previous branch
2014-03-28 13:51:20 -07:00
Junio C Hamano 9abf65d23c Merge branch 'bp/commit-p-editor'
When it is not necessary to edit a commit log message (e.g. "git
commit -m" is given a message without specifying "-e"), we used to
disable the spawning of the editor by overriding GIT_EDITOR, but
this means all the uses of the editor, other than to edit the
commit log message, are also affected.

* bp/commit-p-editor:
  run-command: mark run_hook_with_custom_index as deprecated
  merge hook tests: fix and update tests
  merge: fix GIT_EDITOR override for commit hook
  commit: fix patch hunk editing with "commit -p -m"
  test patch hunk editing with "commit -p -m"
  merge hook tests: use 'test_must_fail' instead of '!'
  merge hook tests: fix missing '&&' in test
2014-03-28 13:51:11 -07:00
Junio C Hamano b2273d0603 Merge branch 'ah/doc-gitk-config'
* ah/doc-gitk-config:
  Documentation/gitk: document the location of the configulation file
2014-03-28 13:51:09 -07:00
Junio C Hamano c301a23ff8 Merge branch 'fr/add-interactive-argv-array'
* fr/add-interactive-argv-array:
  add: use struct argv_array in run_add_interactive()
2014-03-28 13:51:05 -07:00
Junio C Hamano fe2a4f1591 Merge branch 'jk/subtree-prefix'
A stray environment variable $prefix could have leaked into and
affected the behaviour of the "subtree" script.

* jk/subtree-prefix:
  subtree: initialize "prefix" variable
2014-03-28 13:50:59 -07:00
Junio C Hamano 0ddcc9cfba Merge branch 'jk/pack-bitmap-progress'
The progress output while repacking and transferring objects showed
an apparent large silence while writing the objects out of existing
packfiles, when the reachability bitmap was in use.

* jk/pack-bitmap-progress:
  pack-objects: show reused packfile objects in "Counting objects"
  pack-objects: show progress for reused packfiles
2014-03-28 13:50:56 -07:00
Junio C Hamano e2450e1245 Merge branch 'jk/pack-bitmap'
Instead of dying when asked to (re)pack with the reachability
bitmap when a bitmap cannot be built, just (re)pack without
producing a bitmap in such a case, with a warning.

* jk/pack-bitmap:
  pack-objects: turn off bitmaps when skipping objects
2014-03-28 13:50:50 -07:00
W. Trevor King 7c15fe92ac doc: submodule.*.branch config is keyed by name
Ever since 941987a5 (git-submodule: give submodules proper names,
2007-06-11) introduced the ability to move a submodule from one path
to another inside its superproject tree without losing its identity,
we should have consistently used submodule.<name>.* to access
settings related to the named submodule.

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-27 15:01:42 -07:00
W. Trevor King 15d64936d4 doc: submodule.* config are keyed by submodule names
Ever since 941987a5 (git-submodule: give submodules proper names,
2007-06-11) introduced the ability to move a submodule from one path
to another inside its superproject tree without losing its identity,
we should have consistently used submodule.<name>.* to access
settings related to the named submodule.

Reported-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-27 14:58:37 -07:00
Marat Radchenko da8daa367b MSVC: allow linking with the cURL library
Teach the clink.pl script that -lcurl is a request to link with the
cURL library, and drop NO_CURL from config.mak.uname for the MSVC
platform.

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-27 12:05:14 -07:00
Matthieu Moy 7a76c28ff2 status: disable translation when --porcelain is used
"git status --branch --porcelain" displays the status of the branch
(ahead, behind, gone), and used gettext to translate the string.

Use hardcoded strings when --porcelain is used, but keep the gettext
translation for "git status --short" which is essentially the same, but
meant to be read by a human.

Reported-by: Anarky <ghostanarky@gmail.com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-26 12:56:30 -07:00
Junio C Hamano d393d140b5 Update draft release notes to 2.0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-25 12:01:39 -07:00
Junio C Hamano 53c98cc718 Merge branch 'ss/test-on-mingw-rsync-path-no-absolute'
* ss/test-on-mingw-rsync-path-no-absolute:
  t5510: Do not use $(pwd) when fetching / pushing / pulling via rsync
2014-03-25 11:08:35 -07:00
Junio C Hamano 37943cc6b9 Merge branch 'bb/diff-no-index-dotdot'
* bb/diff-no-index-dotdot:
  diff-no-index: replace manual "."/".." check with is_dot_or_dotdot()
  diff-no-index: rename read_directory()
2014-03-25 11:08:31 -07:00
Junio C Hamano cf30bfb8fb Merge branch 'us/printf-not-echo'
* us/printf-not-echo:
  test-lib.sh: do not "echo" caller-supplied strings
  rebase -i: do not "echo" random user-supplied strings
2014-03-25 11:08:27 -07:00
Junio C Hamano 3e33860aa1 Merge branch 'rr/doc-merge-strategies'
* rr/doc-merge-strategies:
  Documentation/merge-strategies: avoid hyphenated commands
2014-03-25 11:08:23 -07:00
Junio C Hamano 0e8c09263e Merge branch 'nd/index-pack-error-message'
* nd/index-pack-error-message:
  index-pack: report error using the correct variable
2014-03-25 11:08:19 -07:00
Junio C Hamano 66d913367d Merge branch 'jk/lib-terminal-lazy'
The test helper lib-terminal always run an actual test_expect_* when
included, which screwed up with the use of skil-all that may have to
be done later.

* jk/lib-terminal-lazy:
  t/lib-terminal: make TTY a lazy prerequisite
2014-03-25 11:08:09 -07:00
Junio C Hamano 2f2db83fb7 Merge branch 'dm/configure-iconv-locale-charset'
* dm/configure-iconv-locale-charset:
  configure.ac: link with -liconv for locale_charset()
2014-03-25 11:07:51 -07:00
Junio C Hamano 46c0f913a4 Merge branch 'nd/commit-editor-cleanup'
"git commit --cleanup=<mode>" learned a new mode, scissors.

* nd/commit-editor-cleanup:
  commit: add --cleanup=scissors
  wt-status.c: move cut-line print code out to wt_status_add_cut_line
  wt-status.c: make cut_line[] const to shrink .data section a bit
2014-03-25 11:07:48 -07:00
Junio C Hamano d4c6e9fb6f Merge branch 'jk/warn-on-object-refname-ambiguity'
* jk/warn-on-object-refname-ambiguity:
  rev-list: disable object/refname ambiguity check with --stdin
  cat-file: restore warn_on_object_refname_ambiguity flag
  cat-file: fix a minor memory leak in batch_objects
  cat-file: refactor error handling of batch_objects
2014-03-25 11:07:36 -07:00
Junio C Hamano ec8cd4fc11 Merge branch 'mh/remove-subtree-long-pathname-fix'
* mh/remove-subtree-long-pathname-fix:
  entry.c: fix possible buffer overflow in remove_subtree()
  checkout_entry(): use the strbuf throughout the function
2014-03-25 11:07:09 -07:00
Junio C Hamano 34a2e88ae2 Merge branch 'nd/indent-fix-connect-c'
* nd/indent-fix-connect-c:
  connect.c: SP after "}", not TAB
2014-03-25 11:07:06 -07:00
Junio C Hamano 12de60ac7a Merge branch 'jk/mv-submodules-fix'
"git mv" that moves a submodule forgot to adjust the array that uses
to keep track of which submodules were to be moved to update its
configuration.

* jk/mv-submodules-fix:
  mv: prevent mismatched data when ignoring errors.
  builtin/mv: fix out of bounds write
2014-03-25 11:02:02 -07:00
Junio C Hamano 2dfefe0f89 Merge branch 'cp/am-patch-format-doc'
* cp/am-patch-format-doc:
  Documentation/git-am: typofix
  Documentation/git-am: Document supported --patch-format options
2014-03-25 11:01:31 -07:00
Adam 9fe0cf3a5e branch.c: install_branch_config: simplify if chain
Simplify if chain in install_branch_config().

Signed-off-by: Adam <Adam@sigterm.info>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-24 12:43:07 -07:00
Junio C Hamano ce7f8745aa t1502: protect runs of SPs used in the indentation
The expected output from the argument help use runs of SPs to align
the description of each option; a careless use of --whitespace=fix
can turn leading parts of them into appropriate number of HTs.
Prevent such a breakage by prefixing all the expected lines with
leading vertical bars in the original and stripping them with a
small sed script.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-23 17:28:03 -07:00
Ilya Bobyr 9bab5b6061 rev-parse --parseopt: option argument name hints
Built-in commands can specify names for option arguments when usage text
is generated for a command.  sh based commands should be able to do the
same.

Option argument name hint is any text that comes after [*=?!] after the
argument name up to the first whitespace.

Signed-off-by: Ilya Bobyr <ilya.bobyr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-23 17:28:03 -07:00
Дилян Палаузов 3064b13053 Makefile: describe CHARSET_LIB better
The original explanation was not even grammatically correct or
readable.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-23 13:41:38 -07:00
Johannes Sixt 8a2e8da367 userdiff: have 'cpp' hunk header pattern catch more C++ anchor points
The hunk header pattern 'cpp' is intended for C and C++ source code, but
it is actually not particularly useful for the latter, and even misses
some use-cases for the former.

The parts of the pattern have the following flaws:

- The first part matches an identifier followed immediately by a colon
  and arbitrary text and is intended to reject goto labels and C++
  access specifiers (public, private, protected). But this pattern also
  rejects C++ constructs, which look like this:

    MyClass::MyClass()
    MyClass::~MyClass()
    MyClass::Item MyClass::Find(...

- The second part matches an identifier followed by a list of qualified
  names (i.e. identifiers separated by the C++ scope operator '::')
  separated by space or '*' followed by an opening parenthesis (with
  space between the tokens). It matches function declarations like

    struct item* get_head(...
    int Outer::Inner::Func(...

  Since the pattern requires at least two identifiers, GNU-style
  function definitions are ignored:

    void
    func(...

  Moreover, since the pattern does not allow punctuation other than '*',
  the following C++ constructs are not recognized:

  . template definitions:
      template<class T> int func(T arg)

  . functions returning references:
      const string& get_message()

  . functions returning templated types:
      vector<int> foo()

  . operator definitions:
      Value operator+(Value l, Value r)

- The third part of the pattern finally matches compound definitions.
  But it forgets about unions and namespaces, and also skips single-line
  definitions

    struct random_iterator_tag {};

  because no semicolon can occur on the line.

Change the first pattern to require a colon at the end of the line
(except for trailing space and comments), so that it does not reject
constructor or destructor definitions.

Notice that all interesting anchor points begin with an identifier or
keyword. But since there is a large variety of syntactical constructs
after the first "word", the simplest is to require only this word and
accept everything else. Therefore, this boils down to a line that begins
with a letter or underscore (optionally preceded by the C++ scope
operator '::' to accept functions returning a type anchored at the
global namespace). Replace the second and third part by a single pattern
that picks such a line.

This has the following desirable consequence:

- All constructs mentioned above are recognized.

and the following likely desirable consequences:

- Definitions of global variables and typedefs are recognized:

    int num_entries = 0;
    extern const char* help_text;
    typedef basic_string<wchar_t> wstring;

- Commonly used marco-ized boilerplate code is recognized:

    BEGIN_MESSAGE_MAP(CCanvas,CWnd)
    Q_DECLARE_METATYPE(MyStruct)
    PATTERNS("tex",...)

  (The last one is from this very patch.)

but also the following possibly undesirable consequence:

- When a label is not on a line by itself (except for a comment) it is
  no longer rejected, but can appear as a hunk header if it occurs at
  the beginning of a line:

    next:;

IMO, the benefits of the change outweigh the (possible) regressions by a
large margin.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-21 15:03:32 -07:00