]> git.99rst.org Git - git.git/log
git.git
12 years agoMerge branch 'jk/pack-bitmap'
Junio C Hamano [Fri, 28 Mar 2014 20:50:50 +0000 (13:50 -0700)]
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

12 years agoMSVC: link in invalidcontinue.obj for better POSIX compatibility
Marat Radchenko [Fri, 28 Mar 2014 20:08:02 +0000 (00:08 +0400)]
MSVC: link in invalidcontinue.obj for better POSIX compatibility

By default, Windows abort()'s instead of setting
errno=EINVAL when invalid arguments are passed to standard functions.

For example, when PAGER quits and git detects it with
errno=EPIPE on write(), check_pipe() in write_or_die.c tries raise(SIGPIPE)
but since there is no SIGPIPE on Windows, it is treated as invalid argument,
causing abort() and crash report window.

Linking in invalidcontinue.obj (provided along with MS compiler) allows
raise(SIGPIPE) to return with errno=EINVAL.

Signed-off-by: Marat Radchenko <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agodoc: submodule.*.branch config is keyed by name
W. Trevor King [Thu, 27 Mar 2014 21:06:20 +0000 (14:06 -0700)]
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agodoc: submodule.* config are keyed by submodule names
W. Trevor King [Thu, 27 Mar 2014 21:06:20 +0000 (14:06 -0700)]
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 <redacted>
Signed-off-by: W. Trevor King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoMSVC: allow linking with the cURL library
Marat Radchenko [Thu, 27 Mar 2014 07:34:27 +0000 (11:34 +0400)]
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoPortable alloca for Git
Kirill Smelkov [Thu, 27 Mar 2014 14:22:50 +0000 (18:22 +0400)]
Portable alloca for Git

In the next patch we'll have to use alloca() for performance reasons,
but since alloca is non-standardized and is not portable, let's have a
trick with compatibility wrappers:

1. at configure time, determine, do we have working alloca() through
   alloca.h, and define

    #define HAVE_ALLOCA_H

   if yes.

2. in code

    #ifdef HAVE_ALLOCA_H
    # include <alloca.h>
    # define xalloca(size)      (alloca(size))
    # define xalloca_free(p)    do {} while(0)
    #else
    # define xalloca(size)      (xmalloc(size))
    # define xalloca_free(p)    (free(p))
    #endif

   and use it like

   func() {
       p = xalloca(size);
       ...

       xalloca_free(p);
   }

This way, for systems, where alloca is available, we'll have optimal
on-stack allocations with fast executions. On the other hand, on
systems, where alloca is not available, this gracefully fallbacks to
xmalloc/free.

Both autoconf and config.mak.uname configurations were updated. For
autoconf, we are not bothering considering cases, when no alloca.h is
available, but alloca() works some other way - its simply alloca.h is
available and works or not, everything else is deep legacy.

For config.mak.uname, I've tried to make my almost-sure guess for where
alloca() is available, but since I only have access to Linux it is the
only change I can be sure about myself, with relevant to other changed
systems people Cc'ed.

NOTE

SunOS and Windows had explicit -DHAVE_ALLOCA_H in their configurations.
I've changed that to now-common HAVE_ALLOCA_H=YesPlease which should be
correct.

Cc: Brandon Casey <redacted>
Cc: Marius Storm-Olsen <redacted>
Cc: Johannes Sixt <redacted>
Cc: Johannes Schindelin <redacted>
Cc: Ramsay Jones <redacted>
Cc: Gerrit Pape <redacted>
Cc: Petr Salinger <redacted>
Cc: Jonathan Nieder <redacted>
Acked-by: Thomas Schwinge <redacted> (GNU Hurd changes)
Signed-off-by: Kirill Smelkov <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agotree-diff: reuse base str(buf) memory on sub-tree recursion
Kirill Smelkov [Thu, 27 Mar 2014 14:22:07 +0000 (18:22 +0400)]
tree-diff: reuse base str(buf) memory on sub-tree recursion

Instead of allocating it all the time for every subtree in
ll_diff_tree_sha1, let's allocate it once in diff_tree_sha1, and then
all callee just use it in stacking style, without memory allocations.

This should be faster, and for me this change gives the following
slight speedups for

    git log --raw --no-abbrev --no-renames --format='%H'

                navy.git    linux.git v3.10..v3.11

    before      0.618s      1.903s
    after       0.611s      1.889s
    speedup     1.1%        0.7%

Signed-off-by: Kirill Smelkov <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agotree-diff: no need to call "full" diff_tree_sha1 from show_path()
Kirill Smelkov [Thu, 27 Mar 2014 14:21:29 +0000 (18:21 +0400)]
tree-diff: no need to call "full" diff_tree_sha1 from show_path()

As described in previous commit, when recursing into sub-trees, we can
use lower-level tree walker, since its interface is now sha1 based.

The change is ok, because diff_tree_sha1() only invokes
ll_diff_tree_sha1(), and also, if base is empty, try_to_follow_renames().
But base is not empty here, as we have added a path and '/' before
recursing.

Signed-off-by: Kirill Smelkov <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agotree-diff: rework diff_tree interface to be sha1 based
Kirill Smelkov [Thu, 27 Mar 2014 14:24:38 +0000 (18:24 +0400)]
tree-diff: rework diff_tree interface to be sha1 based

In the next commit this will allow to reduce intermediate calls, when
recursing into subtrees - at that stage we know only subtree sha1, and
it is natural for tree walker to start from that phase. For now we do

    diff_tree
        show_path
            diff_tree_sha1
                diff_tree
                    ...

and the change will allow to reduce it to

    diff_tree
        show_path
            diff_tree

Also, it will allow to omit allocating strbuf for each subtree, and just
reuse the common strbuf via playing with its len.

The above-mentioned improvements go in the next 2 patches.

The downside is that try_to_follow_renames(), if active, we cause
re-reading of 2 initial trees, which was negligible based on my timings,
and which is outweighed cogently by the upsides.

NOTE To keep with the current interface and semantics, I needed to
rename the function from diff_tree() to diff_tree_sha1(). As
diff_tree_sha1() was already used, and the function we are talking here
is its more low-level helper, let's use convention for prefixing
such helpers with "ll_". So the final renaming is

    diff_tree() -> ll_diff_tree_sha1()

Signed-off-by: Kirill Smelkov <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agotree-diff: diff_tree() should now be static
Kirill Smelkov [Mon, 24 Feb 2014 16:21:45 +0000 (20:21 +0400)]
tree-diff: diff_tree() should now be static

We reworked all its users to use the functionality through
diff_tree_sha1 variant in recent patches (see "tree-diff: allow
diff_tree_sha1 to accept NULL sha1" and what comes next).

diff_tree() is now not used outside tree-diff.c - make it static.

Signed-off-by: Kirill Smelkov <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agotree-diff: remove special-case diff-emitting code for empty-tree cases
Kirill Smelkov [Mon, 24 Feb 2014 16:21:44 +0000 (20:21 +0400)]
tree-diff: remove special-case diff-emitting code for empty-tree cases

While walking trees, we iterate their entries from lowest to highest in
sort order, so empty tree means all entries were already went over.

If we artificially assign +infinity value to such tree "entry", it will
go after all usual entries, and through the usual driver loop we will be
taking the same actions, which were hand-coded for special cases, i.e.

    t1 empty, t2 non-empty
        pathcmp(+∞, t2) -> +1
        show_path(/*t1=*/NULL, t2);     /* = t1 > t2 case in main loop */

    t1 non-empty, t2-empty
        pathcmp(t1, +∞) -> -1
        show_path(t1, /*t2=*/NULL);     /* = t1 < t2 case in main loop */

In other words when we have t1 and t2, we return a sign that tells the
caller to indicate the "earlier" one to be emitted, and by returning the
sign that causes the non-empty side to be emitted, we will automatically
cause the entries from the remaining side to be emitted, without
attempting to touch the empty side at all.  We can teach
tree_entry_pathcmp() to pretend that an empty tree has an element that
sorts after anything else to achieve this.

Right now we never go to when compared tree descriptors are both
infinity, as this condition is checked in the loop beginning as
finishing criteria, but will do so in the future, when there will be
several parents iterated simultaneously, and some pair of them would run
to the end.

Signed-off-by: Kirill Smelkov <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoapply --ignore-space-change: lines with and without leading whitespaces do not match
Junio C Hamano [Wed, 26 Mar 2014 20:42:06 +0000 (13:42 -0700)]
apply --ignore-space-change: lines with and without leading whitespaces do not match

The fuzzy_matchlines() function is used when attempting to resurrect
a patch that is whitespace-damaged, or when applying a patch that
was produced against an old codebase to the codebase after
indentation change.

The patch may want to change a line "a_bc" ("_" is used throught
this description for a whitespace to make it stand out) in the
original into something else, and we may not find "a_bc" in the
current source, but there may be "a__bc" (two spaces instead of one
the whitespace-damaged patch claims to expect).  By ignoring the
amount of whitespaces, it forces "git apply" to consider that "a_bc"
in the broken patch meant to refer to "a__bc" in reality.

However, the implementation special cases a run of whitespaces at
the beginning of a line and makes "abc" match "_abc", even though a
whitespace in the middle of string never matches a 0-width gap,
e.g. "a_bc" does not match "abc".  A run of whitespace at the end of
one string does not match a 0-width end of line on the other line,
either, e.g. "abc_" does not match "abc".

Fix this inconsistency by making the code skip leading whitespaces
only when both strings begin with a whitespace.  This makes the
option mean the same as the option of the same name in "diff" and
"git diff".

Note that I am not sure if anybody sane should use this option in
the first place.  The fuzzy match logic may be able to find the
original line that the patch author may have meant to touch because
it does not fully trust what the original lines say (i.e. context
lines prefixed by " " and old lines prefixed by "-" does not have to
exactly match the contents the patch is applied to).  There is no
reason for us to trust what the replacement lines (i.e. new lines
prefixed by "+") say, either, but with this option enabled, we end
up copying these new lines with suspicious whitespace distributions
literally into the patched result.  But as long as we keep it, we
should make it do its insane thing consistently.

Signed-off-by: Junio C Hamano <redacted>
12 years agofetch: handle overlaping refspecs on --prune
Carlos Martín Nieto [Thu, 27 Feb 2014 09:00:10 +0000 (10:00 +0100)]
fetch: handle overlaping refspecs on --prune

We need to consider that a remote-tracking branch may match more than
one rhs of a fetch refspec. In such a case, it is not enough to stop at
the first match but look at all of the matches in order to determine
whether a head is stale.

To this goal, introduce a variant of query_refspecs which returns all of
the matching refspecs and loop over those answers to check for
staleness.

Signed-off-by: Carlos Martín Nieto <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agostatus: disable translation when --porcelain is used
Matthieu Moy [Thu, 20 Mar 2014 12:12:41 +0000 (13:12 +0100)]
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 <redacted>
Signed-off-by: Matthieu Moy <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agolog: add --show-linear-break to help see non-linear history
Nguyễn Thái Ngọc Duy [Tue, 25 Mar 2014 13:23:27 +0000 (20:23 +0700)]
log: add --show-linear-break to help see non-linear history

Option explanation is in rev-list-options.txt. The interaction with -z
is left undecided.

Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoobject.h: centralize object flag allocation
Nguyễn Thái Ngọc Duy [Tue, 25 Mar 2014 13:23:26 +0000 (20:23 +0700)]
object.h: centralize object flag allocation

While the field "flags" is mainly used by the revision walker, it is
also used in many other places. Centralize the whole flag allocation to
one place for a better overview (and easier to move flags if we have
too).

Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agogit-am.sh: use the $(...) construct for command substitution
Elia Pinto [Tue, 25 Mar 2014 17:22:22 +0000 (10:22 -0700)]
git-am.sh: use the $(...) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

    for _f in $(find . -name "*.sh")
    do
      sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
    done

and then carefully proof-read.

Signed-off-by: Elia Pinto <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agocheck-builtins.sh: use the $(...) construct for command substitution
Elia Pinto [Tue, 25 Mar 2014 17:22:22 +0000 (10:22 -0700)]
check-builtins.sh: use the $(...) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

    for _f in $(find . -name "*.sh")
    do
      sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
    done

and then carefully proof-read.

Signed-off-by: Elia Pinto <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoremote-hg: do not fail on invalid bookmarks
Max Horn [Fri, 21 Mar 2014 11:36:36 +0000 (12:36 +0100)]
remote-hg: do not fail on invalid bookmarks

Mercurial can have bookmarks pointing to "nullid" (the empty root
revision), while Git can not have references to it. When cloning or
fetching from a Mercurial repository that has such a bookmark, the
import failed because git-remote-hg was not be able to create the
corresponding reference.

Warn the user about the invalid reference, and do not advertise these
bookmarks as head refs, but otherwise continue the import. In
particular, we still keep track of the fact that the remote repository
has a bookmark of the given name, in case the user wants to modify that
bookmark.

Also add some test cases for this issue.

Reported-by: Antoine Pelisse <redacted>
Signed-off-by: Max Horn <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoUpdate draft release notes to 2.0
Junio C Hamano [Tue, 25 Mar 2014 19:01:39 +0000 (12:01 -0700)]
Update draft release notes to 2.0

Signed-off-by: Junio C Hamano <redacted>
12 years agoMerge branch 'ss/test-on-mingw-rsync-path-no-absolute'
Junio C Hamano [Tue, 25 Mar 2014 18:08:35 +0000 (11:08 -0700)]
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

12 years agoMerge branch 'bb/diff-no-index-dotdot'
Junio C Hamano [Tue, 25 Mar 2014 18:08:31 +0000 (11:08 -0700)]
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()

12 years agoMerge branch 'us/printf-not-echo'
Junio C Hamano [Tue, 25 Mar 2014 18:08:26 +0000 (11:08 -0700)]
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

12 years agoMerge branch 'rr/doc-merge-strategies'
Junio C Hamano [Tue, 25 Mar 2014 18:08:23 +0000 (11:08 -0700)]
Merge branch 'rr/doc-merge-strategies'

* rr/doc-merge-strategies:
  Documentation/merge-strategies: avoid hyphenated commands

12 years agoMerge branch 'nd/index-pack-error-message'
Junio C Hamano [Tue, 25 Mar 2014 18:08:19 +0000 (11:08 -0700)]
Merge branch 'nd/index-pack-error-message'

* nd/index-pack-error-message:
  index-pack: report error using the correct variable

12 years agoMerge branch 'jk/lib-terminal-lazy'
Junio C Hamano [Tue, 25 Mar 2014 18:08:09 +0000 (11:08 -0700)]
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

12 years agoMerge branch 'dm/configure-iconv-locale-charset'
Junio C Hamano [Tue, 25 Mar 2014 18:07:51 +0000 (11:07 -0700)]
Merge branch 'dm/configure-iconv-locale-charset'

* dm/configure-iconv-locale-charset:
  configure.ac: link with -liconv for locale_charset()

12 years agoMerge branch 'nd/commit-editor-cleanup'
Junio C Hamano [Tue, 25 Mar 2014 18:07:47 +0000 (11:07 -0700)]
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

12 years agoMerge branch 'jk/warn-on-object-refname-ambiguity'
Junio C Hamano [Tue, 25 Mar 2014 18:07:36 +0000 (11:07 -0700)]
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

12 years agoMerge branch 'mh/remove-subtree-long-pathname-fix'
Junio C Hamano [Tue, 25 Mar 2014 18:07:09 +0000 (11:07 -0700)]
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

12 years agoMerge branch 'nd/indent-fix-connect-c'
Junio C Hamano [Tue, 25 Mar 2014 18:07:05 +0000 (11:07 -0700)]
Merge branch 'nd/indent-fix-connect-c'

* nd/indent-fix-connect-c:
  connect.c: SP after "}", not TAB

12 years agoMerge branch 'jk/mv-submodules-fix'
Junio C Hamano [Tue, 25 Mar 2014 18:02:01 +0000 (11:02 -0700)]
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

12 years agoMerge branch 'cp/am-patch-format-doc'
Junio C Hamano [Tue, 25 Mar 2014 18:01:31 +0000 (11:01 -0700)]
Merge branch 'cp/am-patch-format-doc'

* cp/am-patch-format-doc:
  Documentation/git-am: typofix
  Documentation/git-am: Document supported --patch-format options

12 years agopickaxe: simplify kwset loop in contains()
René Scharfe [Sat, 22 Mar 2014 17:16:00 +0000 (18:16 +0100)]
pickaxe: simplify kwset loop in contains()

Inlining the variable "found" actually makes the code shorter and
easier to read.

Signed-off-by: Rene Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agopickaxe: call strlen only when necessary in diffcore_pickaxe_count()
René Scharfe [Sat, 22 Mar 2014 17:15:59 +0000 (18:15 +0100)]
pickaxe: call strlen only when necessary in diffcore_pickaxe_count()

We need to determine the search term's length only when fixed-string
matching is used; regular expression compilation takes a NUL-terminated
string directly.  Only call strlen() in the former case.

Signed-off-by: Rene Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agopickaxe: move pickaxe() after pickaxe_match()
René Scharfe [Sat, 22 Mar 2014 17:15:58 +0000 (18:15 +0100)]
pickaxe: move pickaxe() after pickaxe_match()

pickaxe() calls pickaxe_match(); moving the definition of the former
after the latter allows us to do without an explicit function
declaration.

Signed-off-by: Rene Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agopickaxe: merge diffcore_pickaxe_grep() and diffcore_pickaxe_count() into diffcore_pic...
René Scharfe [Sat, 22 Mar 2014 17:15:57 +0000 (18:15 +0100)]
pickaxe: merge diffcore_pickaxe_grep() and diffcore_pickaxe_count() into diffcore_pickaxe()

diffcore_pickaxe_count() initializes the regular expression or kwset for
the search term, calls pickaxe() with the callback has_changes() and
cleans up afterwards.  diffcore_pickaxe_grep() does the same, only it
doesn't support kwset and uses the callback diff_grep() instead.  Merge
the two functions to form the new diffcore_pickaxe() and thus get rid of
the duplicate regex setup and cleanup code.

Signed-off-by: Rene Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agopickaxe: honor -i when used with -S and --pickaxe-regex
René Scharfe [Sat, 22 Mar 2014 17:15:56 +0000 (18:15 +0100)]
pickaxe: honor -i when used with -S and --pickaxe-regex

accccde4 (pickaxe: allow -i to search in patch case-insensitively)
allowed case-insenitive matching for -G and -S, but for the latter
only if fixed string matching is used.  Allow it for -S and regular
expression matching as well to make the support complete.

Signed-off-by: Rene Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot4209: use helper functions to test --author
René Scharfe [Sat, 22 Mar 2014 17:15:55 +0000 (18:15 +0100)]
t4209: use helper functions to test --author

Also add tests for case sensitive and non-matching cases.

Signed-off-by: Rene Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot4209: use helper functions to test --grep
René Scharfe [Sat, 22 Mar 2014 17:15:54 +0000 (18:15 +0100)]
t4209: use helper functions to test --grep

Also add tests for non-matching cases.

Signed-off-by: Rene Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot4209: factor out helper function test_log_icase()
René Scharfe [Sat, 22 Mar 2014 17:15:53 +0000 (18:15 +0100)]
t4209: factor out helper function test_log_icase()

Reduce code duplication by introducing test_log_icase() that runs the
same test with both --regexp-ignore-case and -i.  The specification of
the four basic test scenarios (matching/nomatching combined with case
sensitive/insensitive) becomes easier to read and write.

Signed-off-by: Rene Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot4209: factor out helper function test_log()
René Scharfe [Sat, 22 Mar 2014 17:15:52 +0000 (18:15 +0100)]
t4209: factor out helper function test_log()

Twelve tests in t4209 follow the same simple pattern for description,
git log call and checking.  Extract that shared logic into a helper
function named test_log.  Test specifications become a lot more
compact, new tests can be added more easily.

Signed-off-by: Rene Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agobranch.c: install_branch_config: simplify if chain
Adam [Mon, 10 Mar 2014 05:32:01 +0000 (01:32 -0400)]
branch.c: install_branch_config: simplify if chain

Simplify if chain in install_branch_config().

Signed-off-by: Adam <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot4209: set up expectations up front
René Scharfe [Sat, 22 Mar 2014 17:15:51 +0000 (18:15 +0100)]
t4209: set up expectations up front

Instead of creating an expect file for each test, build three files with
the possible valid values during setup and use them in the tests.  This
shortens the test code and saves nine calls to git rev-parse.

Signed-off-by: Rene Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoparse-options: make sure argh string does not have SP or _
Junio C Hamano [Sun, 23 Mar 2014 23:04:36 +0000 (16:04 -0700)]
parse-options: make sure argh string does not have SP or _

We encourage to spell an argument hint that consists of multiple
words as a single-token separated with dashes.  In order to help
catching violations added by new callers of parse-options, make sure
argh does not contain SP or _ when the code validates the option
definitions.

Signed-off-by: Junio C Hamano <redacted>
12 years agoupdate-index: teach --cacheinfo a new syntax "mode,sha1,path"
Junio C Hamano [Sun, 23 Mar 2014 23:57:28 +0000 (16:57 -0700)]
update-index: teach --cacheinfo a new syntax "mode,sha1,path"

The "--cacheinfo" option is unusual in that it takes three option
parameters.  An option with an optional parameter is bad enough.  An
option with multiple parameters is simply insane.

Introduce a new syntax that takes these three things concatenated
together with a comma, which makes the command line syntax more
uniform across subcommands, while retaining the traditional syntax
for backward compatiblity.

If we were designing the "update-index" subcommand from scratch
today, it may probably have made sense to make this option (and
possibly others) a command mode option that does not take any option
parameter (hence no need for arg-help).  But we do not live in such
an ideal world, and as far as I can tell, the command still supports
(and must support) mixed command modes in a single invocation, e.g.

    $ git update-index path1 --add path2 \
        --cacheinfo 100644 $(git hash-object --stdin -w <path3) path3 \
path4

must make sure path1 is already in the index and update all of these
four paths.  So this is probably as far as we can go to fix this issue
without risking to break people's existing scripts.

Signed-off-by: Junio C Hamano <redacted>
12 years agoparse-options: multi-word argh should use dash to separate words
Junio C Hamano [Sun, 23 Mar 2014 22:58:12 +0000 (15:58 -0700)]
parse-options: multi-word argh should use dash to separate words

"When you need to use space, use dash" is a strange way to say that
you must not use a space.  Because it is more common for the command
line descriptions to use dashed-multi-words, you do not even want to
use spaces in these places.  Rephrase the documentation to avoid
this strangeness.

Fix a few existing multi-word argument help strings, i.e.

 - GPG key-ids given to -S/--gpg-sign are "key-id";
 - Refs used for storing notes are "notes-ref"; and
 - Expiry timestamps given to --expire are "expiry-date".

and update the corresponding documentation pages.

Signed-off-by: Junio C Hamano <redacted>
12 years agot1502: protect runs of SPs used in the indentation
Junio C Hamano [Sun, 23 Mar 2014 22:26:36 +0000 (15:26 -0700)]
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 <redacted>
12 years agorev-parse --parseopt: option argument name hints
Ilya Bobyr [Sat, 22 Mar 2014 09:47:34 +0000 (02:47 -0700)]
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoMakefile: describe CHARSET_LIB better
Дилян Палаузов [Tue, 11 Mar 2014 22:37:33 +0000 (23:37 +0100)]
Makefile: describe CHARSET_LIB better

The original explanation was not even grammatically correct or
readable.

Signed-off-by: Junio C Hamano <redacted>
12 years agouserdiff: have 'cpp' hunk header pattern catch more C++ anchor points
Johannes Sixt [Fri, 21 Mar 2014 21:07:22 +0000 (22:07 +0100)]
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot4018: test cases showing that the cpp pattern misses many anchor points
Johannes Sixt [Fri, 21 Mar 2014 21:07:21 +0000 (22:07 +0100)]
t4018: test cases showing that the cpp pattern misses many anchor points

Most of the tests show C++ code, but there is also a union definition and
a GNU style function definition that are not recognized.

Signed-off-by: Johannes Sixt <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot4018: test cases for the built-in cpp pattern
Johannes Sixt [Fri, 21 Mar 2014 21:07:20 +0000 (22:07 +0100)]
t4018: test cases for the built-in cpp pattern

A later patch changes the built-in cpp pattern. These test cases
demonstrate aspects of the pattern that we do not want to change.

Signed-off-by: Johannes Sixt <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot4018: reduce test files for pattern compilation tests
Johannes Sixt [Fri, 21 Mar 2014 21:07:19 +0000 (22:07 +0100)]
t4018: reduce test files for pattern compilation tests

All test cases that need a file with specific text patterns have been
converted to utilize texts in the t4018/ directory. The remaining tests
in the test script deal only with the validity of the regular
expressions. These tests do not depend on the contents of files that
'git diff' is invoked on. Remove the largish here-document and use only
tiny files.

While we are touching these tests, convert grep to test_i18ngrep as the
texts checked for may undergo translation in the future.

Signed-off-by: Johannes Sixt <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot4018: convert custom pattern test to the new infrastructure
Johannes Sixt [Fri, 21 Mar 2014 21:07:18 +0000 (22:07 +0100)]
t4018: convert custom pattern test to the new infrastructure

For the test case "matches to end of line", extend the pattern by a few
wildcards so that the pattern captures the "RIGHT" token, which is needed
for verification, without mentioning it in the pattern.

Signed-off-by: Johannes Sixt <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot4018: convert java pattern test to the new infrastructure
Johannes Sixt [Fri, 21 Mar 2014 21:07:17 +0000 (22:07 +0100)]
t4018: convert java pattern test to the new infrastructure

Signed-off-by: Johannes Sixt <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot4018: convert perl pattern tests to the new infrastructure
Johannes Sixt [Fri, 21 Mar 2014 21:07:16 +0000 (22:07 +0100)]
t4018: convert perl pattern tests to the new infrastructure

There is one subtlety: The old test case 'perl pattern gets full line of
POD header' does not have its own new test case, but the feature is
tested nevertheless by placing the RIGHT tag at the end of the expected
hunk header in t4018/perl-skip-sub-in-pod.

Signed-off-by: Johannes Sixt <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot4018: an infrastructure to test hunk headers
Johannes Sixt [Fri, 21 Mar 2014 21:07:15 +0000 (22:07 +0100)]
t4018: an infrastructure to test hunk headers

Add an infrastructure that simplifies adding new tests of the hunk
header regular expressions.

To add new tests, a file with the syntax to test can be dropped in the
directory t4018. The README file explains how a test file must contain;
the README itself tests the default behavior.

Signed-off-by: Johannes Sixt <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agouserdiff: support unsigned and long long suffixes of integer constants
Johannes Sixt [Fri, 21 Mar 2014 21:07:14 +0000 (22:07 +0100)]
userdiff: support unsigned and long long suffixes of integer constants

Do not split constants such as 123U, 456ll, 789UL at the first U or
second L.

Signed-off-by: Johannes Sixt <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agouserdiff: support C++ ->* and .* operators in the word regexp
Johannes Sixt [Fri, 21 Mar 2014 21:07:13 +0000 (22:07 +0100)]
userdiff: support C++ ->* and .* operators in the word regexp

The character sequences ->* and .* are valid C++ operators. Keep them
together in --word-diff mode.

Signed-off-by: Johannes Sixt <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot0001: drop subshells just for "cd"
Jeff King [Thu, 20 Mar 2014 23:23:06 +0000 (19:23 -0400)]
t0001: drop subshells just for "cd"

Many tests do something like:

  (
mkdir foo &&
cd foo &&
git init
  )

You can do the same these days with "git init foo", which
makes the tests shorter and simpler to read.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot0001: drop useless subshells
Jeff King [Thu, 20 Mar 2014 23:21:25 +0000 (19:21 -0400)]
t0001: drop useless subshells

Many tests use subshells, but don't actually change the
shell environment. They were probably cargo-culted from
earlier tests which did need subshells. Drop the useless
ones.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot0001: use test_must_fail
Jeff King [Thu, 20 Mar 2014 23:19:50 +0000 (19:19 -0400)]
t0001: use test_must_fail

We've hand-rolled several "if" statements looking for
failures. We can use test_must_fail here, which is shorter
and more robust.

Note that we modify the commands slightly (to use "git init
foo" rather than "cd foo && git init") to avoid dealing with
a subshell, but this should not affect the outcome.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot0001: use test_config_global
Jeff King [Thu, 20 Mar 2014 23:18:12 +0000 (19:18 -0400)]
t0001: use test_config_global

We hand-set several config options using :

  git config -f $HOME/.gitconfig ...

Instead, we can use "test_config_global". Not only is this
more readable, but it cleans up for us so that subsequent
tests aren't polluted by our settings.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot0001: use test_path_is_*
Jeff King [Thu, 20 Mar 2014 23:17:35 +0000 (19:17 -0400)]
t0001: use test_path_is_*

t0001 predates the test_path_is_* helpers, and uses "test
-f" and "test -d" directly. Using the helpers provides
better debugging output, and are a little more robust.
As opposed to "! test -d", test_path_is_missing will
actually makes sure the path does not exist at all.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot0001: make symlink reinit test more careful
Jeff King [Thu, 20 Mar 2014 23:17:15 +0000 (19:17 -0400)]
t0001: make symlink reinit test more careful

In the final test of t0001, we have a repo whose .git is a
symlink to a directory "here", and we use
"--separate-git-dir" to migrate that to a .git file pointing
to a different directory. We check that the data is migrated
to the new directory and that .git looks like a git-file.

We also check that "here" is not a directory, which is
slightly misleading. It should not be a directory, but
neither should it be gone. It is the actual resting place of
the git-file, and .git remains a symlink to it.

Let's check that more explicitly, both to make our test more
robust, and to make further cleanups in this area more
obvious.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot: prefer "git config --file" to GIT_CONFIG
Jeff King [Thu, 20 Mar 2014 23:17:01 +0000 (19:17 -0400)]
t: prefer "git config --file" to GIT_CONFIG

Doing:

  GIT_CONFIG=foo git config ...

is equivalent to:

  git config --file=foo ...

The latter is easier to read and slightly less error-prone,
because of issues with one-shot variables and shell
functions (e.g., you cannot use the former with
test_must_fail).

Note that we explicitly leave one case in t1300 which checks
the same operation on both GIT_CONFIG and "git config
--file". They are equivalent in the code these days, but
this will make sure it remains so.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot: prefer "git config --file" to GIT_CONFIG with test_must_fail
Jeff King [Thu, 20 Mar 2014 23:15:54 +0000 (19:15 -0400)]
t: prefer "git config --file" to GIT_CONFIG with test_must_fail

This lets us get rid of an extra "env" invocation in the
middle, and is slightly more readable.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot: stop using GIT_CONFIG to cross repo boundaries
Jeff King [Thu, 20 Mar 2014 23:15:24 +0000 (19:15 -0400)]
t: stop using GIT_CONFIG to cross repo boundaries

Some tests want to check or set config in another
repository. E.g., t1000 creates repositories and makes sure
that their core.bare and core.worktree settings are what we
expect. We can do this with:

  GIT_CONFIG=$repo/.git/config git config ...

but it better shows the intent to just enter the repository
and let "git config" do the normal lookups:

  (cd $repo && git config ...)

In theory, this would cause us to use an extra subshell, but
in all such cases, we are actually already in a subshell.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot: drop useless sane_unset GIT_* calls
Jeff King [Thu, 20 Mar 2014 23:14:33 +0000 (19:14 -0400)]
t: drop useless sane_unset GIT_* calls

Several test scripts manually unset GIT_CONFIG and other
GIT_* variables. These are generally taken care of for us by
test-lib.sh already.

Unsetting these is not only useless, but can be confusing to
a reader, who may wonder why some tests in a script unset
them and others do not (t0001 is particularly guilty of this
inconsistency, probably because many of its tests predate
the test-lib.sh environment-cleansing).

Note that we cannot always get rid of such unsetting. For
example, t9130 can drop the GIT_CONFIG unset, but not the
GIT_DIR one, because lib-git-svn.sh sets the latter. And in
t1000, we unset GIT_TEMPLATE_DIR, which is explicitly
initialized by test-lib.sh.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot/test-lib: drop redundant unset of GIT_CONFIG
Jeff King [Thu, 20 Mar 2014 23:13:36 +0000 (19:13 -0400)]
t/test-lib: drop redundant unset of GIT_CONFIG

This is already handled by the mass GIT_* unsetting added by
95a1d12 (tests: scrub environment of GIT_* variables,
2011-03-15).

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot/Makefile: stop setting GIT_CONFIG
Jeff King [Thu, 20 Mar 2014 23:13:21 +0000 (19:13 -0400)]
t/Makefile: stop setting GIT_CONFIG

Once upon a time, the setting of GIT_CONFIG in the
environment could affect how tests ran. Commit 9c3796f (Fix
setting config variables with an alternative GIT_CONFIG,
2006-06-20) unconditionally set GIT_CONFIG in the Makefile
when running tests to give us a known starting point.

This is insufficient for running the tests outside of the
Makefile, however, and 8565d2d (Make tests independent of
global config files, 2007-02-15) later set GIT_CONFIG
directly in test-lib.sh. At that point the Makefile setting
was redundant, but we never removed it. Let's do so now.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoUpdate draft release notes to 2.0
Junio C Hamano [Fri, 21 Mar 2014 20:41:27 +0000 (13:41 -0700)]
Update draft release notes to 2.0

12 years agoMerge branch 'lt/request-pull'
Junio C Hamano [Fri, 21 Mar 2014 19:50:44 +0000 (12:50 -0700)]
Merge branch 'lt/request-pull'

Discard the accumulated "heuristics" to guess from which branch the
result wants to be pulled from and make sure what the end user
specified is not second-guessed by "git request-pull", to avoid
mistakes.

* lt/request-pull:
  request-pull: documentation updates
  request-pull: resurrect "pretty refname" feature
  request-pull: test updates
  request-pull: pick up tag message as before
  request-pull: allow "local:remote" to specify names on both ends
  request-pull: more strictly match local/remote branches

12 years agoMerge branch 'es/sh-i18n-envsubst'
Junio C Hamano [Fri, 21 Mar 2014 19:50:39 +0000 (12:50 -0700)]
Merge branch 'es/sh-i18n-envsubst'

* es/sh-i18n-envsubst:
  sh-i18n--envsubst: retire unused string_list_member()

12 years agoMerge branch 'nd/upload-pack-shallow'
Junio C Hamano [Fri, 21 Mar 2014 19:49:08 +0000 (12:49 -0700)]
Merge branch 'nd/upload-pack-shallow'

Serving objects from a shallow repository needs to write a
temporary file to be used, but the serving upload-pack may not have
write access to the repository which is meant to be read-only.

Instead feed these temporary shallow bounds from the standard input
of pack-objects so that we do not have to use a temporary file.

* nd/upload-pack-shallow:
  upload-pack: send shallow info over stdin to pack-objects

12 years agoMerge branch 'jn/wt-status'
Junio C Hamano [Fri, 21 Mar 2014 19:48:59 +0000 (12:48 -0700)]
Merge branch 'jn/wt-status'

Unify the codepaths that format new/modified/changed sections and
conflicted paths in the "git status" output and make it possible to
properly internationalize their output.

* jn/wt-status:
  wt-status: lift the artificual "at least 20 columns" floor
  wt-status: i18n of section labels
  wt-status: extract the code to compute width for labels
  wt-status: make full label string to be subject to l10n

12 years agoMerge branch 'jc/stash-pop-not-popped'
Junio C Hamano [Fri, 21 Mar 2014 19:48:51 +0000 (12:48 -0700)]
Merge branch 'jc/stash-pop-not-popped'

"stash pop", upon failing to apply the stash, refrains from
discarding the stash to avoid information loss.  Be more explicit
in the error message.

The wording may want to get a bit more bikeshedding.

* jc/stash-pop-not-popped:
  stash pop: mention we did not drop the stash upon failing to apply

12 years agoMerge branch 'dk/skip-prefix-scan-only-once'
Junio C Hamano [Fri, 21 Mar 2014 19:47:41 +0000 (12:47 -0700)]
Merge branch 'dk/skip-prefix-scan-only-once'

Update implementation of skip_prefix() to scan only once; given
that most "prefix" arguments to the inline function are constant
strings whose strlen() can be determined at the compile time, this
might actually make things worse with a compiler with sufficient
intelligence.

* dk/skip-prefix-scan-only-once:
  skip_prefix(): scan prefix only once

12 years agoMerge branch 'nd/tag-version-sort'
Junio C Hamano [Fri, 21 Mar 2014 19:47:38 +0000 (12:47 -0700)]
Merge branch 'nd/tag-version-sort'

Allow v1.9.0 sorted before v1.10.0 in "git tag --list" output.

* nd/tag-version-sort:
  tag: support --sort=<spec>

12 years agoMerge branch 'jk/shallow-update-fix'
Junio C Hamano [Fri, 21 Mar 2014 19:33:29 +0000 (12:33 -0700)]
Merge branch 'jk/shallow-update-fix'

Serving objects from a shallow repository needs to write a
new file to hold the temporary shallow boundaries but it was not
cleaned when we exit due to die() or a signal.

* jk/shallow-update-fix:
  shallow: verify shallow file after taking lock
  shallow: automatically clean up shallow tempfiles
  shallow: use stat_validity to check for up-to-date file

12 years agoMerge branch 'tc/commit-dry-run-exit-status-tests'
Junio C Hamano [Fri, 21 Mar 2014 19:33:25 +0000 (12:33 -0700)]
Merge branch 'tc/commit-dry-run-exit-status-tests'

* tc/commit-dry-run-exit-status-tests:
  demonstrate git-commit --dry-run exit code behaviour

12 years agoconfig.txt: third-party tools may and do use their own variables
Chris Angelico [Fri, 21 Mar 2014 04:07:08 +0000 (15:07 +1100)]
config.txt: third-party tools may and do use their own variables

Signed-off-by: Chris Angelico <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agodoc: status, remove leftover statement about '#' prefix
Dirk Wallenstein [Fri, 21 Mar 2014 14:10:18 +0000 (15:10 +0100)]
doc: status, remove leftover statement about '#' prefix

This hasn't been true since 2556b996 (status: disable display of '#'
comment prefix by default, 2013-09-06).

Signed-off-by: Dirk Wallenstein <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agotree-diff: simplify tree_entry_pathcmp
Kirill Smelkov [Mon, 24 Feb 2014 16:21:43 +0000 (20:21 +0400)]
tree-diff: simplify tree_entry_pathcmp

Since an earlier "Finally switch over tree descriptors to contain a
pre-parsed entry", we can safely access all tree_desc->entry fields
directly instead of first "extracting" them through
tree_entry_extract.

Use it. The code generated stays the same - only it now visually looks
cleaner.

Signed-off-by: Kirill Smelkov <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agotree-diff: show_path prototype is not needed anymore
Kirill Smelkov [Mon, 24 Feb 2014 16:21:42 +0000 (20:21 +0400)]
tree-diff: show_path prototype is not needed anymore

We moved all action-taking code below show_path() in recent HEAD~~
(tree-diff: move all action-taking code out of compare_tree_entry).

Signed-off-by: Kirill Smelkov <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agotree-diff: rename compare_tree_entry -> tree_entry_pathcmp
Kirill Smelkov [Mon, 24 Feb 2014 16:21:41 +0000 (20:21 +0400)]
tree-diff: rename compare_tree_entry -> tree_entry_pathcmp

Since previous commit, this function does not compare entry hashes, and
mode are compared fully outside of it. So what it does is compare entry
names and DIR bit in modes. Reflect this in its name.

Add documentation stating the semantics, and move the note about
files/dirs comparison to it.

Signed-off-by: Kirill Smelkov <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agotree-diff: move all action-taking code out of compare_tree_entry()
Kirill Smelkov [Mon, 24 Feb 2014 16:21:40 +0000 (20:21 +0400)]
tree-diff: move all action-taking code out of compare_tree_entry()

- let it do only comparison.

This way the code is cleaner and more structured - cmp function only
compares, and the driver takes action based on comparison result.

There should be no change in performance, as effectively, we just move
if series from on place into another, and merge it to was-already-there
same switch/if, so the result is maybe a little bit faster.

Signed-off-by: Kirill Smelkov <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agotree-diff: don't assume compare_tree_entry() returns -1,0,1
Kirill Smelkov [Mon, 24 Feb 2014 16:21:39 +0000 (20:21 +0400)]
tree-diff: don't assume compare_tree_entry() returns -1,0,1

It does, but we'll be reworking it in the next patch after it won't, and
besides it is better to stick to standard
strcmp/memcmp/base_name_compare/etc... convention, where comparison
function returns <0, =0, >0

Regarding performance, comparing for <0, =0, >0 should be a little bit
faster, than switch, because it is just 1 test-without-immediate
instruction and then up to 3 conditional branches, and in switch you
have up to 3 tests with immediate and up to 3 conditional branches.

No worry, that update_tree_entry(t2) is duplicated for =0 and >0 - it
will be good after we'll be adding support for multiparent walker and
will stay that way.

=0 case goes first, because it happens more often in real diffs - i.e.
paths are the same.

Signed-off-by: Kirill Smelkov <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agotree-diff: consolidate code for emitting diffs and recursion in one place
Kirill Smelkov [Mon, 24 Feb 2014 16:21:38 +0000 (20:21 +0400)]
tree-diff: consolidate code for emitting diffs and recursion in one place

Currently both compare_tree_entry() and show_entry() invoke opt diff
callbacks (opt->add_remove() and opt->change()), and also they both have
code which decides whether to recurse into sub-tree, and whether to emit
a tree as separate entry if DIFF_OPT_TREE_IN_RECURSIVE is set.

I.e. we have code duplication and logic scattered on two places.

Let's consolidate it - all diff emiting code and recurion logic moves
to show_entry, which is now named as show_path, because it shows diff
for a path, based on up to two tree entries, with actual diff emitting
code being kept in new helper emit_diff() for clarity.

What we have as the result, is that compare_tree_entry is now free from
code with logic for diff generation, and also performance is not
affected as timings for

    `git log --raw --no-abbrev --no-renames`

for navy.git and `linux.git v3.10..v3.11`, just like in previous patch,
stay the same.

Signed-off-by: Kirill Smelkov <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agogrep: add grep.fullName config variable
Andreas Schwab [Mon, 17 Mar 2014 19:16:05 +0000 (20:16 +0100)]
grep: add grep.fullName config variable

This configuration variable sets the default for the --full-name option.

Signed-off-by: Andreas Schwab <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agofsck: use bitwise-or assignment operator to set flag
Hiroyuki Sano [Wed, 19 Mar 2014 23:02:04 +0000 (08:02 +0900)]
fsck: use bitwise-or assignment operator to set flag

fsck_tree() has two different ways to set a flag variable, either by
using a if-statement that guards an assignment, or by using a
bitwise-or assignment operator.  Most are done with the former, and
only one variable is assigned with the latter.

Since all the conditions are short-and-sweet, we can afford to
uniformly use the latter style, which makes the resulting code
shorter and easier to read.

Signed-off-by: Hiroyuki Sano <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoDocumentation/gitk: document the location of the configulation file
Astril Hayato [Thu, 20 Mar 2014 13:33:49 +0000 (13:33 +0000)]
Documentation/gitk: document the location of the configulation file

User config file location complies with the XDG base directory
specification while supporting the traditional $HOME/.gitk as a
fallback.

Signed-off-by: Astril Hayato <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agofsck.c:fsck_commit(): use skip_prefix() to verify and skip constant
Yuxuan Shui [Thu, 13 Mar 2014 04:45:51 +0000 (12:45 +0800)]
fsck.c:fsck_commit(): use skip_prefix() to verify and skip constant

fsck_commit() uses memcmp() to check if the buffer starts with a
certain prefix, and skips the prefix if it does.

This is exactly what skip_prefix() was designed for.

Signed-off-by: Yuxuan Shui <redacted>
Helped-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot5510: Do not use $(pwd) when fetching / pushing / pulling via rsync
Sebastian Schuberth [Wed, 19 Mar 2014 19:43:53 +0000 (20:43 +0100)]
t5510: Do not use $(pwd) when fetching / pushing / pulling via rsync

On MINGW, "pwd" is defined as "pwd -W" in test-lib.sh. This usually is the
right thing, but the absolute Windows path with a colon confuses rsync. We
could use $PWD in this case to work around the issue, but in fact there is
no need to use an absolute path in the first place, so get rid of it.

This was discovered in the context of the mingwGitDevEnv project and only
did not surface before with msysgit because the latter does not ship
rsync.

Signed-off-by: Sebastian Schuberth <redacted>
Acked-by: Johannes Schindelin <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agotests: use "env" to run commands with temporary env-var settings
David Tran [Tue, 18 Mar 2014 18:54:05 +0000 (18:54 +0000)]
tests: use "env" to run commands with temporary env-var settings

Ordinarily, we would say "VAR=VAL command" to execute a tested
command with environment variable(s) set only for that command.
This however does not work if 'command' is a shell function (most
notably 'test_must_fail'); the result of the assignment is retained
and affects later commands.

To avoid this, we used to assign and export environment variables
and run such a test in a subshell, like so:

        (
                VAR=VAL && export VAR &&
                test_must_fail git command to be tested
        )

But with "env" utility, we should be able to say:

        test_must_fail env VAR=VAL git command to be tested

which is much shorter and easier to read.

Signed-off-by: David Tran <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agodiff-no-index: replace manual "."/".." check with is_dot_or_dotdot()
Brian Bourn [Wed, 19 Mar 2014 15:58:22 +0000 (11:58 -0400)]
diff-no-index: replace manual "."/".." check with is_dot_or_dotdot()

Helped-by: Eric Sunshine <redacted>
Signed-off-by: Brian Bourn <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agodiff-no-index: rename read_directory()
Brian Bourn [Wed, 19 Mar 2014 15:58:21 +0000 (11:58 -0400)]
diff-no-index: rename read_directory()

In the next patch, we will replace a manual checking of "." or ".."
with a call to is_dot_or_dotdot() defined in dir.h.  The private
function read_directory() defined in this file will conflict with
the global function declared there when we do so.

As a preparatory step, rename the private read_directory() to avoid
the name collision.

Helped-by: Eric Sunshine <redacted>
Signed-off-by: Brian Bourn <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agorebase: allow "-" short-hand for the previous branch
Brian Gesiak [Wed, 19 Mar 2014 11:02:15 +0000 (20:02 +0900)]
rebase: allow "-" short-hand for the previous branch

Teach rebase the same shorthand as checkout and merge to name the
branch to rebase the current branch on; that is, that "-" means "the
branch we were previously on".

Requested-by: Tim Chase <redacted>
Signed-off-by: Brian Gesiak <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoSync with 1.9.1
Junio C Hamano [Tue, 18 Mar 2014 21:34:25 +0000 (14:34 -0700)]
Sync with 1.9.1

Signed-off-by: Junio C Hamano <redacted>
git clone https://git.99rst.org/PROJECT