1. 17 May, 2018 1 commit
  2. 14 Mar, 2018 3 commits
  3. 24 Jan, 2018 4 commits
  4. 27 Dec, 2017 5 commits
  5. 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),
      'IGNORE_UNTRACKED_IN_SUBMODULES', and 'IGNORE_DIRTY_SUBMODULES' diff
      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
      'submodule.<name>.ignore'.
      
      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
      changes.
      Reported-by: default avatarOrgad Shaneh <orgads@gmail.com>
      Signed-off-by: default avatarBrandon Williams <bmwill@google.com>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      c6d8ccf3
  6. 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
      	+ 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
      	+ E.silent_on_remove
      
      	@@
      	expression E;
      	@@
      	- E.FIND_COPIES_HARDER
      	+ E.find_copies_harder
      
      	@@
      	expression E;
      	@@
      	- E.FOLLOW_RENAMES
      	+ E.follow_renames
      
      	@@
      	expression E;
      	@@
      	- E.RENAME_EMPTY
      	+ 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
      	+ E.allow_external
      
      	@@
      	expression E;
      	@@
      	- E.EXIT_WITH_STATUS
      	+ E.exit_with_status
      
      	@@
      	expression E;
      	@@
      	- E.REVERSE_DIFF
      	+ E.reverse_diff
      
      	@@
      	expression E;
      	@@
      	- E.CHECK_FAILED
      	+ E.check_failed
      
      	@@
      	expression E;
      	@@
      	- E.RELATIVE_NAME
      	+ E.relative_name
      
      	@@
      	expression E;
      	@@
      	- E.IGNORE_SUBMODULES
      	+ E.ignore_submodules
      
      	@@
      	expression E;
      	@@
      	- E.DIRSTAT_CUMULATIVE
      	+ E.dirstat_cumulative
      
      	@@
      	expression E;
      	@@
      	- E.DIRSTAT_BY_FILE
      	+ E.dirstat_by_file
      
      	@@
      	expression E;
      	@@
      	- E.ALLOW_TEXTCONV
      	+ E.allow_textconv
      
      	@@
      	expression E;
      	@@
      	- E.TEXTCONV_SET_VIA_CMDLINE
      	+ E.textconv_set_via_cmdline
      
      	@@
      	expression E;
      	@@
      	- E.DIFF_FROM_CONTENTS
      	+ E.diff_from_contents
      
      	@@
      	expression E;
      	@@
      	- E.DIRTY_SUBMODULES
      	+ E.dirty_submodules
      
      	@@
      	expression E;
      	@@
      	- E.IGNORE_UNTRACKED_IN_SUBMODULES
      	+ E.ignore_untracked_in_submodules
      
      	@@
      	expression E;
      	@@
      	- E.IGNORE_DIRTY_SUBMODULES
      	+ E.ignore_dirty_submodules
      
      	@@
      	expression E;
      	@@
      	- E.OVERRIDE_SUBMODULE_CONFIG
      	+ E.override_submodule_config
      
      	@@
      	expression E;
      	@@
      	- E.DIRSTAT_BY_LINE
      	+ E.dirstat_by_line
      
      	@@
      	expression E;
      	@@
      	- E.FUNCCONTEXT
      	+ E.funccontext
      
      	@@
      	expression E;
      	@@
      	- E.PICKAXE_IGNORE_CASE
      	+ E.pickaxe_ignore_case
      
      	@@
      	expression E;
      	@@
      	- E.DEFAULT_FOLLOW_RENAMES
      	+ E.default_follow_renames
      Signed-off-by: default avatarBrandon Williams <bmwill@google.com>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      0d1e0e78
    • 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: default avatarBrandon Williams <bmwill@google.com>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      23dcf77f
  7. 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
      stale.
      
      This commit implements --ignored=matching with --untracked-files=all.
      The following commit will implement --ignored=matching with
      --untracked=files=normal.
      
      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
      directories.
      
      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
      directory.
      Signed-off-by: default avatarJameson Miller <jamill@microsoft.com>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      eec0f7f2
  8. 16 Oct, 2017 1 commit
  9. 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
      lock_file\s*\*"`.
      Signed-off-by: default avatarMartin Ågren <martin.agren@gmail.com>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      837e34eb
  10. 01 Oct, 2017 1 commit
  11. 15 Sep, 2017 1 commit
  12. 10 Sep, 2017 1 commit
  13. 06 Sep, 2017 1 commit
  14. 10 Jul, 2017 1 commit
  15. 22 Jun, 2017 1 commit
    • Kaartic Sivaraam's avatar
      status: contextually notify user about an initial commit · 4ddb1354
      Kaartic Sivaraam authored
      The existing message, "Initial commit", makes sense for the commit template
      notifying users that it's their initial commit, but is confusing when
      merely checking the status of a fresh repository (or orphan branch)
      without having any commits yet.
      
      Change the output of "status" to say "No commits yet" when "git
      status" is run on a fresh repo (or orphan branch), while retaining the
      current "Initial commit" message displayed in the template that's
      displayed in the editor when the initial commit is being authored.
      
      Correspondingly change the output of "short status" to "No commits yet
      on " when "git status -sb" is run on a fresh repo (or orphan branch).
      
      A few alternatives considered were,
      
       * Waiting for initial commit
       * Your current branch does not have any commits
       * Current branch waiting for initial commit
      
      The most succint one among the alternatives was chosen.
      
      [with help on tests from Ævar]
      Helped-by: default avatarJunio C Hamano <gitster@pobox.com>
      Signed-off-by: Ævar Arnfjörð Bjarmason's avatarÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: default avatarKaartic Sivaraam <kaarticsivaraam91196@gmail.com>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      4ddb1354
  16. 19 Jun, 2017 1 commit
  17. 26 May, 2017 1 commit
  18. 18 May, 2017 1 commit
    • Brian Malehorn's avatar
      interpret-trailers: honor the cut line · d76650b8
      Brian Malehorn authored
      If a commit message is edited with the "verbose" option, the buffer
      will have a cut line and diff after the log message, like so:
      
          my subject
      
          # ------------------------ >8 ------------------------
          # Do not touch the line above.
          # Everything below will be removed.
          diff --git a/foo.txt b/foo.txt
          index 5716ca5..7601807 100644
          --- a/foo.txt
          +++ b/foo.txt
          @@ -1 +1 @@
          -bar
          +baz
      
      "git interpret-trailers" is unaware of the cut line, and assumes the
      trailer block would be at the end of the whole thing.  This can easily
      be seen with:
      
           $ GIT_EDITOR='git interpret-trailers --in-place --trailer Acked-by:me' \
             git commit --amend -v
      
      Teach "git interpret-trailers" to notice the cut-line and ignore the
      remainder of the input when looking for a place to add new trailer
      block.  This makes it consistent with how "git commit -v -s" inserts a
      new Signed-off-by: line.
      
      This can be done by the same logic as the existing helper function,
      wt_status_truncate_message_at_cut_line(), uses, but it wants the caller
      to pass a strbuf to it.  Because the function ignore_non_trailer() used
      by the command takes a <pointer, length> pair, not a strbuf, steal the
      logic from wt_status_truncate_message_at_cut_line() to create a new
      wt_status_locate_end() helper function that takes <pointer, length>
      pair, and make ignore_non_trailer() call it to help "interpret-trailers".
      
      Since there is only one caller of wt_status_truncate_message_at_cut_line()
      in cmd_commit(), rewrite it to call wt_status_locate_end() helper instead
      and remove the old helper that no longer has any caller.
      Signed-off-by: Brian Malehorn's avatarBrian Malehorn <bmalehorn@gmail.com>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      d76650b8
  19. 08 May, 2017 3 commits
    • brian m. carlson's avatar
      Convert lookup_commit* to struct object_id · bc83266a
      brian m. carlson authored
      Convert lookup_commit, lookup_commit_or_die,
      lookup_commit_reference, and lookup_commit_reference_gently to take
      struct object_id arguments.
      
      Introduce a temporary in parse_object buffer in order to convert this
      function.  This is required since in order to convert parse_object and
      parse_object_buffer, lookup_commit_reference_gently and
      lookup_commit_or_die would need to be converted.  Not introducing a
      temporary would therefore require that lookup_commit_or_die take a
      struct object_id *, but lookup_commit would take unsigned char *,
      leaving a confusing and hard-to-use interface.
      
      parse_object_buffer will lose this temporary in a later patch.
      
      This commit was created with manual changes to commit.c, commit.h, and
      object.c, plus the following semantic patch:
      
      @@
      expression E1, E2;
      @@
      - lookup_commit_reference_gently(E1.hash, E2)
      + lookup_commit_reference_gently(&E1, E2)
      
      @@
      expression E1, E2;
      @@
      - lookup_commit_reference_gently(E1->hash, E2)
      + lookup_commit_reference_gently(E1, E2)
      
      @@
      expression E1;
      @@
      - lookup_commit_reference(E1.hash)
      + lookup_commit_reference(&E1)
      
      @@
      expression E1;
      @@
      - lookup_commit_reference(E1->hash)
      + lookup_commit_reference(E1)
      
      @@
      expression E1;
      @@
      - lookup_commit(E1.hash)
      + lookup_commit(&E1)
      
      @@
      expression E1;
      @@
      - lookup_commit(E1->hash)
      + lookup_commit(E1)
      
      @@
      expression E1, E2;
      @@
      - lookup_commit_or_die(E1.hash, E2)
      + lookup_commit_or_die(&E1, E2)
      
      @@
      expression E1, E2;
      @@
      - lookup_commit_or_die(E1->hash, E2)
      + lookup_commit_or_die(E1, E2)
      Signed-off-by: brian m. carlson's avatarbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      bc83266a
    • Johannes Schindelin's avatar
      split_commit_in_progress(): simplify & fix memory leak · 41fc6b33
      Johannes Schindelin authored
      This function did a whole lot of unnecessary work, such as reading in
      four files just to figure out that, oh, hey, we do not need to look at
      them after all because the HEAD is not detached.
      
      Simplify the entire function to return early when possible, to read in
      the files only when necessary, and to release the allocated memory
      always (there was a leak, reported via Coverity, where we failed to
      release the allocated strings if the HEAD is not detached).
      Signed-off-by: Johannes Schindelin's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      41fc6b33
    • Johannes Schindelin's avatar
      e7b65e20
  20. 06 May, 2017 1 commit
  21. 28 Apr, 2017 1 commit
    • Jeff King's avatar
      status: fix missing newline when comment chars are disabled · 75177c85
      Jeff King authored
      When git-status shows tracking data for the current branch
      in the long format, we try to end the stanza with a blank
      line. When status.displayCommentPrefix is true, we call
      color_fprintf_ln() to do so. But when it's false, we call
      the enigmatic:
      
        fputs("", s->fp);
      
      which does nothing at all! This is a bug from 7d7d6802
      (silence a bunch of format-zero-length warnings,
      2014-05-04). Prior to that, we called fprintf_ln() with an
      empty string. Switching to fputs() meant we needed to
      include the "newline in the string, but we didn't.
      
      So you see:
      
        On branch jk/status-tracking-newline
        Your branch is ahead of 'origin/master' by 1 commit.
        Changes not staged for commit:
                modified:  foo
      
        Untracked files:
           bar
      
      whereas there should be a blank line before the "Changes not
      staged" line.
      
      The fix itself is a one-liner. But we never noticed this
      bug because t7508 doesn't exercise the ahead/behind code at
      all.  So let's configure an upstream during the initial
      setup, which means that the code will be exercised as part
      of all of the various invocations in that script. This makes
      the diff rather noisy, but should give us good coverage.
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      75177c85
  22. 27 Apr, 2017 1 commit
    • Johannes Schindelin's avatar
      timestamp_t: a new data type for timestamps · dddbad72
      Johannes Schindelin authored
      Git's source code assumes that unsigned long is at least as precise as
      time_t. Which is incorrect, and causes a lot of problems, in particular
      where unsigned long is only 32-bit (notably on Windows, even in 64-bit
      versions).
      
      So let's just use a more appropriate data type instead. In preparation
      for this, we introduce the new `timestamp_t` data type.
      
      By necessity, this is a very, very large patch, as it has to replace all
      timestamps' data type in one go.
      
      As we will use a data type that is not necessarily identical to `time_t`,
      we need to be very careful to use `time_t` whenever we interact with the
      system functions, and `timestamp_t` everywhere else.
      Signed-off-by: Johannes Schindelin's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      dddbad72
  23. 29 Mar, 2017 1 commit
    • Stefan Beller's avatar
      short status: improve reporting for submodule changes · dd6962dd
      Stefan Beller authored
      If I add an untracked file to a submodule or modify a tracked file,
      currently "git status --short" treats the change in the same way as
      changes to the current HEAD of the submodule:
      
              $ git clone --quiet --recurse-submodules https://gerrit.googlesource.com/gerrit
              $ echo hello >gerrit/plugins/replication/stray-file
              $ sed -i -e 's/.*//' gerrit/plugins/replication/.mailmap
              $ git -C gerrit status --short
               M plugins/replication
      
      This is by analogy with ordinary files, where "M" represents a change
      that has not been added yet to the index.  But this change cannot be
      added to the index without entering the submodule, "git add"-ing it,
      and running "git commit", so the analogy is counterproductive.
      
      Introduce new status letters " ?" and " m" for this.  These are similar
      to the existing "??" and " M" but mean that the submodule (not the
      parent project) has new untracked files and modified files, respectively.
      The user can use "git add" and "git commit" from within the submodule to
      add them.
      
      Changes to the submodule's HEAD commit can be recorded in the index with
      a plain "git add -u" and are shown with " M", like today.
      
      To avoid excessive clutter, show at most one of " ?", " m", and " M" for
      the submodule.  They represent increasing levels of change --- the last
      one that applies is shown (e.g., " m" if there are both modified files
      and untracked files in the submodule, or " M" if the submodule's HEAD
      has been modified and it has untracked files).
      
      While making these changes, we need to make sure to not break porcelain
      level 1, which shares code with "status --short".  We only change
      "git status --short".
      
      Non-short "git status" and "git status --porcelain=2" already handle
      these cases by showing more detail:
      
              $ git -C gerrit status --porcelain=2
              1 .M S.MU 160000 160000 160000 305c864db28eb0c77c8499bc04c87de3f849cf3c 305c864db28eb0c77c8499bc04c87de3f849cf3c plugins/replication
              $ git -C gerrit status
      [...]
              modified:   plugins/replication (modified content, untracked content)
      
      Scripts caring about these distinctions should use --porcelain=2.
      Helped-by: default avatarJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: Stefan Beller's avatarStefan Beller <sbeller@google.com>
      Reviewed-by: default avatarJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      dd6962dd
  24. 17 Mar, 2017 1 commit
  25. 14 Mar, 2017 1 commit
    • Michael J Gruber's avatar
      git-status: make porcelain more robust · b9e2bc56
      Michael J Gruber authored
      git status provides a porcelain mode for porcelain writers with a
      supposedly stable (plumbing) interface.
      7a76c28f ("status: disable translation when --porcelain is used", 2014-03-20)
      made sure that ahead/behind info is not translated (i.e. is stable).
      
      Make sure that the remaining two strings (initial commit, detached head)
      are stable, too.
      
      These changes are for the v1 porcelain interface. While we do have a perfectly
      stable v2 porcelain interface now, some tools (such as
      powerline-gitstatus) are written against v1 and profit from fixing v1
      without any changes on their side.
      Signed-off-by: default avatarMichael J Gruber <git@drmicha.warpmail.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      b9e2bc56
  26. 22 Feb, 2017 3 commits