1. 23 2月, 2010 1 次提交
    • L
      Move 'builtin-*' into a 'builtin/' subdirectory · 81b50f3c
      Linus Torvalds 提交于
      This shrinks the top-level directory a bit, and makes it much more
      pleasant to use auto-completion on the thing. Instead of
      
      	[torvalds@nehalem git]$ em buil<tab>
      	Display all 180 possibilities? (y or n)
      	[torvalds@nehalem git]$ em builtin-sh
      	builtin-shortlog.c     builtin-show-branch.c  builtin-show-ref.c
      	builtin-shortlog.o     builtin-show-branch.o  builtin-show-ref.o
      	[torvalds@nehalem git]$ em builtin-shor<tab>
      	builtin-shortlog.c  builtin-shortlog.o
      	[torvalds@nehalem git]$ em builtin-shortlog.c
      
      you get
      
      	[torvalds@nehalem git]$ em buil<tab>		[type]
      	builtin/   builtin.h
      	[torvalds@nehalem git]$ em builtin		[auto-completes to]
      	[torvalds@nehalem git]$ em builtin/sh<tab>	[type]
      	shortlog.c     shortlog.o     show-branch.c  show-branch.o  show-ref.c     show-ref.o
      	[torvalds@nehalem git]$ em builtin/sho		[auto-completes to]
      	[torvalds@nehalem git]$ em builtin/shor<tab>	[type]
      	shortlog.c  shortlog.o
      	[torvalds@nehalem git]$ em builtin/shortlog.c
      
      which doesn't seem all that different, but not having that annoying
      break in "Display all 180 possibilities?" is quite a relief.
      
      NOTE! If you do this in a clean tree (no object files etc), or using an
      editor that has auto-completion rules that ignores '*.o' files, you
      won't see that annoying 'Display all 180 possibilities?' message - it
      will just show the choices instead.  I think bash has some cut-off
      around 100 choices or something.
      
      So the reason I see this is that I'm using an odd editory, and thus
      don't have the rules to cut down on auto-completion.  But you can
      simulate that by using 'ls' instead, or something similar.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      81b50f3c
  2. 18 2月, 2010 1 次提交
  3. 18 11月, 2009 1 次提交
  4. 10 11月, 2009 5 次提交
  5. 31 10月, 2009 1 次提交
  6. 28 10月, 2009 1 次提交
  7. 25 10月, 2009 1 次提交
  8. 19 9月, 2009 1 次提交
    • J
      fetch: Speed up fetch by rewriting find_non_local_tags · e984c54a
      Julian Phillips 提交于
      When trying to get a list of remote tags to see if we need to fetch
      any we were doing a linear search for the matching tag ref for the
      tag^{} commit entries.  This proves to be incredibly slow for large
      numbers of tags.  Rewrite the function so that we build up a
      string_list of refs to fetch and then process that instead.
      
      As an extreme example, for a repository with 50000 tags (and just a
      single commit on a single branch), a fetch that does nothing goes from
      ~1m50s to ~4.1s.
      Signed-off-by: NJulian Phillips <julian@quantumfyre.co.uk>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e984c54a
  9. 13 9月, 2009 1 次提交
    • J
      use write_str_in_full helper to avoid literal string lengths · 2b7ca830
      Jim Meyering 提交于
      In 2d14d65c (Use a clearer style to issue commands to remote helpers,
      2009-09-03) I happened to notice two changes like this:
      
      -	write_in_full(helper->in, "list\n", 5);
      +
      +	strbuf_addstr(&buf, "list\n");
      +	write_in_full(helper->in, buf.buf, buf.len);
      +	strbuf_reset(&buf);
      
      IMHO, it would be better to define a new function,
      
          static inline ssize_t write_str_in_full(int fd, const char *str)
          {
                 return write_in_full(fd, str, strlen(str));
          }
      
      and then use it like this:
      
      -       strbuf_addstr(&buf, "list\n");
      -       write_in_full(helper->in, buf.buf, buf.len);
      -       strbuf_reset(&buf);
      +       write_str_in_full(helper->in, "list\n");
      
      Thus not requiring the added allocation, and still avoiding
      the maintenance risk of literal string lengths.
      These days, compilers are good enough that strlen("literal")
      imposes no run-time cost.
      
      Transformed via this:
      
          perl -pi -e \
              's/write_in_full\((.*?), (".*?"), \d+\)/write_str_in_full($1, $2)/'\
            $(git grep -l 'write_in_full.*"')
      Signed-off-by: NJim Meyering <meyering@redhat.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2b7ca830
  10. 11 7月, 2009 1 次提交
    • J
      quickfetch(): Prevent overflow of the rev-list command line · d9eb0205
      Johan Herland 提交于
      quickfetch() calls rev-list to check whether the objects we are about to
      fetch are already present in the repo (if so, we can skip the object fetch).
      However, when there are many (~1000) refs to be fetched, the rev-list
      command line grows larger than the maximum command line size on some systems
      (32K in Windows). This causes rev-list to fail, making quickfetch() return
      non-zero, which unnecessarily triggers the transport machinery. This somehow
      causes fetch to fail with an exit code.
      
      By using the --stdin option to rev-list (and feeding the object list to its
      standard input), we prevent the overflow of the rev-list command line,
      which causes quickfetch(), and subsequently the overall fetch, to succeed.
      
      However, using rev-list --stdin is not entirely straightforward: rev-list
      terminates immediately when encountering an unknown object, which can
      trigger SIGPIPE if we are still writing object's to its standard input.
      We therefore temporarily ignore SIGPIPE so that the fetch process is not
      terminated.
      
      The patch also contains a testcase to verify the fix (note that before
      the patch, the testcase would only fail on msysGit).
      Signed-off-by: NJohan Herland <johan@herland.net>
      Improved-by: NJohannes Sixt <j6t@kdbg.org>
      Improved-by: NAlex Riesen <raa.lkml@gmail.com>
      Tested-by: NPeter Krefting <peter@softwolves.pp.se>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d9eb0205
  11. 26 5月, 2009 1 次提交
    • J
      fetch: report ref storage DF errors more accurately · fa250759
      Jeff King 提交于
      When we fail to store a fetched ref, we recommend that the
      user try running "git prune" to remove up any old refs that
      have been deleted by the remote, which would clear up any DF
      conflicts. However, ref storage might fail for other
      reasons (e.g., permissions problems) in which case the
      advice is useless and misleading.
      
      This patch detects when there is an actual DF situation and
      only issues the advice when one is found.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      fa250759
  12. 25 5月, 2009 1 次提交
  13. 14 5月, 2009 2 次提交
  14. 21 4月, 2009 1 次提交
    • A
      fetch: Strip usernames from url's before storing them · 47abd85b
      Andreas Ericsson 提交于
      When pulling from a remote, the full URL including username
      is by default added to the commit message. Since it adds
      very little value but could be used by malicious people to
      glean valid usernames (with matching hostnames), we're far
      better off just stripping the username before storing the
      remote URL locally.
      
      Note that this patch has no lasting visible effect when
      "git pull" does not create a merge commit. It simply
      alters what gets written to .git/FETCH_HEAD, which is used
      by "git merge" to automagically create its messages.
      Signed-off-by: NAndreas Ericsson <ae@op5.se>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      47abd85b
  15. 23 3月, 2009 1 次提交
  16. 11 3月, 2009 1 次提交
    • D
      Give error when no remote is configured · fa685bdf
      Daniel Barkalow 提交于
      When there's no explicitly-named remote, we use the remote specified
      for the current branch, which in turn defaults to "origin". But it
      this case should require the remote to actually be configured, and not
      fall back to the path "origin".
      
      Possibly, the config file's "remote = something" should require the
      something to be a configured remote instead of a bare repository URL,
      but we actually test with a bare repository URL.
      
      In fetch, we were giving the sensible error message when coming up
      with a URL failed, but this wasn't actually reachable, so move that
      error up and use it when appropriate.
      
      In push, we need a new error message, because the old one (formerly
      unreachable without a lot of help) used the repo name, which was NULL.
      Signed-off-by: NDaniel Barkalow <barkalow@iabervon.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      fa685bdf
  17. 10 3月, 2009 1 次提交
  18. 22 1月, 2009 2 次提交
    • J
      refactor signal handling for cleanup functions · 57b235a4
      Jeff King 提交于
      The current code is very inconsistent about which signals
      are caught for doing cleanup of temporary files and lock
      files. Some callsites checked only SIGINT, while others
      checked a variety of death-dealing signals.
      
      This patch factors out those signals to a single function,
      and then calls it everywhere. For some sites, that means
      this is a simple clean up. For others, it is an improvement
      in that they will now properly clean themselves up after a
      larger variety of signals.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      57b235a4
    • J
      chain kill signals for cleanup functions · 4a16d072
      Jeff King 提交于
      If a piece of code wanted to do some cleanup before exiting
      (e.g., cleaning up a lockfile or a tempfile), our usual
      strategy was to install a signal handler that did something
      like this:
      
        do_cleanup(); /* actual work */
        signal(signo, SIG_DFL); /* restore previous behavior */
        raise(signo); /* deliver signal, killing ourselves */
      
      For a single handler, this works fine. However, if we want
      to clean up two _different_ things, we run into a problem.
      The most recently installed handler will run, but when it
      removes itself as a handler, it doesn't put back the first
      handler.
      
      This patch introduces sigchain, a tiny library for handling
      a stack of signal handlers. You sigchain_push each handler,
      and use sigchain_pop to restore whoever was before you in
      the stack.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4a16d072
  19. 06 1月, 2009 1 次提交
  20. 15 11月, 2008 1 次提交
  21. 18 10月, 2008 1 次提交
  22. 14 10月, 2008 1 次提交
    • J
      Fix fetch/pull when run without --update-head-ok · 8ee5d731
      Johannes Schindelin 提交于
      Some confusing tutorials suggested that it would be a good idea to fetch
      into the current branch with something like this:
      
      	git fetch origin master:master
      
      (or even worse: the same command line with "pull" instead of "fetch").
      While it might make sense to store what you want to pull, it typically is
      plain wrong when the current branch is "master".  This should only be
      allowed when (an incorrect) "git pull origin master:master" tries to work
      around by giving --update-head-ok to underlying "git fetch", and otherwise
      we should refuse it, but somewhere along the lines we lost that behavior.
      
      The check for the current branch is now _only_ performed in non-bare
      repositories, which is an improvement from the original behaviour.
      
      Some newer tests were depending on the broken behaviour of "git fetch"
      this patch fixes, and have been adjusted.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Acked-by: NShawn O. Pearce <spearce@spearce.org>
      Acked-by: NDaniel Barkalow <barkalow@iabervon.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8ee5d731
  23. 09 9月, 2008 1 次提交
  24. 22 7月, 2008 1 次提交
    • J
      Rename path_list to string_list · c455c87c
      Johannes Schindelin 提交于
      The name path_list was correct for the first usage of that data structure,
      but it really is a general-purpose string list.
      
      $ perl -i -pe 's/path-list/string-list/g' $(git grep -l path-list)
      $ perl -i -pe 's/path_list/string_list/g' $(git grep -l path_list)
      $ git mv path-list.h string-list.h
      $ git mv path-list.c string-list.c
      $ perl -i -pe 's/has_path/has_string/g' $(git grep -l has_path)
      $ perl -i -pe 's/path/string/g' string-list.[ch]
      $ git mv Documentation/technical/api-path-list.txt \
      	Documentation/technical/api-string-list.txt
      $ perl -i -pe 's/strdup_paths/strdup_strings/g' $(git grep -l strdup_paths)
      
      ... and then fix all users of string-list to access the member "string"
      instead of "path".
      
      Documentation/technical/api-string-list.txt needed some rewrapping, too.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c455c87c
  25. 14 7月, 2008 1 次提交
    • S
      Make usage strings dash-less · 1b1dd23f
      Stephan Beyer 提交于
      When you misuse a git command, you are shown the usage string.
      But this is currently shown in the dashed form.  So if you just
      copy what you see, it will not work, when the dashed form
      is no longer supported.
      
      This patch makes git commands show the dash-less version.
      
      For shell scripts that do not specify OPTIONS_SPEC, git-sh-setup.sh
      generates a dash-less usage string now.
      Signed-off-by: NStephan Beyer <s-beyer@gmx.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1b1dd23f
  26. 30 6月, 2008 1 次提交
    • J
      fetch: give a hint to the user when local refs fail to update · f3cb169b
      Jeff King 提交于
      There are basically two categories of update failures for
      local refs:
      
        1. problems outside of git, like disk full, bad
           permissions, etc.
      
        2. D/F conflicts on tracking branch ref names
      
      In either case, there should already have been an error
      message. In case '1', hopefully enough information has
      already been given that the user can fix it. In the case of
      '2', we can hint that the user can clean up their tracking
      branch area by using 'git remote prune'.
      
      Note that we don't actually know _which_ case we have, so
      the user will receive the hint in case 1, as well. In this
      case the suggestion won't do any good, but hopefully the
      user is smart enough to figure out that it's just a hint.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f3cb169b
  27. 28 6月, 2008 1 次提交
    • J
      fetch: report local storage errors in status table · 6315472e
      Jeff King 提交于
      Previously, if there was an error while storing a local
      tracking ref, the low-level functions would report an error,
      but fetch's status output wouldn't indicate any problem.
      E.g., imagine you have an old "refs/remotes/origin/foo/bar" but
      upstream has deleted "foo/bar" in favor of a new branch
      "foo". You would get output like this:
      
        error: there are still refs under 'refs/remotes/origin/foo'
        From $url_of_repo
         * [new branch]      foo        -> origin/foo
      
      With this patch, the output takes into account the status of
      updating the local ref:
      
        error: there are still refs under 'refs/remotes/origin/foo'
        From $url_of_repo
         ! [new branch]      foo        -> origin/foo  (unable to update local ref)
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6315472e
  28. 29 5月, 2008 1 次提交
  29. 12 5月, 2008 1 次提交
  30. 05 5月, 2008 1 次提交
  31. 29 4月, 2008 1 次提交
    • A
      Fix use after free() in builtin-fetch · 7b7f39ea
      Alex Riesen 提交于
      As reported by Dave Jones:
      
      Since master.kernel.org updated to latest, I noticed that I could crash
      git-fetch by doing this..
      
      export KERNEL=/pub/scm/linux/kernel/git/
      git fetch $KERNEL/torvalds/linux-2.6 master:linus
      
      (gdb) bt
       0  0x000000349fd6d44b in free () from /lib64/libc.so.6
       1  0x000000000048f4eb in transport_unlock_pack (transport=0x7ce530) at transport.c:811
       2  0x000000349fd31b25 in exit () from /lib64/libc.so.6
       3  0x00000000004043d8 in handle_internal_command (argc=3, argv=0x7fffea4449f0) at git.c:379
       4  0x0000000000404547 in main (argc=3, argv=0x7fffea4449f0) at git.c:443
       5  0x000000349fd1c784 in __libc_start_main () from /lib64/libc.so.6
       6  0x0000000000403ef9 in ?? ()
       7  0x00007fffea4449d8 in ?? ()
       8  0x0000000000000000 in ?? ()
      
      I then remembered, my .bashrc has this..
      
      export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
      
      which is handy for showing up such bugs.
      
      More info on this glibc feature is at http://udrepper.livejournal.com/11429.htmlSigned-off-by: NAlex Riesen <raa.lkml@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7b7f39ea
  32. 10 4月, 2008 2 次提交
    • J
      git-fetch: always show status of non-tracking-ref fetches · e5c49826
      Jeff King 提交于
      Previously, a fetch like:
      
        git fetch git://some/url
      
      would show no ref status output (just the object downloading
      status, if there was any), leading to some confusion.
      
      With this patch, we now show the usual ref table, with
      remote refs going into FETCH_HEAD. Previously this output
      was shown only if "-v"erbose was specified.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e5c49826
    • J
      git-fetch: fix status output when not storing tracking ref · f59774ad
      Jeff King 提交于
      There was code in update_local_ref for handling this case,
      but it never actually got called. It assumed that storing in
      FETCH_HEAD meant a blank peer_ref name, but we actually have
      a NULL peer_ref in this case, so we never even made it to
      the update_local_ref function.
      
      On top of that, the display formatting was different from
      all of the other cases, probably owing to the fact that
      nobody had ever actually seen the output.
      
      This patch harmonizes the output with the other cases and
      moves the detection of this case into store_updated_refs,
      where we can actually trigger it.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f59774ad
  33. 06 4月, 2008 1 次提交