1. 11 10月, 2008 1 次提交
  2. 25 9月, 2008 4 次提交
  3. 05 9月, 2008 4 次提交
  4. 02 9月, 2008 1 次提交
  5. 27 7月, 2008 3 次提交
    • A
      git-gui: Preserve scroll position on reshow_diff. · 25b8fb1e
      Alexander Gavrilov 提交于
      It is especially useful for Stage/Unstage Line, because
      they invoke full state scan and diff reload, which originally
      would reset the scroll position to the top of the file.
      Signed-off-by: NAlexander Gavrilov <angavrilov@gmail.com>
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      25b8fb1e
    • J
      git-gui: "Stage Line": Treat independent changes in adjacent lines better · c7f74570
      Johannes Sixt 提交于
      Assume that we want to commit these states:
      
        Old state == HEAD    Intermediate state   New state
        --------------------------------------------------------
        context before       context before       context before
        old 1                new 1                new 1
        old 2                old 2                new 2
        context after        context after        context after
      
      that is, want to commit two changes in this order:
      
        1. transform "old 1" into "new 1"
        2. transform "old 2" into "new 2"
      
      [This discussion and this patch is about this very case and one other case
      as outlined below; any other intermediate states that one could imagine are
      not affected by this patch.]
      
      Now assume further, that we have not staged and commited anything, but we
      have already changed the working file to the new state. Then we will see
      this hunk in the "Unstaged Changes":
      
        @@ -1,4 +1,4 @@
         context before
        -old 1
        -old 2
        +new 1
        +new 2
         context after
      
      The obvious way to stage the intermediate state is to apply "Stage This
      Line" to "-old 1" and "+new 1". Unfortunately, this resulted in this
      intermediate state:
      
        context before
        old 2
        new 1
        context after
      
      which is not what we wanted. In fact, it was impossible to stage the
      intermediate state using "Stage Line". The crux was that if a "+" line was
      staged, then the "-" lines were converted to context lines and arranged
      *before* the "+" line in the forged hunk that we fed to 'git apply'.
      
      With this patch we now treat "+" lines that are staged differently. In
      particular, the "-" lines before the "+" block are moved *after* the
      staged "+" line. Now it is possible to get the correct intermediate state
      by staging "-old 1" and "+new 1". Problem solved.
      
      But there is a catch.
      
      Noticing that we didn't get the right intermediate state by staging
      "-old 1" and "+new 1", we could have had the idea to stage the complete
      hunk and to *unstage* "-old 2" and "+new 2". But... the result is the same.
      The reason is that there is the exact symmetric problem with unstaging the
      last "-" and "+" line that are in adjacent blocks of "-" and "+" lines.
      
      This patch does *not* change the way in which "-" lines are *unstaged*.
      
      Why? Because if we did (i.e. move "+" lines before the "-" line after
      converting them to context lines), then it would be impossible to stage
      this intermediate state:
      
        context before
        old 1
        new 2
        context after
      
      that is, it would be impossible to stage the two independet changes in the
      opposite order.
      
      Let's look at this case a bit further: The obvious way to get this
      intermediate state would be to apply "Stage This Line" to "-old 2" and
      "+new 2". Before this patch, this worked as expected. With this patch, it
      does not work as expected, but it can still be achieved by first staging
      the entire hunk, then *unstaging* "-old 1" and "+new 1".
      
      In summary, this patch makes a common case possible, at the expense that
      a less common case is made more complicated for the user.
      Signed-off-by: NJohannes Sixt <johannes.sixt@telecom.at>
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      c7f74570
    • J
      git-gui: Fix "Stage/Unstage Line" with one line of context. · fa6b5b39
      Johannes Sixt 提交于
      To "Stage/Unstage Line" we construct a patch that contains exactly one
      change (either addition or removal); the hunk header was forged by counting
      the old side and adjusting the count by +/-1 for the new side. But when we
      counted the context we never counted the changed line itself. If the hunk
      had only one removal line and one line of context, like this:
      
          @@ -1,3 +1,2 @@
           context 1
          -removal
           context 2
      
      We had constructed this patch:
      
          @@ -1,2 +1,1 @@
           context 1
          -removal
           context 2
      
      which does not apply because git apply deduces that it must apply at the
      end of the file. ("context 2" is considered garbage and ignored.) The fix
      is that removal lines must be counted towards the context of the old side.
      Signed-off-by: NJohannes Sixt <johannes.sixt@telecom.at>
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      fa6b5b39
  6. 02 7月, 2008 1 次提交
    • J
      git-gui: Implement "Stage/Unstage Line" · 5821988f
      Johannes Sixt 提交于
      This adds a context menu entry below "Stage/Unstage Hunk" that stages or
      unstages just the line under the mouse pointer.
      
      This is by itself useful, for example, if there are unrelated changes in
      the same hunk and the hunk cannot be split by reducing the context.
      
      The feature can also be used to split a hunk by staging a number of
      additions (or unstaging a number of removals) until there are enough
      context lines that the hunk gets split.
      
      The implementation reads the complete hunk that the line lives in, and
      constructs a new hunk by picking existing context lines, removing unneeded
      change lines and transforming other change lines to context lines. The
      resulting hunk is fed through 'git apply' just like in the "Stage/Unstage
      Hunk" case.
      Signed-off-by: NJohannes Sixt <johannes.sixt@telecom.at>
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      5821988f
  7. 16 1月, 2008 1 次提交
    • S
      git-gui: Refresh file status description after hunk application · a41e45ea
      Shawn O. Pearce 提交于
      If we apply a hunk in either direction this may change the file's
      status.  For example if a file is completely unstaged, and has at
      least two hunks in it and the user stages one hunk the file will
      change from "Modified, not staged" to "Portions staged for commit".
      
      Resetting the file path causes our trace on this variable to fire;
      that trace is used to update the file header in the diff viewer to
      the file's current status.
      
      Noticed by Johannes Sixt.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      a41e45ea
  8. 14 12月, 2007 1 次提交
  9. 14 9月, 2007 2 次提交
    • S
      git-gui: Paper bag fix missing translated strings · 31bb1d1b
      Shawn O. Pearce 提交于
      The Tcl expression "[append [mc Foo] Bar]" does not return the string
      "FooBar" after translation; instead it is setting the variable Foo to
      the value Bar, or if Foo is already defined it is appending Bar onto
      the end of it.  This is *not* what we wanted to have happen here.
      
      Tcl's join function is actually the correct function but its default
      joinStr argument is a single space.  Unfortunately all of our call
      sites do not want an extra space added to their string.  So we need
      a small wrapper function to make the call to join with an empty
      join string.  In C this is (roughly) the job of the strcat function.
      Since strcat is not yet used at the global level it is a reasonable
      name to use here.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      31bb1d1b
    • M
      git-gui: add some strings to translation · c8c4854b
      Michele Ballabio 提交于
      Most of these changes were suggested by Shawn Pearce in an answer
      to Johannes Schindelin.
      
      Some strings for the blame module were added too.
      
      [sp: Minor edits in blame module formatting]
      Signed-off-by: NMichele Ballabio <barra_cuda@katamail.com>
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      c8c4854b
  10. 10 9月, 2007 3 次提交
  11. 02 9月, 2007 1 次提交
  12. 17 7月, 2007 1 次提交
    • S
      git-gui: Always disable the Tcl EOF character when reading · 6eb420ef
      Shawn O. Pearce 提交于
      On Windows (which includes Cygwin) Tcl defaults to leaving the EOF
      character of input file streams set to the ASCII EOF character, but
      if that character were to appear in the data stream then Tcl will
      close the channel early.  So we have to disable eofchar on Windows.
      Since the default is disabled on all platforms except Windows, we
      can just disable it everywhere to prevent any sort of read problem.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      6eb420ef
  13. 09 7月, 2007 2 次提交
    • S
      git-gui: Always use absolute path to all git executables · 0b812616
      Shawn O. Pearce 提交于
      Rather than making the C library search for git every time we want
      to execute it we now search for the main git wrapper at startup, do
      symlink resolution, and then always use the absolute path that we
      found to execute the binary later on.  This should save us some
      cycles, especially on stat challenged systems like Cygwin/Win32.
      
      While I was working on this change I also converted all of our
      existing pipes ([open "| git ..."]) to use two new pipe wrapper
      functions.  These functions take additional options like --nice
      and --stderr which instructs Tcl to take special action, like
      running the underlying git program through `nice` (if available)
      or redirect stderr to stdout for capture in Tcl.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      0b812616
    • S
      git-gui: Refactor our ui_status_value update technique · 699d5601
      Shawn O. Pearce 提交于
      I'm really starting to dislike global variables.  The ui_status_value
      global varible is just one of those that seems to appear in a lot of
      code and in many cases we didn't even declare it "global" within the
      proc that updates it so we haven't always been getting all of the
      updates we expected to see.
      
      This change introduces two new global procs:
      
        ui_status $msg;   # Sets the status bar to show $msg.
        ui_ready;         # Changes the status bar to show "Ready."
      
      The second (special) form is used because we often update the area
      with this message once we are done processing a block of work and
      want the user to know we have completed it.
      
      I'm not fixing the cases that appear in lib/branch.tcl right now
      as I'm actually in the middle of a huge refactoring of that code
      to support making a detached HEAD checkout.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      699d5601
  14. 01 6月, 2007 1 次提交
  15. 08 5月, 2007 1 次提交
    • S
      git-gui: Refactor into multiple files to save my sanity · f522c9b5
      Shawn O. Pearce 提交于
      I'm finding it difficult to work with a 6,000+ line Tcl script
      and not go insane while looking for a particular block of code.
      Since most of the program is organized into different units of
      functionality and not all users will need all units immediately
      on startup we can improve things by splitting procs out into
      multiple files and let auto_load handle things for us.
      
      This should help not only to better organize the source, but
      it may also improve startup times for some users as the Tcl
      parser does not need to read as much script before it can show
      the UI.  In many cases the user can avoid reading at least half
      of git-gui now.
      
      Unfortunately we now need a library directory in our runtime
      location.  This is currently assumed to be $(sharedir)/git-gui/lib
      and its expected that the Makefile invoker will setup some sort of
      reasonable sharedir value for us, or let us assume its going to be
      $(gitexecdir)/../share.
      
      We now also require a tclsh (in TCL_PATH) to just run the Makefile,
      as we use tclsh to generate the tclIndex for our lib directory.  I'm
      hoping this is not an unncessary burden on end-users who are building
      from source.
      
      I haven't really made any functionality changes here, this is just a
      huge migration of code from one file to many smaller files.  All of
      the new changes are to setup the library path and install the library
      files.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      f522c9b5