1. 16 4月, 2013 1 次提交
  2. 12 4月, 2013 1 次提交
  3. 03 4月, 2013 2 次提交
  4. 24 3月, 2013 1 次提交
  5. 22 3月, 2013 1 次提交
    • J
      wt-status: fix possible use of uninitialized variable · b8527d5f
      Jeff King 提交于
      In wt_status_print_change_data, we accept a change_type flag
      that is meant to be either WT_STATUS_UPDATED or
      WT_STATUS_CHANGED.  We then switch() on this value to set
      the local variable "status" for each case, but do not
      provide a fallback "default" label to the switch statement.
      
      As a result, the compiler realizes that "status" might be
      unset, and complains with a warning. To silence this
      warning, we use the "int status = status" trick.  This is
      correct with the current code, as all callers provide one of
      the two expected change_type flags. However, it's also a
      maintenance trap, as there is nothing to prevent future
      callers from passing another flag, nor to document this
      assumption.
      
      Instead of using the "x = x" hack, let's handle the default
      case in the switch() statement with a die("BUG"). That tells
      the compiler and any readers of the code exactly what the
      function's input assumptions are.
      
      We could also convert the flag to an enum, which would
      provide a compile-time check on the function input. However,
      since these flags are part of a larger enum, that would make
      the code unnecessarily complex (we would have to make a new
      enum with just the two flags, and then convert it to the old
      enum for passing to sub-functions).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b8527d5f
  6. 17 3月, 2013 5 次提交
  7. 06 2月, 2013 1 次提交
  8. 17 1月, 2013 1 次提交
    • J
      Allow custom "comment char" · eff80a9f
      Junio C Hamano 提交于
      Some users do want to write a line that begin with a pound sign, #,
      in their commit log message.  Many tracking system recognise
      a token of #<bugid> form, for example.
      
      The support we offer these use cases is not very friendly to the end
      users.  They have a choice between
      
       - Don't do it.  Avoid such a line by rewrapping or indenting; and
      
       - Use --cleanup=whitespace but remove all the hint lines we add.
      
      Give them a way to set a custom comment char, e.g.
      
          $ git -c core.commentchar="%" commit
      
      so that they do not have to do either of the two workarounds.
      
      [jc: although I started the topic, all the tests and documentation
      updates, many of the call sites of the new strbuf_add_commented_*()
      functions, and the change to git-submodule.sh scripted Porcelain are
      from Ralf.]
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NRalf Thielow <ralf.thielow@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      eff80a9f
  9. 02 1月, 2013 1 次提交
    • A
      dir.c: Make git-status --ignored more consistent · 721ac4ed
      Antoine Pelisse 提交于
      The current behavior of git-status is inconsistent and misleading.
      Especially when used with --untracked-files=all option:
      
       - files ignored in untracked directories will be missing from
         status output.
      
       - untracked files in committed yet ignored directories are also
         missing.
      
       - with --untracked-files=normal, untracked directories that
         contains only ignored files are dropped too.
      
      Make the behavior more consistent across all possible use cases:
      
       - "--ignored --untracked-files=normal" doesn't show each specific
         files but top directory.  It instead shows untracked directories
         that only contains ignored files, and ignored tracked directories
         with untracked files.
      
       - "--ignored --untracked-files=all" shows all ignored files, either
         because it's in an ignored directory (tracked or untracked), or
         because the file is explicitly ignored.
      Signed-off-by: NAntoine Pelisse <apelisse@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      721ac4ed
  10. 16 9月, 2012 1 次提交
  11. 07 9月, 2012 1 次提交
  12. 17 7月, 2012 1 次提交
    • J
      status: color in-progress message like other header messages · 3cd9d1b2
      Jeff King 提交于
      The "status" command recently learned to describe the
      in-progress operation in its long output format (e.g.,
      rebasing, am, etc). This message gets its own slot in the
      color table, even though it is not configurable. As a
      result, if the user has set color.status.header to a
      non-default value, this message will not match (and cannot
      be made to match, as there is no config option).
      
      It is probably more sane to just color it like the rest of
      the text (i.e., just use color.status.header). This would
      not allow users to customize the color of this message
      independently, but they cannot do that with the current code
      anyway, and if somebody wants to build customizable
      colorization later, this patch does not make it much harder
      to do so.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3cd9d1b2
  13. 15 6月, 2012 3 次提交
  14. 08 5月, 2012 3 次提交
    • J
      status: respect "-b" for porcelain format · d4a6bf1f
      Jeff King 提交于
      There is no reason not to, as the user has to explicitly ask
      for it, so we are not breaking compatibility by doing so. We
      can do this simply by moving the "show_branch" flag into
      the wt_status struct. As a bonus, this saves us from passing
      it explicitly, simplifying the code.
      Signed-off-by: NJeff King <peff@peff.net>
      d4a6bf1f
    • J
      status: fix null termination with "-b" · a5985237
      Jeff King 提交于
      When the "-z" option is given to status, we are supposed to
      NUL-terminate each record. However, the "-b" code to show
      the tracking branch did not respect this, and always ended
      with a newline.
      Signed-off-by: NJeff King <peff@peff.net>
      a5985237
    • J
      status: refactor null_termination option · 3207a3a2
      Jeff King 提交于
      This option is passed separately to the wt_status printing
      functions, whereas every other formatting option is
      contained in the wt_status struct itself. Let's do the same
      here, so we can avoid passing it around through the call
      stack.
      Signed-off-by: NJeff King <peff@peff.net>
      3207a3a2
  15. 28 4月, 2012 1 次提交
  16. 14 12月, 2011 1 次提交
  17. 24 10月, 2011 1 次提交
  18. 20 8月, 2011 1 次提交
    • J
      color: delay auto-color decision until point of use · daa0c3d9
      Jeff King 提交于
      When we read a color value either from a config file or from
      the command line, we use git_config_colorbool to convert it
      from the tristate always/never/auto into a single yes/no
      boolean value.
      
      This has some timing implications with respect to starting
      a pager.
      
      If we start (or decide not to start) the pager before
      checking the colorbool, everything is fine. Either isatty(1)
      will give us the right information, or we will properly
      check for pager_in_use().
      
      However, if we decide to start a pager after we have checked
      the colorbool, things are not so simple. If stdout is a tty,
      then we will have already decided to use color. However, the
      user may also have configured color.pager not to use color
      with the pager. In this case, we need to actually turn off
      color. Unfortunately, the pager code has no idea which color
      variables were turned on (and there are many of them
      throughout the code, and they may even have been manipulated
      after the colorbool selection by something like "--color" on
      the command line).
      
      This bug can be seen any time a pager is started after
      config and command line options are checked. This has
      affected "git diff" since 89d07f75 (diff: don't run pager if
      user asked for a diff style exit code, 2007-08-12). It has
      also affect the log family since 1fda91b5 (Fix 'git log'
      early pager startup error case, 2010-08-24).
      
      This patch splits the notion of parsing a colorbool and
      actually checking the configuration. The "use_color"
      variables now have an additional possible value,
      GIT_COLOR_AUTO. Users of the variable should use the new
      "want_color()" wrapper, which will lazily determine and
      cache the auto-color decision.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      daa0c3d9
  19. 19 8月, 2011 1 次提交
    • J
      diff: refactor COLOR_DIFF from a flag into an int · f1c96261
      Jeff King 提交于
      This lets us store more than just a bit flag for whether we
      want color; we can also store whether we want automatic
      colors. This can be useful for making the automatic-color
      decision closer to the point of use.
      
      This mostly just involves replacing DIFF_OPT_* calls with
      manipulations of the flag. The biggest exception is that
      calls to DIFF_OPT_TST must check for "o->use_color > 0",
      which lets an "unknown" value (i.e., the default) stay at
      "no color". In the previous code, a value of "-1" was not
      propagated at all.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f1c96261
  20. 02 6月, 2011 1 次提交
    • J
      status: fix bug with missing --ignore files · 1282988b
      Jeff King 提交于
      Commit 1b908b6f (wt-status: rename and restructure
      status-print-untracked, 2010-04-10) converted the
      wt_status_print_untracked function into
      wt_status_print_other, taking a string_list of either
      untracked or ignored items to print. However, the "nothing
      to show" early return still checked the wt_status->untracked
      list instead of the passed-in list.
      
      That meant that if we had ignored items to show, but no
      untracked items, we would erroneously exit early and fail to
      show the ignored items.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1282988b
  21. 10 3月, 2011 6 次提交
  22. 09 3月, 2011 4 次提交
    • J
      commit, status: use status_printf{,_ln,_more} helpers · b926c0d1
      Jonathan Nieder 提交于
      wt-status code is used to provide a reminder of changes included and
      not included for the commit message template opened in the operator's
      text editor by "git commit".  Therefore each line of its output begins
      with the comment character "#":
      
      	# Please enter the commit message for your changes. Lines starting
      
      Use the new status_printf{,_ln,_more} functions to take care of adding
      "#" to the beginning of such status lines automatically.  Using these
      will have two advantages over the current code:
      
       - The obvious one is to force separation of the "#" from the
         translatable part of the message when git learns to translate its
         output.
      
       - Another advantage is that this makes it easier for us to drop "#"
         prefix in "git status" output in later versions of git if we want
         to.
      Explained-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b926c0d1
    • J
      wt-status: add helpers for printing wt-status lines · becbdae8
      Jonathan Nieder 提交于
      Introduce status_printf{,_ln,_more} wrapper functions around
      color_vfprintf() which take care of adding "#" to the beginning of
      status lines automatically.  The semantics:
      
       - status_printf() is just like color_fprintf() but it adds a "# "
         at the beginning of each line of output;
      
       - status_printf_ln() is a convenience function that additionally
         adds "\n" at the end;
      
       - status_printf_more() is a variant of status_printf() used to
         continue lines that have already started.  It suppresses the "#" at
         the beginning of the first line.
      Helped-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      becbdae8
    • J
      commit, status: use status_printf{,_ln,_more} helpers · 098d0e0e
      Jonathan Nieder 提交于
      wt-status code is used to provide a reminder of changes included and
      not included for the commit message template opened in the operator's
      text editor by "git commit".  Therefore each line of its output begins
      with the comment character "#":
      
      	# Please enter the commit message for your changes. Lines starting
      
      Use the new status_printf{,_ln,_more} functions to take care of adding
      "#" to the beginning of such status lines automatically.  Using these
      will have two advantages over the current code:
      
       - The obvious one is to force separation of the "#" from the
         translatable part of the message when git learns to translate its
         output.
      
       - Another advantage is that this makes it easier for us to drop "#"
         prefix in "git status" output in later versions of git if we want
         to.
      Explained-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      098d0e0e
    • J
      wt-status: add helpers for printing wt-status lines · e0335fcd
      Jonathan Nieder 提交于
      Introduce status_printf{,_ln,_more} wrapper functions around
      color_vfprintf() which take care of adding "#" to the beginning of
      status lines automatically.  The semantics:
      
       - status_printf() is just like color_fprintf() but it adds a "# "
         at the beginning of each line of output;
      
       - status_printf_ln() is a convenience function that additionally
         adds "\n" at the end;
      
       - status_printf_more() is a variant of status_printf() used to
         continue lines that have already started.  It suppresses the "#" at
         the beginning of the first line.
      Helped-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e0335fcd
  23. 22 2月, 2011 1 次提交
    • J
      Teach commit about CHERRY_PICK_HEAD · 37f7a857
      Jay Soffian 提交于
      Previously the user was advised to use commit -c CHERRY_PICK_HEAD after
      a conflicting cherry-pick. While this would preserve the original
      commit's authorship, it would sadly discard cherry-pick's carefully
      crafted MERGE_MSG (which contains the list of conflicts as well as the
      original commit-id in the case of cherry-pick -x).
      
      On the other hand, if a bare 'commit' were performed, it would preserve
      the MERGE_MSG while resetting the authorship.
      
      In other words, there was no way to simultaneously take the authorship
      from CHERRY_PICK_HEAD and the commit message from MERGE_MSG.
      
      This change fixes that situation. A bare 'commit' will now take the
      authorship from CHERRY_PICK_HEAD and the commit message from MERGE_MSG.
      If the user wishes to reset authorship, that must now be done explicitly
      via --reset-author.
      
      A side-benefit of passing commit authorship along this way is that we
      can eliminate redundant authorship parsing code from revert.c.
      
      (Also removed an unused include from revert.c)
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      37f7a857