Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Dec 20, 2011
  1. @gitster

    Merge branch 'ab/enable-i18n'

    gitster authored
    * ab/enable-i18n:
      i18n: add infrastructure for translating Git with gettext
    
    Conflicts:
    	Makefile
Commits on Dec 14, 2011
  1. @peff @gitster

    http-push: enable "proactive auth"

    peff authored gitster committed
    Before commit 986bbc0, git was proactive about asking for
    http passwords. It assumed that if you had a username in
    your URL, you would also want a password, and asked for it
    before making any http requests.
    
    However, this could interfere with the use of .netrc (see
    986bbc0 for details). And it was also unnecessary, since
    the http fetching code had learned to recognize an HTTP 401
    and prompt the user then. Furthermore, the proactive prompt
    could interfere with the usage of .netrc (see 986bbc0 for
    details).
    
    Unfortunately, the http push-over-DAV code never learned to
    recognize HTTP 401, and so was broken by this change. This
    patch does a quick fix of re-enabling the "proactive auth"
    strategy only for http-push, leaving the dumb http fetch and
    smart-http as-is.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 6, 2011
  1. @avar @gitster

    i18n: add infrastructure for translating Git with gettext

    avar authored gitster committed
    Change the skeleton implementation of i18n in Git to one that can show
    localized strings to users for our C, Shell and Perl programs using
    either GNU libintl or the Solaris gettext implementation.
    
    This new internationalization support is enabled by default. If
    gettext isn't available, or if Git is compiled with
    NO_GETTEXT=YesPlease, Git falls back on its current behavior of
    showing interface messages in English. When using the autoconf script
    we'll auto-detect if the gettext libraries are installed and act
    appropriately.
    
    This change is somewhat large because as well as adding a C, Shell and
    Perl i18n interface we're adding a lot of tests for them, and for
    those tests to work we need a skeleton PO file to actually test
    translations. A minimal Icelandic translation is included for this
    purpose. Icelandic includes multi-byte characters which makes it easy
    to test various edge cases, and it's a language I happen to
    understand.
    
    The rest of the commit message goes into detail about various
    sub-parts of this commit.
    
    = Installation
    
    Gettext .mo files will be installed and looked for in the standard
    $(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
    override that, but that's only intended to be used to test Git itself.
    
    = Perl
    
    Perl code that's to be localized should use the new Git::I18n
    module. It imports a __ function into the caller's package by default.
    
    Instead of using the high level Locale::TextDomain interface I've
    opted to use the low-level (equivalent to the C interface)
    Locale::Messages module, which Locale::TextDomain itself uses.
    
    Locale::TextDomain does a lot of redundant work we don't need, and
    some of it would potentially introduce bugs. It tries to set the
    $TEXTDOMAIN based on package of the caller, and has its own
    hardcoded paths where it'll search for messages.
    
    I found it easier just to completely avoid it rather than try to
    circumvent its behavior. In any case, this is an issue wholly
    internal Git::I18N. Its guts can be changed later if that's deemed
    necessary.
    
    See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
    a further elaboration on this topic.
    
    = Shell
    
    Shell code that's to be localized should use the git-sh-i18n
    library. It's basically just a wrapper for the system's gettext.sh.
    
    If gettext.sh isn't available we'll fall back on gettext(1) if it's
    available. The latter is available without the former on Solaris,
    which has its own non-GNU gettext implementation. We also need to
    emulate eval_gettext() there.
    
    If neither are present we'll use a dumb printf(1) fall-through
    wrapper.
    
    = About libcharset.h and langinfo.h
    
    We use libcharset to query the character set of the current locale if
    it's available. I.e. we'll use it instead of nl_langinfo if
    HAVE_LIBCHARSET_H is set.
    
    The GNU gettext manual recommends using langinfo.h's
    nl_langinfo(CODESET) to acquire the current character set, but on
    systems that have libcharset.h's locale_charset() using the latter is
    either saner, or the only option on those systems.
    
    GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
    but MinGW and some others need to use libcharset.h's locale_charset()
    instead.
    
    =Credits
    
    This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
    did the initial Makefile / C work, and a lot of comments from the Git
    mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
    Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
    others.
    
    [jc: squashed a small Makefile fix from Ramsay]
    
    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
    Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 18, 2011
  1. @gitster

    Merge branch 'jk/http-auth'

    gitster authored
    * jk/http-auth:
      http_init: accept separate URL parameter
      http: use hostname in credential description
      http: retry authentication failures for all http requests
      remote-curl: don't retry auth failures with dumb protocol
      improve httpd auth tests
      url: decode buffers that are not NUL-terminated
Commits on Oct 16, 2011
  1. @peff @gitster

    http_init: accept separate URL parameter

    peff authored gitster committed
    The http_init function takes a "struct remote". Part of its
    initialization procedure is to look at the remote's url and
    grab some auth-related parameters. However, using the url
    included in the remote is:
    
      - wrong; the remote-curl helper may have a separate,
        unrelated URL (e.g., from remote.*.pushurl). Looking at
        the remote's configured url is incorrect.
    
      - incomplete; http-fetch doesn't have a remote, so passes
        NULL. So http_init never gets to see the URL we are
        actually going to use.
    
      - cumbersome; http-push has a similar problem to
        http-fetch, but actually builds a fake remote just to
        pass in the URL.
    
    Instead, let's just add a separate URL parameter to
    http_init, and all three callsites can pass in the
    appropriate information.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 24, 2011
  1. @gitster

    Mark http-fetch without -a as deprecated

    Ben Walton authored gitster committed
    As the use of http-fetch without -a can create an object store that is
    invalid to the point where it cannot even be fsck'd, mark it as
    deprecated.  A future release should change the default and then
    remove the option entirely.
    
    Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Apr 3, 2011
  1. @toofishes @gitster

    Fix two unused variable warnings in gcc 4.6

    toofishes authored gitster committed
    Seen with -Wunused-but-set-variable.
    
    Signed-off-by: Dan McGee <dpmcgee@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 26, 2010
  1. @rctay @gitster

    http-fetch: rework url handling

    rctay authored gitster committed
    Do away with a second url variable, rewritten_url, and make url
    non-const. This is safe because the functions called with url (ie.
    get_http_walker() and walker_fetch()) do not modify it (ie. marked with
    const char *).
    
    Also, replace code that adds a trailing slash with a call to
    str_end_url_with_slash().
    
    Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 2, 2010
  1. @rctay @gitster

    http: init and cleanup separately from http-walker

    rctay authored gitster committed
    Previously, all our http operations were done with http-walker. With the
    new remote-curl helper, we find ourselves using http methods outside of
    http-walker - for example, fetching info/refs.
    
    Accomodate this by separating http_init() and http_cleanup() invocations
    from http-walker.
    
    Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 10, 2009
  1. @jrn @gitster

    Let 'git http-fetch -h' show usage outside any git repository

    jrn authored gitster committed
    Delay search for a git directory until option parsing has finished.
    None of the functions used in option parsing look for or read any
    files other than stdin, so this is safe.
    
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @jrn @gitster

    http-fetch: add missing initialization of argv0_path

    jrn authored gitster committed
    According to c6dfb39 (remote-curl: add missing initialization of
    argv0_path, 2009-10-13), programs with "main" must call this to
    work correctly on MinGW.
    
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 6, 2009
  1. @torvalds @gitster

    git-http-fetch: not a builtin

    torvalds authored gitster committed
    This splits up git-http-fetch so that it isn't built-in.
    
    It also removes the general dependency on curl, because it is no
    longer used by any built-in code. Because they are no longer LIB_OBJS,
    add LIB_H to the dependencies of http-related object files, and remove
    http.h from the dependencies of transport.o
    
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Sep 19, 2007
  1. @gitster

    Modularize commit-walker

    Daniel Barkalow authored gitster committed
    This turns the extern functions to be provided by the backend into a
    struct of pointers, renames the functions to be more
    namespace-friendly, and updates http-fetch to this interface. It
    removes the unused include from http-push.c. It makes git-http-fetch a
    builtin (with the implementation a separate file, accessible
    directly).
    
    Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @gitster

    Make function to refill http queue a callback

    Daniel Barkalow authored gitster committed
    This eliminates the last function provided by the code using http.h as
    a global symbol, so it should be possible to have multiple programs
    using http.h in the same executable, and it also adds an argument to
    that callback, so that info can be passed into the callback without
    being global.
    
    Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. @gitster

    Refactor http.h USE_CURL_MULTI fill_active_slots().

    Daniel Barkalow authored gitster committed
    This removes all of the boilerplate and http-internal stuff from
    fill_active_slots() and makes it easy to turn into a callback.
    
    Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 7, 2007
  1. @gitster

    War on whitespace

    gitster authored
    This uses "git-apply --whitespace=strip" to fix whitespace errors that have
    crept in to our source files over time.  There are a few files that need
    to have trailing whitespaces (most notably, test vectors).  The results
    still passes the test, and build result in Documentation/ area is unchanged.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Apr 5, 2007
  1. Fix lseek(2) calls with args 2 and 3 swapped

    Dana How authored Junio C Hamano committed
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Mar 28, 2007
  1. http-fetch: remove path_len from struct alt_base, it was computed but…

    Gerrit Pape authored Junio C Hamano committed
    … never used
    
    Signed-off-by: Gerrit Pape <pape@smarden.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
  2. http-fetch: don't use double-slash as directory separator in URLs

    Gerrit Pape authored Junio C Hamano committed
    Please see http://bugs.debian.org/409887
    
    http-fetch expected the URL given at the command line to have a trailing
    slash anyway, and then added '/objects...' when requesting objects files
    from the http server.
    
    Now it doesn't require the trailing slash in <url> anymore, and strips
    trailing slashes if given nonetheless.
    
    Signed-off-by: Gerrit Pape <pape@smarden.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Feb 21, 2007
  1. prefixcmp(): fix-up leftover strncmp().

    Junio C Hamano authored
    There were instances of strncmp() that were formatted improperly
    (e.g. whitespace around parameter before closing parenthesis)
    that caused the earlier mechanical conversion step to miss
    them.  This step cleans them up.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
  2. Mechanical conversion to use prefixcmp()

    Junio C Hamano authored
    This mechanically converts strncmp() to use prefixcmp(), but only when
    the parameters match specific patterns, so that they can be verified
    easily.  Leftover from this will be fixed in a separate step, including
    idiotic conversions like
    
        if (!strncmp("foo", arg, 3))
    
      =>
    
        if (!(-prefixcmp(arg, "foo")))
    
    This was done by using this script in px.perl
    
       #!/usr/bin/perl -i.bak -p
       if (/strncmp\(([^,]+), "([^\\"]*)", (\d+)\)/ && (length($2) == $3)) {
               s|strncmp\(([^,]+), "([^\\"]*)", (\d+)\)|prefixcmp($1, "$2")|;
       }
       if (/strncmp\("([^\\"]*)", ([^,]+), (\d+)\)/ && (length($1) == $3)) {
               s|strncmp\("([^\\"]*)", ([^,]+), (\d+)\)|(-prefixcmp($2, "$1"))|;
       }
    
    and running:
    
       $ git grep -l strncmp -- '*.c' | xargs perl px.perl
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jan 29, 2007
  1. git-fsck-objects is now synonym to git-fsck

    Junio C Hamano authored
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jan 28, 2007
  1. Don't force everybody to call setup_ident().

    Junio C Hamano authored
    Back when only handful commands that created commit and tag were
    the only users of committer identity information, it made sense
    to explicitly call setup_ident() to pre-fill the default value
    from the gecos information.  But it is much simpler for programs
    to make the call automatic when get_ident() is called these days,
    since many more programs want to use the information when updating
    the reflog.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jan 10, 2007
  1. @spearce

    Don't die in git-http-fetch when fetching packs.

    spearce authored Junio C Hamano committed
    My sp/mmap changes to pack-check.c modified the function such that
    it expects packed_git.pack_size to be populated with the total
    bytecount of the packfile by the caller.
    
    But that isn't the case for packs obtained by git-http-fetch as
    pack_size was not initialized before being accessed.  This caused
    verify_pack to think it had 2^32-21 bytes available when the
    downloaded pack perhaps was only 305 bytes in length.  The use_pack
    function then later dies with "offset beyond end of packfile"
    when computing the overall file checksum.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jan 8, 2007
  1. @awhitcroft

    short i/o: fix calls to write to use xwrite or write_in_full

    awhitcroft authored Junio C Hamano committed
    We have a number of badly checked write() calls.  Often we are
    expecting write() to write exactly the size we requested or fail,
    this fails to handle interrupts or short writes.  Switch to using
    the new write_in_full().  Otherwise we at a minimum need to check
    for EINTR and EAGAIN, where this is appropriate use xwrite().
    
    Note, the changes to config handling are much larger and handled
    in the next patch in the sequence.
    
    Signed-off-by: Andy Whitcroft <apw@shadowen.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
  2. @awhitcroft

    short i/o: fix calls to read to use xread or read_in_full

    awhitcroft authored Junio C Hamano committed
    We have a number of badly checked read() calls.  Often we are
    expecting read() to read exactly the size we requested or fail, this
    fails to handle interrupts or short reads.  Add a read_in_full()
    providing those semantics.  Otherwise we at a minimum need to check
    for EINTR and EAGAIN, where this is appropriate use xread().
    
    Signed-off-by: Andy Whitcroft <apw@shadowen.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Oct 9, 2006
  1. Add WEBDAV timeout to http-fetch.

    Junio C Hamano authored
    Sean <seanlkml@sympatico.ca> writes:
    
    > On Sat, 07 Oct 2006 21:52:02 -0700
    > Junio C Hamano <junkio@cox.net> wrote:
    >
    >> Using DAV, if it works with the server, has the advantage of not
    >> having to keep objects/info/packs up-to-date from repository
    >> owner's point of view.  But the repository owner ends up keeping
    >> up-to-date as a side effect of keeping info/refs up-to-date
    >> anyway (as I do not see a code to read that information over
    >> DAV), so there is no point doing this over DAV in practice.
    >>
    >> Perhaps we should remove call to remote_ls() from
    >> fetch_indices() unconditionally, not just protected with
    >> NO_EXPAT and be done with it?
    >
    > That makes a lot of sense.  A server really has to always provide
    > a objects/info/packs anyway, just to be fetchable today by clients
    > that are compiled with NO_EXPAT.
    
    And even for an isolated group where everybody knows that
    everybody else runs DAV-enabled clients, they need info/refs
    prepared for ls-remote and git-fetch script, which means you
    will run update-server-info to keep objects/info/packs up to
    date.
    
    Nick, do you see holes in my logic?
    
    -- >8 --
    http-fetch.c: drop remote_ls()
    
    While doing remote_ls() over DAV potentially allows the server
    side not to keep objects/info/pack up-to-date, misconfigured or
    buggy servers can silently ignore or not to respond to DAV
    requests and makes the client hang.
    
    The server side (unfortunately) needs to run git-update-server-info
    even if remote_ls() removes the need to keep objects/info/pack file
    up-to-date, because the caller of git-http-fetch (git-fetch) and other
    clients that interact with the repository (e.g. git-ls-remote) need to
    read from info/refs file (there is no code to make that unnecessary by
    using DAV yet).
    
    Perhaps the right solution in the longer-term is to make info/refs
    also unnecessary by using DAV, and we would want to resurrect the
    code this patch removes when we do so, but let's drop remote_ls()
    implementation for now.  It is causing problems without really
    helping anything yet.
    
    git will keep it for us until we need it next time.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Sep 16, 2006
  1. Add ftp:// protocol support for git-http-fetch

    Junio C Hamano authored
    Based on Sasha Khapyorsky's patch but adjusted to the refactored
    "missing target" detection code.
    
    It might have been better if the program were called
    git-url-fetch but it is too late now ;-).
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
  2. http-fetch.c: consolidate code to detect missing fetch target

    Junio C Hamano authored
    At a handful places we check two error codes from curl library
    to see if the file we asked was missing from the remote (e.g.
    we asked for a loose object when it is in a pack) to decide what
    to do next.  This consolidates the check into a single function.
    
    NOTE: the original did not check for HTTP_RETURNED_ERROR when
    error code is 404, but this version does to make sure 404 is
    from HTTP and not some other protcol.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Sep 13, 2006
  1. http-fetch: fix alternates handling.

    Junio C Hamano authored
    Fetch over http from a repository that uses alternates to borrow
    from neighbouring repositories were quite broken, apparently for
    some time now.
    
    We parse input and count bytes to allocate the new buffer, and
    when we copy into that buffer we know exactly how many bytes we
    want to copy from where.  Using strlcpy for it was simply
    stupid, and the code forgot to take it into account that strlcpy
    terminated the string with NUL.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Sep 2, 2006
  1. @spearce

    Replace uses of strdup with xstrdup.

    spearce authored Junio C Hamano committed
    Like xmalloc and xrealloc xstrdup dies with a useful message if
    the native strdup() implementation returns NULL rather than a
    valid pointer.
    
    I just tried to use xstrdup in new code and found it to be missing.
    However I expected it to be present as xmalloc and xrealloc are
    already commonly used throughout the code.
    
    [jc: removed the part that deals with last_XXX, which I am
     finding more and more dubious these days.]
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Aug 28, 2006
  1. free(NULL) is perfectly valid.

    Junio C Hamano authored
    Jonas noticed some places say "if (X) free(X)" which is totally
    unnecessary.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Aug 23, 2006
  1. @spearce

    Convert memcpy(a,b,20) to hashcpy(a,b).

    spearce authored Junio C Hamano committed
    This abstracts away the size of the hash values when copying them
    from memory location to memory location, much as the introduction
    of hashcmp abstracted away hash value comparsion.
    
    A few call sites were using char* rather than unsigned char* so
    I added the cast rather than open hashcpy to be void*.  This is a
    reasonable tradeoff as most call sites already use unsigned char*
    and the existing hashcmp is also declared to be unsigned char*.
    
    [jc: Splitted the patch to "master" part, to be followed by a
     patch for merge-recursive.c which is not in "master" yet.
    
     Fixed the cast in the latter hunk to combine-diff.c which was
     wrong in the original.
    
     Also converted ones left-over in combine-diff.c, diff-lib.c and
     upload-pack.c ]
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Aug 17, 2006
  1. Do not use memcmp(sha1_1, sha1_2, 20) with hardcoded length.

    David Rientjes authored Junio C Hamano committed
    Introduces global inline:
    
    	hashcmp(const unsigned char *sha1, const unsigned char *sha2)
    
    Uses memcmp for comparison and returns the result based on the length of
    the hash name (a future runtime decision).
    
    Acked-by: Alex Riesen <raa.lkml@gmail.com>
    Signed-off-by: David Rientjes <rientjes@google.com>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Aug 16, 2006
  1. remove unnecessary initializations

    David Rientjes authored Junio C Hamano committed
    [jc: I needed to hand merge the changes to the updated codebase,
     so the result needs to be checked.]
    
    Signed-off-by: David Rientjes <rientjes@google.com>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Something went wrong with that request. Please try again.