Git development
 help / color / mirror / Atom feed
* Re: On recording renames
From: Junio C Hamano @ 2006-03-04 13:19 UTC (permalink / raw)
  To: git; +Cc: paul
In-Reply-To: <7v64muvin9.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano <junkio@cox.net> writes:

> A bit more on merges and renames...
> The whole thread is worth reading, but the punch line is:
>
>         The transition happened over time with multiple commits.
>         You cannot record "this is the rename" by attributing that
>         information to one particular commit.

After re-reading that thread, and especially the analysis of the
history of that part of the kernel source I did back then, I am
again convinced that Linus was right when he said "file renames
do not matter".  That real-life example shows how inadequate
file boundaries are when dealing with content changes.

An ideal merge strategy would handle the case where pieces of
code gradually moves around across file boundaries.  I do not
think this is something you can sensibly do by recording file
rename history.  It would not help the situation a bit even if
you gave each file (or content or object or whatever you want to
call it) a persistent ID.

One way (now, it is my turn to handwave) to do such a merge
might be to take the whole tree as if it were a flat single file
(think of it as a concatenation of all files in the tree) with
each line tagged with the pathname.  You and your friend would
start from something like this.  A single file that describe
topics of interest to both of you:

                    notes.txt:Kernel Topics
                    notes.txt: - filesystem
                    notes.txt: - scheduler
                    notes.txt: - devices
                    notes.txt:Cool Git Topics
                    notes.txt: - git-cvsserver
                    notes.txt: - Cogito

And your friend splits this into two files and starts editing,
while you edit the original file:

        your friend                     you

        linux.txt:Kernel Topics         notes.txt:Kernel Topics
        linux.txt: - filesystem         notes.txt: - filesystem
        linux.txt: - scheduler          notes.txt: - scheduler
        linux.txt: - devices            notes.txt: - devices
        linux.txt: - stable driver API  notes.txt: - mm
        git.txt:Cool Git Topics         notes.txt:Cool Git Topics
        git.txt: - git-cvsserver        notes.txt: - git-cvsserver
        git.txt: - Cogito               notes.txt: - gitview
                                        notes.txt: - Cogito
                                        notes.txt: - StGIT
                                        notes.txt: - diff --cc

Now you would want to compare notes and merge them.  When
comparing these two "trees", the clever merge algorithm would
treat this two-column thingy and merge both labels
(i.e. pathnames) and contents:

                    linux.txt:Kernel Topics
                    linux.txt: - filesystem
                    linux.txt: - scheduler
                    linux.txt: - devices
                    linux.txt: - mm
                    linux.txt: - stable driver API
                    git.txt:Cool Git Topics
                    git.txt: - git-cvsserver
                    git.txt: - gitview
                    git.txt: - Cogito
                    git.txt: - StGIT
                    git.txt: - diff --cc

It could even guess that the line you touched are related to the
hunk your friend moved to another file (iow, your friend gave a
new label to the region you touched), and label your new line
with the same pathname as surrounding lines.

I suspect this is weave merge taken to its extreme, but I am
handwaving so please do not ask me how I would propose to
implement it ;-).  The point really is that file is a poor unit
of operation when dealing with changes.

^ permalink raw reply

* [PATCH] contrib/emacs: Add an Emacs VC backend.
From: Alexandre Julliard @ 2006-03-04 14:32 UTC (permalink / raw)
  To: git

Add a basic Emacs VC backend. It currently supports the following
commands: checkin, checkout, diff, log, revert, and annotate. There is
only limited support for working with revisions other than HEAD.

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

---

 contrib/emacs/vc-git.el |  135 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 135 insertions(+), 0 deletions(-)
 create mode 100644 contrib/emacs/vc-git.el

b0c7984b6da71ab875c40a661b9a743370c41dfb
diff --git a/contrib/emacs/vc-git.el b/contrib/emacs/vc-git.el
new file mode 100644
index 0000000..2453cdc
--- /dev/null
+++ b/contrib/emacs/vc-git.el
@@ -0,0 +1,135 @@
+;;; vc-git.el --- VC backend for the git version control system
+
+;; Copyright (C) 2006 Alexandre Julliard
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2 of
+;; the License, or (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be
+;; useful, but WITHOUT ANY WARRANTY; without even the implied
+;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+;; PURPOSE.  See the GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public
+;; License along with this program; if not, write to the Free
+;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+;; MA 02111-1307 USA
+
+;;; Commentary:
+
+;; This file contains a VC backend for the git version control
+;; system.
+;;
+;; To install: put this file on the load-path and add GIT to the list
+;; of supported backends in `vc-handled-backends'.
+;;
+;; TODO
+;;  - changelog generation
+;;  - working with revisions other than HEAD
+;;
+
+(defvar git-commits-coding-system 'utf-8
+  "Default coding system for git commits.")
+
+(defun vc-git--run-command-string (file &rest args)
+  "Run a git command on FILE and return its output as string."
+  (let* ((ok t)
+         (str (with-output-to-string
+                (with-current-buffer standard-output
+                  (unless (eq 0 (apply #'call-process "git" nil '(t nil) nil
+                                       (append args (list (file-relative-name file)))))
+                    (setq ok nil))))))
+    (and ok str)))
+
+(defun vc-git--run-command (file &rest args)
+  "Run a git command on FILE, discarding any output."
+  (let ((name (file-relative-name file)))
+    (eq 0 (apply #'call-process "git" nil (get-buffer "*Messages") nil (append args (list name))))))
+
+(defun vc-git-registered (file)
+  "Check whether FILE is registered with git."
+  (with-temp-buffer
+    (let* ((dir (file-name-directory file))
+           (name (file-relative-name file dir)))
+      (when dir (cd dir))
+      (and (eq 0 (call-process "git" nil '(t nil) nil "ls-files" "-c" "-z" "--" name))
+           (let ((str (buffer-string)))
+             (and (> (length str) (length name))
+                  (string= (substring str 0 (1+ (length name))) (concat name "\0"))))))))
+
+(defun vc-git-state (file)
+  "git-specific version of `vc-state'."
+  (let ((diff (vc-git--run-command-string file "diff-index" "-z" "HEAD" "--")))
+    (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} [ADMU]\0[^\0]+\0" diff))
+        'edited
+      'up-to-date)))
+
+(defun vc-git-workfile-version (file)
+  "git-specific version of `vc-workfile-version'."
+  (let ((str (with-output-to-string
+               (with-current-buffer standard-output
+                 (call-process "git" nil '(t nil) nil "symbolic-ref" "HEAD")))))
+    (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
+        (match-string 2 str)
+      str)))
+
+(defun vc-git-revert (file &optional contents-done)
+  "Revert FILE to the version stored in the git repository."
+  (if contents-done
+      (vc-git--run-command file "update-index" "--")
+    (vc-git--run-command file "checkout" "HEAD")))
+
+(defun vc-git-checkout-model (file)
+  'implicit)
+
+(defun vc-git-workfile-unchanged-p (file)
+  (let ((sha1 (vc-git--run-command-string file "hash-object" "--"))
+        (head (vc-git--run-command-string file "ls-tree" "-z" "HEAD" "--")))
+    (and head
+         (string-match "[0-7]\\{6\\} blob \\([0-9a-f]\\{40\\}\\)\t[^\0]+\0" head)
+         (string= (car (split-string sha1 "\n")) (match-string 1 head)))))
+
+(defun vc-git-register (file &optional rev comment)
+  "Register FILE into the git version-control system."
+  (vc-git--run-command file "update-index" "--add" "--"))
+
+(defun vc-git-print-log (file)
+  (let ((name (file-relative-name file))
+        (coding-system-for-read git-commits-coding-system))
+    (vc-do-command nil 'async "git" name "rev-list" "--pretty" "HEAD" "--")))
+
+(defun vc-git-diff (file &optional rev1 rev2)
+  (let ((name (file-relative-name file)))
+    (if (and rev1 rev2)
+        (vc-do-command "*vc-diff*" 0 "git" name "diff-tree" "-p" rev1 rev2 "--")
+      (vc-do-command "*vc-diff*" 0 "git" name "diff-index" "-p" (or rev1 "HEAD") "--"))
+    ; git-diff-index doesn't set exit status like diff does
+    (if (vc-git-workfile-unchanged-p file) 0 1)))
+
+(defun vc-git-checkin (file rev comment)
+  (let ((coding-system-for-write git-commits-coding-system))
+    (vc-git--run-command file "commit" "-m" comment "--only" "--")))
+
+(defun vc-git-checkout (file &optional editable rev destfile)
+  (vc-git--run-command file "checkout" (or rev "HEAD")))
+
+(defun vc-git-annotate-command (file buf &optional rev)
+  ; FIXME: rev is ignored
+  (let ((name (file-relative-name file)))
+    (call-process "git" nil buf nil "annotate" name)))
+
+(defun vc-git-annotate-time ()
+  (and (re-search-forward "[0-9a-f]+\t(.*\t\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\) \\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\) \\([-+0-9]+\\)\t[0-9]+)" nil t)
+       (vc-annotate-convert-time
+        (apply #'encode-time (mapcar (lambda (match) (string-to-number (match-string match))) '(6 5 4 3 2 1 7))))))
+
+;; Not really useful since we can't do anything with the revision yet
+;;(defun vc-annotate-extract-revision-at-line ()
+;;  (save-excursion
+;;    (move-beginning-of-line 1)
+;;    (and (looking-at "[0-9a-f]+")
+;;         (buffer-substring (match-beginning 0) (match-end 0)))))
+
+(provide 'vc-git)
-- 
1.2.4.g0040-dirty

-- 
Alexandre Julliard
julliard@winehq.org

^ permalink raw reply related

* Emacs git interface
From: Jakub Narebski @ 2006-03-04 15:10 UTC (permalink / raw)
  To: Alexandre Julliard; +Cc: git

Thank you for creating Emacs git interface.

You might want to take a look at other Emacs version control interfaces
  http://www.emacswiki.org/cgi-bin/wiki/CategoryVersionControl
especially for distributed SCMs similar to Git: Mercurial and Monotone:
  http://hg.serpentine.com/mercurial/bos?f=794a337fb657;file=contrib/mercurial.el;style=gitweb
  http://viewmtn.angrygoats.net/getfile.py?id=file&path=contrib/monotone.el
   
-- 
Jakub Narebski
    Poland

^ permalink raw reply

* [PATCH 1/5] git.el: Portability fixes for XEmacs and Emacs CVS.
From: Alexandre Julliard @ 2006-03-04 16:37 UTC (permalink / raw)
  To: git

Fixed octal constants for XEmacs.
Added highlighting support in log-edit buffer for Emacs CVS.

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

---

 contrib/emacs/git.el |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

7c95060616dd2f596d2f0bc0d707c584002913db
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 8f23477..5828d4c 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -388,9 +388,9 @@ If not set, fall back to `add-log-mailin
   (propertize
    (if (or (not old-perm)
            (not new-perm)
-           (eq 0 (logand #O111 (logxor old-perm new-perm))))
+           (eq 0 (logand ?\111 (logxor old-perm new-perm))))
        "  "
-     (if (eq 0 (logand #O111 old-perm)) "+x" "-x"))
+     (if (eq 0 (logand ?\111 old-perm)) "+x" "-x"))
   'face 'git-permission-face))
 
 (defun git-fileinfo-prettyprint (info)
@@ -806,7 +806,13 @@ If not set, fall back to `add-log-mailin
          "\n")
         (when (and merge-heads (file-readable-p ".git/MERGE_MSG"))
           (insert-file-contents ".git/MERGE_MSG"))))
-      (log-edit #'git-do-commit nil #'git-log-edit-files buffer)))
+    (let ((log-edit-font-lock-keywords
+           `(("^\\(Author:\\|Date:\\|Parent:\\)\\(.*\\)"
+              (1 font-lock-keyword-face)
+              (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))))
 
 (defun git-find-file ()
   "Visit the current file in its own buffer."
@@ -891,7 +897,7 @@ If not set, fall back to `add-log-mailin
     (define-key map "d"    diff-map)
     (define-key map "="   'git-diff-file)
     (define-key map "f"   'git-find-file)
-    (define-key map [RET] 'git-find-file)
+    (define-key map "\r"  'git-find-file)
     (define-key map "g"   'git-refresh-status)
     (define-key map "i"   'git-ignore-file)
     (define-key map "l"   'git-log-file)
-- 
1.2.4.g0040-dirty

-- 
Alexandre Julliard
julliard@winehq.org

^ permalink raw reply related

* [PATCH 2/5] git.el: Set default directory before running the status mode setup hooks.
From: Alexandre Julliard @ 2006-03-04 16:38 UTC (permalink / raw)
  To: git

Also set the list-buffers-directory variable for nicer buffer list
display.

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

---

 contrib/emacs/git.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

437d990348e13e6a4460cc445ec5d2b2077cf2fb
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 5828d4c..2363e48 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -943,6 +943,7 @@ Commands:
     (erase-buffer)
   (let ((status (ewoc-create 'git-fileinfo-prettyprint "" "")))
     (set (make-local-variable 'git-status) status))
+  (set (make-local-variable 'list-buffers-directory) default-directory)
   (run-hooks 'git-status-mode-hook)))
 
 (defun git-status (dir)
@@ -952,8 +953,8 @@ Commands:
   (if (file-directory-p (concat (file-name-as-directory dir) ".git"))
       (let ((buffer (create-file-buffer (expand-file-name "*git-status*" dir))))
         (switch-to-buffer buffer)
-        (git-status-mode)
         (cd dir)
+        (git-status-mode)
         (git-refresh-status)
         (goto-char (point-min)))
     (message "%s is not a git working tree." dir)))
-- 
1.2.4.g0040-dirty


-- 
Alexandre Julliard
julliard@winehq.org

^ permalink raw reply related

* [PATCH 3/5] git.el: Automatically update .gitignore status.
From: Alexandre Julliard @ 2006-03-04 16:38 UTC (permalink / raw)
  To: git

Update .gitignore files in the status list as they are created or
modified.

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

---

 contrib/emacs/git.el |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

403b5738e69df610ab625085ccbd771a466b7af8
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 2363e48..335dcb2 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -213,14 +213,19 @@ If not set, fall back to `add-log-mailin
   "Add a file name to the ignore file in its directory."
   (let* ((fullname (expand-file-name file))
          (dir (file-name-directory fullname))
-         (name (file-name-nondirectory fullname)))
+         (name (file-name-nondirectory fullname))
+         (ignore-name (expand-file-name git-per-dir-ignore-file dir))
+         (created (not (file-exists-p ignore-name))))
   (save-window-excursion
-    (set-buffer (find-file-noselect (expand-file-name git-per-dir-ignore-file dir)))
+    (set-buffer (find-file-noselect ignore-name))
     (goto-char (point-max))
     (unless (zerop (current-column)) (insert "\n"))
     (insert name "\n")
     (sort-lines nil (point-min) (point-max))
-    (save-buffer))))
+    (save-buffer))
+  (when created
+    (git-run-command nil nil "update-index" "--info-only" "--add" "--" (file-relative-name ignore-name)))
+  (git-add-status-file (if created 'added 'modified) (file-relative-name ignore-name))))
 
 
 ;;;; Wrappers for basic git commands
-- 
1.2.4.g0040-dirty

-- 
Alexandre Julliard
julliard@winehq.org

^ permalink raw reply related

* [PATCH 4/5] git.el: Added support for Signed-off-by.
From: Alexandre Julliard @ 2006-03-04 16:38 UTC (permalink / raw)
  To: git

If `git-append-signed-off-by' is non-nil, automatically append a
sign-off line to the log message when editing it.

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

---

 contrib/emacs/git.el |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

00728d51cbda0f21be59cc56b23f4943c6657a63
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 335dcb2..0b24b4d 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -39,7 +39,6 @@
 ;;  - hook into file save (after-save-hook)
 ;;  - diff against other branch
 ;;  - renaming files from the status buffer
-;;  - support for appending signed-off-by
 ;;  - creating tags
 ;;  - fetch/pull
 ;;  - switching branches
@@ -103,6 +102,9 @@ If not set, fall back to `add-log-mailin
 (defvar git-commits-coding-system 'utf-8
   "Default coding system for git commits.")
 
+(defvar git-append-signed-off-by nil
+  "Whether to append a Signed-off-by line to the commit message.")
+
 (defconst git-log-msg-separator "--- log message follows this line ---")
 
 (defconst git-per-dir-ignore-file ".gitignore"
@@ -792,7 +794,8 @@ If not set, fall back to `add-log-mailin
   (unless git-status (error "Not in git-status buffer."))
   (let ((buffer (get-buffer-create "*git-commit*"))
         (merge-heads (git-get-merge-heads))
-        (dir default-directory))
+        (dir default-directory)
+        (sign-off git-append-signed-off-by))
     (with-current-buffer buffer
       (when (eq 0 (buffer-size))
         (cd dir)
@@ -809,10 +812,13 @@ If not set, fall back to `add-log-mailin
           'face 'git-header-face)
          (propertize git-log-msg-separator 'face 'git-separator-face)
          "\n")
-        (when (and merge-heads (file-readable-p ".git/MERGE_MSG"))
-          (insert-file-contents ".git/MERGE_MSG"))))
+        (cond ((and merge-heads (file-readable-p ".git/MERGE_MSG"))
+               (insert-file-contents ".git/MERGE_MSG"))
+              (sign-off
+               (insert (format "\n\nSigned-off-by: %s <%s>\n"
+                               (git-get-committer-name) (git-get-committer-email)))))))
     (let ((log-edit-font-lock-keywords
-           `(("^\\(Author:\\|Date:\\|Parent:\\)\\(.*\\)"
+           `(("^\\(Author:\\|Date:\\|Parent:\\|Signed-off-by:\\)\\(.*\\)"
               (1 font-lock-keyword-face)
               (2 font-lock-function-name-face))
              (,(concat "^\\(" (regexp-quote git-log-msg-separator) "\\)$")
-- 
1.2.4.g0040-dirty

-- 
Alexandre Julliard
julliard@winehq.org

^ permalink raw reply related

* [PATCH 5/5] git.el: Added customize support for all parameters.
From: Alexandre Julliard @ 2006-03-04 16:38 UTC (permalink / raw)
  To: git

Also fixed quoting of git-log-msg-separator.

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

---

 contrib/emacs/git.el |   85 ++++++++++++++++++++++++++++++++------------------
 1 files changed, 54 insertions(+), 31 deletions(-)

c41661801015e1d04d1ac3c3a3ccd2ba254bb02c
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 0b24b4d..5135e36 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -44,7 +44,6 @@
 ;;  - switching branches
 ;;  - revlist browser
 ;;  - git-show-branch browser
-;;  - customize support
 ;;  - menus
 ;;
 
@@ -52,68 +51,92 @@
 (require 'ewoc)
 
 
-;;;; Faces
+;;;; Customizations
 ;;;; ------------------------------------------------------------
 
+(defgroup git nil
+  "Git user interface")
+
+(defcustom git-committer-name nil
+  "User name to use for commits.
+The default is to fall back to `add-log-full-name' and then `user-full-name'."
+  :group 'git
+  :type '(choice (const :tag "Default" nil)
+                 (string :tag "Name")))
+
+(defcustom git-committer-email nil
+  "Email address to use for commits.
+The default is to fall back to `add-log-mailing-address' and then `user-mail-address'."
+  :group 'git
+  :type '(choice (const :tag "Default" nil)
+                 (string :tag "Email")))
+
+(defcustom git-commits-coding-system 'utf-8
+  "Default coding system for the log message of git commits."
+  :group 'git
+  :type 'coding-system)
+
+(defcustom git-append-signed-off-by nil
+  "Whether to append a Signed-off-by line to the commit message before editing."
+  :group 'git
+  :type 'boolean)
+
+(defcustom git-per-dir-ignore-file ".gitignore"
+  "Name of the per-directory ignore file."
+  :group 'git
+  :type 'string)
+
 (defface git-status-face
   '((((class color) (background light)) (:foreground "purple")))
-  "Git mode face used to highlight added and modified files.")
+  "Git mode face used to highlight added and modified files."
+  :group 'git)
 
 (defface git-unmerged-face
   '((((class color) (background light)) (:foreground "red" :bold t)))
-  "Git mode face used to highlight unmerged files.")
+  "Git mode face used to highlight unmerged files."
+  :group 'git)
 
 (defface git-unknown-face
   '((((class color) (background light)) (:foreground "goldenrod" :bold t)))
-  "Git mode face used to highlight unknown files.")
+  "Git mode face used to highlight unknown files."
+  :group 'git)
 
 (defface git-uptodate-face
   '((((class color) (background light)) (:foreground "grey60")))
-  "Git mode face used to highlight up-to-date files.")
+  "Git mode face used to highlight up-to-date files."
+  :group 'git)
 
 (defface git-ignored-face
   '((((class color) (background light)) (:foreground "grey60")))
-  "Git mode face used to highlight ignored files.")
+  "Git mode face used to highlight ignored files."
+  :group 'git)
 
 (defface git-mark-face
   '((((class color) (background light)) (:foreground "red" :bold t)))
-  "Git mode face used for the file marks.")
+  "Git mode face used for the file marks."
+  :group 'git)
 
 (defface git-header-face
   '((((class color) (background light)) (:foreground "blue")))
-  "Git mode face used for commit headers.")
+  "Git mode face used for commit headers."
+  :group 'git)
 
 (defface git-separator-face
   '((((class color) (background light)) (:foreground "brown")))
-  "Git mode face used for commit separator.")
+  "Git mode face used for commit separator."
+  :group 'git)
 
 (defface git-permission-face
   '((((class color) (background light)) (:foreground "green" :bold t)))
-  "Git mode face used for permission changes.")
-
-(defvar git-committer-name nil
-  "*User name to use for commits.
-If not set, fall back to `add-log-full-name' and then `user-full-name'.")
-
-(defvar git-committer-email nil
-  "*Email address to use for commits.
-If not set, fall back to `add-log-mailing-address' and then `user-mail-address'.")
-
-(defvar git-commits-coding-system 'utf-8
-  "Default coding system for git commits.")
-
-(defvar git-append-signed-off-by nil
-  "Whether to append a Signed-off-by line to the commit message.")
-
-(defconst git-log-msg-separator "--- log message follows this line ---")
-
-(defconst git-per-dir-ignore-file ".gitignore"
-  "Name of the per-directory ignore file.")
+  "Git mode face used for permission changes."
+  :group 'git)
 
 
 ;;;; Utilities
 ;;;; ------------------------------------------------------------
 
+(defconst git-log-msg-separator "--- log message follows this line ---")
+
 (defun git-get-env-strings (env)
   "Build a list of NAME=VALUE strings from a list of environment strings."
   (mapcar (lambda (entry) (concat (car entry) "=" (cdr entry))) env))
@@ -279,7 +302,7 @@ If not set, fall back to `add-log-mailin
     (with-current-buffer buffer
       (goto-char (point-min))
       (if
-          (setq log-start (re-search-forward (concat "^" git-log-msg-separator "\n") nil t))
+          (setq log-start (re-search-forward (concat "^" (regexp-quote git-log-msg-separator) "\n") nil t))
           (save-restriction
             (narrow-to-region (point-min) log-start)
             (goto-char (point-min))
-- 
1.2.4.g0040-dirty

-- 
Alexandre Julliard
julliard@winehq.org

^ permalink raw reply related

* [PATCH] AsciiDoc fix for tutorial
From: Francis Daly @ 2006-03-04 16:35 UTC (permalink / raw)
  To: git

RE \^.+\^ becomes <sup>. Not wanted here

---

 Documentation/tutorial.txt |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

7b81a656bfa1faea449f4c9c083d69f940912a8d
diff --git a/Documentation/tutorial.txt b/Documentation/tutorial.txt
index 66680d7..268a877 100644
--- a/Documentation/tutorial.txt
+++ b/Documentation/tutorial.txt
@@ -309,7 +309,7 @@ git diff HEAD^^ HEAD^
 -------------------------------------
 
 shows the difference between that previous state and the state two
-commits ago.  Also, HEAD~5 can be used as a shorthand for HEAD^^^^^,
+commits ago.  Also, HEAD~5 can be used as a shorthand for HEAD{caret}{caret}{caret}^^,
 and more generally HEAD~n can refer to the nth previous commit.
 Commits representing merges have more than one parent, and you can
 specify which parent to follow in that case; see
-- 
1.2.GIT

-- 
Francis Daly        francis@daoine.org

^ permalink raw reply related

* Re: On recording renames
From: Linus Torvalds @ 2006-03-04 17:36 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, paul
In-Reply-To: <7v8xrqqrdd.fsf@assigned-by-dhcp.cox.net>



On Sat, 4 Mar 2006, Junio C Hamano wrote:
> 
> An ideal merge strategy would handle the case where pieces of
> code gradually moves around across file boundaries.  I do not
> think this is something you can sensibly do by recording file
> rename history.  It would not help the situation a bit even if
> you gave each file (or content or object or whatever you want to
> call it) a persistent ID.

Actually, we have an absolutely perfect example of this much closer to 
home.

I originally did the "rev-list split" series on an older version of git, 
before you did the --objects-edge and the full pathname hashing 
improvements. But when I was done, you'd merged that, and I needed to 
merge my rev-list.c split with your improvements in order to send it to 
you.

Now, the whold file hadn't actually been renamed, but about 50% of that 
file had been split into a new one. So effectively you had a merge where 
part of the new stuff had to be merged into another file.

Now, I think this is actually more common than renames in many ways. It's 
not a "complete" rename, but as far as _part_ of your changes were
concerned, it was one.

And yes, such a split can be something that is done in stages, again 
exactly the same way about 85% of rev-list.c was moved into revision.c in 
two stages: the first stage was the argument parsing and setup, and the 
second stage was the actual revision walking logic.

		Linus

^ permalink raw reply

* git-status too verbose?
From: Eric Jaffe @ 2006-03-04 17:52 UTC (permalink / raw)
  To: git

I was wondering if anyone else thinks that git-status should be more
like "git-diff --name-status". That is,
  # A a/newfile.c
  # M a/oldfile.c

instead of
  # new file: a/newfile.c
  # modified: a/oldfile.c

This would be similar to cg-status and "svn status", etc.

--
Eric Jaffe <jaffe.eric@gmail.com>

^ permalink raw reply

* Re: [PATCH] AsciiDoc fix for tutorial
From: Junio C Hamano @ 2006-03-04 21:51 UTC (permalink / raw)
  To: Francis Daly; +Cc: git
In-Reply-To: <20060304163527.GA12015@craic.sysops.org>

Francis Daly <francis@daoine.org> writes:

>  shows the difference between that previous state and the state two
> -commits ago.  Also, HEAD~5 can be used as a shorthand for HEAD^^^^^,
> +commits ago.  Also, HEAD~5 can be used as a shorthand for HEAD{caret}{caret}{caret}^^,

Thanks.  Why not 5 {caret}, not just three {caret} plus ^^?

^ permalink raw reply

* Re: Problems with using git
From: Greg KH @ 2006-03-04 22:25 UTC (permalink / raw)
  To: Mark Wooding; +Cc: git
In-Reply-To: <slrne0isi9.fr9.mdw@metalzone.distorted.org.uk>

On Sat, Mar 04, 2006 at 10:56:09AM +0000, Mark Wooding wrote:
> Greg KH <greg@kroah.com> wrote:
> 
> > The latest development tree, and the latest public betas contain
> > 1.1.3.  If you think this should be newer, I can easily go poke the
> > proper people...
> 
> Given that there's a security issue which got fixed in 1.1.5, I think
> this is really a bit poor.
> 
> I notice, by contrast, that Debian had managed to repackage and release
> a new GIT the day after Junio fixed the bug in the first place.  That
> was more than a month ago.

Fair enough, I'll go poke the proper people now...

thanks,

greg k-h

^ permalink raw reply

* [PATCH] Use core.sharedrepository consistently.
From: Fernando J. Pereda @ 2006-03-04 22:51 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 1523 bytes --]

'git init-db --shared' sets 'core.sharedRepository' but in
setup.c 'core.sharedrepository' is checked instead. This
trivial patch makes both init-db.c and its documentation to
use 'core.sharedrepository'.

Signed-off-by: Fernando J. Pereda <ferdy@gentoo.org>

---

 Documentation/git-init-db.txt |    2 +-
 init-db.c                     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

531df8e5c78ca67746b7a651ac4486eae8b114c6
diff --git a/Documentation/git-init-db.txt b/Documentation/git-init-db.txt
index ea4d849..2d818d6 100644
--- a/Documentation/git-init-db.txt
+++ b/Documentation/git-init-db.txt
@@ -34,7 +34,7 @@ environment variable then the sha1 direc
 otherwise the default `$GIT_DIR/objects` directory is used.
 
 A shared repository allows users belonging to the same group to push into that
-repository. When specifying `--shared` the config variable "core.sharedRepository" 
+repository. When specifying `--shared` the config variable "core.sharedrepository"
 is set to 'true' so that directories under `$GIT_DIR` are made group writable
 (and g+sx, since the git group may be not the primary group of all users).
 
diff --git a/init-db.c b/init-db.c
index ff29496..e77a749 100644
--- a/init-db.c
+++ b/init-db.c
@@ -285,7 +285,7 @@ int main(int argc, char **argv)
 	safe_create_dir(path, 1);
 
 	if (shared_repository)
-		git_config_set("core.sharedRepository", "true");
+		git_config_set("core.sharedrepository", "true");
 
 	return 0;
 }
-- 
1.2.4


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply related

* Re: [PATCH] Use core.sharedrepository consistently.
From: Fernando J. Pereda @ 2006-03-04 23:02 UTC (permalink / raw)
  To: git
In-Reply-To: <20060304225125.GB8891@ferdyx.org>

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

On Sat, Mar 04, 2006 at 11:51:25PM +0100, Fernando J. Pereda wrote:
> [snip]

Nevermind that one... I screwed almost every possible header in my mail.
Sorry.

-- 
Fernando J. Pereda Garcimartín
Gentoo Developer (Alpha,net-mail,mutt,git)
20BB BDC3 761A 4781 E6ED  ED0B 0A48 5B0C 60BD 28D4

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* [PATCH] Use core.sharedrepository consistently.
From: Fernando J. Pereda @ 2006-03-04 23:05 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]

'git init-db --shared' sets 'core.sharedRepository' but in
setup.c 'core.sharedrepository' is checked instead. This
trivial patch fixes both init-db.c and its documentation to
use 'core.sharedrepository'.

Signed-off-by: Fernando J. Pereda <ferdy@gentoo.org>

---

 Documentation/git-init-db.txt |    2 +-
 init-db.c                     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

531df8e5c78ca67746b7a651ac4486eae8b114c6
diff --git a/Documentation/git-init-db.txt b/Documentation/git-init-db.txt
index ea4d849..2d818d6 100644
--- a/Documentation/git-init-db.txt
+++ b/Documentation/git-init-db.txt
@@ -34,7 +34,7 @@ environment variable then the sha1 direc
 otherwise the default `$GIT_DIR/objects` directory is used.
 
 A shared repository allows users belonging to the same group to push into that
-repository. When specifying `--shared` the config variable "core.sharedRepository" 
+repository. When specifying `--shared` the config variable "core.sharedrepository"
 is set to 'true' so that directories under `$GIT_DIR` are made group writable
 (and g+sx, since the git group may be not the primary group of all users).
 
diff --git a/init-db.c b/init-db.c
index ff29496..e77a749 100644
--- a/init-db.c
+++ b/init-db.c
@@ -285,7 +285,7 @@ int main(int argc, char **argv)
 	safe_create_dir(path, 1);
 
 	if (shared_repository)
-		git_config_set("core.sharedRepository", "true");
+		git_config_set("core.sharedrepository", "true");
 
 	return 0;
 }
-- 
1.2.4

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply related

* Re: [PATCH] AsciiDoc fix for tutorial
From: Francis Daly @ 2006-03-04 23:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7v4q2dri8c.fsf@assigned-by-dhcp.cox.net>

On Sat, Mar 04, 2006 at 01:51:47PM -0800, Junio C Hamano wrote:
> Francis Daly <francis@daoine.org> writes:
> 
> >  shows the difference between that previous state and the state two
> > -commits ago.  Also, HEAD~5 can be used as a shorthand for HEAD^^^^^,
> > +commits ago.  Also, HEAD~5 can be used as a shorthand for HEAD{caret}{caret}{caret}^^,
> 
> Thanks.  Why not 5 {caret}, not just three {caret} plus ^^?

No real reason; the asciidoc parser accepts two together so I left them
there.  Anyone reading a transformed version should see the real ^s,
so the question is whether it's clearer for someone reading the .txt
file to see a mixture with a passing resemblance to a few lines earlier,
or just to see {caret} consistently.

5 {caret} is fine by me.

For more consistency, there are three other ^s in the file could which
could also be changed, but none of them cause breakage now.

	f
-- 
Francis Daly        francis@daoine.org

^ permalink raw reply

* Re: [PATCH] Use core.sharedrepository consistently.
From: Linus Torvalds @ 2006-03-04 23:16 UTC (permalink / raw)
  To: Fernando J. Pereda; +Cc: git
In-Reply-To: <20060304225125.GB8891@ferdyx.org>



On Sat, 4 Mar 2006, Fernando J. Pereda wrote:
>
> 'git init-db --shared' sets 'core.sharedRepository' but in
> setup.c 'core.sharedrepository' is checked instead.

It really shouldn't matter.

Case in a git config option name is always converted to lower case when 
the config file is read, exactly so that you can use mixed case without 
the actual readers caring. Lots of people prefer mixed-case for 
human-readable info, ie

	[Core]
		Name=Linus Torvalds

will actually generate

	core.name=Linus Torvalds

as the config variable.

So the code should have worked fine.  Unless there is some bug somewhere.

		Linus

^ permalink raw reply

* Re: [PATCH] Use core.sharedrepository consistently.
From: Junio C Hamano @ 2006-03-04 23:38 UTC (permalink / raw)
  To: Fernando J. Pereda; +Cc: git
In-Reply-To: <20060304230557.GB28469@ferdyx.org>

"Fernando J. Pereda" <ferdy@gentoo.org> writes:

> 'git init-db --shared' sets 'core.sharedRepository' but in
> setup.c 'core.sharedrepository' is checked instead.

I thought they were case insensitive..

^ permalink raw reply

* Managing topic branches
From: Junio C Hamano @ 2006-03-05  1:56 UTC (permalink / raw)
  To: git

I adopted Tony's excellent "topic branches" workflow to manage
the topics cooking in separate branches.  The flow goes like
this:

 - The change to the topic are made as new commits on top of
   the topic branch.  My naming convention for topic branches
   are two letters directory under .git/refs/heads/ and short
   word.  E.g. np/delta for Nico's finer-grained delta work,
   ml/cvsserver for Martin's git-cvsserver.

 - To test topics myself and publish the bleeding edge to
   others, updated topic branches are merged into "next".  If I
   have some changes to "master", the tip of it is also
   merged into "next", so that people following "next" will not
   miss out trivial fixes directly made to "master".

 - Once a topic is fully cooked, it is merged into "master".  I
   delete the topic branch in my private repository (its tip is
   already merged into "master" and also it was merged into
   "next" long time ago).

This worked reasonably well, and I can see what are still not in
"master" but brewing in "next" with two ways:

 - "git log master..next".  This is the orthodox way to view
   list of commits that are in next but still not in next.
   Giving --no-merges option would help cutting down the
   cluttering.

 - "git show-branch --topics master 'heads/??/*'". (note: ??/*
   is literally given to show-branch to let it glob).

However, the former started to break down recently, due to two
reasons.

1. np/delta turned out to be unsatisfactory, and I had reverts
   and re-reverts in the topic branch.  Eventually Nico and I
   decided to throw away the last three commits after merging
   the earlier bits into "master".

        (other topic brances merged into next)
           \   \       \    \      \   \
        o---o---o---o---o---o---o---o---o next
       /           /           /
      o---o---x---x---x---x---x np/delta
     /     \ <-- earlier parts merged
    o---o---o---o---o master

Some commits on "np/delta" merged into "next" are reverts and
the tip of "next" now do not have unwanted bits from the
finer-grained delta experiments.  I have dropped np/delta topic
branch, so "show-branch --topics" does not bother me with these
commits marked with 'x' anymore, but "git log master..next" will
keep showing them


2. "ml/cvsserver" was initially based on then-current "next"
   tip, because it depended on something else that was only
   present in "next", but by the time I pulled it from Martin,
   the pieces it depended on have already graduated to "master".

Since I wanted to have cvsserver in the "master" sooner than
everything else that were in "next" when Martin prepared these
commits, I ended up doing this:

Here is what the ancestry graph looked like when I received
cvsserver stuff:

                        a---b---c ml/cvsserver
                       /
          o---o---o---o next
         /   /   /             A: another topic ml/cvsserver
        /   A   B*                depended on
       /     \                 B*: many other "unready" topics
      o---o---o---o master

So I cherry-picked them on to "master", and merged both
"ml/cvsserver" and "master" into "next":

                        a---b---c ml/cvsserver
                       /         \ <-- questionable octopus leg
          o---o---o---o-----------* next
         /   /   /               /  
        /   o   o               /  
       /     \                 /
      o---o---o---o---a'--b'--c' master

I could have done without the "questionable octopus leg", but I
did so that when Martin pulled my "next" into his cvsserver
branch, he does not have to do the real merges [*1*].  But now
commits a---b---c comes back to haunt me whenever I do "git log
master..next".

The moral of the story is not to try to be nice to others
without thinking about its concequences ;-).  I should have just
done without the "questionable octopus leg", and asked Martin to
discard and rebase his tip of the development to my "next" after
this merge.


Anyhow, what I ended up doing to make "log master..next" usable
again was to cauterize the tips of unwanted topic branches
merged into next by merging them into "master" branch using
"ours" strategy:

	$ git checkout master
	$ git merge -s ours "excuse for this" HEAD ml/cvsserver np/delta

Luckily, I have merged up all the B*'s from "next" to "master",
so this was possible, but otherwise until I either merge them to
"master" or decide to drop forever I needed to keep a---b---c
around in "log master..next" output for a loooong time X-<.


[Footnote]

*1* I briefly thought about doing this instead, but this is a
wrong thing to do:

                        a---b---c ml/cvsserver
                       /         \       
          o---o---o---o-------------------* next
         /   /   /                 \     /
        /   A   B*                  \   / 
       /     \                       \ /
      o---o---o---o-------------------* master
                   \                 /
                    a'------b'------c'
                     (cherry picked)

At this point, master would claim to have merged B* but actually
it has not.

^ permalink raw reply

* What's in git.git
From: Junio C Hamano @ 2006-03-05  4:22 UTC (permalink / raw)
  To: git

I've merged up a lot for people to have fun over the weekend
;-).

The most notable core-ish change is that rev-list split and new
git-log implementation by Linus.  I've been using this myself
for a while without problems, but there might still be some
corner cases that I (and Linus perhaps) do not exercise where
git-log command behaves slightly differently.  rev-list is not
supposed to have *any* regression other than removal of
--merge-order.  Please report regressions.

A new killer application is git-cvsserver.  It now talks pserver
protocol for anonymous CVS access.  Helping Martin to audit the
code for any issues, security or otherwise, is greatly
appreciated.

Fredrik's git-blame still has -Wdeclaration-after-statement
issues, but deserves to be beaten harder alongside Ryan's
git-annotate for two reasons.  It should be a good example
program to use the new revision traversal infrastructure, and it
is always good to have competing two implementations ;-).


* The 'master' branch has these since the last announcement.

 - Cygwin portability for test (Alex Riesen)
   workaround fat/ntfs deficiencies for t3600-rm.sh (git-rm)

 - Emacs interface (Alexandre Julliard)
   contrib/emacs: Add an Emacs VC backend.
   git.el: Added customize support for all parameters.
   git.el: Added support for Signed-off-by.
   git.el: Automatically update .gitignore status.
   git.el: Portability fixes for XEmacs and Emacs CVS.
   git.el: Set default directory before running the status mode setup hooks.

 - gitview updates (Aneesh Kumar K.V)
   gitview: Use horizontal scroll bar in the tree view
   gitview: pass the missing argument _show_clicked_cb.

 - git-svn updates (Eric Wong)
   contrib/git-svn: add --id/-i=$GIT_SVN_ID command-line switch
   contrib/git-svn: add -b/--branch switch for branch detection
   contrib/git-svn: allow --authors-file to be specified
   contrib/git-svn: avoid re-reading the repository uuid, it never changes
   contrib/git-svn: better documenting of CLI switches
   contrib/git-svn: cleanup option parsing
   contrib/git-svn: create a more recent master if one does not exist
   contrib/git-svn: fix a copied-tree bug in an overzealous assertion
   contrib/git-svn: several small bug fixes and changes
   contrib/git-svn: strip 'git-svn-id:' when commiting to SVN
   contrib/git-svn: use refs/remotes/git-svn instead of git-svn-HEAD
   git-branch: add -r switch to list refs/remotes/*

 - send-email fix (Eric Wong)
   send-email: accept --no-signed-off-by-cc as the documentation states

 - checkout-index --stdin (Shawn Pearce)
   Teach git-checkout-index to read filenames from stdin.

 - git-blame (Fredrik Kuivinen)
   Add git-blame, a tool for assigning blame.
   git-blame, take 2

 - git-mv updates (Josef Weidendorfer)
   git-mv: Allow -h without repo & fix error message
   git-mv: fixes for path handling
   git-mv: fix moves into a subdir from outside

 - split rev-list implementation and git-log (Linus and me)
   First cut at libifying revlist generation
   Splitting rev-list into revisions lib, end of beginning.
   git-rev-list libification: rev-list walking
   Introduce trivial new pager.c helper infrastructure
   Tie it all together: "git log"
   Rip out merge-order and make "git log <paths>..." work again.
   rev-list split: minimum fixup.
   git-log (internal): add approxidate.
   git-log (internal): more options.
   setup_revisions(): handle -n<n> and -<n> internally.

 - git-verify-tag update (me)
   Pretty-print tagger dates.

 - git-commit --amend (me) 

 - show-branch --topics (me)

 - git-svnimport update (Karl  Hasselström)
   Save username -> Full Name <email@addr.es> map file

 - git tool survey documentation (Marco Costalba)
   Add a Documentation/git-tools.txt

 - git-cvsserver updates (Martin Langhoff)
   cvsserver: Checkout correctly on Eclipse
   annotate: fix -S parameter to take a string
   cvsserver: Eclipse compat -- now "compare with latest from HEAD" works
   cvsserver: checkout faster by sending files in a sensible order
   cvsserver: fix checkouts with -d <somedir>
   cvsserver: nested directory creation fixups for Eclipse clients
   cvsserver: better error messages
   cvsserver: anonymous cvs via pserver support

 - delta cleanup (Nicolas Pitre)
   relax delta selection filtering in pack-objects
   diff-delta: fold two special tests into one plus cleanups
   diff-delta: big code simplification

 - git-annotate updates (Ryan Anderson)
   annotate: handle \No newline at end of file.
   annotate: Add a basic set of test cases.

 - misc fixes and docs (Francis Daly, Johannes Schindelin, Jonas Fonseca,
   Mark Wooding, Shawn Pearce, Tony Luck, Martin Langhoff, me)
   AsciiDoc fix for tutorial
   Documentation: read-tree --aggressive
   Documentation: rev-list --objects-edge
   Fix test case for some sed
   GIT-VERSION-GEN: squelch unneeded error from "cat version"
   Prevent --index-info from ignoring -z.
   Pull GIT 1.2.4 fixes from master
   Re-fix compilation warnings.
   Warn about invalid refs
   annotate should number lines starting with 1
   annotate: fix -S parameter to take a string
   annotate: resurrect raw timestamps.
   combine-diff: Honour --full-index.
   combine-diff: Honour -z option correctly.
   git-commit: make sure we protect against races.
   manpages: insert two missing [verse] markers for multi-line SYNOPSIS
   read-tree --aggressive: remove deleted entry from the working tree.
   tar-tree: file/dirmode fix.
   war on whitespaces: documentation.

* The 'next' branch, in addition, has these.

 - diffcore-rename/break and similarity estimator tweaks (me)
   count-delta: no need for this anymore.
   diffcore-break: similarity estimator fix.
   diffcore-delta: make change counter to byte oriented again.
   diffcore-rename: similarity estimator fix.

* The 'pu' branch, in addition, has these.

 - checkout-index --temp --stage=all (Shawn Pearce)

^ permalink raw reply

* Re: What's in git.git
From: Junio C Hamano @ 2006-03-05  4:51 UTC (permalink / raw)
  To: git
In-Reply-To: <7vacc5jza6.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano <junkio@cox.net> writes:

> Fredrik's git-blame still has -Wdeclaration-after-statement
> issues,...

Quick correction before anybody says anything.

Sorry Fredrik, there is none anymore --- you have already done
clean-up and I merged it.  Just "print_map defined but not used".

^ permalink raw reply

* Re: What's in git.git
From: Linus Torvalds @ 2006-03-05  4:58 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vacc5jza6.fsf@assigned-by-dhcp.cox.net>


On Sat, 4 Mar 2006, Junio C Hamano wrote:
> 
> The most notable core-ish change is that rev-list split and new
> git-log implementation by Linus.  I've been using this myself
> for a while without problems, but there might still be some
> corner cases that I (and Linus perhaps) do not exercise where
> git-log command behaves slightly differently.  rev-list is not
> supposed to have *any* regression other than removal of
> --merge-order.  Please report regressions.

Here's a potential fix for a special case that we used to have to make

	git-rev-list --max-count=1

be faster and not unnecessarily parse any parent objects.

Now, we had that special case because gitweb was apparently doing a lot of 
it, and quite frankly, I don't know if it still does. But basically it 
avoids doing the "pop_most_recent_commit()" which will look up and parse 
the parents, if it is obvious that it can.

I'm not sure this is worth it, but it looks obvious enough. Somebody with 
gitweb somewhere should probably check if it still even wants this.

		Linus

----
diff --git a/revision.c b/revision.c
index a3df810..33a5f20 100644
--- a/revision.c
+++ b/revision.c
@@ -696,6 +696,18 @@ struct commit *get_revision(struct rev_i
 		break;
 	case 0:
 		return NULL;
+
+	/* Special case to avoid unnecessary parent checking */
+	case 1:
+		if (!revs->limited &&
+		    !revs->no_merges &&
+		    !revs->paths &&
+		    revs->min_age == -1 &&
+		    revs->max_age == -1) {
+		    	revs->max_count = 0;
+			commit->object.flags |= SHOWN;
+			return commit;
+		}
 	default:
 		revs->max_count--;
 	}

^ permalink raw reply related

* Re: [PATCH] Add --temp and --stage=all options to checkout-index.
From: Junio C Hamano @ 2006-03-05  5:29 UTC (permalink / raw)
  To: Shawn Pearce; +Cc: git
In-Reply-To: <20060303151331.GA16369@spearce.org>

Shawn Pearce <spearce@spearce.org> writes:

> Junio C Hamano <junkio@cox.net> wrote:
>> Shawn Pearce <spearce@spearce.org> writes:
>> 
>> >  Unfortunately this change lead me down a path which changed the core
>> >  checkout code also used by apply and read-tree.
>> 

I would have preferred not to add to_tempfile member to the
checkout struct.  Instead, if checkout_entry has non NULL
topath, check out to a temporary location and return the path;
otherwise behave the way it did before.

That way everybody else would not need to declare useless
topath[] array on the stack and pass it to checkout_entry
(instead they would just pass NULL because they are not
interested in checking out to temporary files).

I am unsure about what the tempfile option should do when asked
to checkout a symbolic link.  Creating a temporary regular file
that has the readlink result does not sound very useful to me.

BTW, in any case, I think there is one breakage that needs to be
fixed with something like this...

---
diff --git a/apply.c b/apply.c
index 5a2cf54..727d63d 100644
--- a/apply.c
+++ b/apply.c
@@ -1311,6 +1311,7 @@ static int check_patch(struct patch *pat
 				costate.force = 0;
 				costate.quiet = 0;
 				costate.not_new = 0;
+				costate.to_tempfile = 0;
 				costate.refresh_cache = 1;
 				if (checkout_entry(active_cache[pos],
 						   &costate, topath) ||

^ permalink raw reply related

* Re: What's in git.git
From: Junio C Hamano @ 2006-03-05  5:44 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0603042058250.13139@g5.osdl.org>

Linus Torvalds <torvalds@osdl.org> writes:

> I'm not sure this is worth it, but it looks obvious enough. Somebody with 
> gitweb somewhere should probably check if it still even wants this.

I just pulled and it's still v264 (Jan 17 2006).  It does it in
one sub (git_read_commit) to read a single commit and the sub is
called from almost everywhere, so it would help.

Having said that...

> diff --git a/revision.c b/revision.c
> index a3df810..33a5f20 100644
> --- a/revision.c
> +++ b/revision.c
> @@ -696,6 +696,18 @@ struct commit *get_revision(struct rev_i
>  		break;
>  	case 0:
>  		return NULL;
> +
> +	/* Special case to avoid unnecessary parent checking */
> +	case 1:
> +		if (!revs->limited &&
> +		    !revs->no_merges &&
> +		    !revs->paths &&
> +		    revs->min_age == -1 &&
> +		    revs->max_age == -1) {
> +		    	revs->max_count = 0;
> +			commit->object.flags |= SHOWN;
> +			return commit;
> +		}

At this point commit is revs->commits->item.  It cannot be
UNINTERESTING because you make it sure with !revs->limited and
friends, but I wonder if it can be SHOWN already for some
reason, in which case returning it is wrong.

Unlike the earlier special case in rev-list, this special case
kicks in for the last iteration of repeated calls to
get_revision() (e.g. third iteration of "rev-list -3")...

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox