Permalink
Commits on Jul 6, 2012
  1. Merge jrn/db/vcs-svn-housekeeping:vcs-svn into master

    barrbrain committed Jul 6, 2012
    This commit will be re-written when db/vcs-svn-housekeeping graduates to jch/master.
  2. vcs-svn: allow 64-bit Prop-Content-Length

    jrn committed Jul 6, 2012
    Currently the vcs-svn/ library only pays attention to the presence of
    the Prop-Content-Length field and doesn't care about its value, but
    some day we might care about the value.  Parse it as an off_t instead
    of arbitrarily limiting to 32 bits for intuitiveness.
    
    So now you can import from a dump with more than 2 GiB of properties
    for a node.  In practice that isn't likely to happen often, and this
    is mostly meant as a cleanup.
    
    Based-on-patch-by: David Barr <davidbarr@google.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
  3. vcs-svn: suppress a signed/unsigned comparison warning

    jrn committed Jul 6, 2012
    All callers pass a nonnegative delta_len, so the code is already safe.
    Add an assertion to ensure that remains so and add a cast to keep
    clang and gcc -Wsign-compare from worrying.
    
    Reported-by: David Barr <davidbarr@google.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
  4. vcs-svn: suppress a signed/unsigned comparison warning

    barrbrain authored and jrn committed May 31, 2012
    The preceding code checks that view->max_off is nonnegative and
    (off + width) fits in an off_t, so this code is already safe.
    
    Signed-off-by: David Barr <davidbarr@google.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
  5. vcs-svn: suppress signed/unsigned comparison warnings

    barrbrain authored and jrn committed May 31, 2012
    These are already safe because both sides of the comparison are
    nonnegative.
    
    This would normally not be important because Git is not -Wsign-compare
    clean anyway, but we like to keep the vcs-svn/ lib to a higher
    standard for convenience using it in other projects.
    
    Signed-off-by: David Barr <davidbarr@google.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
  6. vcs-svn: use strstr instead of memmem

    barrbrain authored and jrn committed May 31, 2012
    memmem is a GNU extension.
    
    Avoiding it makes the code clearer and makes it easier for projects
    that don't share git's compat/ code, such as the standalone
    svn-dump-fast-export project, to reuse the vcs-svn/ library.
    
    Signed-off-by: David Barr <davidbarr@google.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
  7. vcs-svn: use constcmp instead of prefixcmp

    barrbrain authored and jrn committed May 31, 2012
    Since the length of t is already known, we can simplify a little by
    using memcmp() instead of strncmp() to carry out a prefix comparison.
    All nearby code already does this.
    
    Noticed in the standalone svn-dump-fast-export project which has not
    needed to implement prefixcmp() yet.
    
    Signed-off-by: David Barr <davidbarr@google.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
  8. vcs-svn: simplify cleanup in apply_one_window

    barrbrain authored and jrn committed May 31, 2012
    Currently the cleanup code looks like this:
    
    	free resources
    	return 0;
     error_out:
    	free resources
    	return -1;
    
    Avoid duplicating the "free resources" part by keeping the return
    value in a variable and sharing code between the success and
    exceptional case:
    
    	ret = 0;
     out:
    	free resources
    	return ret;
    
    Noticed in the svn-dump-fast-export project, where using the error()
    macro in void context produces a warning.
    
    Signed-off-by: David Barr <davidbarr@google.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
  9. vcs-svn: avoid self-assignment in dummy initialization of pre_off

    barrbrain authored and jrn committed May 31, 2012
    Without this change, clang complains:
    
     vcs-svn/svndiff.c:298:3: warning: Assigned value is garbage or undefined
                     off_t pre_off = pre_off; /* stupid GCC... */
                     ^               ~~~~~~~
    
    This code uses an old and common idiom for suppressing an
    "uninitialized variable" warning, and clang is wrong to warn about it.
    The idiom tells the compiler to leave the variable uninitialized,
    which saves a few bytes of code size, and, more importantly, allows
    valgrind to check at runtime that the variable is properly initialized
    by the time it is used.
    
    But MSVC and clang do not know that idiom, so let's avoid it in
    vcs-svn/ code.
    
    Initialize pre_off to -1, a recognizably meaningless value, to allow
    future code changes that cause pre_off to be used before it is
    initialized to be caught early.
    
    Signed-off-by: David Barr <davidbarr@google.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
  10. vcs-svn: drop no-op reset methods

    barrbrain authored and jrn committed May 31, 2012
    Since v1.7.5~42^2~6 (vcs-svn: remove buffer_read_string)
    buffer_reset() does nothing thus fast_export_reset() also.
    
    Signed-off-by: David Barr <davidbarr@google.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Commits on May 31, 2012
  1. README.textile: changes from git v1.7.10.2 are merged

    barrbrain committed May 17, 2012
    Signed-off-by: David Barr <davidbarr@google.com>
  2. Merge git_v1.7.10.2:contrib/svn-fe into master

    barrbrain committed May 17, 2012
    Conflicts:
    	contrib/svn-fe/svn-fe.c
    	contrib/svn-fe/svn-fe.txt
  3. Merge git_v1.7.10.2:vcs-svn into master

    barrbrain committed May 17, 2012
    Conflicts:
    	vcs-svn/fast_export.c
    	vcs-svn/fast_export.h
    	vcs-svn/line_buffer.c
    	vcs-svn/line_buffer.h
    	vcs-svn/line_buffer.txt
    	vcs-svn/repo_tree.c
    	vcs-svn/repo_tree.h
    	vcs-svn/sliding_window.c
    	vcs-svn/sliding_window.h
    	vcs-svn/svndiff.c
    	vcs-svn/svndiff.h
    	vcs-svn/svndump.c
    	vcs-svn/svndump.h
  4. vcs-svn: fix cppcheck warning

    barrbrain committed May 18, 2012
    [vcs-svn/fast_export.c:211]: (warning) Using sizeof with a numeric constant as function argument might not be what you intended.
    
    Signed-off-by: David Barr <davidbarr@google.com>
  5. compat: fix clang-analyzer warning

    barrbrain committed May 18, 2012
    compat/strbuf.h:76:15: warning: Array access (via field buf) results in a null pointer dereference
            sb->buf[len] = 0;
                ~~~      ^
    
    Signed-off-by: David Barr <davidbarr@google.com>
  6. compat: fix sparse warnings

    barrbrain committed May 18, 2012
    compat/mkgmtime.c:95:1: warning: non-ANSI definition of function 'tmcomp'
    compat/mkgmtime.c:109:22: warning: non-ANSI definition of function 'mkgmtime'
    compat/quote.c:16:5: warning: symbol 'quote_path_fully' was not declared. Should it be static?
    
    Signed-off-by: David Barr <davidbarr@google.com>
Commits on May 17, 2012
  1. vcs-svn: add warning and die_errno to compat-util

    barrbrain committed May 17, 2012
    Signed-off-by: David Barr <davidbarr@google.com>
  2. compat: restore needed functions in strbuf

    barrbrain committed May 17, 2012
    Downstream changes depend on strbuf_swap(), strbuf_remove() and strbuf_addstr().
    
    Signed-off-by: David Barr <davidbarr@google.com>
  3. compat: add quote.c from git 1.7.10.2

    barrbrain committed May 17, 2012
    Downstream changes depend on quote_c_style().
    
    Signed-off-by: David Barr <davidbarr@google.com>
  4. README.textile: reflect downstream effort

    barrbrain committed May 17, 2012
    Signed-off-by: David Barr <davidbarr@google.com>
  5. compat: separate the compatibility library

    barrbrain committed May 17, 2012
    This is to make licensing easier to follow.
    
    Signed-off-by: David Barr <davidbarr@google.com>
  6. contrib/svn-fe: separate the front-end

    barrbrain committed May 17, 2012
    This is to line up with git.git and facilitate upstreaming from there.
    
    Signed-off-by: David Barr <davidbarr@google.com>
  7. vcs-svn: separate the core library

    barrbrain committed May 17, 2012
    This is to line up with git.git and facilitate upstreaming from there.
    
    Signed-off-by: David Barr <davidbarr@google.com>
Commits on Mar 28, 2012
  1. correct spelling: an URL -> a URL

    meyering authored and gitster committed Mar 28, 2012
    Signed-off-by: Jim Meyering <meyering@redhat.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 2, 2012
  1. vcs-svn: suppress a -Wtype-limits warning

    jrn authored and gitster committed Feb 2, 2012
    On 32-bit architectures with 64-bit file offsets, gcc 4.3 and earlier
    produce the following warning:
    
    	    CC vcs-svn/sliding_window.o
    	vcs-svn/sliding_window.c: In function `check_overflow':
    	vcs-svn/sliding_window.c:36: warning: comparison is always false \
    	    due to limited range of data type
    
    The warning appears even when gcc is run without any warning flags
    (this is gcc bug 12963).  In later versions the same warning can be
    reproduced with -Wtype-limits, which is implied by -Wextra.
    
    On 64-bit architectures it really is possible for a size_t not to be
    representable as an off_t so the check this is warning about is not
    actually redundant.  But even false positives are distracting.  Avoid
    the warning by making the "len" argument to check_overflow a
    uintmax_t; no functional change intended.
    
    Reported-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. vcs-svn: allow import of > 4GiB files

    jrn authored and gitster committed Feb 2, 2012
    There is no reason in principle that an svn-format dump would not be
    able to represent a file whose length does not fit in a 32-bit
    integer.  Use off_t consistently to represent file lengths (in place
    of using uint32_t in some contexts) so we can handle that.
    
    Most svn-fe code is already ready to do that without this patch and
    passes values of type off_t around.  The type mismatch from stragglers
    was noticed with gcc -Wtype-limits.
    
    While at it, tighten the parsing of the Text-content-length field to
    make sure it is a number and does not overflow, and tighten other
    overflow checks as that value is passed around and manipulated.
    
    Inspired-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. vcs-svn: rename check_overflow arguments for clarity

    Ramsay Jones authored and gitster committed Feb 2, 2012
    Code using the argument names a and b just doesn't look right (not
    sure why!).  Use more explicit names "offset" and "len" to make their
    type and meaning clearer.
    
    Also rename check_overflow() to check_offset_overflow() to clarify
    that we are making sure that "len" bytes beyond "offset" still fits
    the type to represent an offset.
    
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  4. vcs-svn: suppress -Wtype-limits warning

    jrn committed Feb 2, 2012
    On 32-bit architectures with 64-bit file offsets, gcc 4.3 and earlier
    produce the following warning:
    
    	    CC vcs-svn/sliding_window.o
    	vcs-svn/sliding_window.c: In function `check_overflow':
    	vcs-svn/sliding_window.c:36: warning: comparison is always false \
    	    due to limited range of data type
    
    The warning appears even when gcc is run without any warning flags
    (PR12963).  In later versions it can be reproduced with -Wtype-limits,
    which is implied by -Wextra.
    
    On 64-bit architectures it really is possible for a size_t not to be
    representable as an off_t so the check being warned about is not
    actually redundant.  But even false positives are distracting.  Avoid
    the warning by making the "len" argument to check_overflow a
    uintmax_t; no functional change intended.
    
    Reported-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
  5. vcs-svn: allow import of > 4GiB files

    jrn committed Feb 2, 2012
    There is no reason in principle that an svn-format dump would not
    be able to represent a file whose length does not fit in a 32-bit
    integer.  Use off_t consistently (instead of uint32_t) to represent
    file lengths so we can handle that.
    
    Most of our code is already ready to do that without this patch and
    already passes values of type off_t around.  The type mismatch due to
    stragglers was noticed with gcc -Wtype-limits.
    
    Inspired-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
  6. vcs-svn: rename check_overflow and its arguments for clarity

    Ramsay Jones authored and jrn committed Feb 2, 2012
    The canonical interpretation of a range a,b is as an interval [a,b),
    not [a,a+b), so this function taking argument names a and b feels
    unnatural.  Use more explicit names "offset" and "len" to make the
    arguments' type and function clearer.
    
    While at it, rename the function to convey that we are making sure
    the sum of this offset and length do not overflow an off_t, not a
    size_t.
    
    [jn: split out from a patch from Ramsay Jones, then improved with
     advice from Thomas Rast, Dmitry Ivankov, and David Barr]
    
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Improved-by: Dmitry Ivankov <divanorama@gmail.com>
Commits on Jan 27, 2012
  1. vcs-svn/svndiff.c: squelch false "unused" warning from gcc

    gitster committed Jan 27, 2012
    Curiously, pre_len given to read_length() does not trigger the same warning
    even though the code structure is the same. Most likely this is because
    read_offset() is used only once and inlining it will make gcc realize that
    it has a chance to do more flow analysis. Alas, the analysis is flawed, so
    it does not help X-<.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. Merge branch 'svn-fe' of git://repo.or.cz/git/jrn into jn/svn-fe

    gitster committed Jan 27, 2012
    This simplifies svn-fe a great deal and fulfills a longstanding wish:
    support for dumps with deltas in them, and incremental imports.
    
    The cost is that commandline usage of the svn-fe tool becomes a little
    more complicated since it no longer keeps state itself but instead reads
    blobs back from fast-import in order to copy them between revisions and
    apply deltas to them.
    
    Also removes a couple of custom data structures and replaces them with
    strbufs like other parts of Git.
    
    * 'svn-fe' of git://repo.or.cz/git/jrn: (32 commits)
      vcs-svn: reset first_commit_done in fast_export_init
      vcs-svn: do not initialize report_buffer twice
      vcs-svn: avoid hangs from corrupt deltas
      vcs-svn: guard against overflow when computing preimage length
      vcs-svn: cap number of bytes read from sliding view
      test-svn-fe: split off "test-svn-fe -d" into a separate function
      vcs-svn: implement text-delta handling
      vcs-svn: let deltas use data from preimage
      vcs-svn: let deltas use data from postimage
      vcs-svn: verify that deltas consume all inline data
      vcs-svn: implement copyfrom_data delta instruction
      vcs-svn: read instructions from deltas
      vcs-svn: read inline data from deltas
      vcs-svn: read the preimage when applying deltas
      vcs-svn: parse svndiff0 window header
      vcs-svn: skeleton of an svn delta parser
      vcs-svn: make buffer_read_binary API more convenient
      vcs-svn: learn to maintain a sliding view of a file
      Makefile: list one vcs-svn/xdiff object or header per line
      vcs-svn: avoid using ls command twice
      ...
    
    Conflicts:
    	Makefile
    	contrib/svn-fe/svn-fe.txt
Commits on Dec 21, 2011
  1. Fix a bitwise negation assignment issue spotted by Sun Studio

    avar authored and gitster committed Dec 21, 2011
    Change direct and indirect assignments of the bitwise negation of 0 to
    uint32_t variables to have a "U" suffix. I.e. ~0U instead of ~0. This
    eliminates warnings under Sun Studio 12 Update 1:
    
        "vcs-svn/string_pool.c", line 11: warning: initializer will be sign-extended: -1 (E_INIT_SIGN_EXTEND)
        "vcs-svn/string_pool.c", line 81: warning: initializer will be sign-extended: -1 (E_INIT_SIGN_EXTEND)
        "vcs-svn/repo_tree.c", line 112: warning: initializer will be sign-extended: -1 (E_INIT_SIGN_EXTEND)
        "vcs-svn/repo_tree.c", line 112: warning: initializer will be sign-extended: -1 (E_INIT_SIGN_EXTEND)
        "test-treap.c", line 34: warning: initializer will be sign-extended: -1 (E_INIT_SIGN_EXTEND)
    
    The semantics are still the same as demonstrated by this program:
    
        $ cat test.c && make test && ./test
        #include <stdio.h>
        #include <stdint.h>
    
        int main(void)
        {
            uint32_t foo = ~0;
            uint32_t bar = ~0U;
    
            printf("foo = <%u> bar = <%u>\n", foo, bar);
    
            return 0;
        }
        cc     test.c   -o test
        "test.c", line 5: warning: initializer will be sign-extended: -1
        foo = <4294967295> bar = <4294967295>
    
    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 23, 2011
  1. vcs-svn: reset first_commit_done in fast_export_init

    divanorama authored and jrn committed Jun 23, 2011
    first_commit_done has zero as a default value, but it
    is not reset back to zero in fast_export_init.
    
    Reset it back to zero so that each export will have
    proper initial state.
    
    Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Commits on Jun 21, 2011
  1. vcs-svn: do not initialize report_buffer twice

    divanorama authored and jrn committed Jun 20, 2011
    When importing from a dump with deltas, first fast_export_init calls
    buffer_fdinit, and then init_report_buffer calls fdopen once again
    when processing the first delta.  The second initialization is
    redundant and leaks a FILE *.
    
    Remove the redundant on-demand initialization to fix this.
    Initializing directly in fast_export_init is simpler and lets the
    caller pass an int specifying which fd to use instead of hard-coding
    REPORT_FILENO.
    
    Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>