1. 09 10月, 2010 1 次提交
  2. 10 9月, 2010 1 次提交
  3. 26 8月, 2010 1 次提交
    • B
      builtin/fetch.c: ignore merge config when not fetching from branch's remote · 3ee1757b
      Brandon Casey 提交于
      When 'git fetch' is supplied a single argument, it tries to match it
      against a configured remote and then fetch the refs specified by the
      named remote's fetchspec.  Additionally, or alternatively, if the current
      branch has a merge ref configured, and if the name of the remote supplied
      to fetch matches the one in the branch's configuration, then git also adds
      the merge ref to the list of refs to update.
      
      If the argument to fetch does not specify a named remote, or if the name
      supplied does not match the remote configured for the current branch, then
      the current branch's merge configuration should not be considered.
      
      git currently mishandles the case when the argument to fetch specifies a
      GIT URL(i.e. not a named remote) and the current branch has a configured
      merge ref.  In this case, fetch should ignore the branch's merge ref and
      attempt to fetch from the remote repository's HEAD branch.  But, since
      fetch only checks _whether_ the current branch has a merge ref configured,
      and does _not_ check whether the branch's configured remote matches the
      command line argument (until later), it will mistakenly enter the wrong
      branch of an 'if' statement and will not fall back to fetch the HEAD branch.
      The fetch ends up doing nothing and returns with a successful zero status.
      
      Fix this by comparing the remote repository's name to the branch's remote
      name, in addition to whether it has a configured merge ref, sooner, so that
      fetch can correctly decide whether the branch's configuration is interesting
      or not, and fall back to fetching from the remote's HEAD branch when
      appropriate.
      
      This fixes the test in t5510.
      Signed-off-by: NBrandon Casey <casey@nrlssc.navy.mil>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3ee1757b
  4. 15 8月, 2010 1 次提交
  5. 28 7月, 2010 1 次提交
  6. 06 7月, 2010 2 次提交
  7. 28 6月, 2010 4 次提交
  8. 01 6月, 2010 1 次提交
    • G
      Rewrite dynamic structure initializations to runtime assignment · 66dbfd55
      Gary V. Vaughan 提交于
      Unfortunately, there are still plenty of production systems with
      vendor compilers that choke unless all compound declarations can be
      determined statically at compile time, for example hpux10.20 (I can
      provide a comprehensive list of our supported platforms that exhibit
      this problem if necessary).
      
      This patch simply breaks apart any compound declarations with dynamic
      initialisation expressions, and moves the initialisation until after
      the last declaration in the same block, in all the places necessary to
      have the offending compilers accept the code.
      Signed-off-by: NGary V. Vaughan <gary@thewrittenword.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      66dbfd55
  9. 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
  10. 18 2月, 2010 1 次提交
  11. 18 11月, 2009 1 次提交
  12. 10 11月, 2009 5 次提交
  13. 31 10月, 2009 1 次提交
  14. 28 10月, 2009 1 次提交
  15. 25 10月, 2009 1 次提交
  16. 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
  17. 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
  18. 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
  19. 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
  20. 25 5月, 2009 1 次提交
  21. 14 5月, 2009 2 次提交
  22. 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
  23. 23 3月, 2009 1 次提交
  24. 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
  25. 10 3月, 2009 1 次提交
  26. 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
  27. 06 1月, 2009 1 次提交
  28. 15 11月, 2008 1 次提交
  29. 18 10月, 2008 1 次提交
  30. 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