From 82a2d6bdf9532812e2f315477494956a2f26e2cd Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 19 Jun 2007 10:48:09 -0400 Subject: [PATCH 01/16] git-gui: Correctly install to /usr/bin on Cygwin Mark Levedahl noted that installation on Cygwin to /usr/bin can cause problems with the automatic guessing of our library location. The problem is that installation to /usr/bin means we actually have: /usr/bin = c:\cygwin\bin /usr/share = c:\cygwin\usr\share So git-gui guesses that its library should be found within the c:\cygwin\share directory, as that is where it should be relative to the script itself in c:\cygwin\bin. In my first version of this patch I tried to use `cygpath` to resolve /usr/bin and /usr/share to test that they were in the same relative locations, but that didn't work out correctly as we were actually testing /usr/share against itself, so it always was equal, and we always used relative paths. So my original solution was quite wrong. Mark suggested we just always disable relative behavior on Cygwin, because of the complexity of the mount mapping problem, so that's all I'm doing. Signed-off-by: Shawn O. Pearce --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3de0de1a23..9d99f67046 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,8 @@ GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE @$(SHELL_PATH) ./GIT-VERSION-GEN -include GIT-VERSION-FILE +uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not') + SCRIPT_SH = git-gui.sh GITGUI_BUILT_INS = git-citool ALL_PROGRAMS = $(GITGUI_BUILT_INS) $(patsubst %.sh,%,$(SCRIPT_SH)) @@ -58,8 +60,12 @@ exedir_SQ = $(subst ','\'',$(exedir)) $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh $(QUIET_GEN)rm -f $@ $@+ && \ + GITGUI_RELATIVE= && \ if test '$(exedir_SQ)' = '$(libdir_SQ)'; then \ - GITGUI_RELATIVE=1; \ + if test "$(uname_O)" = Cygwin; \ + then GITGUI_RELATIVE= ; \ + else GITGUI_RELATIVE=1; \ + fi; \ fi && \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|^exec wish "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' \ From fb626dc00044c106652ae39300b4cb613af70ab1 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 12 Jun 2007 00:04:30 -0400 Subject: [PATCH 02/16] git-gui: Bind Tab/Shift-Tab to cycle between panes in blame The blame viewer is composed of two different areas, the file area on top and the commit area on the bottom. If users are trying to shift the focus it is probably because they want to shift from one area to the other, so we just setup Tab and Shift-Tab to jump from the one half to the other in a cycle. Signed-off-by: Shawn O. Pearce --- lib/blame.tcl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/blame.tcl b/lib/blame.tcl index 139171d39e..076233c3c3 100644 --- a/lib/blame.tcl +++ b/lib/blame.tcl @@ -272,6 +272,8 @@ constructor new {i_commit i_path} { set cursorW %W tk_popup $w.ctxm %X %Y " + bind $i "[list focus $w_cviewer];break" + bind $i "[list focus $w_cviewer];break" } foreach i [concat $w_columns $w_cviewer] { @@ -287,8 +289,10 @@ constructor new {i_commit i_path} { bind $i {catch {%W yview scroll 1 pages};break} } + bind $w_cviewer "[list focus $w_file];break" + bind $w_cviewer "[list focus $w_file];break" bind $w_cviewer [list focus $w_cviewer] - bind $top [list focus $top] + bind $w_file [list focus $w_file] grid configure $w.header -sticky ew grid configure $w.file_pane -sticky nsew From 4e817d1ac4f10916343a2610a55f5af8bc949f65 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Fri, 22 Jun 2007 01:10:12 -0400 Subject: [PATCH 03/16] git-gui: Don't require $DISPLAY just to get --version Junio asked that we don't force the user to have a valid X11 server configured in $DISPLAY just to obtain the output of `git gui version`. This makes sense, the user may be an automated tool that is running without an X server available to it, such as a build script or other sort of package management system. Or it might just be a user working in a non-GUI environment and wondering "what version of git-gui do I have installed?". Tcl has a lot of warts, but one of its better ones is that a comment can be continued to the next line by escaping the LF that would have ended the comment using a backslash-LF sequence. In the past we have used this trick to escape away the 'exec wish' that is actually a Bourne shell script and keep Tcl from executing it. I'm using that feature here to comment out the Bourne shell script and hide it from the Tcl engine. Except now our Bourne shell script is a few lines long and checks to see if it should print the version, or not. Signed-off-by: Shawn O. Pearce --- Makefile | 2 +- git-gui.sh | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 9d99f67046..ab550fc6a7 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh fi; \ fi && \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ - -e 's|^exec wish "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' \ + -e 's|^ exec wish "$$0"| exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' \ -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \ -e 's|@@GITGUI_RELATIVE@@|'$$GITGUI_RELATIVE'|' \ -e $$GITGUI_RELATIVE's|@@GITGUI_LIBDIR@@|$(libdir_SQ)|' \ diff --git a/git-gui.sh b/git-gui.sh index 97de595f27..6ee0573c98 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1,6 +1,12 @@ #!/bin/sh # Tcl ignores the next line -*- tcl -*- \ -exec wish "$0" -- "$@" + if test "z$*" = zversion \ + || test "z$*" = z--version; \ + then \ + echo 'git-gui version @@GITGUI_VERSION@@'; \ + exit; \ + fi; \ + exec wish "$0" -- "$@" set appvers {@@GITGUI_VERSION@@} set copyright { @@ -271,11 +277,6 @@ proc tk_optionMenu {w varName args} { ## ## version check -if {{--version} eq $argv || {version} eq $argv} { - puts "git-gui version $appvers" - exit -} - set req_maj 1 set req_min 5 From 582c7393a47894ea299a82c2ae91fec3101e7559 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 26 Jun 2007 23:19:41 +0200 Subject: [PATCH 04/16] Ignore submodule commits when fetching over dumb protocols Without this patch, the code would look for the submodule commits in the superproject and (needlessly) fail when it couldn't find them. Signed-off-by: Sven Verdoolaege Acked-by: Linus Torvalds Signed-off-by: Junio C Hamano --- fetch.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fetch.c b/fetch.c index 8e29d313f8..6f1f420be2 100644 --- a/fetch.c +++ b/fetch.c @@ -46,6 +46,9 @@ static int process_tree(struct tree *tree) while (tree_entry(&desc, &entry)) { struct object *obj = NULL; + /* submodule commits are not stored in the superproject */ + if (S_ISDIRLNK(entry.mode)) + continue; if (S_ISDIR(entry.mode)) { struct tree *tree = lookup_tree(entry.sha1); if (tree) From 1164f1e48d7c8ed613e8a371ecfce27220606e09 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Tue, 26 Jun 2007 14:34:02 -0700 Subject: [PATCH 05/16] Fix zero-object version-2 packs A pack-file can get created without any objects in it (to transfer "no data" - which can happen if you use a reference git repo, for example, or just otherwise just end up transferring only branch head information and already have all the objects themselves). And while we probably should never create an index for such a pack, if we do (and we do), the index file size sanity checking was incorrect. This fixes it. Reported-and-tested-by: Jocke Tjernlund Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- sha1_file.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sha1_file.c b/sha1_file.c index c2f807f4c2..b9d07de156 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -509,7 +509,10 @@ static int check_packed_git_idx(const char *path, struct packed_git *p) * for offsets larger than 2^31. */ unsigned long min_size = 8 + 4*256 + nr*(20 + 4 + 4) + 20 + 20; - if (idx_size < min_size || idx_size > min_size + (nr - 1)*8) { + unsigned long max_size = min_size; + if (nr) + max_size += (nr - 1)*8; + if (idx_size < min_size || idx_size > max_size) { munmap(idx_map, idx_size); return error("wrong index file size in %s", path); } From e3ae6bb9aaf030251f1d13c4de3aa220cf282460 Mon Sep 17 00:00:00 2001 From: Sam Vilain Date: Wed, 27 Jun 2007 11:44:22 +1200 Subject: [PATCH 06/16] cleanup merge-base test script Add a picture, and keep the setup and the tests together. Signed-off-by: Sam Vilain Signed-off-by: Junio C Hamano --- t/t6010-merge-base.sh | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/t/t6010-merge-base.sh b/t/t6010-merge-base.sh index b15920b852..22e0893056 100755 --- a/t/t6010-merge-base.sh +++ b/t/t6010-merge-base.sh @@ -34,6 +34,12 @@ doit() { echo $commit } +# E---D---C---B---A +# \'-_ \ \ +# \ `---------G \ +# \ \ +# F----------------H + # Setup... E=$(doit 5 E) D=$(doit 4 D $E) @@ -44,6 +50,18 @@ A=$(doit 1 A $B) G=$(doit 7 G $B $E) H=$(doit 8 H $A $F) +test_expect_success 'compute merge-base (single)' \ + 'MB=$(git-merge-base G H) && + expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"' + +test_expect_success 'compute merge-base (all)' \ + 'MB=$(git-merge-base --all G H) && + expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"' + +test_expect_success 'compute merge-base with show-branch' \ + 'MB=$(git-show-branch --merge-base G H) && + expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"' + # Setup for second test to demonstrate that relying on timestamps in a # distributed SCM to provide a _consistent_ partial ordering of commits # leads to insanity. @@ -81,18 +99,6 @@ R2=$(doit 3 R2 $R1) PL=$(doit 4 PL $L2 $C2) PR=$(doit 4 PR $C2 $R2) -test_expect_success 'compute merge-base (single)' \ - 'MB=$(git-merge-base G H) && - expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"' - -test_expect_success 'compute merge-base (all)' \ - 'MB=$(git-merge-base --all G H) && - expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"' - -test_expect_success 'compute merge-base with show-branch' \ - 'MB=$(git-show-branch --merge-base G H) && - expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"' - test_expect_success 'compute merge-base (single)' \ 'MB=$(git-merge-base PL PR) && expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/C2"' From e373bb73889e15452b622df67465b77803876aa6 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Mon, 25 Jun 2007 16:03:53 +0200 Subject: [PATCH 07/16] config: Complete documentation of --get-regexp The asciidoc documentation of the --get-regexp option was incomplete. Add some missing pieces: - List the option in SYNOPSIS - Mention that key names are printed Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- Documentation/git-config.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt index 056b14724c..387d7bc841 100644 --- a/Documentation/git-config.txt +++ b/Documentation/git-config.txt @@ -14,6 +14,7 @@ SYNOPSIS 'git-config' [--system | --global] --replace-all name [value [value_regex]] 'git-config' [--system | --global] [type] --get name [value_regex] 'git-config' [--system | --global] [type] --get-all name [value_regex] +'git-config' [--system | --global] [type] --get-regexp name_regex [value_regex] 'git-config' [--system | --global] --unset name [value_regex] 'git-config' [--system | --global] --unset-all name [value_regex] 'git-config' [--system | --global] --rename-section old_name new_name @@ -73,6 +74,7 @@ OPTIONS --get-regexp:: Like --get-all, but interprets the name as a regular expression. + Also outputs the key names. --global:: For writing options: write to global ~/.gitconfig file rather than From b69ba460bb0710b2af8a20b4b0d62233f29401ec Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Mon, 25 Jun 2007 16:03:54 +0200 Subject: [PATCH 08/16] config: Change output of --get-regexp for valueless keys Print no space after the name of a key without value. Otherwise keys without values are printed exactly the same as keys with empty values. Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- builtin-config.c | 8 ++++++-- t/t1300-repo-config.sh | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/builtin-config.c b/builtin-config.c index b2515f7e65..dbc2339d0f 100644 --- a/builtin-config.c +++ b/builtin-config.c @@ -38,8 +38,12 @@ static int show_config(const char* key_, const char* value_) regexec(regexp, (value_?value_:""), 0, NULL, 0))) return 0; - if (show_keys) - printf("%s ", key_); + if (show_keys) { + if (value_) + printf("%s ", key_); + else + printf("%s", key_); + } if (seen && !do_all) dup_error = 1; if (type == T_INT) diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 3f3fd2d7f7..f1a78b19ac 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -283,6 +283,12 @@ EOF test_expect_success 'get variable with no value' \ 'git-config --get novalue.variable ^$' +echo novalue.variable > expect + +test_expect_success 'get-regexp variable with no value' \ + 'git-config --get-regexp novalue > output && + cmp output expect' + git-config > output 2>&1 test_expect_success 'no arguments, but no crash' \ From fffaaba3588b0da14f4e3265540d400859aad49e Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 27 Jun 2007 00:27:13 -0400 Subject: [PATCH 09/16] git-gui: Don't nice git blame on MSYS as nice is not supported Johannes Sixt reported that MinGW/MSYS does not have a nice.exe to drop the priority of a child process when it gets spawned. So we have to avoid trying to start `git blame` through nice when we are on Windows and do not have Cygwin available to us. Signed-off-by: Shawn O. Pearce --- lib/blame.tcl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/blame.tcl b/lib/blame.tcl index 076233c3c3..b523654815 100644 --- a/lib/blame.tcl +++ b/lib/blame.tcl @@ -487,7 +487,11 @@ method _read_file {fd jump} { } ifdeleted { catch {close $fd} } method _exec_blame {cur_w cur_d options cur_s} { - set cmd [list nice git blame] + set cmd [list] + if {![is_Windows] || [is_Cygwin]} { + lappend cmd nice + } + lappend cmd git blame set cmd [concat $cmd $options] lappend cmd --incremental if {$commit eq {}} { From 7e508eb1a2efce72be1651a35ab3150bfa3c88d6 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 26 Jun 2007 15:27:35 -0400 Subject: [PATCH 10/16] git-gui: Don't require a .pvcsrc to create Tools/Migrate menu hack The Tools/Migrate menu option is a hack just for me. Yes, that's right, git-gui has a hidden feature that really only works for me, and the users that I support within my day-job's great firewall. The menu option is not supported outside of that environment. In the past we only enabled Tools/Migrate if our special local script 'gui-miga' existed in the proper location, and if there was a special '.pvcsrc' in the top level of the working directory. This latter test for the '.pvcsrc' file is now failing, as the file was removed from all Git repositories due to changes made to other tooling within the great firewall's realm. I have changed the test to only work on Cygwin, and only if the special 'gui-miga' is present. This works around the configuration changes made recently within the great firewall's realm, but really this entire Tools/Migrate thing should be abstracted out into some sort of plugin system so other users can extend git-gui as they need. Signed-off-by: Shawn O. Pearce --- git-gui.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/git-gui.sh b/git-gui.sh index 6ee0573c98..4fbc408c4d 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1545,8 +1545,7 @@ if {[is_MacOSX]} { # -- Tools Menu # - if {[file exists /usr/local/miga/lib/gui-miga] - && [file exists .pvcsrc]} { + if {[is_Cygwin] && [file exists /usr/local/miga/lib/gui-miga]} { proc do_miga {} { global ui_status_value if {![lock_index update]} return From 38d697a156f6e6702cfe9d460296cb521e3fb1b2 Mon Sep 17 00:00:00 2001 From: Sam Vilain Date: Sat, 30 Jun 2007 20:56:12 +1200 Subject: [PATCH 11/16] repack: improve documentation on -a option Some minor enhancements to the git-repack manual page. Signed-off-by: Sam Vilain Signed-off-by: Junio C Hamano --- Documentation/git-repack.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt index cc3b0b21c7..c57013b953 100644 --- a/Documentation/git-repack.txt +++ b/Documentation/git-repack.txt @@ -14,7 +14,8 @@ DESCRIPTION ----------- This script is used to combine all objects that do not currently -reside in a "pack", into a pack. +reside in a "pack", into a pack. It can also be used to re-organise +existing packs into a single, more efficient pack. A pack is a collection of objects, individually compressed, with delta compression applied, stored in a single file, with an @@ -28,11 +29,13 @@ OPTIONS -a:: Instead of incrementally packing the unpacked objects, - pack everything available into a single pack. + pack everything referenced into a single pack. Especially useful when packing a repository that is used for private development and there is no need to worry - about people fetching via dumb file transfer protocols - from it. Use with '-d'. + about people fetching via dumb protocols from it. Use + with '-d'. This will clean up the objects that `git prune` + leaves behind, but `git fsck --full` shows as + dangling. -d:: After packing, if the newly created packs make some From 181ea688b83d3b46b9d0e55f1db0123332611db6 Mon Sep 17 00:00:00 2001 From: Sam Vilain Date: Sat, 30 Jun 2007 20:56:16 +1200 Subject: [PATCH 12/16] git-remote: document -n The 'show' and 'prune' commands accept an option '-n'; document what it does. Signed-off-by: Sam Vilain Signed-off-by: Junio C Hamano --- Documentation/git-remote.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt index 3dde7134a5..b35c65ba3b 100644 --- a/Documentation/git-remote.txt +++ b/Documentation/git-remote.txt @@ -49,6 +49,9 @@ branch the `HEAD` at the remote repository actually points at. 'show':: Gives some information about the remote . ++ +With `-n` option, the remote heads are not queried first with +`git ls-remote `; cached information is used instead. 'prune':: @@ -56,6 +59,10 @@ Deletes all stale tracking branches under . These stale branches have already been removed from the remote repository referenced by , but are still locally available in "remotes/". ++ +With `-n` option, the remote heads are not confirmed first with `git +ls-remote `; cached information is used instead. Use with +caution. 'update':: From 206488774238c94ff337dd5c997be441dbde5112 Mon Sep 17 00:00:00 2001 From: Matt Kraai Date: Sat, 30 Jun 2007 10:05:03 -0700 Subject: [PATCH 13/16] Correct the name of NO_R_TO_GCC_LINKER in the comment describing it. Signed-off-by: Matt Kraai Signed-off-by: Junio C Hamano --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 50e7bb39b5..eb443bddb9 100644 --- a/Makefile +++ b/Makefile @@ -94,9 +94,9 @@ all:: # Define OLD_ICONV if your library has an old iconv(), where the second # (input buffer pointer) parameter is declared with type (const char **). # -# Define NO_R_TO_GCC if your gcc does not like "-R/path/lib" that -# tells runtime paths to dynamic libraries; "-Wl,-rpath=/path/lib" -# is used instead. +# Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib" +# that tells runtime paths to dynamic libraries; +# "-Wl,-rpath=/path/lib" is used instead. # # Define USE_NSEC below if you want git to care about sub-second file mtimes # and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and From 57887443c24e5a2b4b04e7db69b44b53d8e87b44 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 2 Jul 2007 00:35:58 -0700 Subject: [PATCH 14/16] GIT 1.5.2.3 Signed-off-by: Junio C Hamano --- Documentation/RelNotes-1.5.2.3.txt | 27 +++++++++++++++++++++++++++ GIT-VERSION-GEN | 2 +- RelNotes | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 Documentation/RelNotes-1.5.2.3.txt diff --git a/Documentation/RelNotes-1.5.2.3.txt b/Documentation/RelNotes-1.5.2.3.txt new file mode 100644 index 0000000000..addb22955b --- /dev/null +++ b/Documentation/RelNotes-1.5.2.3.txt @@ -0,0 +1,27 @@ +GIT v1.5.2.3 Release Notes +========================== + +Fixes since v1.5.2.2 +-------------------- + + * Bugfixes + + - Version 2 pack index format was introduced in version 1.5.2 + to support pack files that has offset that cannot be + represented in 32-bit. The runtime code to validate such + an index mishandled such an index for an empty pack. + + - Commit walkers (most notably, fetch over http protocol) + tried to traverse commit objects contained in trees (aka + subproject); they shouldn't. + + - A build option NO_R_TO_GCC_LINKER was not explained in Makefile + comment correctly. + + * Documentation Fixes and Updates + + - git-config --regexp was not documented properly. + + - git-repack -a was not documented properly. + + - git-remote -n was not documented properly. diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 3c3cd2f27d..5c6d2b2898 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v1.5.2.2.GIT +DEF_VER=v1.5.2.3.GIT LF=' ' diff --git a/RelNotes b/RelNotes index 61f977884d..a1c82a863b 120000 --- a/RelNotes +++ b/RelNotes @@ -1 +1 @@ -Documentation/RelNotes-1.5.2.2.txt \ No newline at end of file +Documentation/RelNotes-1.5.2.3.txt \ No newline at end of file From 8d2244ba74f5207b9f7f9f1b4efbcccacbbb2c7b Mon Sep 17 00:00:00 2001 From: Andy Parkins Date: Mon, 2 Jul 2007 13:56:58 +0100 Subject: [PATCH 15/16] Make git-prune submodule aware (and fix a SEGFAULT in the process) I ran git-prune on a repository and got this: $ git-prune error: Object 228f8065b930120e35fc0c154c237487ab02d64a is a blob, not a commit Segmentation fault (core dumped) This repository was a strange one in that it was being used to provide its own submodule. That is, the repository was cloned into a subdirectory, an independent branch checked out in that subdirectory, and then it was marked as a submodule. git-prune then failed in the above manner. The problem was that git-prune was not submodule aware in two areas. Linus said: > So what happens is that something traverses a tree object, looks at each > entry, sees that it's not a tree, and tries to look it up as a blob. But > subprojects are commits, not blobs, and then when you look at the object > more closely, you get the above kind of object type confusion. and included a patch to add an S_ISGITLINK() test to reachable.c's process_tree() function. That fixed the first git-prune error, and stopped it from trying to process the gitlink entries in trees as if they were pointers to other trees (and of course failing, because gitlinks _aren't_ trees). That part of this patch is his. The second area is add_cache_refs(). This is called before starting the reachability analysis, and was calling lookup_blob() on every object hash found in the index. However, it is no longer true that every hash in the index is a pointer to a blob, some of them are gitlinks, and are not backed by any object at all, they are commits in another repository. Normally this bug was not causing any problems, but in the case of the self-referencing repository described above, it meant that the gitlink hash was being marked as being of type OBJ_BLOB by add_cache_refs() call to lookup_blob(). Then later, because that hash was also pointed to by a ref, add_one_ref() would treat it as a commit; lookup_commit() would return a NULL because that object was already noted as being an OBJ_BLOB, not an OBJ_COMMIT; and parse_commit_buffer() would SEGFAULT on that NULL pointer. The fix made by this patch is to not blindly call lookup_blob() in reachable.c's add_cache_refs(), and instead skip any index entries that are S_ISGITLINK(). Signed-off-by: Andy Parkins Signed-off-by: Junio C Hamano --- reachable.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/reachable.c b/reachable.c index ff3dd34962..c1aee603e7 100644 --- a/reachable.c +++ b/reachable.c @@ -21,6 +21,14 @@ static void process_blob(struct blob *blob, /* Nothing to do, really .. The blob lookup was the important part */ } +static void process_gitlink(const unsigned char *sha1, + struct object_array *p, + struct name_path *path, + const char *name) +{ + /* I don't think we want to recurse into this, really. */ +} + static void process_tree(struct tree *tree, struct object_array *p, struct name_path *path, @@ -47,6 +55,8 @@ static void process_tree(struct tree *tree, while (tree_entry(&desc, &entry)) { if (S_ISDIR(entry.mode)) process_tree(lookup_tree(entry.sha1), p, &me, entry.path); + else if (S_ISDIRLNK(entry.mode)) + process_gitlink(entry.sha1, p, &me, entry.path); else process_blob(lookup_blob(entry.sha1), p, &me, entry.path); } @@ -159,6 +169,16 @@ static void add_cache_refs(struct rev_info *revs) read_cache(); for (i = 0; i < active_nr; i++) { + /* + * The index can contain blobs and GITLINKs, GITLINKs are hashes + * that don't actually point to objects in the repository, it's + * almost guaranteed that they are NOT blobs, so we don't call + * lookup_blob() on them, to avoid populating the hash table + * with invalid information + */ + if (S_ISDIRLNK(ntohl(active_cache[i]->ce_mode))) + continue; + lookup_blob(active_cache[i]->sha1); /* * We could add the blobs to the pending list, but quite From e8964a5b91e13169ad73c7b1db2e904441ad93f5 Mon Sep 17 00:00:00 2001 From: Michael Hendricks Date: Mon, 2 Jul 2007 10:48:34 -0600 Subject: [PATCH 16/16] Correctly document the name of the global excludes file configuration Signed-off-by: Michael Hendricks Signed-off-by: Junio C Hamano --- Documentation/config.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index 7d9afe20f9..a75f7f7664 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -263,7 +263,7 @@ You probably do not need to adjust this value. + Common unit suffixes of 'k', 'm', or 'g' are supported. -core.excludeFile:: +core.excludesfile:: In addition to '.gitignore' (per-directory) and '.git/info/exclude', git looks into this file for patterns of files which are not meant to be tracked. See