1. 22 Feb, 2019 1 commit
  2. 14 Jan, 2019 2 commits
  3. 13 Nov, 2018 1 commit
  4. 12 Nov, 2018 2 commits
  5. 04 Oct, 2018 1 commit
    • Stephen P. Smith's avatar
      roll wt_status_state into wt_status and populate in the collect phase · 73ba5d78
      Stephen P. Smith authored
      Status variables were initialized in the collect phase and some
      variables were later freed in the print functions.
      A "struct wt_status" used to be sufficient for the output phase to
      work.  It was designed to be filled in the collect phase and consumed
      in the output phase, but over time some fields were added and output
      phase started filling the fields.
      A "struct wt_status_state" that was used in other codepaths turned out
      to be useful in the "git status" output.  This is not tied to "struct
      wt_status", so filling in the collect phase was not consistently
      Move the status state structure variables into the status state
      structure and populate them in the collect functions.
      Create a new function to free the buffers that were being freed in the
      print function.  Call this new function in commit.c where both the
      collect and print functions were being called.
      Based on a patch suggestion by Junio C Hamano. [1]
      [1] https://public-inbox.org/git/xmqqr2i5ueg4.fsf@gitster-ct.c.googlers.com/Signed-off-by: 's avatarStephen P. Smith <ischis2@cox.net>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  6. 21 Sep, 2018 1 commit
  7. 07 Sep, 2018 3 commits
  8. 29 Aug, 2018 1 commit
    • Jeff King's avatar
      convert "oidcmp() == 0" to oideq() · 4a7e27e9
      Jeff King authored
      Using the more restrictive oideq() should, in the long run,
      give the compiler more opportunities to optimize these
      callsites. For now, this conversion should be a complete
      noop with respect to the generated code.
      The result is also perhaps a little more readable, as it
      avoids the "zero is equal" idiom. Since it's so prevalent in
      C, I think seasoned programmers tend not to even notice it
      anymore, but it can sometimes make for awkward double
      negations (e.g., we can drop a few !!oidcmp() instances
      This patch was generated almost entirely by the included
      coccinelle patch. This mechanical conversion should be
      completely safe, because we check explicitly for cases where
      oidcmp() is compared to 0, which is what oideq() is doing
      under the hood. Note that we don't have to catch "!oidcmp()"
      separately; coccinelle's standard isomorphisms make sure the
      two are treated equivalently.
      I say "almost" because I did hand-edit the coccinelle output
      to fix up a few style violations (it mostly keeps the
      original formatting, but sometimes unwraps long lines).
      Signed-off-by: 's avatarJeff King <peff@peff.net>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  9. 13 Aug, 2018 1 commit
  10. 11 Jul, 2018 1 commit
    • Jeff King's avatar
      has_uncommitted_changes(): fall back to empty tree · 3506dc94
      Jeff King authored
      If has_uncommitted_changes() can't resolve HEAD (e.g.,
      because it's unborn or corrupt), then we end up calling
      run_diff_index() with an empty revs.pending array. This
      causes a segfault, as run_diff_index() blindly looks at the
      first pending item.
      Fixing this raises a question of fault: should
      run_diff_index() handle this case, or is the caller wrong to
      pass an empty pending list?
      Looking at the other callers of run_diff_index(), they
      handle this in one of three ways:
       - they resolve the object themselves, and avoid doing the
         diff if it's not valid
       - they resolve the object themselves, and fall back to the
         empty tree
       - they use setup_revisions(), which will die() if the
         object isn't valid
      Since this is the only broken caller, that argues that the
      fix should go there. Falling back to the empty tree makes
      sense here, as we'd claim uncommitted changes if and only if
      the index is non-empty. This may be a little funny in the
      case of corruption (the corrupt HEAD probably _isn't_
      empty), but:
        - we don't actually know the reason here that HEAD didn't
          resolve (the much more likely case is that we have an
          unborn HEAD, in which case the empty tree comparison is
          the right thing)
        - this matches how other code, like "git diff", behaves
      While we're thinking about it, let's add an assertion to
      run_diff_index(). It should always be passed a single
      object, and as this bug shows, it's easy to get it wrong
      (and an assertion is easier to hunt down than a segfault, or
      a quietly ignored extra tree).
      Reported-by: Ævar Arnfjörð Bjarmason's avatarÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: 's avatarJeff King <peff@peff.net>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  11. 29 Jun, 2018 1 commit
  12. 17 May, 2018 1 commit
  13. 13 May, 2018 1 commit
    • Ben Peart's avatar
      add status config and command line options for rename detection · e8b2dc2c
      Ben Peart authored
      After performing a merge that has conflicts git status will, by default,
      attempt to detect renames which causes many objects to be examined.  In a
      virtualized repo, those objects do not exist locally so the rename logic
      triggers them to be fetched from the server. This results in the status call
      taking hours to complete on very large repos vs seconds with this patch.
      Add a new config status.renames setting to enable turning off rename
      detection during status and commit.  This setting will default to the value
      of diff.renames.
      Add a new config status.renamelimit setting to to enable bounding the time
      spent finding out inexact renames during status and commit.  This setting
      will default to the value of diff.renamelimit.
      Add --no-renames command line option to status that enables overriding the
      config setting from the command line. Add --find-renames[=<n>] command line
      option to status that enables detecting renames and optionally setting the
      similarity index.
      Reviewed-by: 's avatarElijah Newren <newren@gmail.com>
      Original-Patch-by: 's avatarAlejandro Pauly <alpauly@microsoft.com>
      Signed-off-by: 's avatarBen Peart <Ben.Peart@microsoft.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  14. 06 May, 2018 2 commits
    • Johannes Schindelin's avatar
      Replace all die("BUG: ...") calls by BUG() ones · 033abf97
      Johannes Schindelin authored
      In d8193743 (usage.c: add BUG() function, 2017-05-12), a new macro
      was introduced to use for reporting bugs instead of die(). It was then
      subsequently used to convert one single caller in 588a538a
      (setup_git_env: convert die("BUG") to BUG(), 2017-05-12).
      The cover letter of the patch series containing this patch
      (cf 20170513032414.mfrwabt4hovujde2@sigill.intra.peff.net) is not
      terribly clear why only one call site was converted, or what the plan
      is for other, similar calls to die() to report bugs.
      Let's just convert all remaining ones in one fell swoop.
      This trick was performed by this invocation:
      	sed -i 's/die("BUG: /BUG("/g' $(git grep -l 'die("BUG' \*.c)
      Signed-off-by: Johannes Schindelin's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
    • Eckhard S. Maaß's avatar
      wt-status: use settings from git_diff_ui_config · dc6b1d92
      Eckhard S. Maaß authored
      If you do something like
          - git add .
          - git status
          - git commit
          - git show (or git diff HEAD)
      one would expect to have analogous output from git status and git show
      (or similar diff-related programs). This is generally not the case, as
      git status has hard coded values for diff related options.
      With this commit the hard coded settings are dropped from the status
      command in favour for values provided by git_diff_ui_config.
      What follows are some remarks on the concrete options which were hard
      coded in git status:
      Since the very beginning of git status in a3e870f2 ("Add "commit"
      helper script", 2005-05-30), git status always used rename detection,
      whereas with commands like show and log one had to activate it with a
      command line option. After 5404c116 ("diff: activate diff.renames by
      default", 2016-02-25) the default behaves the same by coincidence, but
      changing diff.renames to other values can break the consistency between
      git status and other commands again. With this commit one control the
      same default behaviour with diff.renames.
      Similarly one has the option diff.renamelimit to adjust this limit for
      all commands but git status. With this commit git status will also honor
      Unlike the other two options this cannot be configured by a
      configuration option yet. This commit will also change the default
      behaviour to not use break rewrites. But as rename detection is most
      likely on, this is dangerous to be activated anyway as one can see
          https://public-inbox.org/git/xmqqegqaahnh.fsf@gitster.dls.corp.google.com/Signed-off-by: 's avatarEckhard S. Maaß <eckhard.s.maass@gmail.com>
      Reviewed-by: 's avatarElijah Newren <newren@gmail.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  15. 02 May, 2018 1 commit
  16. 14 Mar, 2018 3 commits
  17. 24 Jan, 2018 4 commits
  18. 27 Dec, 2017 5 commits
  19. 07 Nov, 2017 1 commit
    • Brandon Williams's avatar
      wt-status: actually ignore submodules when requested · c6d8ccf3
      Brandon Williams authored
      Since ff6f1f56 (submodule-config: lazy-load a repository's .gitmodules
      file, 2017-08-03) rebase interactive fails if there are any submodules
      with unstaged changes which have been configured with a value for
      'submodule.<name>.ignore' in the repository's config.
      This is due to how configured values of 'submodule.<name>.ignore' are
      handled in addition to a change in how the submodule config is loaded.
      When the diff machinery hits a submodule (gitlink as well as a
      corresponding entry in the submodule subsystem) it will read the value
      of 'submodule.<name>.ignore' stored in the repository's config and if
      the config is present it will clear the 'IGNORE_SUBMODULES' (which is
      the flag explicitly requested by rebase interactive),
      flags and then set one of them based on the configured value.
      Historically this wasn't a problem because the submodule subsystem
      wasn't initialized because the .gitmodules file wasn't explicitly loaded
      by the rebase interactive command.  So when the diff machinery hit a
      submodule it would skip over reading any configured values of
      In order to preserve the behavior of submodules being ignored by rebase
      interactive, also set the 'OVERRIDE_SUBMODULE_CONFIG' diff flag when
      submodules are requested to be ignored when checking for unstaged
      Reported-by: 's avatarOrgad Shaneh <orgads@gmail.com>
      Signed-off-by: 's avatarBrandon Williams <bmwill@google.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  20. 01 Nov, 2017 2 commits
    • Brandon Williams's avatar
      diff: make struct diff_flags members lowercase · 0d1e0e78
      Brandon Williams authored
      Now that the flags stored in struct diff_flags are being accessed
      directly and not through macros, change all struct members from being
      uppercase to lowercase.
      This conversion is done using the following semantic patch:
      	expression E;
      	- E.RECURSIVE
      	+ E.recursive
      	expression E;
      	+ E.tree_in_recursive
      	expression E;
      	- E.BINARY
      	+ E.binary
      	expression E;
      	- E.TEXT
      	+ E.text
      	expression E;
      	- E.FULL_INDEX
      	+ E.full_index
      	expression E;
      	+ E.silent_on_remove
      	expression E;
      	+ E.find_copies_harder
      	expression E;
      	+ E.follow_renames
      	expression E;
      	+ E.rename_empty
      	expression E;
      	- E.HAS_CHANGES
      	+ E.has_changes
      	expression E;
      	- E.QUICK
      	+ E.quick
      	expression E;
      	- E.NO_INDEX
      	+ E.no_index
      	expression E;
      	+ E.allow_external
      	expression E;
      	+ E.exit_with_status
      	expression E;
      	+ E.reverse_diff
      	expression E;
      	+ E.check_failed
      	expression E;
      	+ E.relative_name
      	expression E;
      	+ E.ignore_submodules
      	expression E;
      	+ E.dirstat_cumulative
      	expression E;
      	+ E.dirstat_by_file
      	expression E;
      	+ E.allow_textconv
      	expression E;
      	+ E.textconv_set_via_cmdline
      	expression E;
      	+ E.diff_from_contents
      	expression E;
      	+ E.dirty_submodules
      	expression E;
      	+ E.ignore_untracked_in_submodules
      	expression E;
      	+ E.ignore_dirty_submodules
      	expression E;
      	+ E.override_submodule_config
      	expression E;
      	+ E.dirstat_by_line
      	expression E;
      	+ E.funccontext
      	expression E;
      	+ E.pickaxe_ignore_case
      	expression E;
      	+ E.default_follow_renames
      Signed-off-by: 's avatarBrandon Williams <bmwill@google.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
    • Brandon Williams's avatar
      diff: remove DIFF_OPT_SET macro · 23dcf77f
      Brandon Williams authored
      Remove the `DIFF_OPT_SET` macro and instead set the flags directly.
      This conversion is done using the following semantic patch:
      	expression E;
      	identifier fld;
      	- DIFF_OPT_SET(&E, fld)
      	+ E.flags.fld = 1
      	type T;
      	T *ptr;
      	identifier fld;
      	- DIFF_OPT_SET(ptr, fld)
      	+ ptr->flags.fld = 1
      Signed-off-by: 's avatarBrandon Williams <bmwill@google.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  21. 31 Oct, 2017 1 commit
    • Jameson Miller's avatar
      status: add option to show ignored files differently · eec0f7f2
      Jameson Miller authored
      Teach the status command more flexibility in how ignored files are
      reported. Currently, the reporting of ignored files and untracked
      files are linked. You cannot control how ignored files are reported
      independently of how untracked files are reported (i.e. `all` vs
      `normal`). This makes it impossible to show untracked files with the
      `all` option, but show ignored files with the `normal` option.
      This work 1) adds the ability to control the reporting of ignored
      files independently of untracked files and 2) introduces the concept
      of status reporting ignored paths that explicitly match an ignored
      pattern. There are 2 benefits to these changes: 1) if a consumer needs
      all untracked files but not all ignored files, there is a performance
      benefit to not scanning all contents of an ignored directory and 2)
      returning ignored files that explicitly match a path allow a consumer
      to make more informed decisions about when a status result might be
      This commit implements --ignored=matching with --untracked-files=all.
      The following commit will implement --ignored=matching with
      As an example of where this flexibility could be useful is that our
      application (Visual Studio) runs the status command and presents the
      output. It shows all untracked files individually (e.g. using the
      '--untracked-files==all' option), and would like to know about which
      paths are ignored. It uses information about ignored paths to make
      decisions about when the status result might have changed.
      Additionally, many projects place build output into directories inside
      a repository's working directory (e.g. in "bin/" and "obj/"
      directories). Normal usage is to explicitly ignore these 2 directory
      names in the .gitignore file (rather than or in addition to the *.obj
      pattern).If an application could know that these directories are
      explicitly ignored, it could infer that all contents are ignored as
      well and make better informed decisions about files in these
      directories. It could infer that any changes under these paths would
      not affect the output of status. Additionally, there can be a
      significant performance benefit by avoiding scanning through ignored
      When status is set to report matching ignored files, it has the
      following behavior. Ignored files and directories that explicitly
      match an exclude pattern are reported. If an ignored directory matches
      an exclude pattern, then the path of the directory is returned. If a
      directory does not match an exclude pattern, but all of its contents
      are ignored, then the contained files are reported instead of the
      Signed-off-by: 's avatarJameson Miller <jamill@microsoft.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  22. 16 Oct, 2017 1 commit
  23. 06 Oct, 2017 1 commit
    • Martin Ågren's avatar
      treewide: prefer lockfiles on the stack · 837e34eb
      Martin Ågren authored
      There is no longer any need to allocate and leak a `struct lock_file`.
      The previous patch addressed an instance where we needed a minor tweak
      alongside the trivial changes.
      Deal with the remaining instances where we allocate and leak a struct
      within a single function. Change them to have the `struct lock_file` on
      the stack instead.
      These instances were identified by running `git grep "^\s*struct
      Signed-off-by: 's avatarMartin Ågren <martin.agren@gmail.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  24. 01 Oct, 2017 1 commit
  25. 15 Sep, 2017 1 commit