1. 10 5月, 2013 2 次提交
    • R
      t5004: avoid using tar for checking emptiness of archive · ea2d20d4
      René Scharfe 提交于
      Test 2 of t5004 checks if a supposedly empty tar archive really
      contains no files.  24676f02 (t5004: fix issue with empty archive test
      and bsdtar) removed our commit hash to make it work with bsdtar, but
      the test still fails on NetBSD and OpenBSD, which use their own tar
      that considers a tar file containing only NULs as broken.
      
      Here's what the different archivers do when asked to create a tar
      file without entries:
      
      	$ uname -v
      	NetBSD 6.0.1 (GENERIC)
      	$ gtar --version | head -1
      	tar (GNU tar) 1.26
      	$ bsdtar --version
      	bsdtar 2.8.4 - libarchive 2.8.4
      
      	$ : >zero.tar
      	$ perl -e 'print "\0" x 10240' >tenk.tar
      	$ sha1 zero.tar tenk.tar
      	SHA1 (zero.tar) = da39a3ee5e6b4b0d3255bfef95601890afd80709
      	SHA1 (tenk.tar) = 34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c
      
      	$ : | tar cf - -T - | sha1
      	da39a3ee5e6b4b0d3255bfef95601890afd80709
      	$ : | gtar cf - -T - | sha1
      	34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c
      	$ : | bsdtar cf - -T - | sha1
      	34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c
      
      So NetBSD's native tar creates an empty file, while GNU tar and bsdtar
      both give us 10KB of NULs -- just like git archive with an empty tree.
      Now let's see how the archivers handle these two kinds of empty tar
      files:
      
      	$ tar tf zero.tar; echo $?
      	tar: Unexpected EOF on archive file
      	1
      	$ gtar tf zero.tar; echo $?
      	gtar: This does not look like a tar archive
      	gtar: Exiting with failure status due to previous errors
      	2
      	$ bsdtar tf zero.tar; echo $?
      	0
      
      	$ tar tf tenk.tar; echo $?
      	tar: Cannot identify format. Searching...
      	tar: End of archive volume 1 reached
      	tar: Sorry, unable to determine archive format.
      	1
      	$ gtar tf tenk.tar; echo $?
      	0
      	$ bsdtar tf tenk.tar; echo $?
      	0
      
      NetBSD's tar complains about both, bsdtar happily accepts any of them
      and GNU tar doesn't like zero-length archive files.  So the safest
      course of action is to stay with our block-of-NULs format which is
      compatible with GNU tar and bsdtar, as we can't make NetBSD's native
      tar happy anyway.
      
      We can simplify our test, however, by taking tar out of the picture.
      Instead of extracting the archive and checking for the non-presence of
      files, check if the file has a size of 10KB and contains only NULs.
      This makes t5004 pass on NetBSD and OpenBSD.
      Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ea2d20d4
    • R
      t5004: ignore pax global header file · abdb9b2e
      René Scharfe 提交于
      Versions of tar that don't know pax headers -- like the ones in NetBSD 6
      and OpenBSD 5.2 -- extract them as regular files.  Explicitly ignore the
      file created for our global header when checking the list of extracted
      files, as this is normal and harmless fall-back behaviour.  This fixes
      test 3 of t5004 on these platforms.
      Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      abdb9b2e
  2. 07 5月, 2013 1 次提交
  3. 06 5月, 2013 1 次提交
  4. 29 4月, 2013 2 次提交
  5. 27 4月, 2013 3 次提交
  6. 26 4月, 2013 1 次提交
    • Z
      bash-prompt.sh: show where rebase is at when stopped · b71dc3e1
      Zoltan Klinger 提交于
      When a rebase stops (e.g. interrupted by a merge conflict), it could
      be useful to know how far a rebase has progressed and how many
      commits in total this rebase will apply. Teach the __git_ps1()
      command to display the number of commits so far applied and the
      total number of commits to be applied, like this:
      
        ((3ec0a6a...)|REBASE 2/5)
      
      In the example above the rebase has stopped at the second commit due to
      a merge conflict and there are a total number of five commits to be
      applied by this rebase.
      
      This information can be already obtained from the following files which are
      being generated during the rebase:
      
          GIT_DIR/.git/rebase-merge/msgnum (git-rebase--merge.sh)
          GIT_DIR/.git/rebase-merge/end    (git-rebase--merge.sh)
          GIT_DIR/.git/rebase-apply/next   (git-am.sh)
          GIT_DIR/.git/rebase-apply/last   (git-am.sh)
      
      but "rebase -i" does not leave necessary clues.
      
      Implement this feature by doing these three things:
      
        1) Modify git-rebase--interactive.sh to also create
      
      	GIT_DIR/.git/rebase-merge/msgnum
      	GIT_DIR/.git/rebase-merge/end
      
           files for the number of commits so far applied and the total
           number of commits to be applied.
      
        2) Modify git-prompt.sh to read and display info from the above
           files.
      
        3) Update test t9903-bash-prompt.sh to reflect changes introduced
           by this patch.
      Signed-off-by: NZoltan Klinger <zoltan.klinger@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b71dc3e1
  7. 25 4月, 2013 3 次提交
  8. 24 4月, 2013 2 次提交
    • P
      rebase: find orig_head unambiguously · ea709800
      Phil Hord 提交于
      When we 'git rebase $upstream', git uses 'rev-parse --verify
      $current_branch' to find ORIG_HEAD.  But if $current_branch
      is ambiguous, 'rev-parse --verify' emits a warning and returns
      a SHA1 anyway.  When the wrong ambiguous choice is used,
      git-rebase fails non-gracefully:  it emits a warning about
      failing to lock $current_branch, an error about being unable to
      checkout $current_branch again, and it might even decide the
      rebase is a fast-forward when it is not.
      
      In the 'rebase $upstream' case, we already know the unambiguous
      spelling of $current_branch is "HEAD".  Fix git-rebase to find
      $orig_head unambiguously.
      
      Add a test in t3400-rebase.sh which creates an ambiguous branch
      name and rebases it implicitly with 'git rebase $other'.
      Signed-off-by: NPhil Hord <hordp@cisco.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ea709800
    • T
      bisect: Log possibly bad, skipped commits at bisection end · f989cac9
      Torstein Hegge 提交于
      If the bisection completes with only skipped commits left to as possible
      first bad commit, output the list of possible first bad commits to human
      readers of the bisection log.
      Signed-off-by: NTorstein Hegge <hegge@resisty.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f989cac9
  9. 19 4月, 2013 6 次提交
  10. 18 4月, 2013 2 次提交
    • R
      pretty: handle broken commit headers gracefully · 9dbe7c3d
      René Scharfe 提交于
      Centralize the parsing of the date and time zone strings in the new
      helper function show_ident_date() and make sure it checks the pointers
      provided by split_ident_line() for NULL before use.
      Reported-by: NIvan Lyapunov <dront78@gmail.com>
      Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9dbe7c3d
    • J
      cat-file: print tags raw for "cat-file -p" · 9cfa5126
      Jeff King 提交于
      When "cat-file -p" prints commits, it shows them in their
      raw format, since git's format is already human-readable.
      For tags, however, we print the whole thing raw except for
      one thing: we convert the timestamp on the tagger line into a
      human-readable date.
      
      This dates all the way back to a0f15fa5 (Pretty-print tagger
      dates, 2006-03-01). At that time there was no other way to
      pretty-print a tag.  These days, however, neither of those
      matters much. The normal way to pretty-print a tag is with
      "git show", which is much more flexible than "cat-file -p".
      
      Commit a0f15fa5 also built "verify-tag --verbose" (and
      subsequently "tag -v") around the "cat-file -p" output.
      However, that behavior was lost in commit 62e09ce9 (Make git
      tag a builtin, 2007-07-20), and we went back to printing
      the raw tag contents. Nobody seems to have noticed the bug
      since then (and it is arguably a saner behavior anyway, as
      it shows the actual bytes for which we verified the
      signature).
      
      Let's drop the tagger-date formatting for "cat-file -p". It
      makes us more consistent with cat-file's commit
      pretty-printer, and as a bonus, we can drop the hand-rolled
      tag parsing code in cat-file (which happened to behave
      inconsistently with the tag pretty-printing code elsewhere).
      
      This is a change of output format, so it's possible that
      some callers could considered this a regression. However,
      the original behavior was arguably a bug (due to the
      inconsistency with commits), likely nobody was relying on it
      (even we do not use it ourselves these days), and anyone
      relying on the "-p" pretty-printer should be able to expect
      a change in the output format (i.e., while "cat-file" is
      plumbing, the output format of "-p" was never guaranteed to
      be stable).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9cfa5126
  11. 16 4月, 2013 11 次提交
  12. 15 4月, 2013 5 次提交
    • N
      checkout: add --ignore-skip-worktree-bits in sparse checkout mode · 08d595dc
      Nguyễn Thái Ngọc Duy 提交于
      "git checkout -- <paths>" is usually used to restore all modified
      files in <paths>. In sparse checkout mode, this command is overloaded
      with another meaning: to add back all files in <paths> that are
      excluded by sparse patterns.
      
      As the former makes more sense for day-to-day use. Switch it to the
      default and the latter enabled with --ignore-skip-worktree-bits.
      
      While at there, add info/sparse-checkout to gitrepository-layout.txt
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      08d595dc
    • J
      t/test-lib.sh: drop "$test" variable · 002d4ce8
      Jeff King 提交于
      The $test variable is used as an interim buffer for
      constructing $TRASH_DIRECTORY, and is almost compatible with
      it (the exception being that $test has not been converted to
      an absolute path). Let's get rid of it entirely so that
      later code does not accidentally use it, thinking the two
      are interchangeable.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      002d4ce8
    • J
      t/test-lib.sh: fix TRASH_DIRECTORY handling · 38b074de
      John Keeping 提交于
      After the location of $TRASH_DIRECTORY is adjusted by
      $TEST_OUTPUT_DIRECTORY, we go on to use the $test variable to make the
      trash directory and cd into it.  This means that when
      $TEST_OUTPUT_DIRECTORY is not "." and an absolute --root has not been
      specified, we do not remove the trash directory once the tests are
      complete (remove_trash is set to $TRASH_DIRECTORY).
      
      Fix this by always referring to the trash directory as $TRASH_DIRECTORY.
      Signed-off-by: NJohn Keeping <john@keeping.me.uk>
      Acked-by: NJeff King <peff@peff.net>
      Acked-by: NThomas Rast <trast@inf.ethz.ch>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      38b074de
    • F
      completion: get rid of compgen · 7d13e0a3
      Felipe Contreras 提交于
      The functionality we use from compgen is not much, we can do the same
      manually, with drastic improvements in speed, especially when dealing
      with only a few words.
      
      This patch also has the sideffect that brekage reported by Jeroen Meijer
      and SZEDER Gábor gets fixed because we no longer expand the resulting
      words.
      
      Here are some numbers filtering N amount of words:
      
        == 1 ==
        original: 0.002s
        new: 0.000s
        == 10 ==
        original: 0.002s
        new: 0.000s
        == 100 ==
        original: 0.003s
        new: 0.002s
        == 1000 ==
        original: 0.012s
        new: 0.011s
        == 10000 ==
        original: 0.056s
        new: 0.066s
        == 100000 ==
        original: 2.669s
        new: 0.622s
      
      If the results are not narrowed:
      
        == 1 ==
        original: 0.002s
        new: 0.000s
        == 10 ==
        original: 0.002s
        new: 0.001s
        == 100 ==
        original: 0.004s
        new: 0.004s
        == 1000 ==
        original: 0.020s
        new: 0.015s
        == 10000 ==
        original: 0.101s
        new: 0.355s
        == 100000 ==
        original: 2.850s
        new: 31.941s
      
      So, unless 'git checkout <tab>' usually gives you more than 10000
      results, you'll get an improvement :)
      
      Other possible solutions perform better after 1000 words, but worst if
      less than that:
      
        COMPREPLY=($(awk -v cur="$3" -v pre="$2" -v suf="$4"
      	'$0 ~ cur { print pre$0suf }' <<< "$1" ))
      
        COMPREPLY=($(printf -- "$2%s$4\n" $1 | grep "^$2$3"))
      Signed-off-by: NFelipe Contreras <felipe.contreras@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7d13e0a3
    • F
      completion: add __gitcomp_nl tests · 43369a22
      Felipe Contreras 提交于
      Original patch by SZEDER Gábor.
      Signed-off-by: NFelipe Contreras <felipe.contreras@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      43369a22
  13. 14 4月, 2013 1 次提交
    • J
      doc/http-backend: match query-string in apache half-auth example · b0808819
      Jeff King 提交于
      When setting up a "half-auth" repository in which reads can
      be done anonymously but writes require authentication, it is
      best if the server can require authentication for both the
      ref advertisement and the actual receive-pack POSTs. This
      alleviates the need for the admin to set http.receivepack in
      the repositories, and means that the client is challenged
      for credentials immediately, instead of partway through the
      push process (and git clients older than v1.7.11.7 had
      trouble handling these challenges).
      
      Since detecting a push during the ref advertisement requires
      matching the query string, and this is non-trivial to do in
      Apache, we have traditionally punted and instructed users to
      just protect "/git-receive-pack$".  This patch provides the
      mod_rewrite recipe to actually match the ref advertisement,
      which is preferred.
      
      While we're at it, let's add the recipe to our test scripts
      so that we can be sure that it works, and doesn't get broken
      (either by our changes or by changes in Apache).
      Signed-off-by: NJeff King <peff@peff.net>
      Acked-by: NJakub Narębski <jnareb@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b0808819