This adds a removeBranch method similar to the addBranch method. It
calls these methods when a branch is created/deleted in the UI, avoiding
the cost of simply calling refresh afterwards.
Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
This enables a "discard" button for unstaged hunks which simply gets rid of the
changes (by using "git apply --reverse").
To avoid repetition, the stageHunk method was split into a more generic
processHunk method. The "discard" functionality is called through
discardHunk.
The NSAlert shown when discarding can be bypassed by pressing "Alt"
while clicking the discard-button.
Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
This fixes a simple error where a staged file was read and added with
its mode/sha exchanged, and therefore its index-info could not be used
by update-index.
The error was introduced in a6b7c0c2a6. This fixes ticket #159.
Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
* pu/pb/fix_refresh:
Rename 'CachedChanges" to "StagedChanges" for greater consistency
PBChangedFile: remove shouldBeDeleted boolean
GitCommitController: Also use dictionary lookup for untracked files
CommitController: Use a dictionary lookup when refreshing index
GitCommitController: clean up index functions
We fake the index entry for the untracked files, and then use
the same method as we used earlier for adding the files. This
allows us to delete untracked files without problem, and is
generally a nicer implementation.
This way, we can accurately change the status of all existing files,
and keep the same files.
Now, what is needed is a way to do the same for the 'other changes',
and then we can remove the shouldBeRemoved stuff
* stable:
GitRevList -- Try to read the encoding of the commit message
GitRevList: fix crash when loading 0 commits
Tickets #151 and #155: check for illegal branch names before creating.
This tries to read the encoding of the commit message, if it's specified by
git (using i18n.commitEncoding at the time of committing). It uses an ugly
hack to try to convert the encoding string to an NSStringEncoding, and then
uses that for the subject and committer name.
I'm not sure how expensive this is. If it's too expensive, we might need to
cache this value.
When there were no commits to load, 'git log' would output something like:
Final output: 0 done
After that, GitX would try to read the sha after the input, which would
cause illegal string access and the throwing of a c++ exception. we fix
this by just stopping with revision loading if the input isn't at least
40 characters -- the minimum for a sha.
Pieter rewrote history.js in cfbcfc1f38, avoiding the use of
.innerHTML for performance reasons. This broke the HTML-arrows when
dealing with renames / mode-changes because createTextNode quotes them.
This is a simple work-around.
Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
* stable:
When selecting a folder in tree-view, display the
PBGitRepository: Correctly indicate bare/non-bare repos
Get rid of some unnecessary casts
CommitController: Don't rewrap commit message when amending
Release notes for 0.6.3
PBGitCommit: Call git show with --no-color to be safe
Info.plist: Fix handling of directories
PBGitIndexController: fix uninitialized value
Conflicts:
PBGitCommitController.m
path rather than the <PBGitTree: 0x...> object.
For example:
"This is a tree with path <PBGitTree: 0x1313000>"
..instead of:
"This is a tree with path Documentation/ReleaseNotes"
This addresses an issue with non-bare repos which had no core.bare
variable in the config. The isBareRepository-function would work
on the full fileURL (pointing to the .git subdir), which in turn would
indicate a bare repo (this is what git rev-parse --is-bare-repository
returns in .git, and the opposite is true for the superdir).
We work around by using the working-dir for a repo (and directly
indicating a bare repo if there is no workdir). The only issue remaining
is the case of a bare repo manually set to "core.bare = false".
Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
A failure of the commit-msg hook (similar to the
pre-commit hook) will cause the commit to abort.
Commit-msg requires an argument containing the
filename holding the commit, in this case
.git/COMMIT_EDITMSG.
Some hooks, such as commit-msg and
prepare-commit-msg require at least one argument.
This allows executeHook to take an array of
arguments to be passed on to the hook.
Typically, git-commit writes the commit message
to .git/COMMIT_EDITMSG. This writes the commit
message to that file manually to assist in
hooks such as commit-msg and
prepare-commit-msg which expect this file as the
first argument.
We used to use git log with a custom pretty command to reread the commit message,
but this rewraps the subject line, and also adds extra newlines. We fix this
by reading in the raw commit from git-cat-file, and then searching for the
double newline.
This fixes ticket #132, where setting color.ui = always in the gitconfig
caused GitX to received colorized output for "git show", thereby
destroying the diff-output.
Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
Resulting from the last change to Info.plist in 3e21d041ef we were no
longer able to open directories called <foo>.<bar> wheren bar != git.
Using this code allows us to open all directories again and also to
drag-and-drop to the dock.
Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
This returns not only the name of the git-dir but also the current
branch (or detached HEAD if no local branch is checked out).
When reloading the refs (which also happens when checking-out using
GitX), the displayName-method is called, updating the window-title.
Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
This fixes ticket #132, where setting color.ui = always in the gitconfig
caused GitX to received colorized output for "git show", thereby
destroying the diff-output.
Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
Resulting from the last change to Info.plist in 3e21d041ef we were no
longer able to open directories called <foo>.<bar> wheren bar != git.
Using this code allows us to open all directories again and also to
drag-and-drop to the dock.
Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
This fixes ticket #123, it restricts the branch-selector in history-view
to a maximum-height of 25pixels, which is the height of the button to
select history/commit-mode.
Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
The encoding used to write a new .gitignore was based on an
uninitialized value. Fix this by using UTF-8 as the default.
Found by the clang static analyzer.
* stable:
Fix many gcc 4.2 compiler warnings
GitX.xcodeproj: Quote paths in custom shell scripts
Fix compilation with GCC 4.2
IndexController: Temporarily stop tracking when (un)staging
IndexController: Add methods to stop tracking the Index
ChangesTableView: Remove warning by casting to correct class
Conflicts:
PBGitCommitController.m
Based on a patch by Faustino Osuna <enrique.osuna@gmail.com>
A failure of the pre-commit hook (a non-zero
result from the hook) will cause the commit to
abort. A failure of the post-commit hook has no
effect of the rest of the operation, however, it
is noted in the user interface.
This fixes Lighthouse#50
This speeds up the diff display by using DOM manipulation instead
of .innerHTML. Apparently incremental .innerHTML is really expensive
compared to DOM manipulation (which is expensive compared to a single .innerHTML=).
For example, the v0.2.1 commit, which introduces Sparkle, now loads in 70ms
rather than 230.
This uses the new way to stop tracking the index when
adding files. This can be noticed when staging more than
one file, as the tables might have to refresh dozens
of times.