1. 17 2月, 2010 1 次提交
  2. 27 1月, 2010 1 次提交
    • J
      approxidate_careful() reports errorneous date string · 93cfa7c7
      Junio C Hamano 提交于
      For a long time, the time based reflog syntax (e.g. master@{yesterday})
      didn't complain when the "human readable" timestamp was misspelled, as
      the underlying mechanism tried to be as lenient as possible.  The funny
      thing was that parsing of "@{now}" even relied on the fact that anything
      not recognized by the machinery returned the current timestamp.
      
      Introduce approxidate_careful() that takes an optional pointer to an
      integer, that gets assigned 1 when the input does not make sense as a
      timestamp.
      
      As I am too lazy to fix all the callers that use approxidate(), most of
      the callers do not take advantage of the error checking, but convert the
      code to parse reflog to use it as a demonstration.
      
      Tests are mostly from Jeff King.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      93cfa7c7
  3. 21 11月, 2009 1 次提交
  4. 18 11月, 2009 1 次提交
  5. 16 11月, 2009 1 次提交
  6. 14 11月, 2009 2 次提交
    • J
      Teach git var about GIT_PAGER · 63618245
      Jonathan Nieder 提交于
      Expose the command found by setup_pager() for scripts to use.
      Scripts can use this to avoid repeating the logic to look for a
      proper pager in each command.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      63618245
    • J
      Teach git var about GIT_EDITOR · 44fcb497
      Jonathan Nieder 提交于
      Expose the command used by launch_editor() for scripts to use.
      This should allow one to avoid searching for a proper editor
      separately in each command.
      
      git_editor(void) uses the logic to decide which editor to use
      that used to live in launch_editor().  The function returns NULL
      if there is no suitable editor; the caller is expected to issue
      an error message when appropriate.
      
      launch_editor() uses git_editor() and gives the error message the
      same way as before when EDITOR is not set.
      
      "git var GIT_EDITOR" gives the editor name, or an error message
      when there is no appropriate one.
      
      "git var -l" gives GIT_EDITOR=name only if there is an
      appropriate editor.
      Originally-submitted-by: NJohannes Sixt <j6t@kdbg.org>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      44fcb497
  7. 10 11月, 2009 1 次提交
    • S
      http-backend: Protect GIT_PROJECT_ROOT from /../ requests · 34b6cb8b
      Shawn O. Pearce 提交于
      Eons ago HPA taught git-daemon how to protect itself from /../
      attacks, which Junio brought back into service in d79374c7
      ("daemon.c and path.enter_repo(): revamp path validation").
      
      I did not carry this into git-http-backend as originally we relied
      only upon PATH_TRANSLATED, and assumed the HTTP server had done
      its access control checks to validate the resolved path was within
      a directory permitting access from the remote client.  This would
      usually be sufficient to protect a server from requests for its
      /etc/passwd file by http://host/smart/../etc/passwd sorts of URLs.
      
      However in 917adc03 Mark Lodato added GIT_PROJECT_ROOT as an
      additional method of configuring the CGI.  When this environment
      variable is used the web server does not generate the final access
      path and therefore may blindly pass through "/../etc/passwd"
      in PATH_INFO under the assumption that "/../" might have special
      meaning to the invoked CGI.
      
      Instead of permitting these sorts of malformed path requests, we
      now reject them back at the client, with an error message for the
      server log.  This matches git-daemon behavior.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      34b6cb8b
  8. 31 10月, 2009 1 次提交
  9. 20 10月, 2009 1 次提交
    • J
      Introduce commit notes · a97a7468
      Johannes Schindelin 提交于
      Commit notes are blobs which are shown together with the commit
      message.  These blobs are taken from the notes ref, which you can
      configure by the config variable core.notesRef, which in turn can
      be overridden by the environment variable GIT_NOTES_REF.
      
      The notes ref is a branch which contains "files" whose names are
      the names of the corresponding commits (i.e. the SHA-1).
      
      The rationale for putting this information into a ref is this: we
      want to be able to fetch and possibly union-merge the notes,
      maybe even look at the date when a note was introduced, and we
      want to store them efficiently together with the other objects.
      
      This patch has been improved by the following contributions:
      - Thomas Rast: fix core.notesRef documentation
      - Tor Arne Vestbø: fix printing of multi-line notes
      - Alex Riesen: Using char array instead of char pointer costs less BSS
      - Johan Herland: Plug leak when msg is good, but msglen or type causes return
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NThomas Rast <trast@student.ethz.ch>
      Signed-off-by: NTor Arne Vestbø <tavestbo@trolltech.com>
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      
      get_commit_notes(): Plug memory leak when 'if' triggers, but not because of read_sha1_file() failure
      a97a7468
  10. 18 10月, 2009 1 次提交
  11. 29 9月, 2009 1 次提交
  12. 13 9月, 2009 2 次提交
    • C
      preserve mtime of local clone · f7835a25
      Clemens Buchacher 提交于
      A local clone without hardlinks copies all objects, including dangling
      ones, to the new repository. Since the mtimes are renewed, those
      dangling objects cannot be pruned by "git gc --prune", even if they
      would have been old enough for pruning in the original repository.
      
      Instead, preserve mtime during copy. "git gc --prune" will then work
      in the clone just like it did in the original.
      Signed-off-by: NClemens Buchacher <drizzd@aon.at>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f7835a25
    • 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
  13. 12 9月, 2009 1 次提交
    • J
      push: make non-fast-forward help message configurable · 75194438
      Jeff King 提交于
      This message is designed to help new users understand what
      has happened when refs fail to push. However, it does not
      help experienced users at all, and significantly clutters
      the output, frequently dwarfing the regular status table and
      making it harder to see.
      
      This patch introduces a general configuration mechanism for
      optional messages, with this push message as the first
      example.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      75194438
  14. 06 9月, 2009 1 次提交
    • J
      core.whitespace: split trailing-space into blank-at-{eol,eof} · aeb84b05
      Junio C Hamano 提交于
      People who configured trailing-space depended on it to catch both extra
      white space at the end of line, and extra blank lines at the end of file.
      Earlier attempt to introduce only blank-at-eof gave them an escape hatch
      to keep the old behaviour, but it is a regression until they explicitly
      specify the new error class.
      
      This introduces a blank-at-eol that only catches extra white space at the
      end of line, and makes the traditional trailing-space a convenient synonym
      to catch both blank-at-eol and blank-at-eof.  This way, people who used
      trailing-space continue to catch both classes of errors.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      aeb84b05
  15. 05 9月, 2009 1 次提交
    • J
      apply --whitespace=warn/error: diagnose blank at EOF · 77b15bbd
      Junio C Hamano 提交于
      "git apply" strips new blank lines at EOF under --whitespace=fix option,
      but neigher --whitespace=warn nor --whitespace=error paid any attention to
      these errors.
      
      Introduce a new whitespace error class, blank-at-eof, to make the
      whitespace error handling more consistent.
      
      The patch adds a new "linenr" field to the struct fragment in order to
      record which line the hunk started in the input file, but this is needed
      solely for reporting purposes.  The detection of this class of whitespace
      errors cannot be done while parsing a patch like we do for all the other
      classes of whitespace errors.  It instead has to wait until we find where
      to apply the hunk, but at that point, we do not have an access to the
      original line number in the input file anymore, hence the new field.
      
      Depending on your point of view, this may be a bugfix that makes warn and
      error in line with fix.  Or you could call it a new feature.  The line
      between them is somewhat fuzzy in this case.
      
      Strictly speaking, triggering more errors than before is a change in
      behaviour that is not backward compatible, even though the reason for the
      change is because the code was not checking for an error that it should
      have.  People who do not want added blank lines at EOF to trigger an error
      can disable the new error class.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      77b15bbd
  16. 31 8月, 2009 1 次提交
  17. 22 8月, 2009 2 次提交
  18. 18 8月, 2009 1 次提交
    • J
      check_path(): allow symlinked directories to checkout-index --prefix · da02ca50
      Junio C Hamano 提交于
      Merlyn noticed that Documentation/install-doc-quick.sh no longer correctly
      removes old installed documents when the target directory has a leading
      path that is a symlink.  It turns out that "checkout-index --prefix" was
      broken by recent b6986d8a (git-checkout: be careful about untracked
      symlinks, 2009-07-29).
      
      I suspect has_symlink_leading_path() could learn the third parameter
      (prefix that is allowed to be symlinked directories) to allow us to retire
      a similar function has_dirs_only_path().
      
      Another avenue of fixing this I considered was to get rid of base_dir and
      base_dir_len from "struct checkout", and instead make "git checkout-index"
      when run with --prefix mkdir the leading path and chdir in there.  It
      might be the best longer term solution to this issue, as the base_dir
      feature is used only by that rather obscure codepath as far as I know.
      
      But at least this patch should fix this breakage.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      da02ca50
  19. 06 8月, 2009 1 次提交
  20. 30 7月, 2009 1 次提交
  21. 25 7月, 2009 1 次提交
    • J
      git repack: keep commits hidden by a graft · 7f3140cd
      Johannes Schindelin 提交于
      When you have grafts that pretend that a given commit has different
      parents than the ones recorded in the commit object, it is dangerous
      to let 'git repack' remove those hidden parents, as you can easily
      remove the graft and end up with a broken repository.
      
      So let's play it safe and keep those parent objects and everything
      that is reachable by them, in addition to the grafted parents.
      
      As this behavior can only be triggered by git pack-objects, and as that
      command handles duplicate parents gracefully, we do not bother to cull
      duplicated parents that may result by using both true and grafted
      parents.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7f3140cd
  22. 19 7月, 2009 1 次提交
  23. 10 7月, 2009 1 次提交
  24. 01 6月, 2009 3 次提交
  25. 02 5月, 2009 1 次提交
  26. 30 4月, 2009 1 次提交
  27. 26 4月, 2009 1 次提交
  28. 28 3月, 2009 1 次提交
    • J
      set_shared_perm(): sometimes we know what the final mode bits should look like · 17e61b82
      Junio C Hamano 提交于
      adjust_shared_perm() first obtains the mode bits from lstat(2), expecting
      to find what the result of applying user's umask is, and then tweaks it
      as necessary.  When the file to be adjusted is created with mkstemp(3),
      however, the mode thusly obtained does not have anything to do with user's
      umask, and we would need to start from 0444 in such a case and there is no
      point running lstat(2) for such a path.
      
      This introduces a new API set_shared_perm() to bypass the lstat(2) and
      instead force setting the mode bits to the desired value directly.
      adjust_shared_perm() becomes a thin wrapper to the function.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      17e61b82
  29. 23 3月, 2009 1 次提交
    • J
      Rename interpret/substitute nth_last_branch functions · 431b1969
      Junio C Hamano 提交于
      These allow you to say "git checkout @{-2}" to switch to the branch two
      "branch switching" ago by pretending as if you typed the name of that
      branch.  As it is likely that we will be introducing more short-hands to
      write the name of a branch without writing it explicitly, rename the
      functions from "nth_last_branch" to more generic "branch_name", to prepare
      for different semantics.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      431b1969
  30. 21 3月, 2009 1 次提交
  31. 18 3月, 2009 1 次提交
    • F
      New config push.default to decide default behavior for push · 52153747
      Finn Arne Gangstad 提交于
      When "git push" is not told what refspecs to push, it pushes all matching
      branches to the current remote.  For some workflows this default is not
      useful, and surprises new users.  Some have even found that this default
      behaviour is too easy to trigger by accident with unwanted consequences.
      
      Introduce a new configuration variable "push.default" that decides what
      action git push should take if no refspecs are given or implied by the
      command line arguments or the current remote configuration.
      
      Possible values are:
      
        'nothing'  : Push nothing;
        'matching' : Current default behaviour, push all branches that already
                     exist in the current remote;
        'tracking' : Push the current branch to whatever it is tracking;
        'current'  : Push the current branch to a branch of the same name,
                     i.e. HEAD.
      Signed-off-by: NFinn Arne Gangstad <finnag@pvv.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      52153747
  32. 28 2月, 2009 4 次提交
    • J
      is_kept_pack(): final clean-up · 69e020ae
      Junio C Hamano 提交于
      Now is_kept_pack() is just a member lookup into a structure, we can write
      it as such.
      
      Also rewrite the sole caller of has_sha1_kept_pack() to switch on the
      criteria the callee uses (namely, revs->kept_pack_only) between calling
      has_sha1_kept_pack() and has_sha1_pack(), so that these two callees do not
      have to take a pointer to struct rev_info as an argument.
      
      This removes the header file dependency issue temporarily introduced by
      the earlier commit, so we revert changes associated to that as well.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      69e020ae
    • J
      Consolidate ignore_packed logic more · 386cb772
      Junio C Hamano 提交于
      This refactors three loops that check if a given packfile is on the
      ignore_packed list into a function is_kept_pack().  The function returns
      false for a pack on the list, and true for a pack not on the list, because
      this list is solely used by "git repack" to pass list of packfiles that do
      not have corresponding .keep files, i.e. a packfile not on the list is
      "kept".
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      386cb772
    • J
      has_sha1_kept_pack(): take "struct rev_info" · b8431b03
      Junio C Hamano 提交于
      Its "ignore_packed" parameter always comes from struct rev_info.  This
      patch makes the function take a pointer to the surrounding structure, so
      that the refactoring in the next patch becomes easier to review.
      
      There is an unfortunate header file dependency and the easiest workaround
      is to temporarily move the function declaration from cache.h to
      revision.h; this will be moved back to cache.h once the function loses
      this "ignore_packed" parameter altogether in the later part of the
      series.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b8431b03
    • J
      has_sha1_pack(): refactor "pretend these packs do not exist" interface · cd673c1f
      Junio C Hamano 提交于
      Most of the callers of this function except only one pass NULL to its last
      parameter, ignore_packed.
      
      Introduce has_sha1_kept_pack() function that has the function signature
      and the semantics of this function, and convert the sole caller that does
      not pass NULL to call this new function.
      
      All other callers and has_sha1_pack() lose the ignore_packed parameter.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cd673c1f