mirror of
https://github.com/git/git.git
synced 2026-03-14 10:53:25 +01:00
Merge branch 'master' into next
* master: apply: handle "traditional" creation/deletion diff correctly. gitweb: Remove extra "/" in path names for git_get_project_list git.el: Include MERGE_MSG in the log-edit buffer even when not committing a merge. git.el: Move point after the log message header when entering log-edit mode. git.el: Added a function to open the current file in another window. git.el: Added functions for moving to the next/prev unmerged file.
This commit is contained in:
@@ -1043,10 +1043,14 @@ static int parse_single_patch(char *line, unsigned long size, struct patch *patc
|
||||
* then not having oldlines means the patch is creation,
|
||||
* and not having newlines means the patch is deletion.
|
||||
*/
|
||||
if (patch->is_new < 0 && !oldlines)
|
||||
if (patch->is_new < 0 && !oldlines) {
|
||||
patch->is_new = 1;
|
||||
if (patch->is_delete < 0 && !newlines)
|
||||
patch->old_name = NULL;
|
||||
}
|
||||
if (patch->is_delete < 0 && !newlines) {
|
||||
patch->is_delete = 1;
|
||||
patch->new_name = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (0 < patch->is_new && oldlines)
|
||||
|
||||
@@ -589,6 +589,7 @@ and returns the process output as a string."
|
||||
(let ((commit (git-commit-tree buffer tree head)))
|
||||
(git-update-ref "HEAD" commit head)
|
||||
(condition-case nil (delete-file ".git/MERGE_HEAD") (error nil))
|
||||
(condition-case nil (delete-file ".git/MERGE_MSG") (error nil))
|
||||
(with-current-buffer buffer (erase-buffer))
|
||||
(git-set-files-state files 'uptodate)
|
||||
(when (file-directory-p ".git/rr-cache")
|
||||
@@ -670,6 +671,32 @@ and returns the process output as a string."
|
||||
(unless git-status (error "Not in git-status buffer."))
|
||||
(ewoc-goto-prev git-status n))
|
||||
|
||||
(defun git-next-unmerged-file (&optional n)
|
||||
"Move the selection down N unmerged files."
|
||||
(interactive "p")
|
||||
(unless git-status (error "Not in git-status buffer."))
|
||||
(let* ((last (ewoc-locate git-status))
|
||||
(node (ewoc-next git-status last)))
|
||||
(while (and node (> n 0))
|
||||
(when (eq 'unmerged (git-fileinfo->state (ewoc-data node)))
|
||||
(setq n (1- n))
|
||||
(setq last node))
|
||||
(setq node (ewoc-next git-status node)))
|
||||
(ewoc-goto-node git-status last)))
|
||||
|
||||
(defun git-prev-unmerged-file (&optional n)
|
||||
"Move the selection up N unmerged files."
|
||||
(interactive "p")
|
||||
(unless git-status (error "Not in git-status buffer."))
|
||||
(let* ((last (ewoc-locate git-status))
|
||||
(node (ewoc-prev git-status last)))
|
||||
(while (and node (> n 0))
|
||||
(when (eq 'unmerged (git-fileinfo->state (ewoc-data node)))
|
||||
(setq n (1- n))
|
||||
(setq last node))
|
||||
(setq node (ewoc-prev git-status node)))
|
||||
(ewoc-goto-node git-status last)))
|
||||
|
||||
(defun git-add-file ()
|
||||
"Add marked file(s) to the index cache."
|
||||
(interactive)
|
||||
@@ -862,7 +889,7 @@ and returns the process output as a string."
|
||||
'face 'git-header-face)
|
||||
(propertize git-log-msg-separator 'face 'git-separator-face)
|
||||
"\n")
|
||||
(cond ((and merge-heads (file-readable-p ".git/MERGE_MSG"))
|
||||
(cond ((file-readable-p ".git/MERGE_MSG")
|
||||
(insert-file-contents ".git/MERGE_MSG"))
|
||||
(sign-off
|
||||
(insert (format "\n\nSigned-off-by: %s <%s>\n"
|
||||
@@ -873,7 +900,8 @@ and returns the process output as a string."
|
||||
(2 font-lock-function-name-face))
|
||||
(,(concat "^\\(" (regexp-quote git-log-msg-separator) "\\)$")
|
||||
(1 font-lock-comment-face)))))
|
||||
(log-edit #'git-do-commit nil #'git-log-edit-files buffer))))
|
||||
(log-edit #'git-do-commit nil #'git-log-edit-files buffer)
|
||||
(re-search-forward (regexp-quote (concat git-log-msg-separator "\n")) nil t))))
|
||||
|
||||
(defun git-find-file ()
|
||||
"Visit the current file in its own buffer."
|
||||
@@ -884,6 +912,15 @@ and returns the process output as a string."
|
||||
(when (eq 'unmerged (git-fileinfo->state info))
|
||||
(smerge-mode))))
|
||||
|
||||
(defun git-find-file-other-window ()
|
||||
"Visit the current file in its own buffer in another window."
|
||||
(interactive)
|
||||
(unless git-status (error "Not in git-status buffer."))
|
||||
(let ((info (ewoc-data (ewoc-locate git-status))))
|
||||
(find-file-other-window (git-fileinfo->name info))
|
||||
(when (eq 'unmerged (git-fileinfo->state info))
|
||||
(smerge-mode))))
|
||||
|
||||
(defun git-find-file-imerge ()
|
||||
"Visit the current file in interactive merge mode."
|
||||
(interactive)
|
||||
@@ -967,7 +1004,10 @@ and returns the process output as a string."
|
||||
(define-key map "m" 'git-mark-file)
|
||||
(define-key map "M" 'git-mark-all)
|
||||
(define-key map "n" 'git-next-file)
|
||||
(define-key map "N" 'git-next-unmerged-file)
|
||||
(define-key map "o" 'git-find-file-other-window)
|
||||
(define-key map "p" 'git-prev-file)
|
||||
(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)
|
||||
|
||||
@@ -922,6 +922,8 @@ sub git_get_projects_list {
|
||||
if (-d $projects_list) {
|
||||
# search in directory
|
||||
my $dir = $projects_list . ($filter ? "/$filter" : '');
|
||||
# remove the trailing "/"
|
||||
$dir =~ s!/+$!!;
|
||||
my $pfxlen = length("$dir");
|
||||
|
||||
my $check_forks = gitweb_check_feature('forks');
|
||||
|
||||
Reference in New Issue
Block a user