From 443b92b6e50462942a8b2ca22a7def87036762ff Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Fri, 9 Mar 2007 23:38:57 +0100 Subject: [PATCH 01/11] Adjust reflog filemode in shared repository Without this, committing in a group-shared repository would not work even though all developers are in the same group. Signed-off-by: Matthias Kestenholz Signed-off-by: Junio C Hamano --- refs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/refs.c b/refs.c index a9b8c72c6b..131e870149 100644 --- a/refs.c +++ b/refs.c @@ -921,6 +921,8 @@ static int log_ref_write(const char *ref_name, const unsigned char *old_sha1, log_file, strerror(errno)); } + adjust_shared_perm(log_file); + msglen = 0; if (msg) { /* clean up the message and make sure it is a single line */ From c4431d380c20b4c05c373980c600798fc02e79b0 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 9 Mar 2007 15:21:41 -0500 Subject: [PATCH 02/11] Documentation: s/seperator/separator/ Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- Documentation/git-fast-import.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt index 77a14bb076..a7d255d39f 100644 --- a/Documentation/git-fast-import.txt +++ b/Documentation/git-fast-import.txt @@ -451,7 +451,7 @@ in octal. Git only supports the following modes: In both formats `` is the complete path of the file to be added (if not already existing) or modified (if already existing). -A `` string must use UNIX-style directory seperators (forward +A `` string must use UNIX-style directory separators (forward slash `/`), may contain any byte other than `LF`, and must not start with double quote (`"`). @@ -461,8 +461,8 @@ quoting should be used, e.g. `"path/with\n and \" in it"`. The value of `` must be in canoncial form. That is it must not: * contain an empty directory component (e.g. `foo//bar` is invalid), -* end with a directory seperator (e.g. `foo/` is invalid), -* start with a directory seperator (e.g. `/foo` is invalid), +* end with a directory separator (e.g. `foo/` is invalid), +* start with a directory separator (e.g. `/foo` is invalid), * contain the special component `.` or `..` (e.g. `foo/./bar` and `foo/../bar` are invalid). From c816eb1784b324fcf3988253affac4d43bce78c9 Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Sun, 4 Mar 2007 19:13:09 -0500 Subject: [PATCH 03/11] glossary: fix overoptimistic automatic linking of defined terms The script sort_glossary.pl turns each use of "term" into a link to the definition of "term". To avoid mangling links like gitlink:git-term[1] it doesn't replace any occurence of "term" preceded by "link:git-". This fails for gitlink:git-symbolic-ref[1] when substituting for "ref". So instead just refuse to replace anything preceded by a "-". That could result in missing some opportunities, but that's a less annoying error. Actually I find the automatic substitution a little distracting; some day maybe we should just run it once and commit the result, so it can be hand-tuned. Signed-off-by: "J. Bruce Fields" --- Documentation/sort_glossary.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/sort_glossary.pl b/Documentation/sort_glossary.pl index e0bc552a64..05dc7b2c7b 100644 --- a/Documentation/sort_glossary.pl +++ b/Documentation/sort_glossary.pl @@ -48,7 +48,7 @@ This list is sorted alphabetically: '; @keys=sort {uc($a) cmp uc($b)} keys %terms; -$pattern='(\b(?>";/eg; print '[[ref_'.no_spaces($key).']]'.$key."::\n" From 923642fe1bdf010a1f2bef1507e17b9ee97cbf87 Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Sat, 10 Mar 2007 21:45:29 -0500 Subject: [PATCH 04/11] user-manual: fix inconsistent example The configuration file fragment here is inconsistent with the text above. Thanks to Ramsay Jones for the correction. Cc: Ramsay Jones Signed-off-by: "J. Bruce Fields" --- Documentation/user-manual.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index a5e7b536f2..8b5709ba75 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -601,8 +601,8 @@ a new stanza: $ cat .git/config ... [remote "linux-nfs"] - url = git://linux-nfs.org/~bfields/git.git - fetch = +refs/heads/*:refs/remotes/linux-nfs-read/* + url = git://linux-nfs.org/pub/nfs-2.6.git + fetch = +refs/heads/*:refs/remotes/linux-nfs/* ... ------------------------------------------------- From fabbd8f6ca610a570d7bfcbbfc80bb0e03247b2a Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Sat, 10 Mar 2007 21:52:39 -0500 Subject: [PATCH 05/11] user-manual: fix inconsistent use of pull and merge I used "git pull ." instead of "git merge" here without any explanation. Stick instead to "git merge" for now (the equivalent pull syntax is still covered in a later chapter). Cc: Ramsay Jones Signed-off-by: "J. Bruce Fields" --- Documentation/user-manual.txt | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index 8b5709ba75..f4ea967191 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -1133,17 +1133,9 @@ modified in two different ways in the remote branch and the local branch--then you are warned; the output may look something like this: ------------------------------------------------- -$ git pull . next -Trying really trivial in-index merge... -fatal: Merge requires file-level merging -Nope. -Merging HEAD with 77976da35a11db4580b80ae27e8d65caf5208086 -Merging: -15e2162 world -77976da goodbye -found 1 common ancestor(s): -d122ed4 initial -Auto-merging file.txt +$ git merge next + 100% (4/4) done +Auto-merged file.txt CONFLICT (content): Merge conflict in file.txt Automatic merge failed; fix conflicts and then commit the result. ------------------------------------------------- From ed4eb0d8f3560c20a3b8eefefdcaae4d864743c6 Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Sat, 10 Mar 2007 22:00:12 -0500 Subject: [PATCH 06/11] user-manual: fix missing colon in git-show example There should be a colon in this git-show example. Cc: Ramsay Jones Signed-off-by: "J. Bruce Fields" --- Documentation/user-manual.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index f4ea967191..1e151b4d29 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -1431,7 +1431,7 @@ modifying the working directory, you can do that with gitlink:git-show[1]: ------------------------------------------------- -$ git show HEAD^ path/to/file +$ git show HEAD^:path/to/file ------------------------------------------------- which will display the given version of the file. From 1dc71a9155e209ed4da866eeb7c3064e4568532e Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Sat, 10 Mar 2007 22:38:13 -0500 Subject: [PATCH 07/11] user-manual: fix rendering of history diagrams Asciidoc appears to interpret a backslash at the end of a line as escaping the end-of-line character, which screws up the display of history diagrams like o--o--o \ o--... The obvious fix (replacing "\" by "\\") doesn't work. The only workaround I've found is to include all such diagrams in a LiteralBlock. Asciidoc claims that should be equivalent to a literal paragraph, so I don't understand why the difference--perhaps it's an asciidoc bug. Cc: Ramsay Jones Signed-off-by: "J. Bruce Fields" --- Documentation/user-manual.txt | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index 1e151b4d29..0919574fb4 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -437,11 +437,14 @@ We will sometimes represent git history using diagrams like the one below. Commits are shown as "o", and the links between them with lines drawn with - / and \. Time goes left to right: + +................................................ o--o--o <-- Branch A / o--o--o <-- master \ o--o--o <-- Branch B +................................................ If we need to talk about a particular commit, the character "o" may be replaced with another letter or number. @@ -1928,25 +1931,29 @@ $ git commit You have performed no merges into mywork, so it is just a simple linear sequence of patches on top of "origin": - +................................................ o--o--o <-- origin \ o--o--o <-- mywork +................................................ Some more interesting work has been done in the upstream project, and "origin" has advanced: +................................................ o--o--O--o--o--o <-- origin \ a--b--c <-- mywork +................................................ At this point, you could use "pull" to merge your changes back in; the result would create a new merge commit, like this: - +................................................ o--o--O--o--o--o <-- origin \ \ a--b--c--m <-- mywork +................................................ However, if you prefer to keep the history in mywork a simple series of commits without any merges, you may instead choose to use @@ -1963,9 +1970,11 @@ point at the latest version of origin, then apply each of the saved patches to the new mywork. The result will look like: +................................................ o--o--O--o--o--o <-- origin \ a'--b'--c' <-- mywork +................................................ In the process, it may discover conflicts. In that case it will stop and allow you to fix the conflicts; after fixing conflicts, use "git @@ -2073,24 +2082,30 @@ The primary problem with rewriting the history of a branch has to do with merging. Suppose somebody fetches your branch and merges it into their branch, with a result something like this: +................................................ o--o--O--o--o--o <-- origin \ \ t--t--t--m <-- their branch: +................................................ Then suppose you modify the last three commits: +................................................ o--o--o <-- new head of origin / o--o--O--o--o--o <-- old head of origin +................................................ If we examined all this history together in one repository, it will look like: +................................................ o--o--o <-- new head of origin / o--o--O--o--o--o <-- old head of origin \ \ t--t--t--m <-- their branch: +................................................ Git has no way of knowing that the new head is an updated version of the old head; it treats this situation exactly the same as it would if @@ -2151,9 +2166,11 @@ commit. Git calls this process a "fast forward". A fast forward looks something like this: +................................................ o--o--o--o <-- old head of the branch \ o--o--o <-- new head of the branch +................................................ In some cases it is possible that the new head will *not* actually be @@ -2161,11 +2178,11 @@ a descendant of the old head. For example, the developer may have realized she made a serious mistake, and decided to backtrack, resulting in a situation like: +................................................ o--o--o--o--a--b <-- old head of the branch \ o--o--o <-- new head of the branch - - +................................................ In this case, "git fetch" will fail, and print out a warning. From 8ce9d83b78fa95addf61cb911fa052ec4f37f77e Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Sat, 10 Mar 2007 22:58:54 -0500 Subject: [PATCH 08/11] user-manual: install user manual stylesheet with other web documents Install the stylesheet needed for the user manual. This should solve the problem of, e.g., http://www.kernel.org/pub/software/scm/git/docs/user-manual.html lacking a lot of formatting. Signed-off-by: "J. Bruce Fields" --- Documentation/install-webdoc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/install-webdoc.sh b/Documentation/install-webdoc.sh index b3981936e3..cd3a18eb7f 100755 --- a/Documentation/install-webdoc.sh +++ b/Documentation/install-webdoc.sh @@ -2,7 +2,7 @@ T="$1" -for h in *.html *.txt howto/*.txt howto/*.html RelNotes-*.txt +for h in *.html *.txt howto/*.txt howto/*.html RelNotes-*.txt *.css do if test -f "$T/$h" && diff -u -I'Last updated [0-9][0-9]-[A-Z][a-z][a-z]-' "$T/$h" "$h" From 96a5702409e193616ad7e56700dd6051ad324654 Mon Sep 17 00:00:00 2001 From: Matthias Lederhofer Date: Sun, 11 Mar 2007 02:35:00 +0100 Subject: [PATCH 09/11] setup_git_directory_gently: fix off-by-one error don't tell getcwd that the buffer has one spare byte for an extra / Signed-off-by: Matthias Lederhofer Signed-off-by: Junio C Hamano --- setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.c b/setup.c index e9d3f5aab6..76e5e693cc 100644 --- a/setup.c +++ b/setup.c @@ -216,7 +216,7 @@ const char *setup_git_directory_gently(int *nongit_ok) die("Not a git repository: '%s'", gitdirenv); } - if (!getcwd(cwd, sizeof(cwd)) || cwd[0] != '/') + if (!getcwd(cwd, sizeof(cwd)-1) || cwd[0] != '/') die("Unable to read current working directory"); offset = len = strlen(cwd); From 38448147553917c584a353ed6c39ad55b037f694 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sat, 10 Mar 2007 19:21:25 +0100 Subject: [PATCH 10/11] git.el: Avoid appending a signoff line that is already present. Also avoid inserting an extra newline if other signoff lines are present. Signed-off-by: Alexandre Julliard Signed-off-by: Junio C Hamano --- contrib/emacs/git.el | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el index 13d198229b..427f89b0e1 100644 --- a/contrib/emacs/git.el +++ b/contrib/emacs/git.el @@ -891,6 +891,18 @@ and returns the process output as a string." (with-current-buffer log-edit-parent-buffer (git-get-filenames (git-marked-files-state 'added 'deleted 'modified)))) +(defun git-append-sign-off (name email) + "Append a Signed-off-by entry to the current buffer, avoiding duplicates." + (let ((sign-off (format "Signed-off-by: %s <%s>" name email)) + (case-fold-search t)) + (goto-char (point-min)) + (unless (re-search-forward (concat "^" (regexp-quote sign-off)) nil t) + (goto-char (point-min)) + (unless (re-search-forward "^Signed-off-by: " nil t) + (setq sign-off (concat "\n" sign-off))) + (goto-char (point-max)) + (insert sign-off "\n")))) + (defun git-commit-file () "Commit the marked file(s), asking for a commit message." (interactive) @@ -899,6 +911,8 @@ and returns the process output as a string." (merge-heads (git-get-merge-heads)) (dir default-directory) (coding-system (git-get-commits-coding-system)) + (committer-name (git-get-committer-name)) + (committer-email (git-get-committer-email)) (sign-off git-append-signed-off-by)) (with-current-buffer buffer (when (eq 0 (buffer-size)) @@ -907,7 +921,7 @@ and returns the process output as a string." (insert (propertize (format "Author: %s <%s>\n%s" - (git-get-committer-name) (git-get-committer-email) + committer-name committer-email (if merge-heads (format "Parent: %s\n%s\n" (git-rev-parse "HEAD") @@ -916,11 +930,9 @@ and returns the process output as a string." 'face 'git-header-face) (propertize git-log-msg-separator 'face 'git-separator-face) "\n") - (cond ((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))))))) + (when (file-readable-p ".git/MERGE_MSG") + (insert-file-contents ".git/MERGE_MSG")) + (when sign-off (git-append-sign-off committer-name committer-email)))) (log-edit #'git-do-commit nil #'git-log-edit-files buffer) (setq font-lock-keywords (font-lock-compile-keywords git-log-edit-font-lock-keywords)) (setq buffer-file-coding-system coding-system) From 60fa08ed617dd148a9843bfdef2dfecf2ef60123 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sat, 10 Mar 2007 19:22:26 +0100 Subject: [PATCH 11/11] git.el: Retrieve commit log information from .dotest directory. If a git-am or git-rebase is in progress, fill the commit log buffer from the commit information found in the various files in the .dotest directory. Signed-off-by: Alexandre Julliard Signed-off-by: Junio C Hamano --- contrib/emacs/git.el | 77 ++++++++++++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 24 deletions(-) diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el index 427f89b0e1..db87a37895 100644 --- a/contrib/emacs/git.el +++ b/contrib/emacs/git.el @@ -903,36 +903,65 @@ and returns the process output as a string." (goto-char (point-max)) (insert sign-off "\n")))) +(defun git-setup-log-buffer (buffer &optional author-name author-email subject date msg) + "Setup the log buffer for a commit." + (unless git-status (error "Not in git-status buffer.")) + (let ((merge-heads (git-get-merge-heads)) + (dir default-directory) + (committer-name (git-get-committer-name)) + (committer-email (git-get-committer-email)) + (sign-off git-append-signed-off-by)) + (with-current-buffer buffer + (cd dir) + (erase-buffer) + (insert + (propertize + (format "Author: %s <%s>\n%s%s" + (or author-name committer-name) + (or author-email committer-email) + (if date (format "Date: %s\n" date) "") + (if merge-heads + (format "Parent: %s\n%s\n" + (git-rev-parse "HEAD") + (mapconcat (lambda (str) (concat "Parent: " str)) merge-heads "\n")) + "")) + 'face 'git-header-face) + (propertize git-log-msg-separator 'face 'git-separator-face) + "\n") + (when subject (insert subject "\n\n")) + (cond (msg (insert msg "\n")) + ((file-readable-p ".dotest/msg") + (insert-file-contents ".dotest/msg")) + ((file-readable-p ".git/MERGE_MSG") + (insert-file-contents ".git/MERGE_MSG"))) + ; delete empty lines at end + (goto-char (point-min)) + (when (re-search-forward "\n+\\'" nil t) + (replace-match "\n" t t)) + (when sign-off (git-append-sign-off committer-name committer-email))))) + (defun git-commit-file () "Commit the marked file(s), asking for a commit message." (interactive) (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) (coding-system (git-get-commits-coding-system)) - (committer-name (git-get-committer-name)) - (committer-email (git-get-committer-email)) - (sign-off git-append-signed-off-by)) - (with-current-buffer buffer - (when (eq 0 (buffer-size)) - (cd dir) - (erase-buffer) - (insert - (propertize - (format "Author: %s <%s>\n%s" - committer-name committer-email - (if merge-heads - (format "Parent: %s\n%s\n" - (git-rev-parse "HEAD") - (mapconcat (lambda (str) (concat "Parent: " str)) merge-heads "\n")) - "")) - 'face 'git-header-face) - (propertize git-log-msg-separator 'face 'git-separator-face) - "\n") - (when (file-readable-p ".git/MERGE_MSG") - (insert-file-contents ".git/MERGE_MSG")) - (when sign-off (git-append-sign-off committer-name committer-email)))) + author-name author-email subject date) + (when (eq 0 (buffer-size buffer)) + (when (file-readable-p ".dotest/info") + (with-temp-buffer + (insert-file-contents ".dotest/info") + (goto-char (point-min)) + (when (re-search-forward "^Author: \\(.*\\)\nEmail: \\(.*\\)$" nil t) + (setq author-name (match-string 1)) + (setq author-email (match-string 2))) + (goto-char (point-min)) + (when (re-search-forward "^Subject: \\(.*\\)$" nil t) + (setq subject (match-string 1))) + (goto-char (point-min)) + (when (re-search-forward "^Date: \\(.*\\)$" nil t) + (setq date (match-string 1))))) + (git-setup-log-buffer buffer author-name author-email subject date)) (log-edit #'git-do-commit nil #'git-log-edit-files buffer) (setq font-lock-keywords (font-lock-compile-keywords git-log-edit-font-lock-keywords)) (setq buffer-file-coding-system coding-system)