1. 06 12月, 2007 1 次提交
    • J
      Color support for "git-add -i" · b4c61ed6
      Junio C Hamano 提交于
      This is mostly lifted from earlier series by Dan Zwell, but updated to
      use "git config --get-color" and "git config --get-colorbool" to make it
      simpler and more consistent with commands written in C.
      
      A new configuration color.interactive variable is like color.diff and
      color.status, and controls if "git-add -i" uses color.
      
      A set of configuration variables, color.interactive.<slot>, are used to
      define what color is used for the prompt, header, and help text.
      
      For perl scripts, Git.pm provides $repo->get_color() method, which takes
      the slot name and the default color, and returns the terminal escape
      sequence to color the output text.  $repo->get_colorbool() method can be
      used to check if color is set to be used for a given operation.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b4c61ed6
  2. 03 12月, 2007 2 次提交
  3. 01 12月, 2007 1 次提交
    • W
      Highlight keyboard shortcuts in git-add--interactive · 14cb5038
      Wincent Colaiuta 提交于
      The user interface provided by the command loop in git-add--interactive
      gives the impression that subcommands can only be launched by entering
      an integer identifier from 1 through 8.
      
      A "hidden" feature is that any string can be entered, and a regex search
      anchored at the beginning of the string is used to find the uniquely
      matching option.
      
      This patch makes this feature a little more obvious by highlighting the
      first character of each subcommand (for example "patch" is displayed as
      "[p]atch").
      
      A new function is added to detect the shortest unique prefix and this
      is used to decide what to highlight. Highlighting is also applied when
      choosing files.
      
      In the case where the common prefix may be unreasonably large
      highlighting is omitted; in this patch the soft limit (above which the
      highlighting will be omitted for a particular item) is 0 (in other words,
      there is no soft limit) and the hard limit (above which highlighting will
      be omitted for all items) is 3, but this can be tweaked.
      
      The actual highlighting is done by the highlight_prefix function, which
      will enable us to implement ANSI color code-based highlighting (most
      likely using underline or boldface) in the future.
      Signed-off-by: NWincent Colaiuta <win@wincent.com>
      Acked-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      14cb5038
  4. 29 11月, 2007 1 次提交
  5. 26 11月, 2007 1 次提交
    • W
      Add "--patch" option to git-add--interactive · b63e9950
      Wincent Colaiuta 提交于
      When the "--patch" option is supplied, the patch_update_cmd() function is
      called bypassing the main_loop() and exits.
      
      Seeing as builtin-add is the only caller of git-add--interactive we can
      impose a strict requirement on the format of the arguments to avoid
      possible ambiguity: an "--" argument must be used whenever any pathspecs
      are passed, both with the "--patch" option and without it.
      Signed-off-by: NWincent Colaiuta <win@wincent.com>
      b63e9950
  6. 23 11月, 2007 1 次提交
    • J
      git-add -i: allow multiple selection in patch subcommand · 12db334e
      Junio C Hamano 提交于
      This allows more than one files from the list to be chosen from
      the patch subcommand instead of going through the file one by
      one.
      
      This also updates the "list-and-choose" UI for usability.  When
      the prompt ends with ">>", if you type '*' to choose all
      choices, the prompt immediately returns the choice without
      requiring an extra empty line to confirm the selection.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      12db334e
  7. 22 11月, 2007 2 次提交
  8. 16 11月, 2007 1 次提交
  9. 16 10月, 2007 2 次提交
  10. 30 9月, 2007 2 次提交
  11. 02 8月, 2007 1 次提交
  12. 08 2月, 2007 1 次提交
  13. 19 12月, 2006 2 次提交
    • J
      git-add --interactive: hunk splitting · 835b2aeb
      Junio C Hamano 提交于
      This adds hunk splitting and recounting the patch lines.  The
      'patch' subcommand now allows you to split a large hunk at
      context lines in the middle.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      835b2aeb
    • J
      git-add --interactive · 5cde71d6
      Junio C Hamano 提交于
      A script to be driven when the user says "git add --interactive"
      is introduced.
      
      When it is run, first it runs its internal 'status' command to
      show the current status, and then goes into its internactive
      command loop.
      
      The command loop shows the list of subcommands available, and
      gives a prompt "What now> ".  In general, when the prompt ends
      with a single '>', you can pick only one of the choices given
      and type return, like this:
      
          *** Commands ***
            1: status       2: update       3: revert       4: add untracked
            5: patch        6: diff         7: quit         8: help
          What now> 1
      
      You also could say "s" or "sta" or "status" above as long as the
      choice is unique.
      
      The main command loop has 6 subcommands (plus help and quit).
      
       * 'status' shows the change between HEAD and index (i.e. what
         will be committed if you say "git commit"), and between index
         and working tree files (i.e. what you could stage further
         before "git commit" using "git-add") for each path.  A sample
         output looks like this:
      
                    staged     unstaged path
           1:       binary      nothing foo.png
           2:     +403/-35        +1/-1 git-add--interactive.perl
      
         It shows that foo.png has differences from HEAD (but that is
         binary so line count cannot be shown) and there is no
         difference between indexed copy and the working tree
         version (if the working tree version were also different,
         'binary' would have been shown in place of 'nothing').  The
         other file, git-add--interactive.perl, has 403 lines added
         and 35 lines deleted if you commit what is in the index, but
         working tree file has further modifications (one addition and
         one deletion).
      
       * 'update' shows the status information and gives prompt
         "Update>>".  When the prompt ends with double '>>', you can
         make more than one selection, concatenated with whitespace or
         comma.  Also you can say ranges.  E.g. "2-5 7,9" to choose
         2,3,4,5,7,9 from the list.  You can say '*' to choose
         everything.
      
         What you chose are then highlighted with '*', like this:
      
                    staged     unstaged path
           1:       binary      nothing foo.png
         * 2:     +403/-35        +1/-1 git-add--interactive.perl
      
         To remove selection, prefix the input with - like this:
      
              Update>> -2
      
         After making the selection, answer with an empty line to
         stage the contents of working tree files for selected paths
         in the index.
      
       * 'revert' has a very similar UI to 'update', and the staged
         information for selected paths are reverted to that of the
         HEAD version.  Reverting new paths makes them untracked.
      
       * 'add untracked' has a very similar UI to 'update' and
         'revert', and lets you add untracked paths to the index.
      
       * 'patch' lets you choose one path out of 'status' like
         selection.  After choosing the path, it presents diff between
         the index and the working tree file and asks you if you want
         to stage the change of each hunk.  You can say:
      
              y - add the change from that hunk to index
              n - do not add the change from that hunk to index
              a - add the change from that hunk and all the rest to index
              d - do not the change from that hunk nor any of the rest to index
              j - do not decide on this hunk now, and view the next
                  undecided hunk
              J - do not decide on this hunk now, and view the next hunk
              k - do not decide on this hunk now, and view the previous
                  undecided hunk
              K - do not decide on this hunk now, and view the previous hunk
      
         After deciding the fate for all hunks, if there is any hunk
         that was chosen, the index is updated with the selected hunks.
      
       * 'diff' lets you review what will be committed (i.e. between
         HEAD and index).
      
      This is still rough, but does everything except a few things I
      think are needed.
      
       * 'patch' should be able to allow splitting a hunk into
         multiple hunks.
      
       * 'patch' does not adjust the line offsets @@ -k,l +m,n @@
         in the hunk header.  This does not have major problem in
         practice, but it _should_ do the adjustment.
      
       * It does not have any explicit support for a merge in
         progress; it may not work at all.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      5cde71d6