1. 02 May, 2018 1 commit
  2. 13 Nov, 2017 1 commit
  3. 10 Nov, 2017 1 commit
    • Alex Vandiver's avatar
      fsmonitor: read from getcwd(), not the PWD environment variable · 6f1dc21d
      Alex Vandiver authored
      Though the process has chdir'd to the root of the working tree, the
      PWD environment variable is only guaranteed to be updated accordingly
      if a shell is involved -- which is not guaranteed to be the case.
      That is, if `/usr/bin/perl` is a binary, $ENV{PWD} is unchanged from
      whatever spawned `git` -- if `/usr/bin/perl` is a trivial shell
      wrapper to the real `perl`, `$ENV{PWD}` will have been updated to the
      root of the working copy.
      
      Update to read from the Cwd module using the `getcwd` syscall, not the
      PWD environment variable.  The Cygwin case is left unchanged, as it
      necessarily _does_ go through a shell.
      Signed-off-by: 's avatarAlex Vandiver <alexmv@dropbox.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
      6f1dc21d
  4. 30 Oct, 2017 1 commit
    • Alex Vandiver's avatar
      fsmonitor: don't bother pretty-printing JSON from watchman · c87fbcf7
      Alex Vandiver authored
      This provides modest performance savings.  Benchmarking with the
      following program, with and without `--no-pretty`, we find savings of
      23% (0.316s -> 0.242s) in the git repository, and savings of 8% (5.24s
      -> 4.86s) on a large repository with 580k files in the working copy.
      
          #!/usr/bin/perl
      
          use strict;
          use warnings;
          use IPC::Open2;
          use JSON::XS;
      
          my $pid = open2(\*CHLD_OUT, \*CHLD_IN, "watchman -j @argv")
              or die "open2() failed: $!\n" .
              "Falling back to scanning...\n";
      
          my $query = qq|["query", "$ENV{PWD}", {}]|;
      
          print CHLD_IN $query;
          close CHLD_IN;
          my $response = do {local $/; <CHLD_OUT>};
      
          JSON::XS->new->utf8->decode($response);
      Signed-off-by: 's avatarAlex Vandiver <alexmv@dropbox.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
      c87fbcf7
  5. 04 Oct, 2017 2 commits
    • Alex Vandiver's avatar
      fsmonitor: read entirety of watchman output · 2a387b17
      Alex Vandiver authored
      In Perl, setting $/ sets the string that is used as the "record
      separator," which sets the boundary that the `<>` construct reads to.
      Setting `local $/ = 0666;` evaluates the octal, getting 438, and
      stringifies it.  Thus, the later read from `<CHLD_OUT>` stops as soon
      as it encounters the string "438" in the watchman output, yielding
      invalid JSON; repositories containing filenames with SHA1 hashes are
      able to trip this easily.
      
      Set `$/` to undefined, thus slurping all output from watchman.  Also
      close STDIN which is provided to watchman, to better guarantee that we
      cannot deadlock with watchman while both attempting to read.
      Signed-off-by: 's avatarAlex Vandiver <alexmv@dropbox.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
      2a387b17
    • Ben Peart's avatar
      fsmonitor: MINGW support for watchman integration · dcdb71f1
      Ben Peart authored
      Instead of just taking $ENV{'PWD'}, use the same logic that converts
      PWD to $git_work_tree on MSYS_NT in the watchman integration hook
      script also on MINGW.
      Signed-off-by: 's avatarBen Peart <benpeart@microsoft.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
      dcdb71f1
  6. 01 Oct, 2017 1 commit
  7. 23 Aug, 2017 1 commit
  8. 14 Aug, 2017 1 commit
  9. 12 Jul, 2017 4 commits
  10. 11 Jul, 2017 1 commit
  11. 28 Oct, 2016 1 commit
  12. 14 Jul, 2016 1 commit
    • Stefan Beller's avatar
      push options: {pre,post}-receive hook learns about push options · 77a9745d
      Stefan Beller authored
      The environment variable GIT_PUSH_OPTION_COUNT is set to the number of
      push options sent, and GIT_PUSH_OPTION_{0,1,..} is set to the transmitted
      option.
      
      The code is not executed as the push options are set to NULL, nor is the
      new capability advertised.
      
      There was some discussion back and forth how to present these push options
      to the user as there are some ways to do it:
      
      Keep all options in one environment variable
      ============================================
      + easiest way to implement in Git
      - This would make things hard to parse correctly in the hook.
      
      Put the options in files instead,
      filenames are in GIT_PUSH_OPTION_FILES
      ======================================
      + After a discussion about environment variables and shells, we may not
        want to put user data into an environment variable (see [1] for example).
      + We could transmit binaries, i.e. we're not bound to C strings as
        we are when using environment variables to the user.
      + Maybe easier to parse than constructing environment variable names
        GIT_PUSH_OPTION_{0,1,..} yourself
      - cleanup of the temporary files is hard to do reliably
      - we have race conditions with multiple clients pushing, hence we'd need
        to use mkstemp. That's not too bad, but still.
      
      Use environment variables, but restrict to key/value pairs
      ==========================================================
      (When the user pushes a push option `foo=bar`, we'd
      GIT_PUSH_OPTION_foo=bar)
      + very easy to parse for a simple model of push options
      - it's not sufficient for more elaborate models, e.g.
        it doesn't allow doubles (e.g. cc=reviewer@email)
      
      Present the options in different environment variables
      ======================================================
      (This is implemented)
      * harder to parse as a user, but we have a sample hook for that.
      - doesn't allow binary files
      + allows the same option twice, i.e. is not restrictive about
        options, except for binary files.
      + doesn't clutter a remote directory with (possibly stale)
        temporary files
      
      As we first want to focus on getting simple strings to work
      reliably, we go with the last option for now. If we want to
      do transmission of binaries later, we can just attach a
      'side-channel', e.g. "any push option that contains a '\0' is
      put into a file instead of the environment variable and we'd
      have new GIT_PUSH_OPTION_FILES, GIT_PUSH_OPTION_FILENAME_{0,1,..}
      environment variables".
      
      [1] 'Shellshock' https://lwn.net/Articles/614218/Signed-off-by: Stefan Beller's avatarStefan Beller <sbeller@google.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
      77a9745d
  13. 25 Feb, 2016 1 commit
  14. 22 Dec, 2014 1 commit
    • Jim Hill's avatar
      pre-push.sample: remove unnecessary and misleading IFS=' ' · 3af74cfb
      Jim Hill authored
      The sample hook explicitly sets IFS to SP and nothing else so that
      the "read" used in the per-ref while loop that iterates over
      "<localref> SP <localsha1> SP <remoteref> SP <remotesha>" records,
      where we know refs and sha1s will not have SPs, would split them
      correctly.
      
      While this is not wrong per-se, it is not necessary; because we know
      these fields do not contain HT or LF, either, we can simply leave
      IFS the default.
      
      This will also prevent those who cut and paste from this sample from
      getting bitten when they write things in the per-ref loop that need
      splitting with the default $IFS (e.g. use $(git rev-list ...) to
      produce one-record-per-line output).
      Signed-off-by: 's avatarJim Hill <gjthill@gmail.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
      3af74cfb
  15. 01 Dec, 2014 1 commit
  16. 11 Sep, 2014 1 commit
  17. 24 Sep, 2013 1 commit
  18. 30 Aug, 2013 1 commit
  19. 15 Jul, 2013 3 commits
  20. 11 Jun, 2013 1 commit
  21. 24 Feb, 2013 1 commit
  22. 18 Jan, 2013 1 commit
  23. 26 Oct, 2011 1 commit
  24. 27 Sep, 2011 1 commit
  25. 20 Mar, 2010 2 commits
  26. 07 Nov, 2009 1 commit
  27. 31 Oct, 2009 1 commit
  28. 30 Oct, 2009 1 commit
  29. 24 Oct, 2009 1 commit
  30. 29 Sep, 2009 1 commit
  31. 22 Sep, 2009 1 commit
  32. 20 May, 2009 1 commit
  33. 16 May, 2009 1 commit