Commit Graph

69 Commits

Author SHA1 Message Date
Pieter de Bie a03401dd51 CommitController: Don't turn of off automatic rearranging
In a6b7c0c2a6 (GitCommitController: Also use dictionary lookup for untracked files),
we started using a dictionary when updating the index to avoid O(n^2) lookups
and make the code cleaner at the same time.

Before that change we temporarily stopped tracking the index, so that
the controller wasn't fired with hundreds of KVO notifications. in a6b7c0c2a6,
we removed the re-tracked, but accidentally kept the untracking portion, which
meant that some index changes would not propagate to the controllers.
2009-06-20 21:58:34 +01:00
Pieter de Bie d6ccf34881 CommitController: Reject merges
We don't support this in any way yet, so let's just
issue a warning rather than failing silently
2009-06-20 21:10:54 +01:00
Pieter de Bie ad2213ce2f CommitController: Notify observers when adding files
We forgot to do this when changing the code in 963969af78
(CommitController: don't mutate array we enumerate when refreshing index).
This meant that some changes in the index would not be shown when refreshing,
for example newly added or changed files.
2009-06-16 19:06:57 +01:00
Johannes Gilger dd0822d5cd PBGitCommitController: Don't allow duplicate Sign-Offs
This prevents signing off a commit-message twice by the same person,
just like git-gui does.

Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
2009-06-13 14:13:33 +02:00
Johannes Gilger 93124387c4 PBGitCommit: Add "Sign-Off" button/method
This adds a small method signOff which simply appends a SOB-line to the
current commit-message, using user.name and user.email.

Signed-off-by: Johannes Gilger <heipei@hackvalue.de>

Signed-off-by: Pieter de Bie <frimmirf+gitx@gmail.com>
2009-06-11 23:39:08 +01:00
Pieter de Bie 963969af78 CommitController: don't mutate array we enumerate when refreshing index
There was a nasty bug in handling the finishing of the index change.
This code path was changed when I simplified the file tracking, but
as a result the code now mutated the files array, over which
we were also enumerating. This can cause all sorts of bad stuff, like
files that aren't really deleted from the view, to wrong files that
are deleted, to a crash of the system for wrong memory access.
2009-06-11 23:37:41 +01:00
Pieter de Bie 5090d4f159 Merge branch '5a88e3d' (early part)
* '5a88e3d' (early part):
  keyboardNavigation: Fix keys 'c' and 'v' from webView
  PBGitWindowController: Use beginSheetModalForWindow instead of runModal
2009-06-11 23:22:36 +01:00
Pieter de Bie a14495052a PBGitCommitController: retain author information of previous commit 2009-06-11 18:57:34 +01:00
Johannes Gilger 13746a5a6b PBGitWindowController: Use beginSheetModalForWindow instead of runModal
Introduce a new showMessageSheet/showErrorSheet-method for
PBGitWindowController which uses the beginSheetModalForWindow method of
NSAlert whereever possible. This has the advantage over runModal as it
doesn't block the other instances of GitX and is generally more
unobstrusive for simple status-messages.

Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
2009-06-09 18:33:02 +02:00
Johannes Gilger 7b6393570f PBWebChanges: Allow discarding of hunks
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>
2009-06-06 17:20:30 +01:00
Johannes Gilger 76f1469f52 PBGitCommitController: Fix unstaging of files
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>
2009-06-06 14:24:30 +01:00
Pieter de Bie 85f2c72d69 Merge branch 'pu/pb/fix_refresh'
* 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
2009-05-28 17:41:33 +01:00
Pieter de Bie 0d8ba8c263 Rename 'CachedChanges" to "StagedChanges" for greater consistency 2009-05-28 17:40:17 +01:00
Pieter de Bie a6b7c0c2a6 GitCommitController: Also use dictionary lookup for untracked files
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.
2009-05-28 17:36:24 +01:00
Pieter de Bie cf80a6aa09 CommitController: Use a dictionary lookup when refreshing index
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
2009-05-28 16:58:20 +01:00
Pieter de Bie 33991ec190 GitCommitController: clean up index functions
This adds some comments in the right place and makes the code
somewhat easier to follow.
2009-05-28 16:28:52 +01:00
Pieter de Bie 785e7eda42 Merge branch 'stable'
* 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
2009-05-27 18:25:14 +01:00
Benjamin Kramer c12e8b9dd4 Get rid of some unnecessary casts 2009-05-27 18:09:29 +01:00
Joe Fiorini 40ba75045d Trigger commit-msg hook when committing
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.
2009-05-27 18:03:18 +01:00
Joe Fiorini 897c80f8a7 Write commit message to file
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.
2009-05-27 18:03:09 +01:00
Pieter de Bie df4a50aebe CommitController: Don't rewrap commit message when amending
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.
2009-05-27 17:51:23 +01:00
Pieter de Bie 7caf7d799a Merge branch 'stable'
* 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
2009-05-18 23:11:11 +01:00
Benjamin Kramer 6dcefe5bec Fix many gcc 4.2 compiler warnings 2009-05-18 23:08:51 +01:00
Pieter de Bie 4dfcc4d45d Trigger pre and post-commit hooks when committing
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
2009-05-18 23:06:50 +01:00
Johannes Gilger f4f505c25e PBGitCommitController: Fix unstaging of last hunk
When unstaging the last cached hunk of a file, the file remained in the
"Staged Changes" column, with the notice "This file has no more changes"
and the "Unstage"-button remaining in the diff-view.

This fixes this behaviour by correctly distinguishing files in the
files-array not only by filename but also by unstaged/cached status,
s.t. for a file with unstaged and cached changes, there are two entries
in the files-array.

Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
2009-03-24 00:48:25 +00:00
Pieter de Bie 2b8d378f13 Index: Don't rearrange on every object
We used to change the PBFile status every time we found a 
similarly named file. Because the unstagedFilesController
had a filter and sort predicate for these, the array was
rearranged every time an existing file was found. This quickly
leads to stalling.

We fix it by temporarily disabling the automatic rearranging
and then reenabling it when we're finished.
2009-03-23 22:43:48 +00:00
Johannes Gilger e1f3a33a44 PBGitCommitController: Only show index if we have a workdir 2009-02-06 21:09:03 +01:00
Pieter de Bie 8c34fc9d84 CommitView: Actually show commit message
The message that the commit was succesful used to disappear
because after the commit, the index would refresh and another
file would be shown. We fix this by never requiring a file to be
selected.
2009-01-19 20:08:55 +00:00
Ben Walding feb0b64f29 Fix spelling of successfully in
* commit message
 * documentation
2009-01-19 16:54:56 +00:00
Pieter de Bie 8d729dae4c CommitView: Don't change selection when refreshing
We used to read in a completely new array when refreshing
the index. The problem with this is that the selection
changes when reading in the new array. We avoid this
by changing the current array, rather than loading in
a completely new one.
2008-12-22 21:31:05 +01:00
Pieter de Bie cd4ee1b993 Update views when switching 2008-12-22 20:47:36 +01:00
Pieter de Bie 3dd6385440 Fix memory leaks 2008-11-26 17:44:24 +01:00
Pieter de Bie 0975426f2f CommitView: move index functions to separate controller
This merges functionality that was previously stored in the
combination of PBGitCommitController / PBChangedFile to a
dedicated controller, PBGitIndexController.
2008-11-18 23:59:25 +01:00
Pieter de Bie 90db001409 WebCommitView: Add a state display
This adds a div in the webview to display the current commit
state. It allows us to notify the user of new commits by
showing something in the webview, rather than a modal
dialog.
2008-11-01 20:56:33 +01:00
Pieter de Bie 41a906d715 PBGitRepository: Don't return a ref if we error out
This fixes the -parseReference: method to return nil if
there is an error in the git call. This also simplifies
our commit controller.
2008-10-29 00:24:10 +01:00
Pieter de Bie b252de1a76 CommitView: Allow committing per hunk 2008-10-21 23:31:45 +02:00
Pieter de Bie 472d36c7f9 CommitView: Add context menu to revert changes 2008-10-10 21:59:23 +02:00
Pieter de Bie e659e63fc0 CommitView: Add option to amend commits 2008-10-10 21:59:23 +02:00
Pieter de Bie 5010511bdb CommitView: Always use a single PBChangedFile object
This makes sure we don't add a double object to our array,
if a file has both cached and unstaged changes.
2008-10-10 21:59:23 +02:00
Pieter de Bie 69e1c6fc45 CommitView: Don't break on oneliners
e2210f7306e4c1647ff068f660db1674ce0391e1 (CommitView: Add a better reflog entry)
created a bug where an exception was thrown if you enter a one-lined commit
message.
2008-10-10 21:59:22 +02:00
Pieter de Bie fd146bd44b CommitView: Add a better reflog entry
This adds an entry in the form of

	commit: CommitView: Add a better reflog entry

to the reflog upon commit, rather than

	Commit from GitX

which isn't very informative
2008-10-10 21:59:22 +02:00
Pieter de Bie d66a105a4b CommitView: Allow rootless commits
This fixes the committing of rootless commits by not
requiring a HEAD parent if there isn't one.
2008-10-10 21:59:21 +02:00
Pieter de Bie a42adc6d82 CommitView: Allow doubleclick to (un)stage changes 2008-10-04 22:41:21 +02:00
Pieter de Bie 8c59a1249a CommitView: Also read in new objects with null-separator 2008-10-03 19:06:47 +02:00
Pieter de Bie a0f248ef9f CommitView: Also show deleted files correctly 2008-10-03 18:06:57 +02:00
Pieter de Bie 7a5716b24d CommitView: Use null-terminated strings when reading the index 2008-10-03 18:06:41 +02:00
Pieter de Bie e329493154 Move toolbar to view xib 2008-10-03 17:18:26 +02:00
Pieter de Bie b753ab09e5 CommitView: Don't allow empty commits 2008-09-28 21:25:53 +02:00
Pieter de Bie a2217fe099 Reload commits after doing a commit 2008-09-28 13:03:55 +02:00
Pieter de Bie 4131258108 CommitController: Read index data to EOF
Otherwise not all information may be parsed correctly
2008-09-27 00:32:06 +02:00