* [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
* [PATCH] cosmetics: change from 'See-Also' to 'See Also'
From: Jeff Muizelaar @ 2006-03-05 6:20 UTC (permalink / raw)
To: git
Changes the documentation that uses 'See-Also' to the more common
'See Also' form.
---
Documentation/git-pack-objects.txt | 2 +-
Documentation/git-pack-redundant.txt | 2 +-
Documentation/git-prune-packed.txt | 2 +-
Documentation/git-repack.txt | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
a4de726b80fe261856b9086b32f6e879f5ff0013
diff --git a/Documentation/git-pack-objects.txt b/Documentation/git-pack-objects.txt
index 4cb2e83..567dabf 100644
--- a/Documentation/git-pack-objects.txt
+++ b/Documentation/git-pack-objects.txt
@@ -101,7 +101,7 @@ Documentation
-------------
Documentation by Junio C Hamano
-See-Also
+See Also
--------
gitlink:git-repack[1]
gitlink:git-prune-packed[1]
diff --git a/Documentation/git-pack-redundant.txt b/Documentation/git-pack-redundant.txt
index 9fe86ae..2f4cc46 100644
--- a/Documentation/git-pack-redundant.txt
+++ b/Documentation/git-pack-redundant.txt
@@ -46,7 +46,7 @@ Documentation
--------------
Documentation by Lukas Sandström <lukass@etek.chalmers.se>
-See-Also
+See Also
--------
gitlink:git-pack-objects[1]
gitlink:git-repack[1]
diff --git a/Documentation/git-prune-packed.txt b/Documentation/git-prune-packed.txt
index 37c53a9..2348826 100644
--- a/Documentation/git-prune-packed.txt
+++ b/Documentation/git-prune-packed.txt
@@ -40,7 +40,7 @@ Documentation
--------------
Documentation by Ryan Anderson <ryan@michonline.com>
-See-Also
+See Also
--------
gitlink:git-pack-objects[1]
gitlink:git-repack[1]
diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt
index 6c0f792..d2f9a44 100644
--- a/Documentation/git-repack.txt
+++ b/Documentation/git-repack.txt
@@ -63,7 +63,7 @@ Documentation
--------------
Documentation by Ryan Anderson <ryan@michonline.com>
-See-Also
+See Also
--------
gitlink:git-pack-objects[1]
gitlink:git-prune-packed[1]
--
1.2.4.g8bc6
^ permalink raw reply related
* Re: [PATCH] Add --temp and --stage=all options to checkout-index.
From: Shawn Pearce @ 2006-03-05 8:24 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vlkvpihm4.fsf@assigned-by-dhcp.cox.net>
Sometimes it is convient for a Porcelain to be able to checkout all
unmerged files in all stages so that an external merge tool can be
executed by the Porcelain or the end-user. Using git-unpack-file
on each stage individually incurs a rather high penalty due to the
need to fork for each file version obtained. git-checkout-index -a
--stage=all will now do the same thing, but faster.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
This replaces my prior patch. It looks a heck of a lot cleaner too
due to less indentation changes. :-)
Junio C Hamano <junkio@cox.net> wrote:
> 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.
Good idea.
> 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.
I couldn't decide either here; but there's no `mkstemplink'
or some-such function to generate a temporary symbolic link.
With the target in a temp file a Porcelain can at least generate
a true symbolic link with the correct target or present it the
different versions to the user for resolution. Symlinks are
definately difficult.
> BTW, in any case, I think there is one breakage that needs to be
> fixed with something like this...
That should be fixed with this version of the patch. Good catch.
Documentation/git-checkout-index.txt | 51 ++++++++
apply.c | 3
cache.h | 2
checkout-index.c | 86 ++++++++++++--
entry.c | 40 +++++-
read-tree.c | 2
t/t2004-checkout-cache-temp.sh | 212 ++++++++++++++++++++++++++++++++++
7 files changed, 370 insertions(+), 26 deletions(-)
create mode 100755 t/t2004-checkout-cache-temp.sh
base 1c7fee5d0857d809fe5d93a1d56968e44296ce55
last aa1305c3181ac1a3a493765bf41c2d59f8b8ce3e
diff --git a/Documentation/git-checkout-index.txt b/Documentation/git-checkout-index.txt
index b0b6588..09bd6a5 100644
--- a/Documentation/git-checkout-index.txt
+++ b/Documentation/git-checkout-index.txt
@@ -10,7 +10,8 @@ SYNOPSIS
--------
[verse]
'git-checkout-index' [-u] [-q] [-a] [-f] [-n] [--prefix=<string>]
- [--stage=<number>]
+ [--stage=<number>|all]
+ [--temp]
[-z] [--stdin]
[--] [<file>]\*
@@ -43,9 +44,15 @@ OPTIONS
When creating files, prepend <string> (usually a directory
including a trailing /)
---stage=<number>::
+--stage=<number>|all::
Instead of checking out unmerged entries, copy out the
files from named stage. <number> must be between 1 and 3.
+ Note: --stage=all automatically implies --temp.
+
+--temp::
+ Instead of copying the files to the working directory
+ write the content to temporary files. The temporary name
+ associations will be written to stdout.
--stdin::
Instead of taking list of paths from the command line,
@@ -87,6 +94,46 @@ it will prevent problems with a filename
Using `--` is probably a good policy in scripts.
+Using --temp or --stage=all
+---------------------------
+When `--temp` is used (or implied by `--stage=all`)
+`git-checkout-index` will create a temporary file for each index
+entry being checked out. The index will not be updated with stat
+information. These options can be useful if the caller needs all
+stages of all unmerged entries so that the unmerged files can be
+processed by an external merge tool.
+
+A listing will be written to stdout providing the association of
+temporary file names to tracked path names. The listing format
+has two variations:
+
+ . tempname TAB path RS
++
+The first format is what gets used when `--stage` is omitted or
+is not `--stage=all`. The field tempname is the temporary file
+name holding the file content and path is the tracked path name in
+the index. Only the requested entries are output.
+
+ . stage1temp SP stage2temp SP stage3tmp TAB path RS
++
+The second format is what gets used when `--stage=all`. The three
+stage temporary fields (stage1temp, stage2temp, stage3temp) list the
+name of the temporary file if there is a stage entry in the index
+or `.` if there is no stage entry. Paths which only have a stage 0
+entry will always be omitted from the output.
+
+In both formats RS (the record separator) is newline by default
+but will be the null byte if -z was passed on the command line.
+The temporary file names are always safe strings; they will never
+contain directory separators or whitespace characters. The path
+field is always relative to the current directory and the temporary
+file names are always relative to the top level directory.
+
+If the object being copied out to a temporary file is a symbolic
+link the content of the link will be written to a normal file. It is
+up to the end-user or the Porcelain to make use of this information.
+
+
EXAMPLES
--------
To update and refresh only the files already checked out::
diff --git a/apply.c b/apply.c
index c369966..849a8b4 100644
--- a/apply.c
+++ b/apply.c
@@ -1402,7 +1402,8 @@ static int check_patch(struct patch *pat
costate.not_new = 0;
costate.refresh_cache = 1;
if (checkout_entry(active_cache[pos],
- &costate) ||
+ &costate,
+ NULL) ||
lstat(old_name, &st))
return -1;
}
diff --git a/cache.h b/cache.h
index 8dc1de1..1f96280 100644
--- a/cache.h
+++ b/cache.h
@@ -262,7 +262,7 @@ struct checkout {
refresh_cache:1;
};
-extern int checkout_entry(struct cache_entry *ce, struct checkout *state);
+extern int checkout_entry(struct cache_entry *ce, struct checkout *state, char *topath);
extern struct alternate_object_database {
struct alternate_object_database *next;
diff --git a/checkout-index.c b/checkout-index.c
index f54c606..7b78715 100644
--- a/checkout-index.c
+++ b/checkout-index.c
@@ -40,9 +40,13 @@
#include "strbuf.h"
#include "quote.h"
+#define CHECKOUT_ALL 4
static const char *prefix;
static int prefix_length;
+static int line_termination = '\n';
static int checkout_stage; /* default to checkout stage0 */
+static int to_tempfile;
+static char topath[4][MAXPATHLEN+1];
static struct checkout state = {
.base_dir = "",
@@ -53,11 +57,39 @@ static struct checkout state = {
.refresh_cache = 0,
};
+static void write_tempfile_record (const char *name)
+{
+ int i;
+
+ if (CHECKOUT_ALL == checkout_stage) {
+ for (i = 1; i < 4; i++) {
+ if (i > 1)
+ putchar(' ');
+ if (topath[i][0])
+ fputs(topath[i], stdout);
+ else
+ putchar('.');
+ }
+ } else
+ fputs(topath[checkout_stage], stdout);
+
+ putchar('\t');
+ write_name_quoted("", 0, name + prefix_length,
+ line_termination, stdout);
+ putchar(line_termination);
+
+ for (i = 0; i < 4; i++) {
+ topath[i][0] = 0;
+ }
+}
+
static int checkout_file(const char *name)
{
int namelen = strlen(name);
int pos = cache_name_pos(name, namelen);
int has_same_name = 0;
+ int did_checkout = 0;
+ int errs = 0;
if (pos < 0)
pos = -pos - 1;
@@ -68,9 +100,20 @@ static int checkout_file(const char *nam
memcmp(ce->name, name, namelen))
break;
has_same_name = 1;
- if (checkout_stage == ce_stage(ce))
- return checkout_entry(ce, &state);
pos++;
+ if (ce_stage(ce) != checkout_stage
+ && (CHECKOUT_ALL != checkout_stage || !ce_stage(ce)))
+ continue;
+ did_checkout = 1;
+ if (checkout_entry(ce, &state,
+ to_tempfile ? topath[ce_stage(ce)] : NULL) < 0)
+ errs++;
+ }
+
+ if (did_checkout) {
+ if (to_tempfile)
+ write_tempfile_record(name);
+ return errs > 0 ? -1 : 0;
}
if (!state.quiet) {
@@ -90,18 +133,29 @@ static int checkout_file(const char *nam
static int checkout_all(void)
{
int i, errs = 0;
+ struct cache_entry* last_ce = 0;
for (i = 0; i < active_nr ; i++) {
struct cache_entry *ce = active_cache[i];
- if (ce_stage(ce) != checkout_stage)
+ if (ce_stage(ce) != checkout_stage
+ && (CHECKOUT_ALL != checkout_stage || !ce_stage(ce)))
continue;
if (prefix && *prefix &&
(ce_namelen(ce) <= prefix_length ||
memcmp(prefix, ce->name, prefix_length)))
continue;
- if (checkout_entry(ce, &state) < 0)
+ if (last_ce && to_tempfile) {
+ if (ce_namelen(last_ce) != ce_namelen(ce)
+ || memcmp(last_ce->name, ce->name, ce_namelen(ce)))
+ write_tempfile_record(last_ce->name);
+ }
+ if (checkout_entry(ce, &state,
+ to_tempfile ? topath[ce_stage(ce)] : NULL) < 0)
errs++;
+ last_ce = ce;
}
+ if (last_ce && to_tempfile)
+ write_tempfile_record(last_ce->name);
if (errs)
/* we have already done our error reporting.
* exit with the same code as die().
@@ -111,7 +165,7 @@ static int checkout_all(void)
}
static const char checkout_cache_usage[] =
-"git-checkout-index [-u] [-q] [-a] [-f] [-n] [--stage=[123]] [--prefix=<string>] [--] <file>...";
+"git-checkout-index [-u] [-q] [-a] [-f] [-n] [--stage=[123]|all] [--prefix=<string>] [--temp] [--] <file>...";
static struct cache_file cache_file;
@@ -121,7 +175,6 @@ int main(int argc, char **argv)
int newfd = -1;
int all = 0;
int read_from_stdin = 0;
- int line_termination = '\n';
prefix = setup_git_directory();
git_config(git_default_config);
@@ -175,17 +228,26 @@ int main(int argc, char **argv)
i++; /* do not consider arg as a file name */
break;
}
+ if (!strcmp(arg, "--temp")) {
+ to_tempfile = 1;
+ continue;
+ }
if (!strncmp(arg, "--prefix=", 9)) {
state.base_dir = arg+9;
state.base_dir_len = strlen(state.base_dir);
continue;
}
if (!strncmp(arg, "--stage=", 8)) {
- int ch = arg[8];
- if ('1' <= ch && ch <= '3')
- checkout_stage = arg[8] - '0';
- else
- die("stage should be between 1 and 3");
+ if (!strcmp(arg + 8, "all")) {
+ to_tempfile = 1;
+ checkout_stage = CHECKOUT_ALL;
+ } else {
+ int ch = arg[8];
+ if ('1' <= ch && ch <= '3')
+ checkout_stage = arg[8] - '0';
+ else
+ die("stage should be between 1 and 3 or all");
+ }
continue;
}
if (arg[0] == '-')
@@ -193,7 +255,7 @@ int main(int argc, char **argv)
break;
}
- if (state.base_dir_len) {
+ if (state.base_dir_len || to_tempfile) {
/* when --prefix is specified we do not
* want to update cache.
*/
diff --git a/entry.c b/entry.c
index 8fb99bc..38b5241 100644
--- a/entry.c
+++ b/entry.c
@@ -63,7 +63,7 @@ static int create_file(const char *path,
return open(path, O_WRONLY | O_CREAT | O_EXCL, mode);
}
-static int write_entry(struct cache_entry *ce, const char *path, struct checkout *state)
+static int write_entry(struct cache_entry *ce, char *path, struct checkout *state, int to_tempfile)
{
int fd;
void *new;
@@ -80,7 +80,11 @@ static int write_entry(struct cache_entr
}
switch (ntohl(ce->ce_mode) & S_IFMT) {
case S_IFREG:
- fd = create_file(path, ntohl(ce->ce_mode));
+ if (to_tempfile) {
+ strcpy(path, ".merge_file_XXXXXX");
+ fd = mkstemp(path);
+ } else
+ fd = create_file(path, ntohl(ce->ce_mode));
if (fd < 0) {
free(new);
return error("git-checkout-index: unable to create file %s (%s)",
@@ -93,12 +97,27 @@ static int write_entry(struct cache_entr
return error("git-checkout-index: unable to write file %s", path);
break;
case S_IFLNK:
- if (symlink(new, path)) {
+ if (to_tempfile) {
+ strcpy(path, ".merge_link_XXXXXX");
+ fd = mkstemp(path);
+ if (fd < 0) {
+ free(new);
+ return error("git-checkout-index: unable to create "
+ "file %s (%s)", path, strerror(errno));
+ }
+ wrote = write(fd, new, size);
+ close(fd);
free(new);
- return error("git-checkout-index: unable to create "
- "symlink %s (%s)", path, strerror(errno));
+ if (wrote != size)
+ return error("git-checkout-index: unable to write file %s",
+ path);
+ } else {
+ wrote = symlink(new, path);
+ free(new);
+ if (wrote)
+ return error("git-checkout-index: unable to create "
+ "symlink %s (%s)", path, strerror(errno));
}
- free(new);
break;
default:
free(new);
@@ -113,12 +132,15 @@ static int write_entry(struct cache_entr
return 0;
}
-int checkout_entry(struct cache_entry *ce, struct checkout *state)
+int checkout_entry(struct cache_entry *ce, struct checkout *state, char *topath)
{
- struct stat st;
static char path[MAXPATHLEN+1];
+ struct stat st;
int len = state->base_dir_len;
+ if (topath)
+ return write_entry(ce, topath, state, 1);
+
memcpy(path, state->base_dir, len);
strcpy(path + len, ce->name);
@@ -147,7 +169,7 @@ int checkout_entry(struct cache_entry *c
} else if (state->not_new)
return 0;
create_directories(path, state);
- return write_entry(ce, path, state);
+ return write_entry(ce, path, state, 0);
}
diff --git a/read-tree.c b/read-tree.c
index be29b3f..1c3b09b 100644
--- a/read-tree.c
+++ b/read-tree.c
@@ -337,7 +337,7 @@ static void check_updates(struct cache_e
if (ce->ce_flags & mask) {
ce->ce_flags &= ~mask;
if (update)
- checkout_entry(ce, &state);
+ checkout_entry(ce, &state, NULL);
}
}
if (total) {
diff --git a/t/t2004-checkout-cache-temp.sh b/t/t2004-checkout-cache-temp.sh
new file mode 100755
index 0000000..c100959
--- /dev/null
+++ b/t/t2004-checkout-cache-temp.sh
@@ -0,0 +1,212 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 Shawn Pearce
+#
+
+test_description='git-checkout-index --temp test.
+
+With --temp flag, git-checkout-index writes to temporary merge files
+rather than the tracked path.'
+
+. ./test-lib.sh
+
+test_expect_success \
+'preparation' '
+mkdir asubdir &&
+echo tree1path0 >path0 &&
+echo tree1path1 >path1 &&
+echo tree1path3 >path3 &&
+echo tree1path4 >path4 &&
+echo tree1asubdir/path5 >asubdir/path5 &&
+git-update-index --add path0 path1 path3 path4 asubdir/path5 &&
+t1=$(git-write-tree) &&
+rm -f path* .merge_* out .git/index &&
+echo tree2path0 >path0 &&
+echo tree2path1 >path1 &&
+echo tree2path2 >path2 &&
+echo tree2path4 >path4 &&
+git-update-index --add path0 path1 path2 path4 &&
+t2=$(git-write-tree) &&
+rm -f path* .merge_* out .git/index &&
+echo tree2path0 >path0 &&
+echo tree3path1 >path1 &&
+echo tree3path2 >path2 &&
+echo tree3path3 >path3 &&
+git-update-index --add path0 path1 path2 path3 &&
+t3=$(git-write-tree)'
+
+test_expect_success \
+'checkout one stage 0 to temporary file' '
+rm -f path* .merge_* out .git/index &&
+git-read-tree $t1 &&
+git-checkout-index --temp -- path1 >out &&
+test $(wc -l <out) = 1 &&
+test $(cut "-d " -f2 out) = path1 &&
+p=$(cut "-d " -f1 out) &&
+test -f $p &&
+test $(cat $p) = tree1path1'
+
+test_expect_success \
+'checkout all stage 0 to temporary files' '
+rm -f path* .merge_* out .git/index &&
+git-read-tree $t1 &&
+git-checkout-index -a --temp >out &&
+test $(wc -l <out) = 5 &&
+for f in path0 path1 path3 path4 asubdir/path5
+do
+ test $(grep $f out | cut "-d " -f2) = $f &&
+ p=$(grep $f out | cut "-d " -f1) &&
+ test -f $p &&
+ test $(cat $p) = tree1$f
+done'
+
+test_expect_success \
+'prepare 3-way merge' '
+rm -f path* .merge_* out .git/index &&
+git-read-tree -m $t1 $t2 $t3'
+
+test_expect_success \
+'checkout one stage 2 to temporary file' '
+rm -f path* .merge_* out &&
+git-checkout-index --stage=2 --temp -- path1 >out &&
+test $(wc -l <out) = 1 &&
+test $(cut "-d " -f2 out) = path1 &&
+p=$(cut "-d " -f1 out) &&
+test -f $p &&
+test $(cat $p) = tree2path1'
+
+test_expect_success \
+'checkout all stage 2 to temporary files' '
+rm -f path* .merge_* out &&
+git-checkout-index --all --stage=2 --temp >out &&
+test $(wc -l <out) = 3 &&
+for f in path1 path2 path4
+do
+ test $(grep $f out | cut "-d " -f2) = $f &&
+ p=$(grep $f out | cut "-d " -f1) &&
+ test -f $p &&
+ test $(cat $p) = tree2$f
+done'
+
+test_expect_success \
+'checkout all stages/one file to nothing' '
+rm -f path* .merge_* out &&
+git-checkout-index --stage=all --temp -- path0 >out &&
+test $(wc -l <out) = 0'
+
+test_expect_success \
+'checkout all stages/one file to temporary files' '
+rm -f path* .merge_* out &&
+git-checkout-index --stage=all --temp -- path1 >out &&
+test $(wc -l <out) = 1 &&
+test $(cut "-d " -f2 out) = path1 &&
+cut "-d " -f1 out | (read s1 s2 s3 &&
+test -f $s1 &&
+test -f $s2 &&
+test -f $s3 &&
+test $(cat $s1) = tree1path1 &&
+test $(cat $s2) = tree2path1 &&
+test $(cat $s3) = tree3path1)'
+
+test_expect_success \
+'checkout some stages/one file to temporary files' '
+rm -f path* .merge_* out &&
+git-checkout-index --stage=all --temp -- path2 >out &&
+test $(wc -l <out) = 1 &&
+test $(cut "-d " -f2 out) = path2 &&
+cut "-d " -f1 out | (read s1 s2 s3 &&
+test $s1 = . &&
+test -f $s2 &&
+test -f $s3 &&
+test $(cat $s2) = tree2path2 &&
+test $(cat $s3) = tree3path2)'
+
+test_expect_success \
+'checkout all stages/all files to temporary files' '
+rm -f path* .merge_* out &&
+git-checkout-index -a --stage=all --temp >out &&
+test $(wc -l <out) = 5'
+
+test_expect_success \
+'-- path0: no entry' '
+test x$(grep path0 out | cut "-d " -f2) = x'
+
+test_expect_success \
+'-- path1: all 3 stages' '
+test $(grep path1 out | cut "-d " -f2) = path1 &&
+grep path1 out | cut "-d " -f1 | (read s1 s2 s3 &&
+test -f $s1 &&
+test -f $s2 &&
+test -f $s3 &&
+test $(cat $s1) = tree1path1 &&
+test $(cat $s2) = tree2path1 &&
+test $(cat $s3) = tree3path1)'
+
+test_expect_success \
+'-- path2: no stage 1, have stage 2 and 3' '
+test $(grep path2 out | cut "-d " -f2) = path2 &&
+grep path2 out | cut "-d " -f1 | (read s1 s2 s3 &&
+test $s1 = . &&
+test -f $s2 &&
+test -f $s3 &&
+test $(cat $s2) = tree2path2 &&
+test $(cat $s3) = tree3path2)'
+
+test_expect_success \
+'-- path3: no stage 2, have stage 1 and 3' '
+test $(grep path3 out | cut "-d " -f2) = path3 &&
+grep path3 out | cut "-d " -f1 | (read s1 s2 s3 &&
+test -f $s1 &&
+test $s2 = . &&
+test -f $s3 &&
+test $(cat $s1) = tree1path3 &&
+test $(cat $s3) = tree3path3)'
+
+test_expect_success \
+'-- path4: no stage 3, have stage 1 and 3' '
+test $(grep path4 out | cut "-d " -f2) = path4 &&
+grep path4 out | cut "-d " -f1 | (read s1 s2 s3 &&
+test -f $s1 &&
+test -f $s2 &&
+test $s3 = . &&
+test $(cat $s1) = tree1path4 &&
+test $(cat $s2) = tree2path4)'
+
+test_expect_success \
+'-- asubdir/path5: no stage 2 and 3 have stage 1' '
+test $(grep asubdir/path5 out | cut "-d " -f2) = asubdir/path5 &&
+grep asubdir/path5 out | cut "-d " -f1 | (read s1 s2 s3 &&
+test -f $s1 &&
+test $s2 = . &&
+test $s3 = . &&
+test $(cat $s1) = tree1asubdir/path5)'
+
+test_expect_success \
+'checkout --temp within subdir' '
+(cd asubdir &&
+ git-checkout-index -a --stage=all >out &&
+ test $(wc -l <out) = 1 &&
+ test $(grep path5 out | cut "-d " -f2) = path5 &&
+ grep path5 out | cut "-d " -f1 | (read s1 s2 s3 &&
+ test -f ../$s1 &&
+ test $s2 = . &&
+ test $s3 = . &&
+ test $(cat ../$s1) = tree1asubdir/path5)
+)'
+
+test_expect_success \
+'checkout --temp symlink' '
+rm -f path* .merge_* out .git/index &&
+ln -s b a &&
+git-update-index --add a &&
+t4=$(git-write-tree) &&
+rm -f .git/index &&
+git-read-tree $t4 &&
+git-checkout-index --temp -a >out &&
+test $(wc -l <out) = 1 &&
+test $(cut "-d " -f2 out) = a &&
+p=$(cut "-d " -f1 out) &&
+test -f $p &&
+test $(cat $p) = b'
+
+test_done
--
1.2.4.g0226
^ permalink raw reply related
* Re: [PATCH] Add --temp and --stage=all options to checkout-index.
From: Junio C Hamano @ 2006-03-05 8:55 UTC (permalink / raw)
To: Shawn Pearce; +Cc: git
In-Reply-To: <20060305082415.GD24437@spearce.org>
Shawn Pearce <spearce@spearce.org> writes:
> This replaces my prior patch. It looks a heck of a lot cleaner too
> due to less indentation changes. :-)
Much nicer. Will put in "next" for wider exposure.
^ permalink raw reply
* Re: What's in git.git
From: Martin Langhoff @ 2006-03-05 9:21 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vacc5jza6.fsf@assigned-by-dhcp.cox.net>
On 3/5/06, Junio C Hamano <junkio@cox.net> wrote:
> - 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.
I'm somewhat confused by the fact that there are two emacs modes, both
by Alexandre. Which one should I use? Also -- the killer app for
emacs+git would be to leverage the great patch-editing mode in emacs.
Can we get a new merge conflict mode that generates .rej files? Emacs
is superb at dealing with conflicts formatted that way. OTOH, it may
be able to deal smartly with diff3-style conflicts if it knows how to
talk with the VC backend -- I think the cvs mode can do that.
Linus has mentioned several times that it is more important to have
well oiled tools to deal with conflicts when they happen -- easy
visualization of what the different versions were, commit msgs,
highlight characters that don't match in a line that looks the same at
first glance, etc -- than to try and magically resolve conflicts. I'm
in violent agreement, and keen on seeing the emacs vc stuff fill that
gap.
(of course, if xxdiff and others can help, that'd be cool too, but
currently they seem strangely unable to deal with files with diff3
conflict markers.)
> - git-cvsserver updates (Martin Langhoff)
Wohoo! This needs testers -- give it a whirl, please! BTW, the
workarounds for Eclipse mentioned in the doco are no longer needed.
Still, you do want to give Documentation/git-cvsserver.txt a quick
read.
cheers,
martin
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox