* [PATCH 1/4] git.el: Support for showing unknown/ignored directories.
@ 2008-02-07 12:50 Alexandre Julliard
2008-02-22 15:30 ` Karl Hasselström
0 siblings, 1 reply; 8+ messages in thread
From: Alexandre Julliard @ 2008-02-07 12:50 UTC (permalink / raw)
To: git
Instead of recursing into directories that only contain unknown files,
display only the directory itself. Its contents can be expanded with
git-find-file (bound to C-m).
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
---
contrib/emacs/git.el | 38 +++++++++++++++++++++++++++++---------
1 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index d8a0638..58d72a5 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -558,12 +558,15 @@ and returns the process output as a string."
(?\100 " (type change file -> subproject)")
(?\120 " (type change symlink -> subproject)")
(t " (subproject)")))
+ (?\110 nil) ;; directory (internal, not a real git state)
(?\000 ;; deleted or unknown
(case old-type
(?\120 " (symlink)")
(?\160 " (subproject)")))
(t (format " (unknown type %o)" new-type)))))
- (if str (propertize str 'face 'git-status-face) "")))
+ (cond (str (propertize str 'face 'git-status-face))
+ ((eq new-type ?\110) "/")
+ (t ""))))
(defun git-rename-as-string (info)
"Return a string describing the copy or rename associated with INFO, or an empty string if none."
@@ -666,9 +669,11 @@ Return the list of files that haven't been handled."
(with-temp-buffer
(apply #'git-call-process-env t nil "ls-files" "-z" (append options (list "--") files))
(goto-char (point-min))
- (while (re-search-forward "\\([^\0]*\\)\0" nil t 1)
+ (while (re-search-forward "\\([^\0]*?\\)\\(/?\\)\0" nil t 1)
(let ((name (match-string 1)))
- (push (git-create-fileinfo default-state name) infolist)
+ (push (git-create-fileinfo default-state name 0
+ (if (string-equal "/" (match-string 2)) (lsh ?\110 9) 0))
+ infolist)
(setq files (delete name files)))))
(git-insert-info-list status infolist)
files))
@@ -713,7 +718,7 @@ Return the list of files that haven't been handled."
(defun git-run-ls-files-with-excludes (status files default-state &rest options)
"Run git-ls-files on FILES with appropriate --exclude-from options."
(let ((exclude-files (git-get-exclude-files)))
- (apply #'git-run-ls-files status files default-state
+ (apply #'git-run-ls-files status files default-state "--directory"
(concat "--exclude-per-directory=" git-per-dir-ignore-file)
(append options (mapcar (lambda (f) (concat "--exclude-from=" f)) exclude-files)))))
@@ -957,6 +962,7 @@ Return the list of files that haven't been handled."
"Add marked file(s) to the index cache."
(interactive)
(let ((files (git-get-filenames (git-marked-files-state 'unknown 'ignored))))
+ ;; FIXME: add support for directories
(unless files
(push (file-relative-name (read-file-name "File to add: " nil nil t)) files))
(apply #'git-call-process-env nil nil "update-index" "--add" "--" files)
@@ -983,7 +989,10 @@ Return the list of files that haven't been handled."
(format "Remove %d file%s? " (length files) (if (> (length files) 1) "s" "")))
(progn
(dolist (name files)
- (when (file-exists-p name) (delete-file name)))
+ (ignore-errors
+ (if (file-directory-p name)
+ (delete-directory name)
+ (delete-file name))))
(apply #'git-call-process-env nil nil "update-index" "--remove" "--" files)
(git-update-status-files files nil)
(git-success-message "Removed" files))
@@ -992,7 +1001,7 @@ Return the list of files that haven't been handled."
(defun git-revert-file ()
"Revert changes to the marked file(s)."
(interactive)
- (let ((files (git-marked-files))
+ (let ((files (git-marked-files-state 'added 'deleted 'modified 'unmerged))
added modified)
(when (and files
(yes-or-no-p
@@ -1063,6 +1072,16 @@ Return the list of files that haven't been handled."
(message "Inserting unknown files...done"))
(git-remove-handled)))
+(defun git-expand-directory (info)
+ "Expand the directory represented by INFO to list its files."
+ (when (eq (lsh (git-fileinfo->new-perm info) -9) ?\110)
+ (let ((dir (git-fileinfo->name info)))
+ (git-set-filenames-state git-status (list dir) nil)
+ (git-run-ls-files-with-excludes git-status (list (concat dir "/")) 'unknown "-o")
+ (git-refresh-files)
+ (git-refresh-ewoc-hf git-status)
+ t)))
+
(defun git-setup-diff-buffer (buffer)
"Setup a buffer for displaying a diff."
(let ((dir default-directory))
@@ -1237,9 +1256,10 @@ Return the list of files that haven't been handled."
(interactive)
(unless git-status (error "Not in git-status buffer."))
(let ((info (ewoc-data (ewoc-locate git-status))))
- (find-file (git-fileinfo->name info))
- (when (eq 'unmerged (git-fileinfo->state info))
- (smerge-mode 1))))
+ (unless (git-expand-directory info)
+ (find-file (git-fileinfo->name info))
+ (when (eq 'unmerged (git-fileinfo->state info))
+ (smerge-mode 1)))))
(defun git-find-file-other-window ()
"Visit the current file in its own buffer in another window."
--
1.5.4.38.g0d380
--
Alexandre Julliard
julliard@winehq.org
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] git.el: Support for showing unknown/ignored directories.
2008-02-07 12:50 [PATCH 1/4] git.el: Support for showing unknown/ignored directories Alexandre Julliard
@ 2008-02-22 15:30 ` Karl Hasselström
2008-02-22 15:53 ` Alexandre Julliard
0 siblings, 1 reply; 8+ messages in thread
From: Karl Hasselström @ 2008-02-22 15:30 UTC (permalink / raw)
To: Alexandre Julliard; +Cc: git
On 2008-02-07 13:50:19 +0100, Alexandre Julliard wrote:
> Instead of recursing into directories that only contain unknown
> files, display only the directory itself. Its contents can be
> expanded with git-find-file (bound to C-m).
I have a bunch of directories in my tree with only ignored files in
them. They used to not show up at all, but now they do. If I press
return with the cursor on top of one of them, it vanishes (which is
equivalent to expanding to all the 0 non-ignored files in that
directory, I guess).
I presume this wasn't the intended behavior? I like the idea for
subdirectories that actually contain non-ignored files, but
directories with only ignored files should really not be shown at all.
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] git.el: Support for showing unknown/ignored directories.
2008-02-22 15:30 ` Karl Hasselström
@ 2008-02-22 15:53 ` Alexandre Julliard
2008-02-22 17:10 ` Karl Hasselström
0 siblings, 1 reply; 8+ messages in thread
From: Alexandre Julliard @ 2008-02-22 15:53 UTC (permalink / raw)
To: Karl Hasselström; +Cc: git
Karl Hasselström <kha@treskal.com> writes:
> On 2008-02-07 13:50:19 +0100, Alexandre Julliard wrote:
>
>> Instead of recursing into directories that only contain unknown
>> files, display only the directory itself. Its contents can be
>> expanded with git-find-file (bound to C-m).
>
> I have a bunch of directories in my tree with only ignored files in
> them. They used to not show up at all, but now they do. If I press
> return with the cursor on top of one of them, it vanishes (which is
> equivalent to expanding to all the 0 non-ignored files in that
> directory, I guess).
>
> I presume this wasn't the intended behavior? I like the idea for
> subdirectories that actually contain non-ignored files, but
> directories with only ignored files should really not be shown at all.
It probably needs something like this:
From b32a397a64eec64d433aa0ee00147003723cfeee Mon Sep 17 00:00:00 2001
From: Alexandre Julliard <julliard@winehq.org>
Date: Fri, 22 Feb 2008 16:48:53 +0100
Subject: [PATCH] git.el: Do not display empty directories.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
---
contrib/emacs/git.el | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index d91fbb8..7cb86df 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -753,7 +753,7 @@ Return the list of files that haven't been handled."
(defun git-run-ls-files-with-excludes (status files default-state &rest options)
"Run git-ls-files on FILES with appropriate --exclude-from options."
(let ((exclude-files (git-get-exclude-files)))
- (apply #'git-run-ls-files status files default-state "--directory"
+ (apply #'git-run-ls-files status files default-state "--directory" "--no-empty-directory"
(concat "--exclude-per-directory=" git-per-dir-ignore-file)
(append options (mapcar (lambda (f) (concat "--exclude-from=" f)) exclude-files)))))
--
1.5.4.1.132.gd85f75
--
Alexandre Julliard
julliard@winehq.org
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] git.el: Support for showing unknown/ignored directories.
2008-02-22 15:53 ` Alexandre Julliard
@ 2008-02-22 17:10 ` Karl Hasselström
2008-02-27 11:27 ` Karl Hasselström
0 siblings, 1 reply; 8+ messages in thread
From: Karl Hasselström @ 2008-02-22 17:10 UTC (permalink / raw)
To: Alexandre Julliard; +Cc: git
On 2008-02-22 16:53:16 +0100, Alexandre Julliard wrote:
> Karl Hasselström <kha@treskal.com> writes:
>
> > I have a bunch of directories in my tree with only ignored files
> > in them. They used to not show up at all, but now they do.
>
> It probably needs something like this:
That fixed the problem. Thanks!
> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Tested-by: Karl Hasselström <kha@treskal.com>
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] git.el: Support for showing unknown/ignored directories.
2008-02-22 17:10 ` Karl Hasselström
@ 2008-02-27 11:27 ` Karl Hasselström
2008-02-27 19:48 ` Junio C Hamano
0 siblings, 1 reply; 8+ messages in thread
From: Karl Hasselström @ 2008-02-27 11:27 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Alexandre Julliard, git
On 2008-02-22 18:10:52 +0100, Karl Hasselström wrote:
> On 2008-02-22 16:53:16 +0100, Alexandre Julliard wrote:
>
> > Karl Hasselström <kha@treskal.com> writes:
> >
> > > I have a bunch of directories in my tree with only ignored files
> > > in them. They used to not show up at all, but now they do.
> >
> > It probably needs something like this:
>
> That fixed the problem. Thanks!
>
> > Signed-off-by: Alexandre Julliard <julliard@winehq.org>
>
> Tested-by: Karl Hasselström <kha@treskal.com>
Junio, did you see this bugfix? (I just realized you weren't cc'ed, so
I guess not.)
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] git.el: Support for showing unknown/ignored directories.
2008-02-27 11:27 ` Karl Hasselström
@ 2008-02-27 19:48 ` Junio C Hamano
2008-02-28 7:06 ` Karl Hasselström
0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2008-02-27 19:48 UTC (permalink / raw)
To: Karl Hasselström; +Cc: Alexandre Julliard, git
Karl Hasselström <kha@treskal.com> writes:
> On 2008-02-22 18:10:52 +0100, Karl Hasselström wrote:
> ...
>> That fixed the problem. Thanks!
>>
>> > Signed-off-by: Alexandre Julliard <julliard@winehq.org>
>>
>> Tested-by: Karl Hasselström <kha@treskal.com>
>
> Junio, did you see this bugfix? (I just realized you weren't cc'ed, so
> I guess not.)
No, and thanks.
So I'll take
From: Alexandre Julliard <julliard@winehq.org>
Message-ID: <8763whkmxf.fsf@wine.dyndns.org>
aka
http://article.gmane.org/gmane.comp.version-control.git/74730
in this thread with your Tested-by: and apply to fix 3f3d564
(git.el: Support for showing unknown/ignored directories.)?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] git.el: Support for showing unknown/ignored directories.
2008-02-27 19:48 ` Junio C Hamano
@ 2008-02-28 7:06 ` Karl Hasselström
2008-02-28 7:46 ` Junio C Hamano
0 siblings, 1 reply; 8+ messages in thread
From: Karl Hasselström @ 2008-02-28 7:06 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Alexandre Julliard, git
On 2008-02-27 11:48:30 -0800, Junio C Hamano wrote:
> Karl Hasselström <kha@treskal.com> writes:
>
> > Junio, did you see this bugfix? (I just realized you weren't
> > cc'ed, so I guess not.)
>
> No, and thanks.
>
> So I'll take
>
> From: Alexandre Julliard <julliard@winehq.org>
> Message-ID: <8763whkmxf.fsf@wine.dyndns.org>
>
> aka
>
> http://article.gmane.org/gmane.comp.version-control.git/74730
>
> in this thread with your Tested-by: and apply to fix 3f3d564
> (git.el: Support for showing unknown/ignored directories.)?
Yes, exactly. Thanks.
(Would you like this kind of detailed pointer in a reminder, or is the
threading support in your mailer good enough that just replying to the
right mail will do it?)
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] git.el: Support for showing unknown/ignored directories.
2008-02-28 7:06 ` Karl Hasselström
@ 2008-02-28 7:46 ` Junio C Hamano
0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2008-02-28 7:46 UTC (permalink / raw)
To: Karl Hasselström; +Cc: Alexandre Julliard, git
Karl Hasselström <kha@treskal.com> writes:
> (Would you like this kind of detailed pointer in a reminder, or is the
> threading support in your mailer good enough that just replying to the
> right mail will do it?)
I'd actually like a forwarded message that I can directly feed
to "git am", with Sign-offs and Acked-bys, but being explicit
would be good enough.
I often do not have enough mental and time bandwidth to hunt for
messages more than 2 weeks old in the list archive, so unless
the response is direct reply to the original, I'd rather not
rely on the threading feature. IOW, I can move to grandparent by
typing ^ just fine, but uncles and aunts are harder to find
without reloading my MUA full message archive for N weeks worth.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-02-28 7:47 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-07 12:50 [PATCH 1/4] git.el: Support for showing unknown/ignored directories Alexandre Julliard
2008-02-22 15:30 ` Karl Hasselström
2008-02-22 15:53 ` Alexandre Julliard
2008-02-22 17:10 ` Karl Hasselström
2008-02-27 11:27 ` Karl Hasselström
2008-02-27 19:48 ` Junio C Hamano
2008-02-28 7:06 ` Karl Hasselström
2008-02-28 7:46 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).