All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] git.el: Use git-add-file for unmerged files, remove git-resolve-file
@ 2009-09-03 20:27 Martin Nordholts
  2009-09-08 18:43 ` Alexandre Julliard
  2009-09-08 23:10 ` Junio C Hamano
  0 siblings, 2 replies; 6+ messages in thread
From: Martin Nordholts @ 2009-09-03 20:27 UTC (permalink / raw)
  To: git, Junio C Hamano, Alexandre Julliard

Use `git-add-file' to mark unmerged files as resolved in the
*git-status* buffer to be consistent with git's CLI instructions. Also
remove `git-resolve-file' to make it clear that that "R" is a now a
free keybinding.

Signed-off-by: Martin Nordholts <martinn@src.gnome.org>
---
 contrib/emacs/git.el |   13 +------------
 1 files changed, 1 insertions(+), 12 deletions(-)

diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 8c70ad8..214930a 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -1046,7 +1046,7 @@ The FILES list must be sorted."
 (defun git-add-file ()
   "Add marked file(s) to the index cache."
   (interactive)
-  (let ((files (git-get-filenames (git-marked-files-state 'unknown 'ignored))))
+  (let ((files (git-get-filenames (git-marked-files-state 'unknown 'ignored 'unmerged))))
     ;; FIXME: add support for directories
     (unless files
       (push (file-relative-name (read-file-name "File to add: " nil nil t)) files))
@@ -1119,15 +1119,6 @@ The FILES list must be sorted."
               (when buffer (with-current-buffer buffer (revert-buffer t t t)))))
           (git-success-message "Reverted" names))))))
 
-(defun git-resolve-file ()
-  "Resolve conflicts in marked file(s)."
-  (interactive)
-  (let ((files (git-get-filenames (git-marked-files-state 'unmerged))))
-    (when files
-      (when (apply 'git-call-process-display-error "update-index" "--" files)
-        (git-update-status-files files)
-        (git-success-message "Resolved" files)))))
-
 (defun git-remove-handled ()
   "Remove handled files from the status list."
   (interactive)
@@ -1556,7 +1547,6 @@ amended version of it."
     (define-key map "P"   'git-prev-unmerged-file)
     (define-key map "q"   'git-status-quit)
     (define-key map "r"   'git-remove-file)
-    (define-key map "R"   'git-resolve-file)
     (define-key map "t"    toggle-map)
     (define-key map "T"   'git-toggle-all-marks)
     (define-key map "u"   'git-unmark-file)
@@ -1598,7 +1588,6 @@ amended version of it."
       ("Merge"
 	["Next Unmerged File" git-next-unmerged-file t]
 	["Prev Unmerged File" git-prev-unmerged-file t]
-	["Mark as Resolved" git-resolve-file t]
 	["Interactive Merge File" git-find-file-imerge t]
 	["Diff Against Common Base File" git-diff-file-base t]
 	["Diff Combined" git-diff-file-combined t]
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] git.el: Use git-add-file for unmerged files, remove git-resolve-file
  2009-09-03 20:27 [PATCH] git.el: Use git-add-file for unmerged files, remove git-resolve-file Martin Nordholts
@ 2009-09-08 18:43 ` Alexandre Julliard
  2009-09-08 20:43   ` Junio C Hamano
  2009-09-08 23:10 ` Junio C Hamano
  1 sibling, 1 reply; 6+ messages in thread
From: Alexandre Julliard @ 2009-09-08 18:43 UTC (permalink / raw)
  To: Martin Nordholts; +Cc: git, Junio C Hamano

Martin Nordholts <enselic@gmail.com> writes:

> Use `git-add-file' to mark unmerged files as resolved in the
> *git-status* buffer to be consistent with git's CLI instructions. Also
> remove `git-resolve-file' to make it clear that that "R" is a now a
> free keybinding.
>
> Signed-off-by: Martin Nordholts <martinn@src.gnome.org>

Looks good, thanks.

Acked-by: Alexandre Julliard <julliard@winehq.org>

-- 
Alexandre Julliard
julliard@winehq.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] git.el: Use git-add-file for unmerged files, remove git-resolve-file
  2009-09-08 18:43 ` Alexandre Julliard
@ 2009-09-08 20:43   ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2009-09-08 20:43 UTC (permalink / raw)
  To: Alexandre Julliard; +Cc: Martin Nordholts, git

Alexandre Julliard <julliard@winehq.org> writes:

> Martin Nordholts <enselic@gmail.com> writes:
>
>> Use `git-add-file' to mark unmerged files as resolved in the
>> *git-status* buffer to be consistent with git's CLI instructions. Also
>> remove `git-resolve-file' to make it clear that that "R" is a now a
>> free keybinding.
>>
>> Signed-off-by: Martin Nordholts <martinn@src.gnome.org>
>
> Looks good, thanks.
>
> Acked-by: Alexandre Julliard <julliard@winehq.org>

Thanks, both.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] git.el: Use git-add-file for unmerged files, remove git-resolve-file
  2009-09-03 20:27 [PATCH] git.el: Use git-add-file for unmerged files, remove git-resolve-file Martin Nordholts
  2009-09-08 18:43 ` Alexandre Julliard
@ 2009-09-08 23:10 ` Junio C Hamano
  2009-09-09 16:09   ` Alexandre Julliard
  1 sibling, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2009-09-08 23:10 UTC (permalink / raw)
  To: Martin Nordholts; +Cc: git, Alexandre Julliard

Martin Nordholts <enselic@gmail.com> writes:

> Use `git-add-file' to mark unmerged files as resolved in the
> *git-status* buffer to be consistent with git's CLI instructions. Also
> remove `git-resolve-file' to make it clear that that "R" is a now a
> free keybinding.

I do not know all the details of how Emacs keybinding works, but I had an
impression that something-x sequence is triggered if you type something-X
and you do not have an explicit binding for something-X but you do have a
binding for something-x.

IOW, if I only have

	(define-key global-map "\C-xc" 'compile)

then both "\C-xc" and "\C-xC" runs "compile", but in addition to the
above if I also have

	(define-key global-map "\C-xC" 'grep-find)

then I can invoke these two commands with lower- and upper- case 'c/C'
after control-x.

If people have been relying on the historical behaviour that typing "R"
marked the path resolved (which may internally have been implemented with
whatever way), and if you are removing that binding, wouldn't that now
expose them to whatever happens to be bound to "r"?

And worse, it is bound to git-remove-file.  Shouldn't you at least rebind
the "R" to something safer, like beep?

Am I grossly misunderstanding how Emacs keybindings work?  Is the
experiment I did in the initial part of the message with the global-map
relying on some "magic" that only appears in global-map, and there is no
problem doing this in the map this patch is about?

> Signed-off-by: Martin Nordholts <martinn@src.gnome.org>
> Acked-by: Alexandre Julliard <julliard@winehq.org>
> ---
>  contrib/emacs/git.el |   13 +------------
>  1 files changed, 1 insertions(+), 12 deletions(-)
>
> diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
> index 8c70ad8..214930a 100644
> --- a/contrib/emacs/git.el
> +++ b/contrib/emacs/git.el
> @@ -1046,7 +1046,7 @@ The FILES list must be sorted."
>  (defun git-add-file ()
>    "Add marked file(s) to the index cache."
>    (interactive)
> -  (let ((files (git-get-filenames (git-marked-files-state 'unknown 'ignored))))
> +  (let ((files (git-get-filenames (git-marked-files-state 'unknown 'ignored 'unmerged))))
>      ;; FIXME: add support for directories
>      (unless files
>        (push (file-relative-name (read-file-name "File to add: " nil nil t)) files))
> @@ -1119,15 +1119,6 @@ The FILES list must be sorted."
>                (when buffer (with-current-buffer buffer (revert-buffer t t t)))))
>            (git-success-message "Reverted" names))))))
>  
> -(defun git-resolve-file ()
> -  "Resolve conflicts in marked file(s)."
> -  (interactive)
> -  (let ((files (git-get-filenames (git-marked-files-state 'unmerged))))
> -    (when files
> -      (when (apply 'git-call-process-display-error "update-index" "--" files)
> -        (git-update-status-files files)
> -        (git-success-message "Resolved" files)))))
> -
>  (defun git-remove-handled ()
>    "Remove handled files from the status list."
>    (interactive)
> @@ -1556,7 +1547,6 @@ amended version of it."
>      (define-key map "P"   'git-prev-unmerged-file)
>      (define-key map "q"   'git-status-quit)
>      (define-key map "r"   'git-remove-file)
> -    (define-key map "R"   'git-resolve-file)
>      (define-key map "t"    toggle-map)
>      (define-key map "T"   'git-toggle-all-marks)
>      (define-key map "u"   'git-unmark-file)
> @@ -1598,7 +1588,6 @@ amended version of it."
>        ("Merge"
>  	["Next Unmerged File" git-next-unmerged-file t]
>  	["Prev Unmerged File" git-prev-unmerged-file t]
> -	["Mark as Resolved" git-resolve-file t]
>  	["Interactive Merge File" git-find-file-imerge t]
>  	["Diff Against Common Base File" git-diff-file-base t]
>  	["Diff Combined" git-diff-file-combined t]
> -- 
> 1.6.2.5

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] git.el: Use git-add-file for unmerged files, remove git-resolve-file
  2009-09-08 23:10 ` Junio C Hamano
@ 2009-09-09 16:09   ` Alexandre Julliard
  2009-09-09 19:10     ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Alexandre Julliard @ 2009-09-09 16:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Martin Nordholts, git

Junio C Hamano <gitster@pobox.com> writes:

> I do not know all the details of how Emacs keybinding works, but I had an
> impression that something-x sequence is triggered if you type something-X
> and you do not have an explicit binding for something-X but you do have a
> binding for something-x.
>
> IOW, if I only have
>
> 	(define-key global-map "\C-xc" 'compile)
>
> then both "\C-xc" and "\C-xC" runs "compile", but in addition to the
> above if I also have
>
> 	(define-key global-map "\C-xC" 'grep-find)
>
> then I can invoke these two commands with lower- and upper- case 'c/C'
> after control-x.
>
> If people have been relying on the historical behaviour that typing "R"
> marked the path resolved (which may internally have been implemented with
> whatever way), and if you are removing that binding, wouldn't that now
> expose them to whatever happens to be bound to "r"?

No, I don't claim to understand exactly how that works for the C-x case,
but it doesn't apply here, "r" and "R" are two different bindings.

-- 
Alexandre Julliard
julliard@winehq.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] git.el: Use git-add-file for unmerged files, remove git-resolve-file
  2009-09-09 16:09   ` Alexandre Julliard
@ 2009-09-09 19:10     ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2009-09-09 19:10 UTC (permalink / raw)
  To: Alexandre Julliard; +Cc: Martin Nordholts, git

Alexandre Julliard <julliard@winehq.org> writes:

> Junio C Hamano <gitster@pobox.com> writes:
>
>> I do not know all the details of how Emacs keybinding works, but I had an
>> impression that something-x sequence is triggered if you type something-X
>> and you do not have an explicit binding for something-X but you do have a
>> binding for something-x.
>>
>> IOW, if I only have
>>
>> 	(define-key global-map "\C-xc" 'compile)
>>
>> then both "\C-xc" and "\C-xC" runs "compile", but in addition to the
>> above if I also have
>>
>> 	(define-key global-map "\C-xC" 'grep-find)
>>
>> then I can invoke these two commands with lower- and upper- case 'c/C'
>> after control-x.
>>
>> If people have been relying on the historical behaviour that typing "R"
>> marked the path resolved (which may internally have been implemented with
>> whatever way), and if you are removing that binding, wouldn't that now
>> expose them to whatever happens to be bound to "r"?
>
> No, I don't claim to understand exactly how that works for the C-x case,
> but it doesn't apply here, "r" and "R" are two different bindings.

Thanks.  I just wanted to make sure that a user who is used to typing "R"
won't get the file removed with the new code.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-09-09 19:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-03 20:27 [PATCH] git.el: Use git-add-file for unmerged files, remove git-resolve-file Martin Nordholts
2009-09-08 18:43 ` Alexandre Julliard
2009-09-08 20:43   ` Junio C Hamano
2009-09-08 23:10 ` Junio C Hamano
2009-09-09 16:09   ` Alexandre Julliard
2009-09-09 19:10     ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.