1. 01 4月, 2014 2 次提交
  2. 19 3月, 2014 14 次提交
    • J
      Git 1.9.1 · cee0c275
      Junio C Hamano 提交于
      The version numbering scheme has changed since Git 1.9 and we
      dropped the third dewey-decimal from the traditional numbering
      (e.g. both 1.8.4 and 1.8.5 were major feature releases).  This
      release 1.9.1 is the first maintenance relase for Git 1.9.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cee0c275
    • J
      Merge branch 'jk/clean-d-pathspec' into maint · 9526473f
      Junio C Hamano 提交于
      "git clean -d pathspec" did not use the given pathspec correctly
      and ended up cleaning too much.
      
      * jk/clean-d-pathspec:
        clean: simplify dir/not-dir logic
        clean: respect pathspecs with "-d"
      9526473f
    • J
      Merge branch 'da/difftool-git-files' into maint · 01e13d02
      Junio C Hamano 提交于
      "git difftool" misbehaved when the repository is bound to the
      working tree with the ".git file" mechanism, where a textual file
      ".git" tells us where it is.
      
      * da/difftool-git-files:
        t7800: add a difftool test for .git-files
        difftool: support repositories with .git-files
      01e13d02
    • J
      Merge branch 'jk/remote-pushremote-config-reading' into maint · 4097a254
      Junio C Hamano 提交于
      "git push" did not pay attention to branch.*.pushremote if it is
      defined earlier than remote.pushdefault; the order of these two
      variables in the configuration file should not matter, but it did by
      mistake.
      
      * jk/remote-pushremote-config-reading:
        remote: handle pushremote config in any order
      4097a254
    • J
      Merge branch 'jk/commit-dates-parsing-fix' into maint · 8aac6c97
      Junio C Hamano 提交于
      Codepaths that parse timestamps in commit objects have been
      tightened.
      
      * jk/commit-dates-parsing-fix:
        show_ident_date: fix tz range check
        log: do not segfault on gmtime errors
        log: handle integer overflow in timestamps
        date: check date overflow against time_t
        fsck: report integer overflow in author timestamps
        t4212: test bogus timestamps with git-log
      8aac6c97
    • J
      Merge branch 'tr/diff-submodule-no-reuse-worktree' into maint · a5aca6e8
      Junio C Hamano 提交于
      "git diff --external-diff" incorrectly fed the submodule directory
      in the working tree to the external diff driver when it knew it is
      the same as one of the versions being compared.
      
      * tr/diff-submodule-no-reuse-worktree:
        diff: do not reuse_worktree_file for submodules
      a5aca6e8
    • J
      Merge branch 'nd/reset-setup-worktree' into maint · 1f569775
      Junio C Hamano 提交于
      "git reset" needs to refresh the index when working in a working
      tree (it can also be used to match the index to the HEAD in an
      otherwise bare repository), but it failed to set up the working
      tree properly, causing GIT_WORK_TREE to be ignored.
      
      * nd/reset-setup-worktree:
        reset: optionally setup worktree and refresh index on --mixed
      1f569775
    • J
      Merge branch 'jc/check-attr-honor-working-tree' into maint · a8b31316
      Junio C Hamano 提交于
      "git check-attr" when working on a repository with a working tree
      did not work well when the working tree was specified via the
      --work-tree (and obviously with --git-dir) option.
      
      * jc/check-attr-honor-working-tree:
        check-attr: move to the top of working tree when in non-bare repository
        t0003: do not chdir the whole test process
      a8b31316
    • J
      Merge branch 'bk/refresh-missing-ok-in-merge-recursive' into maint · 6d011b8e
      Junio C Hamano 提交于
      "merge-recursive" was broken in 1.7.7 era and stopped working in an
      empty (temporary) working tree, when there are renames involved.
      This has been corrected.
      
      * bk/refresh-missing-ok-in-merge-recursive:
        merge-recursive.c: tolerate missing files while refreshing index
        read-cache.c: extend make_cache_entry refresh flag with options
        read-cache.c: refactor --ignore-missing implementation
        t3030-merge-recursive: test known breakage with empty work tree
      6d011b8e
    • J
      Merge branch 'ds/rev-parse-required-args' into maint · c7b31732
      Junio C Hamano 提交于
      "git rev-parse" was loose in rejecting command line arguments that
      do not make sense, e.g. "--default" without the required value for
      that option.
      
      * ds/rev-parse-required-args:
        rev-parse: check i before using argv[i] against argc
      c7b31732
    • J
      Merge branch 'jk/config-path-include-fix' into maint · 6f016677
      Junio C Hamano 提交于
      include.path variable (or any variable that expects a path that can
      use ~username expansion) in the configuration file is not a boolean,
      but the code failed to check it.
      
      * jk/config-path-include-fix:
        handle_path_include: don't look at NULL value
        expand_user_path: do not look at NULL path
      6f016677
    • J
      Merge branch 'nd/diff-quiet-stat-dirty' into maint · 34120a5f
      Junio C Hamano 提交于
      "git diff --quiet -- pathspec1 pathspec2" sometimes did not return
      correct status value.
      
      * nd/diff-quiet-stat-dirty:
        diff: do not quit early on stat-dirty files
        diff.c: move diffcore_skip_stat_unmatch core logic out for reuse later
      34120a5f
    • J
      Merge branch 'nd/http-fetch-shallow-fix' into maint · 1030d4c8
      Junio C Hamano 提交于
      Attempting to deepen a shallow repository by fetching over smart
      HTTP transport failed in the protocol exchange, when no-done
      extension was used.  The fetching side waited for the list of
      shallow boundary commits after the sending end stopped talking to
      it.
      
      * nd/http-fetch-shallow-fix:
        t5537: move http tests out to t5539
        fetch-pack: fix deepen shallow over smart http with no-done cap
        protocol-capabilities.txt: document no-done
        protocol-capabilities.txt: refer multi_ack_detailed back to pack-protocol.txt
        pack-protocol.txt: clarify 'obj-id' in the last ACK after 'done'
        test: rename http fetch and push test files
        tests: auto-set LIB_HTTPD_PORT from test name
      1030d4c8
    • J
      Merge branch 'nd/submodule-pathspec-ending-with-slash' into maint · 6a0556e4
      Junio C Hamano 提交于
      Allow "git cmd path/", when the 'path' is where a submodule is
      bound to the top-level working tree, to match 'path', despite the
      extra and unnecessary trailing slash (such a slash is often
      given by command line completion).
      
      * nd/submodule-pathspec-ending-with-slash:
        clean: use cache_name_is_other()
        clean: replace match_pathspec() with dir_path_match()
        pathspec: pass directory indicator to match_pathspec_item()
        match_pathspec: match pathspec "foo/" against directory "foo"
        dir.c: prepare match_pathspec_item for taking more flags
        pathspec: rename match_pathspec_depth() to match_pathspec()
        pathspec: convert some match_pathspec_depth() to dir_path_match()
        pathspec: convert some match_pathspec_depth() to ce_path_match()
      6a0556e4
  3. 12 3月, 2014 2 次提交
    • J
      clean: simplify dir/not-dir logic · 1f2e1088
      Jeff King 提交于
      When we get a list of paths from read_directory, we further
      prune it to create the final list of items to remove. The
      code paths for directories and non-directories repeat the
      same "add to list" code.
      
      This patch restructures the code so that we don't repeat
      ourselves. Also, by following a "if (condition) continue"
      pattern like the pathspec check above, it makes it more
      obvious that the conditional is about excluding directories
      under certain circumstances.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1f2e1088
    • J
      clean: respect pathspecs with "-d" · cf424f5f
      Jeff King 提交于
      git-clean uses read_directory to fill in a `struct dir` with
      potential hits. However, read_directory does not actually
      check against our pathspec. It uses a simplified version
      that may turn up false positives. As a result, we need to
      check that any hits match our pathspec. We do so reliably
      for non-directories. For directories, if "-d" is not given
      we check that the pathspec matched exactly (i.e., we are
      even stricter, and require an explicit "git clean foo" to
      clean "foo/"). But if "-d" is given, rather than relaxing
      the exact match to allow a recursive match, we do not check
      the pathspec at all.
      
      This regression was introduced in 113f10f2 (Make git-clean a
      builtin, 2007-11-11).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cf424f5f
  4. 08 3月, 2014 1 次提交
    • J
      show_ident_date: fix tz range check · 3f419d45
      Jeff King 提交于
      Commit 1dca155f (log: handle integer overflow in
      timestamps, 2014-02-24) tried to catch integer overflow
      coming from strtol() on the timezone field by comparing against
      LONG_MIN/LONG_MAX. However, the intermediate "tz" variable
      is an "int", which means it can never be LONG_MAX on LP64
      systems; we would truncate the output from strtol before the
      comparison.
      
      Clang's -Wtautological-constant-out-of-range-compare notices
      this and rightly complains.
      
      Let's instead store the result of strtol in a long, and then
      compare it against INT_MIN/INT_MAX. This will catch overflow
      from strtol, and also overflow when we pass the result as an
      int to show_date.
      Reported-by: NEric Sunshine <sunshine@sunshineco.com>
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3f419d45
  5. 06 3月, 2014 1 次提交
  6. 05 3月, 2014 1 次提交
  7. 25 2月, 2014 19 次提交
    • N
      diff: do not quit early on stat-dirty files · f34b205f
      Nguyễn Thái Ngọc Duy 提交于
      When QUICK is set (i.e. with --quiet) we try to do as little work as
      possible, stopping after seeing the first change. stat-dirty is
      considered a "change" but it may turn out not, if no actual content is
      changed. The actual content test is performed too late in the process
      and the shortcut may be taken prematurely, leading to incorrect return
      code.
      
      Assume we do "git diff --quiet". If we have a stat-dirty file "a" and
      a really dirty file "b". We break the loop in run_diff_files() and
      stop after "a" because we have got a "change". Later in
      diffcore_skip_stat_unmatch() we find out "a" is actually not
      changed. But there's nothing else in the diff queue, we incorrectly
      declare "no change", ignoring the fact that "b" is changed.
      
      This also happens to "git diff --quiet HEAD" when it hits
      diff_can_quit_early() in oneway_diff().
      
      This patch does the content test earlier in order to keep going if "a"
      is unchanged. The test result is cached so that when
      diffcore_skip_stat_unmatch() is done in the end, we spend no cycles on
      re-testing "a".
      Reported-by: NIWAMOTO Toshihiro <iwamoto@valinux.co.jp>
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f34b205f
    • N
    • N
      clean: use cache_name_is_other() · 2e70c017
      Nguyễn Thái Ngọc Duy 提交于
      cmd_clean() has the exact same code of index_name_is_other(). Reduce
      code duplication.
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2e70c017
    • N
      clean: replace match_pathspec() with dir_path_match() · 05b85022
      Nguyễn Thái Ngọc Duy 提交于
      This instance was left out when many match_pathspec() call sites that
      take input from dir_entry were converted to dir_path_match() because
      it passed a path with the trailing slash stripped out to match_pathspec()
      while the others did not. Stripping for all call sites back then would
      be a regression because match_pathspec() did not know how to match
      pathspec foo/ against _directory_ foo (the stripped version of path
      "foo/").
      
      match_pathspec() knows how to do it now. And dir_path_match() strips
      the trailing slash also. Use the new function, because the stripping
      code is removed in the next patch.
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      05b85022
    • N
      pathspec: pass directory indicator to match_pathspec_item() · ae8d0824
      Nguyễn Thái Ngọc Duy 提交于
      This patch activates the DO_MATCH_DIRECTORY code in m_p_i(), which
      makes "git diff HEAD submodule/" and "git diff HEAD submodule" produce
      the same output. Previously only the version without trailing slash
      returns the difference (if any).
      
      That's the effect of new ce_path_match(). dir_path_match() is not
      executed by the new tests. And it should not introduce regressions.
      
      Previously if path "dir/" is passed in with pathspec "dir/", they
      obviously match. With new dir_path_match(), the path becomes
      _directory_ "dir" vs pathspec "dir/", which is not executed by the old
      code path in m_p_i(). The new code path is executed and produces the
      same result.
      
      The other case is pathspec "dir" and path "dir/" is now turned to
      "dir" (with DO_MATCH_DIRECTORY). Still the same result before or after
      the patch.
      
      So why change? Because of the next patch about clean.c.
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ae8d0824
    • N
      match_pathspec: match pathspec "foo/" against directory "foo" · 68690fdd
      Nguyễn Thái Ngọc Duy 提交于
      Currently we do support matching pathspec "foo/" against directory
      "foo". That is because match_pathspec() has no way to tell "foo" is a
      directory and matching "foo/" against _file_ "foo" is wrong.
      
      The callers can now tell match_pathspec if "foo" is a directory, we
      could make an exception for this case. Code is not executed though
      because no callers pass the flag yet.
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      68690fdd
    • N
    • N
      pathspec: rename match_pathspec_depth() to match_pathspec() · 854b0959
      Nguyễn Thái Ngọc Duy 提交于
      A long time ago, for some reason I was not happy with
      match_pathspec(). I created a better version, match_pathspec_depth()
      that was suppose to replace match_pathspec()
      eventually. match_pathspec() has finally been gone since 6 months
      ago. Use the shorter name for match_pathspec_depth().
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      854b0959
    • N
      pathspec: convert some match_pathspec_depth() to dir_path_match() · ebb32893
      Nguyễn Thái Ngọc Duy 提交于
      This helps reduce the number of match_pathspec_depth() call sites and
      show how m_p_d() is used. And it usage is:
      
       - match against an index entry (ce_path_match or match_pathspec_depth
         in ls-files)
      
       - match against a dir_entry from read_directory (dir_path_match and
         match_pathspec_depth in clean.c, which will be converted later)
      
       - resolve-undo (rerere.c and ls-files.c)
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ebb32893
    • N
      pathspec: convert some match_pathspec_depth() to ce_path_match() · 429bb40a
      Nguyễn Thái Ngọc Duy 提交于
      This helps reduce the number of match_pathspec_depth() call sites and
      show how match_pathspec_depth() is used.
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      429bb40a
    • B
      merge-recursive.c: tolerate missing files while refreshing index · 6e2068ae
      Brad King 提交于
      Teach add_cacheinfo to tell make_cache_entry to skip refreshing stat
      information when a file is missing from the work tree.  We do not want
      the index to be stat-dirty after the merge but also do not want to fail
      when a file happens to be missing.
      
      This fixes the 'merge-recursive w/ empty work tree - ours has rename'
      case in t3030-merge-recursive.
      Suggested-by: NElijah Newren <newren@gmail.com>
      Signed-off-by: NBrad King <brad.king@kitware.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6e2068ae
    • B
      read-cache.c: extend make_cache_entry refresh flag with options · 25762726
      Brad King 提交于
      Convert the make_cache_entry boolean 'refresh' argument to a more
      general 'refresh_options' argument.  Pass the value through to the
      underlying refresh_cache_ent call.  Add option CE_MATCH_REFRESH to
      enable stat refresh.  Update call sites to use the new signature.
      Signed-off-by: NBrad King <brad.king@kitware.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      25762726
    • B
      read-cache.c: refactor --ignore-missing implementation · 2e2e7ec1
      Brad King 提交于
      Move lstat ENOENT handling from refresh_index to refresh_cache_ent and
      activate it with a new CE_MATCH_IGNORE_MISSING option.  This will allow
      other call paths into refresh_cache_ent to use the feature.
      Signed-off-by: NBrad King <brad.king@kitware.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2e2e7ec1
    • B
      t3030-merge-recursive: test known breakage with empty work tree · 29d9af58
      Brad King 提交于
      Sometimes when working with a large repository it can be useful to try
      out a merge and only check out conflicting files to disk (for example as
      a speed optimization on a server).  Until v1.7.7-rc1~28^2~20
      (merge-recursive: When we detect we can skip an update, actually skip
      it, 2011-08-11), it was possible to do so with the following idiom:
      
      	# Prepare a temporary index and empty work tree.
      	GIT_INDEX_FILE="$PWD/tmp-$$-index" &&
      	export GIT_INDEX_FILE &&
      	GIT_WORK_TREE="$PWD/tmp-$$-work" &&
      	export GIT_WORK_TREE &&
      	mkdir "$GIT_WORK_TREE" &&
      
      	# Convince the index that our side is on disk.
      	git read-tree -i -m $ours &&
      	git update-index --ignore-missing --refresh &&
      
      	# Merge their side into our side.
      	bases=$(git merge-base --all $ours $theirs) &&
      	git merge-recursive $bases -- $ours $theirs &&
      	tree=$(git write-tree)
      
      Nowadays, that still works and the exit status is the same, but
      merge-recursive produces a diagnostic if "our" side renamed a file:
      
      	error: addinfo_cache failed for path 'dst'
      
      Add a test to document this regression.
      Signed-off-by: NBrad King <brad.king@kitware.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      29d9af58
    • J
      remote: handle pushremote config in any order · 98b406f3
      Jeff King 提交于
      The remote we push can be defined either by
      remote.pushdefault or by branch.*.pushremote for the current
      branch. The order in which they appear in the config file
      should not matter to precedence (which should be to prefer
      the branch-specific config).
      
      The current code parses the config linearly and uses a
      single string to store both values, overwriting any
      previous value. Thus, config like:
      
        [branch "master"]
        pushremote = foo
        [remote]
        pushdefault = bar
      
      erroneously ends up pushing to "bar" from the master branch.
      
      We can fix this by storing both values and resolving the
      correct value after all config is read.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      98b406f3
    • J
      log: do not segfault on gmtime errors · 2b15846d
      Jeff King 提交于
      Many code paths assume that show_date and show_ident_date
      cannot return NULL. For the most part, we handle missing or
      corrupt timestamps by showing the epoch time t=0.
      
      However, we might still return NULL if gmtime rejects the
      time_t we feed it, resulting in a segfault. Let's catch this
      case and just format t=0.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2b15846d
    • J
      log: handle integer overflow in timestamps · 1dca155f
      Jeff King 提交于
      If an ident line has a ridiculous date value like (2^64)+1,
      we currently just pass ULONG_MAX along to the date code,
      which can produce nonsensical dates.
      
      On systems with a signed long time_t (e.g., 64-bit glibc
      systems), this actually doesn't end up too bad. The
      ULONG_MAX is converted to -1, we apply the timezone field to
      that, and the result ends up somewhere between Dec 31, 1969
      and Jan 1, 1970.
      
      However, there is still a few good reasons to detect the
      overflow explicitly:
      
        1. On systems where "unsigned long" is smaller than
           time_t, we get a nonsensical date in the future.
      
        2. Even where it would produce "Dec 31, 1969", it's easier
           to recognize "midnight Jan 1" as a consistent sentinel
           value for "we could not parse this".
      
        3.  Values which do not overflow strtoul but do overflow a
            signed time_t produce nonsensical values in the past.
            For example, on a 64-bit system with a signed long
            time_t, a timestamp of 18446744073000000000 produces a
            date in 1947.
      
      We also recognize overflow in the timezone field, which
      could produce nonsensical results. In this case we show the
      parsed date, but in UTC.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1dca155f
    • J
      date: check date overflow against time_t · 7ca36d93
      Jeff King 提交于
      When we check whether a timestamp has overflowed, we check
      only against ULONG_MAX, meaning that strtoul has overflowed.
      However, we also feed these timestamps to system functions
      like gmtime, which expect a time_t. On many systems, time_t
      is actually smaller than "unsigned long" (e.g., because it
      is signed), and we would overflow when using these
      functions.  We don't know the actual size or signedness of
      time_t, but we can easily check for truncation with a simple
      assignment.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7ca36d93
    • J
      fsck: report integer overflow in author timestamps · d4b8de04
      Jeff King 提交于
      When we check commit objects, we complain if commit->date is
      ULONG_MAX, which is an indication that we saw integer
      overflow when parsing it. However, we do not do any check at
      all for author lines, which also contain a timestamp.
      
      Let's actually check the timestamps on each ident line
      with strtoul. This catches both author and committer lines,
      and we can get rid of the now-redundant commit->date check.
      
      Note that like the existing check, we compare only against
      ULONG_MAX. Now that we are calling strtoul at the site of
      the check, we could be slightly more careful and also check
      that errno is set to ERANGE. However, this will make further
      refactoring in future patches a little harder, and it
      doesn't really matter in practice.
      
      For 32-bit systems, one would have to create a commit at the
      exact wrong second in 2038. But by the time we get close to
      that, all systems will hopefully have moved to 64-bit (and
      if they haven't, they have a real problem one second later).
      
      For 64-bit systems, by the time we get close to ULONG_MAX,
      all systems will hopefully have been consumed in the fiery
      wrath of our expanding Sun.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d4b8de04