Commits on Oct 21, 2007
  1. git-gui: Don't display CR within console windows

    spearce committed Oct 21, 2007
    Git progress bars from tools like git-push and git-fetch use CR
    to skip back to the start of the current line and redraw it with
    an updated progress.  We were doing this in our Tk widget but had
    failed to skip the CR, which Tk doesn't draw well.
    Signed-off-by: Shawn O. Pearce <>
  2. git-gui: Handle progress bars from newer gits

    spearce committed Oct 20, 2007
    Post Git 1.5.3 a new style progress bar has been introduced that
    uses only one line rather than two.  The formatting of the completed
    and total section is also slightly different so we must adjust our
    regexp to match.  Unfortunately both styles are in active use by
    different versions of Git so we need to look for both.
    Signed-off-by: Shawn O. Pearce <>
Commits on Oct 20, 2007
  1. git-gui: Correctly report failures from git-write-tree

    spearce committed Oct 20, 2007
    If git-write-tree fails (such as if the index file is currently
    locked and it wants to write to it) we were not getting the error
    message as $tree_id was always the empty string so we shortcut
    through the catch and never got the output from stderr.
    Signed-off-by: Shawn O. Pearce <>
Commits on Oct 8, 2007
  1. git-gui: accept versions containing text annotations, like 1.5.3.mingw.1

    sprohaska committed with spearce Oct 6, 2007
    This commit teaches git-gui to accept versions with annotations
    that start with text and optionally end with a dot followed by
    a number.
    This is needed by the current versioning scheme of msysgit,
    which uses versions like 1.5.3.mingw.1. However, the changes
    is not limited to this use case. Any version of the form
    <numeric version>.<anytext>.<number> would be parsed and only
    the starting <numeric version> used for validation.
    [sp: Minor edit to remove unnecessary group matching]
    Signed-off-by: Steffen Prohaska <>
    Signed-off-by: Shawn O. Pearce <>
Commits on Oct 3, 2007
  1. git-gui: Don't crash when starting gitk from a browser session

    spearce committed Oct 2, 2007
    If the user has started git-gui from the command line as a browser
    we offer the gitk menu options but we didn't create the main status
    bar widget in the "." toplevel.  Trying to access it while starting
    gitk just results in Tcl errors.
    Signed-off-by: Shawn O. Pearce <>
  2. git-gui: Allow gitk to be started on Cygwin with native Tcl/Tk

    spearce committed Oct 2, 2007
    gitk expects $env(GIT_DIR) to be valid as both a path that core Git
    and Tcl/Tk can resolve to a valid directory, but it has no special
    handling for Cygwin style UNIX paths and Windows style paths.  So
    we need to do that for gitk and ensure that only relative paths are
    fed to it, thus allowing both Cygwin style and UNIX style paths to
    be resolved.
    Signed-off-by: Shawn O. Pearce <>
Commits on Sep 22, 2007
  1. git-gui: Ensure .git/info/exclude is honored in Cygwin workdirs

    spearce committed Sep 21, 2007
    If we are using Cygwin and the git repository is actually a
    workdir (by way of git-new-workdir) but this Tcl process is
    a native Tcl/Tk and not the Cygwin Tcl/Tk then we are unable
    to traverse the .git/info path as it is a Cygwin symlink and
    not a standard Windows directory.
    So we actually need to start a Cygwin process that can do the
    path translation for us and let it test for .git/info/exclude
    so we know if we can include that file in our git-ls-files or
    Signed-off-by: Shawn O. Pearce <>
  2. git-gui: Handle starting on mapped shares under Cygwin

    spearce committed Sep 21, 2007
    I really cannot explain Cygwin's behavior here but if we start
    git-gui through Cygwin on a local drive it appears that Cygwin
    is leaving $env(PATH) in Unix style, even if it started a native
    (non-Cygwin) Tcl/Tk process to run git-gui.  Yet starting that
    same git-gui and Tcl/Tk combination through Cygwin on a network
    share causes it to automatically convert $env(PATH) into Windows
    style, which broke our internal "which" implementation.
    Signed-off-by: Shawn O. Pearce <>
  3. git-gui: Display message box when we cannot find git in $PATH

    spearce committed Sep 21, 2007
    If we cannot find the git executable in the user's $PATH then
    we cannot function correctly.  Because we need that to get the
    version so we can load our library correctly we cannot rely on
    the library function "error_popup" here, as this is all running
    before the library path has been configured, so error_popup is
    not available to us.
    Signed-off-by: Shawn O. Pearce <>
Commits on Sep 20, 2007
  1. git-gui: Avoid using bold text in entire gui for some fonts

    MrHacky committed with spearce Sep 18, 2007
    Signed-off-by: Shawn O. Pearce <>
Commits on Sep 17, 2007
  1. git-gui: Disable native platform text selection in "lists"

    spearce committed Sep 17, 2007
    Sometimes we use a Tk text widget as though it were a listbox.
    This happens typically when we want to show an icon to the left
    of the text label or just when a text widget is generally a better
    choice then the native listbox widget.
    In these cases if we want the user to have control over the selection
    we implement our own "in_sel" tag that shows the selected region
    and we perform our own selection management in the background
    via keybindings and mouse bindings.  In such uses we don't want
    the user to be able to activate the native platform selection by
    dragging their mouse through the text widget.  Doing so creates a
    very confusing display and the user is left wondering what it may
    mean to have two different types of selection in the same widget.
    Tk doesn't allow us to delete the "sel" tag that it uses internally
    to manage the native selection but it will allow us to make it
    invisible by setting the tag to have the same display properties
    as unselected text.  So long as we don't actually use the "sel"
    tag for anything in code its effectively invisible.
    Signed-off-by: Shawn O. Pearce <>
Commits on Sep 14, 2007
  1. git-gui: Paper bag fix "Commit->Revert" format arguments

    spearce committed Sep 14, 2007
    The recent bug fix to correctly handle filenames with %s (or any
    other valid Tcl format specifier) missed a \ on this line and
    caused the remaining format arguments to not be supplied when we
    updated the status bar.  This caused a Tcl error anytime the user
    was trying to perform a file revert.
    Signed-off-by: Shawn O. Pearce <>
  2. git-gui: Provide 'uninstall' Makefile target to undo an installation

    spearce committed Sep 13, 2007
    Several users have requested a "make uninstall" target be provided
    in the stock git-gui Makefile so that they can undo an install
    if git-gui goes to the wrong place during the initial install,
    or if they are unhappy with the tool and want to remove it from
    their system.
    We currently assume that the complete set of files we need to delete
    are those defined by our Makefile and current source directory.
    This could differ from what the user actually has installed if they
    installed one version then attempt to use another to perform the
    uninstall.  Right now I'm just going to say that is "pilot error".
    Users should uninstall git-gui using the same version of source
    that they used to make the installation.  Perhaps in the future we
    could read tclIndex and base our uninstall decisions on its contents.
    Signed-off-by: Shawn O. Pearce <>
Commits on Sep 13, 2007
  1. git-gui: Font chooser to handle a large number of font families

    spearce committed Sep 13, 2007
    Simon Sasburg noticed that on X11 if there are more fonts than can
    fit in the height of the screen Tk's native tk_optionMenu does not
    offer scroll arrows to the user and it is not possible to review
    all choices or to select those that are off-screen.  On Mac OS X
    the tk_optionMenu works properly but is awkward to navigate if the
    list is long.
    This is a rewrite of our font selection by providing a new modal
    dialog that the user can launch from the git-gui Options panel.
    The dialog offers the user a scrolling list of fonts in a pane.
    An example text shows the user what the font looks like at the size
    they have selected.  But I have to admit the example pane is less
    than ideal.  For example in the case of our diff font we really
    should show the user an example diff complete with our native diff
    syntax coloring.
    Signed-off-by: Shawn O. Pearce <>
    Acked-by: Simon Sasburg <>
  2. git-gui: Make backporting changes from i18n version easier

    spearce committed Sep 13, 2007
    This is a very trivial hack to define a global mc procedure that
    does not actually perform i18n translations on its input strings.
    By declaring an mc procedure here in our maint version of git-gui
    we can take patches that are intended for the latest development
    version of git-gui and easily backport them without needing to
    tweak the mc calls first.
    Signed-off-by: Shawn O. Pearce <>
Commits on Sep 11, 2007
  1. git-gui: Don't delete send on Windows as it doesn't exist

    spearce committed Sep 11, 2007
    The Windows port of Tk does not have the send command so we
    cannot delete it from our global namespace, but the Mac OS
    X and X11 ports do have it.  Switching this delete attempt
    into a catch makes send go away, or stay away.
    Signed-off-by: Shawn O. Pearce <>
Commits on Sep 10, 2007
  1. git-gui: Trim trailing slashes from untracked submodule names

    spearce committed Sep 10, 2007
    Oddly enough `git ls-files --others` supplies us the name of an
    untracked submodule by including the trailing slash but that
    same git version will not accept the name with a trailing slash
    through `git update-index --stdin`.  Stripping off that final
    slash character before loading it into our file lists allows
    git-gui to stage changes to submodules just like any other file.
    This change should give git-gui users some basic submodule support,
    but it is strictly at the plumbing level as we do not actually know
    about calling the git-submodule porcelain that is a recent addition
    to git 1.5.3.
    Signed-off-by: Shawn O. Pearce <>
  2. git-gui: Assume untracked directories are Git submodules

    spearce committed Sep 10, 2007
    If `git ls-files --others` returned us the name of a directory then
    it is because Git has decided that this directory itself contains a
    valid Git repository and its files shouldn't be listed as untracked
    for this repository.
    In such a case we should label the object as a Git repository and
    not just as a directory.
    Signed-off-by: Shawn O. Pearce <>
Commits on Sep 9, 2007
  1. git-gui: handle "deleted symlink" diff marker

    chunga committed with spearce Sep 9, 2007
    Signed-off-by: Michele Ballabio <>
    Signed-off-by: Shawn O. Pearce <>
  2. git-gui: show unstaged symlinks in diff viewer

    chunga committed with spearce Sep 9, 2007
    git-gui has a minor problem with regards to symlinks that point
    to directories.
    	git init
    	mkdir realdir
    	ln -s realdir linkdir
    	git gui
    Now clicking on file names in the "unstaged changes" window,
    there's a problem coming from the "linkdir" symlink: git-gui
    complains with
    	error reading "file4": illegal operation on a directory
    ...even though git-gui can add that same symlink to the index just
    This patch fix this by adding a check.
    [sp: Minor fix to use {link} instead of "link" in condition
         and to only open the path if it is not a symlink.]
    Signed-off-by: Michele Ballabio <>
    Signed-off-by: Shawn O. Pearce <>
  3. git-gui: Avoid use of libdir in Makefile

    spearce committed Sep 9, 2007
    Dmitry V. Levin pointed out that on GNU linux libdir is often used
    in Makefiles to mean "/usr/lib" or "/usr/lib64", a directory that
    is meant to hold platform-specific binary files.  Using a different
    libdir meaning here in git-gui's Makefile breaks idomatic expressions
    like rpm specifile "make libdir=%_libdir".
    Originally I asked that the git.git Makefile undefine libdir before
    it calls git-gui's own Makefile but it turns out this is very hard
    to do, if not impossible.  Renaming our libdir to gg_libdir resolves
    this case with a minimum amount of fuss on our part.
    Signed-off-by: Shawn O. Pearce <>
  4. git-gui: Disable Tk send in all git-gui sessions

    spearce committed Sep 9, 2007
    The Tk designers blessed us with the "send" command, which on X11
    will allow anyone who can connect to your X server to evaluate any
    Tcl code they desire within any running Tk process.  This is just
    plain nuts.  If git-gui wants someone running Tcl code within it
    then would ask someone to supply that Tcl code to it; waiting for
    someone to drop any random Tcl code into us is not fantastic idea.
    By renaming send to the empty name the procedure will be removed
    from the global namespace and Tk will stop responding to random Tcl
    evaluation requests sent through the X server.  Since there is no
    facility to filter these requests it is unlikely that we will ever
    consider enabling this command.
    Signed-off-by: Shawn O. Pearce <>
  5. git-gui: lib/index.tcl: handle files with % in the filename properly

    Gerrit Pape committed with spearce Sep 7, 2007
    Steps to reproduce the bug:
     $ mkdir repo && cd repo && git init
     Initialized empty Git repository in .git/
     $ touch 'foo%3Fsuite'
     $ git-gui
    Then click on the 'foo%3Fsuite' icon to include it in a changeset, a
    popup comes with:
    'Error: bad field specifier "F"'
    Vincent Danjean noticed the problem and also suggested the fix, reported
    Signed-off-by: Gerrit Pape <>
    Signed-off-by: Shawn O. Pearce <>
Commits on Sep 4, 2007
  1. git-gui: Properly set the state of "Stage/Unstage Hunk" action

    spearce committed Sep 2, 2007
    Today I found yet another way for the "Stage Hunk" and "Unstage
    Hunk" context menu actions to leave the wrong state enabled in
    the UI.  The problem this time was that I connected the state
    determination to the value of $::current_diff_side (the side the
    diff is from).  When the user was last looking at a diff from the
    index side and unstages everything the diff panel goes empty, but
    the action stayed enabled as we always assumed unstaging was a
    valid action.
    This change moves the logic for determining when the action is
    enabled away from the individual side selection, as they really
    are two unrelated concepts.
    Signed-off-by: Shawn O. Pearce <>
  2. git-gui: Fix detaching current branch during checkout

    spearce committed Sep 2, 2007
    If the user tried to detach their HEAD while keeping the working
    directory on the same commit we actually did not completely do
    a detach operation internally.  The problem was caused by git-gui
    not forcing the HEAD symbolic ref to be updated to a SHA-1 hash
    when we were not switching revisions.  Now we update the HEAD ref
    if we aren't currently detached or the hashes don't match.
    Signed-off-by: Shawn O. Pearce <>
  3. git-gui: Correct starting of git-remote to handle -w option

    spearce committed Sep 2, 2007
    Current versions of git-remote apparently are passing the -w option
    to Perl as part of the shbang line:
      #!/usr/bin/perl -w
    this caused a problem in git-gui and gave the user a Tcl error with
    the message: "git-remote not supported: #!/usr/bin/perl -w".
    The fix for this is to treat the shbang line as a Tcl list and look
    at the first element only for guessing the executable name.  Once
    we know the executable name we use the remaining elements (if any
    exist) as arguments to the executable, before the script filename.
    Signed-off-by: Shawn O. Pearce <>
Commits on Aug 25, 2007
  1. git-gui: Correct 'git gui blame' in a subdirectory

    spearce committed Aug 25, 2007
    David Kastrup pointed out that the following sequence was not
    working as we had intended:
      $ cd lib
      $ git gui blame console.tcl
      fatal: cannot stat path lib/console.tcl: No such file or directory
    The problem here was we disabled the chdir to the root of the
    working tree when we are running with a "bare allowed" feature
    such as blame or browser, but we still kept the prefix we found via
    `git rev-parse --show-prefix`.  This caused us to try and look for
    the file "console.tcl" within the subdirectory but also include
    the subdirectory's own path from the root of the working tree.
    This is unlikely to succeed, unless the user just happened to have
    a "lib/lib/console.tcl" file in the repository, in which case we
    would produce the wrong result.
    In the case of a bare repository we shouldn't get back a value from
    `rev-parse --show-prefix`, so really $_prefix should only be set
    to the non-empty string if we are in a working tree and we are in a
    subdirectory of that working tree.  If this is true we really want
    to always be at the top level of the working tree, as all paths are
    accessed as though they were relative to the top of the working tree.
    Converting $_prefix to a ../ sequence is a fairly simple approach
    to moving up the requisite levels.
    Signed-off-by: Shawn O. Pearce <>
Commits on Aug 23, 2007
  1. git-gui: Do not offer to stage three-way diff hunks into the index

    spearce committed Aug 23, 2007
    git-apply does not accept a patch that was generated as a three-way
    combined diff format such as we see during merge conflicts.  If we
    get such a diff in our diff viewer and try to send it to git-apply
    it just errors out and the user is left confused wondering why they
    cannot stage that hunk.
    Instead of feeding a known to be unacceptable hunk to git-apply we
    now just disable the stage/unstage context menu option if the hunk
    came from a three way diff.  The user may still be confused about
    why they cannot work with a combined diff, but at least they are
    only confused as to why git-gui is not offering them the action.
    Signed-off-by: Shawn O. Pearce <>
  2. git-gui: Refactor diff pane popup support for future improvements

    spearce committed Aug 23, 2007
    The current popup_diff_menu procedure is somewhat messy as it has a
    few duplications of the same logic in each of the different legs of
    the routine.  We can simplify these by setting a few state variables
    in the different legs.
    No functional change, just a cleanup to make it easier to implement
    future functional changes within this block.
    Signed-off-by: Shawn O. Pearce <>
Commits on Aug 22, 2007
  1. git-gui: Fix "unoptimized loading" to not cause git-gui to crash

    spearce committed Aug 22, 2007
    If the tclsh command was not available to us at the time we were
    "built" our lib/tclIndex just lists all of our library files and
    we source all of them at once during startup, rather than trying
    to lazily load only the procedures we need.  This is a problem as
    some of our library code now depends upon the git-version proc,
    and that proc is not defined until after the library was fully
    I'm moving the library loading until after we have determined the
    version of git we are talking to, as this ensures that the required
    git-reversion procedure is defined before any library code can be
    loaded.  Since error_popup is defined in the library we instead use
    tk_messageBox directly for errors found during the version detection.
    Signed-off-by: Shawn O. Pearce <>
Commits on Aug 21, 2007
  1. git-gui: Paper bag fix "Stage Hunk For Commit" in diff context menu

    spearce committed Aug 21, 2007
    In a13ee29 I totally broke the
    "Stage Hunk For Commit" feature by making this menu item always
    appear in a disabled state, so it was never invokable.  A "teaser
    feature", just sitting there taunting the poor user who has become
    used to having it available.
    The issue caused by a13ee was I added a test to look at the data
    in $file_states, but I didn't do that test correctly as it was
    always looking at a procedure local $file_states array, which is
    not defined, so the test was always true and we always disabled
    the menu entry.
    Instead we only want to disable the menu entry if the current file
    we are looking at has no file state information (git-gui is just a
    very confused little process) or it is an untracked file (and we
    cannot stage individual hunks).
    Signed-off-by: Shawn O. Pearce <>
Commits on Aug 20, 2007
  1. git-gui: Allow git-merge to use branch names in conflict markers

    spearce committed Aug 20, 2007
    Earlier when I rewrote the merge implementation for git-gui I broke
    it such that the conflict markers for the "theirs" side of the hunk
    was using a full SHA-1 ID in hex, rather than the name of the branch
    the user had merged.  This was because I got paranoid and passed off
    the full SHA-1 to git-merge, instead of giving it the reference name
    the user saw in the merge dialog.
    I'd still like to resolve the SHA-1 upfront in git-gui and always use
    that value throughout the merge, but I can't do that until we have a
    full implementation of git-merge written in Tcl.  Until then its more
    important that the conflict markers be useful to the end-user, so we
    need to pass off the ref name and not the SHA-1 ID.
    Signed-off-by: Shawn O. Pearce <>
  2. git-gui: Fix window manager problems on ion3

    spearce committed Aug 20, 2007
    cehteh on #git noticed that secondary windows such as console
    windows from push/fetch/merge or the blame browser failed on ion
    when we tried to open them a second time.
    The issue turned out to be the fact that on ion [winfo ismapped .]
    returns false if . is not visible right now because it has been
    obscured by another window in the same panel.  So we need to keep
    track of whether or not the root window has been displayed for this
    application, and once it has been we cannot ever assume that ismapped
    is going to return true.
    Signed-off-by: Shawn O. Pearce <>
Commits on Aug 4, 2007
  1. git-gui: Added support for OS X right click

    Väinö Järvelä committed with spearce Aug 3, 2007
    OS X sends Button-2 on a "real" right click, such as with a three
    button mouse, or by using the two-finger trackpad click.
    Signed-off-by: Väinö Järvelä <>
    Signed-off-by: Shawn O. Pearce <>
Commits on Aug 3, 2007
  1. git-gui: Avoid Tcl error in popup menu on diff viewer

    spearce committed Aug 3, 2007
    If there is no path currently shown in the diff viewer then we
    were getting Tcl errors anytime the user right-clicked on the
    diff viewer to bring up its popup menu.  The bug here is caused
    by trying to get the file_state for the empty string; this path
    is never seen so we never have file_state for it.  In such cases
    we now disable the Stage Hunk For Commit option.
    Signed-off-by: Shawn O. Pearce <>