diff options
-rw-r--r-- | Documentation/git-applymbox.txt | 14 | ||||
-rw-r--r-- | Documentation/git-init.txt | 1 | ||||
-rw-r--r-- | Documentation/git-mailinfo.txt | 16 | ||||
-rw-r--r-- | Documentation/git-svn.txt | 65 | ||||
-rw-r--r-- | Makefile | 22 | ||||
-rw-r--r-- | builtin-apply.c | 18 | ||||
-rw-r--r-- | builtin-archive.c | 1 | ||||
-rw-r--r-- | builtin-describe.c (renamed from describe.c) | 5 | ||||
-rw-r--r-- | builtin-mailinfo.c | 19 | ||||
-rw-r--r-- | builtin.h | 1 | ||||
-rw-r--r-- | compat/pread.c | 18 | ||||
-rw-r--r-- | contrib/emacs/git.el | 18 | ||||
-rwxr-xr-x | git-am.sh | 4 | ||||
-rwxr-xr-x | git-applymbox.sh | 3 | ||||
-rwxr-xr-x | git-clone.sh | 2 | ||||
-rw-r--r-- | git-compat-util.h | 5 | ||||
-rwxr-xr-x | git-send-email.perl | 10 | ||||
-rw-r--r-- | git.c | 1 | ||||
-rwxr-xr-x | gitweb/gitweb.perl | 7 | ||||
-rw-r--r-- | http-fetch.c | 1 | ||||
-rw-r--r-- | http-push.c | 3 | ||||
-rw-r--r-- | sha1_file.c | 15 | ||||
-rwxr-xr-x | t/t1410-reflog.sh | 2 | ||||
-rw-r--r-- | tree-walk.c | 9 |
24 files changed, 151 insertions, 109 deletions
diff --git a/Documentation/git-applymbox.txt b/Documentation/git-applymbox.txt index f74c6a49b3..95dc65a583 100644 --- a/Documentation/git-applymbox.txt +++ b/Documentation/git-applymbox.txt @@ -42,13 +42,13 @@ OPTIONS and the current tree. -u:: - By default, the commit log message, author name and - author email are taken from the e-mail without any - charset conversion, after minimally decoding MIME - transfer encoding. This flag causes the resulting - commit to be encoded in utf-8 by transliterating them. - Note that the patch is always used as is without charset - conversion, even with this flag. + The commit log message, author name and author email are + taken from the e-mail, and after minimally decoding MIME + transfer encoding, re-coded in UTF-8 by transliterating + them. This used to be optional but now it is the default. ++ +Note that the patch is always used as-is without charset +conversion, even with this flag. -c .dotest/<num>:: When the patch contained in an e-mail does not cleanly diff --git a/Documentation/git-init.txt b/Documentation/git-init.txt new file mode 100644 index 0000000000..36838c753b --- /dev/null +++ b/Documentation/git-init.txt @@ -0,0 +1 @@ +include::git-init-db.txt[] diff --git a/Documentation/git-mailinfo.txt b/Documentation/git-mailinfo.txt index ea0a06557f..5088bbea84 100644 --- a/Documentation/git-mailinfo.txt +++ b/Documentation/git-mailinfo.txt @@ -33,15 +33,13 @@ OPTIONS format-patch --mbox' output. -u:: - By default, the commit log message, author name and - author email are taken from the e-mail without any - charset conversion, after minimally decoding MIME - transfer encoding. This flag causes the resulting - commit to be encoded in the encoding specified by - i18n.commitencoding configuration (defaults to utf-8) by - transliterating them. - Note that the patch is always used as is without charset - conversion, even with this flag. + The commit log message, author name and author email are + taken from the e-mail, and after minimally decoding MIME + transfer encoding, re-coded in UTF-8 by transliterating + them. This used to be optional but now it is the default. ++ +Note that the patch is always used as-is without charset +conversion, even with this flag. --encoding=<encoding>:: Similar to -u but if the local convention is different diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt index 8df43cb819..1b013139af 100644 --- a/Documentation/git-svn.txt +++ b/Documentation/git-svn.txt @@ -249,8 +249,7 @@ repo-config key: svn.authorsfile -q:: --quiet:: - Make git-svn less verbose. This only affects git-svn if you - have the SVN::* libraries installed and are using them. + Make git-svn less verbose. --repack[=<n>]:: --repack-flags=<flags> @@ -321,8 +320,6 @@ for more information on using GIT_SVN_ID. started tracking a branch and never tracked the trunk it was descended from. - This relies on the SVN::* libraries to work. - repo-config key: svn.followparent --no-metadata:: @@ -350,25 +347,6 @@ Run this if you used an old version of git-svn that used "git-svn-HEAD" instead of "remotes/git-svn" as the branch for tracking the remote. ---no-ignore-externals:: -Only used with the 'fetch' and 'rebuild' command. - -This command has no effect when you are using the SVN::* -libraries with git, svn:externals are always avoided. - -By default, git-svn passes --ignore-externals to svn to avoid -fetching svn:external trees into git. Pass this flag to enable -externals tracking directly via git. - -Versions of svn that do not support --ignore-externals are -automatically detected and this flag will be automatically -enabled for them. - -Otherwise, do not enable this flag unless you know what you're -doing. - -repo-config key: svn.noignoreexternals - --ignore-nodate:: Only used with the 'fetch' command. @@ -486,49 +464,18 @@ This allows you to tie unfetched SVN revision 375 to your current HEAD: git-svn fetch 375=$(git-rev-parse HEAD) ------------------------------------------------ -Advanced Example: Tracking a Reorganized Repository -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Note: this example is now obsolete if you have SVN::* libraries -installed. Simply use --follow-parent when fetching. - If you're tracking a directory that has moved, or otherwise been branched or tagged off of another directory in the repository and you -care about the full history of the project, then you can read this -section. - -This is how Yann Dirson tracked the trunk of the ufoai directory when -the /trunk directory of his repository was moved to /ufoai/trunk and -he needed to continue tracking /ufoai/trunk where /trunk left off. +care about the full history of the project, then you can use +the --follow-parent option. ------------------------------------------------------------------------- - # This log message shows when the repository was reorganized: - r166 | ydirson | 2006-03-02 01:36:55 +0100 (Thu, 02 Mar 2006) | 1 line - Changed paths: - D /trunk - A /ufoai/trunk (from /trunk:165) - - # First we start tracking the old revisions: - GIT_SVN_ID=git-oldsvn git-svn init \ - https://svn.sourceforge.net/svnroot/ufoai/trunk - GIT_SVN_ID=git-oldsvn git-svn fetch -r1:165 - - # And now, we continue tracking the new revisions: - GIT_SVN_ID=git-newsvn git-svn init \ - https://svn.sourceforge.net/svnroot/ufoai/ufoai/trunk - GIT_SVN_ID=git-newsvn git-svn fetch \ - 166=`git-rev-parse refs/remotes/git-oldsvn` ------------------------------------------------------------------------- +------------------------------------------------ + git-svn fetch --follow-parent +------------------------------------------------ BUGS ---- -If you are not using the SVN::* Perl libraries and somebody commits a -conflicting changeset to SVN at a bad moment (right before you commit) -causing a conflict and your commit to fail, your svn working tree -($GIT_DIR/git-svn/tree) may be dirtied. The easiest thing to do is -probably just to rm -rf $GIT_DIR/git-svn/tree and run 'rebuild'. You -can avoid this problem entirely by using 'dcommit'. - We ignore all SVN properties except svn:executable. Too difficult to map them since we rely heavily on git write-tree being _exactly_ the same on both the SVN and git working trees and I prefer not to clutter @@ -1,5 +1,5 @@ # The default target of this Makefile is... -all: +all:: # Define NO_OPENSSL environment variable if you do not have OpenSSL. # This also implies MOZILLA_SHA1. @@ -69,6 +69,9 @@ all: # # Define NO_MMAP if you want to avoid mmap. # +# Define NO_PREAD if you have a problem with pread() system call (e.g. +# cygwin.dll before v1.5.22). +# # Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is # generally faster on your platform than accessing the working directory. # @@ -201,7 +204,7 @@ PROGRAMS = \ git-update-server-info$X \ git-upload-pack$X git-verify-pack$X \ git-pack-redundant$X git-var$X \ - git-describe$X git-merge-tree$X git-imap-send$X \ + git-merge-tree$X git-imap-send$X \ git-merge-recursive$X \ $(EXTRA_PROGRAMS) @@ -272,6 +275,7 @@ BUILTIN_OBJS = \ builtin-check-ref-format.o \ builtin-commit-tree.o \ builtin-count-objects.o \ + builtin-describe.o \ builtin-diff.o \ builtin-diff-files.o \ builtin-diff-index.o \ @@ -523,6 +527,10 @@ ifdef NO_MMAP COMPAT_CFLAGS += -DNO_MMAP COMPAT_OBJS += compat/mmap.o endif +ifdef NO_PREAD + COMPAT_CFLAGS += -DNO_PREAD + COMPAT_OBJS += compat/pread.o +endif ifdef NO_FAST_WORKING_DIRECTORY BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY endif @@ -597,9 +605,12 @@ export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir ### Build rules -all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk gitweb/gitweb.cgi +all:: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk gitweb/gitweb.cgi +ifneq (,$X) + $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), rm -f '$p';) +endif -all: +all:: $(MAKE) -C perl PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all $(MAKE) -C templates @@ -841,6 +852,9 @@ install: all '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'; \ fi $(foreach p,$(BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;) +ifneq (,$X) + $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';) +endif install-doc: $(MAKE) -C Documentation install diff --git a/builtin-apply.c b/builtin-apply.c index 1c35837068..54fd2cb0c7 100644 --- a/builtin-apply.c +++ b/builtin-apply.c @@ -811,7 +811,8 @@ static int find_header(char *line, unsigned long size, int *hdrsize, struct patc struct fragment dummy; if (parse_fragment_header(line, len, &dummy) < 0) continue; - error("patch fragment without header at line %d: %.*s", linenr, (int)len-1, line); + die("patch fragment without header at line %d: %.*s", + linenr, (int)len-1, line); } if (size < len + 6) @@ -2238,8 +2239,19 @@ static void remove_file(struct patch *patch) die("unable to remove %s from index", patch->old_name); cache_tree_invalidate_path(active_cache_tree, patch->old_name); } - if (!cached) - unlink(patch->old_name); + if (!cached) { + if (!unlink(patch->old_name)) { + char *name = xstrdup(patch->old_name); + char *end = strrchr(name, '/'); + while (end) { + *end = 0; + if (rmdir(name)) + break; + end = strrchr(name, '/'); + } + free(name); + } + } } static void add_index_file(const char *path, unsigned mode, void *buf, unsigned long size) diff --git a/builtin-archive.c b/builtin-archive.c index 391cf43911..32737d3162 100644 --- a/builtin-archive.c +++ b/builtin-archive.c @@ -137,7 +137,6 @@ void parse_treeish_arg(const char **argv, struct archiver_args *ar_args, if (err || !S_ISDIR(mode)) die("current working directory is untracked"); - free(tree); tree = parse_tree_indirect(tree_sha1); } ar_args->tree = tree; diff --git a/describe.c b/builtin-describe.c index f4029ee74e..ad3b469f37 100644 --- a/describe.c +++ b/builtin-describe.c @@ -2,6 +2,7 @@ #include "commit.h" #include "tag.h" #include "refs.h" +#include "builtin.h" #define SEEN (1u << 0) @@ -139,7 +140,7 @@ static void describe(const char *arg, int last_one) die("cannot describe '%s'", sha1_to_hex(cmit->object.sha1)); } -int main(int argc, char **argv) +int cmd_describe(int argc, const char **argv, const char *prefix) { int i; @@ -161,7 +162,7 @@ int main(int argc, char **argv) usage(describe_usage); } - setup_git_directory(); + save_commit_buffer = 0; if (argc <= i) describe("HEAD", 1); diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c index a67f3eb90b..583da38b67 100644 --- a/builtin-mailinfo.c +++ b/builtin-mailinfo.c @@ -515,12 +515,9 @@ static void convert_to_utf8(char *line, char *charset) char *input_charset = *charset ? charset : latin_one; char *out = reencode_string(line, metainfo_charset, input_charset); - if (!out) { - fprintf(stderr, "cannot convert from %s to %s\n", - input_charset, metainfo_charset); - *charset = 0; - return; - } + if (!out) + die("cannot convert from %s to %s\n", + input_charset, metainfo_charset); strcpy(line, out); free(out); } @@ -797,17 +794,23 @@ static const char mailinfo_usage[] = int cmd_mailinfo(int argc, const char **argv, const char *prefix) { + const char *def_charset; + /* NEEDSWORK: might want to do the optional .git/ directory * discovery */ git_config(git_default_config); + def_charset = (git_commit_encoding ? git_commit_encoding : "utf-8"); + metainfo_charset = def_charset; + while (1 < argc && argv[1][0] == '-') { if (!strcmp(argv[1], "-k")) keep_subject = 1; else if (!strcmp(argv[1], "-u")) - metainfo_charset = (git_commit_encoding - ? git_commit_encoding : "utf-8"); + metainfo_charset = def_charset; + else if (!strcmp(argv[1], "-n")) + metainfo_charset = NULL; else if (!strncmp(argv[1], "--encoding=", 11)) metainfo_charset = argv[1] + 11; else @@ -25,6 +25,7 @@ extern int cmd_check_ref_format(int argc, const char **argv, const char *prefix) extern int cmd_cherry(int argc, const char **argv, const char *prefix); extern int cmd_commit_tree(int argc, const char **argv, const char *prefix); extern int cmd_count_objects(int argc, const char **argv, const char *prefix); +extern int cmd_describe(int argc, const char **argv, const char *prefix); extern int cmd_diff_files(int argc, const char **argv, const char *prefix); extern int cmd_diff_index(int argc, const char **argv, const char *prefix); extern int cmd_diff(int argc, const char **argv, const char *prefix); diff --git a/compat/pread.c b/compat/pread.c new file mode 100644 index 0000000000..978cac4ec9 --- /dev/null +++ b/compat/pread.c @@ -0,0 +1,18 @@ +#include "../git-compat-util.h" + +ssize_t git_pread(int fd, void *buf, size_t count, off_t offset) +{ + off_t current_offset; + ssize_t rc; + + current_offset = lseek(fd, 0, SEEK_CUR); + + if (lseek(fd, offset, SEEK_SET) < 0) + return -1; + + rc = read_in_full(fd, buf, count); + + if (current_offset != lseek(fd, current_offset, SEEK_SET)) + return -1; + return rc; +} diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el index ede3ab2bd8..d90ba816e0 100644 --- a/contrib/emacs/git.el +++ b/contrib/emacs/git.el @@ -280,6 +280,15 @@ and returns the process output as a string." (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)))) +; propertize definition for XEmacs, stolen from erc-compat +(eval-when-compile + (unless (fboundp 'propertize) + (defun propertize (string &rest props) + (let ((string (copy-sequence string))) + (while props + (put-text-property 0 (length string) (nth 0 props) (nth 1 props) string) + (setq props (cddr props))) + string)))) ;;;; Wrappers for basic git commands ;;;; ------------------------------------------------------------ @@ -448,11 +457,10 @@ and returns the process output as a string." (defun git-fileinfo-prettyprint (info) "Pretty-printer for the git-fileinfo structure." - (insert (format " %s %s %s %s%s" - (if (git-fileinfo->marked info) (propertize "*" 'face 'git-mark-face) " ") - (git-status-code-as-string (git-fileinfo->state info)) - (git-permissions-as-string (git-fileinfo->old-perm info) (git-fileinfo->new-perm info)) - (git-escape-file-name (git-fileinfo->name info)) + (insert (concat " " (if (git-fileinfo->marked info) (propertize "*" 'face 'git-mark-face) " ") + " " (git-status-code-as-string (git-fileinfo->state info)) + " " (git-permissions-as-string (git-fileinfo->old-perm info) (git-fileinfo->new-perm info)) + " " (git-escape-file-name (git-fileinfo->name info)) (git-rename-as-string info)))) (defun git-parse-status (status) @@ -128,7 +128,7 @@ do -s|--s|--si|--sig|--sign|--signo|--signof|--signoff) sign=t; shift ;; -u|--u|--ut|--utf|--utf8) - shift ;; # this is now default + utf8=t; shift ;; # this is now default --no-u|--no-ut|--no-utf|--no-utf8) utf8=; shift ;; -k|--k|--ke|--kee|--keep) @@ -228,6 +228,8 @@ fi if test "$(cat "$dotest/utf8")" = t then utf8=-u +else + utf8=-n fi if test "$(cat "$dotest/keep")" = t then diff --git a/git-applymbox.sh b/git-applymbox.sh index 5569fdcc34..1f68599ae5 100755 --- a/git-applymbox.sh +++ b/git-applymbox.sh @@ -23,11 +23,12 @@ USAGE='[-u] [-k] [-q] [-m] (-c .dotest/<num> | mbox) [signoff]' git var GIT_COMMITTER_IDENT >/dev/null || exit -keep_subject= query_apply= continue= utf8= resume=t +keep_subject= query_apply= continue= utf8=-u resume=t while case "$#" in 0) break ;; esac do case "$1" in -u) utf8=-u ;; + -n) utf8=-n ;; -k) keep_subject=-k ;; -q) query_apply=t ;; -c) continue="$2"; resume=f; shift ;; diff --git a/git-clone.sh b/git-clone.sh index 3d388de62a..cf761b2c69 100755 --- a/git-clone.sh +++ b/git-clone.sh @@ -355,7 +355,7 @@ then # The name under $remote_top the remote HEAD seems to point at. head_points_at=$( ( - echo "master" + test -f "$GIT_DIR/$remote_top/master" && echo "master" cd "$GIT_DIR/$remote_top" && find . -type f -print | sed -e 's/^\.\///' ) | ( diff --git a/git-compat-util.h b/git-compat-util.h index e023bf1413..f8d46d587b 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -107,6 +107,11 @@ extern int git_munmap(void *start, size_t length); #define DEFAULT_PACKED_GIT_LIMIT \ ((1024L * 1024L) * (sizeof(void*) >= 8 ? 8192 : 256)) +#ifdef NO_PREAD +#define pread git_pread +extern ssize_t git_pread(int fd, void *buf, size_t count, off_t offset); +#endif + #ifdef NO_SETENV #define setenv gitsetenv extern int gitsetenv(const char *, const char *, int); diff --git a/git-send-email.perl b/git-send-email.perl index ba39d39384..8dc2ee0cf7 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -402,6 +402,15 @@ sub make_message_id $cc = ""; $time = time - scalar $#files; +sub unquote_rfc2047 { + local ($_) = @_; + if (s/=\?utf-8\?q\?(.*)\?=/$1/g) { + s/_/ /g; + s/=([0-9A-F]{2})/chr(hex($1))/eg; + } + return "$_ - unquoted"; +} + sub send_message { my @recipients = unique_email_list(@to); @@ -555,6 +564,7 @@ foreach my $t (@files) { } close F; if (defined $author_not_sender) { + $author_not_sender = unquote_rfc2047($author_not_sender); $message = "From: $author_not_sender\n\n$message"; } @@ -220,6 +220,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp) { "cherry", cmd_cherry, RUN_SETUP }, { "commit-tree", cmd_commit_tree, RUN_SETUP }, { "count-objects", cmd_count_objects, RUN_SETUP }, + { "describe", cmd_describe, RUN_SETUP }, { "diff", cmd_diff, RUN_SETUP | USE_PAGER }, { "diff-files", cmd_diff_files, RUN_SETUP }, { "diff-index", cmd_diff_index, RUN_SETUP }, diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 25e5079a89..88af2e6380 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -2412,7 +2412,6 @@ sub git_patchset_body { push @diff_header, $patch_line; } - #last PATCH unless $patch_line; my $last_patch_line = $patch_line; # check if current patch belong to current raw line @@ -2522,7 +2521,10 @@ sub git_patchset_body { # from-file/to-file diff header $patch_line = $last_patch_line; - last PATCH unless $patch_line; + if (! $patch_line) { + print "</div>\n"; # class="patch" + last PATCH; + } next PATCH if ($patch_line =~ m/^diff /); #assert($patch_line =~ m/^---/) if DEBUG; if ($from{'href'} && $patch_line =~ m!^--- "?a/!) { @@ -2533,7 +2535,6 @@ sub git_patchset_body { print "<div class=\"diff from_file\">$patch_line</div>\n"; $patch_line = <$fd>; - #last PATCH unless $patch_line; chomp $patch_line; #assert($patch_line =~ m/^+++/) if DEBUG; diff --git a/http-fetch.c b/http-fetch.c index fe8cd7bdcd..67dfb0a033 100644 --- a/http-fetch.c +++ b/http-fetch.c @@ -809,6 +809,7 @@ static int fetch_pack(struct alt_base *repo, unsigned char *sha1) return error("Unable to start request"); } + target->pack_size = ftell(packfile); fclose(packfile); ret = move_temp_to_file(tmpfile, filename); diff --git a/http-push.c b/http-push.c index 7e73eac9c3..0a15f53782 100644 --- a/http-push.c +++ b/http-push.c @@ -770,11 +770,14 @@ static void finish_request(struct transfer_request *request) request->url, curl_errorstr); remote->can_update_info_refs = 0; } else { + off_t pack_size = ftell(request->local_stream); + fclose(request->local_stream); request->local_stream = NULL; if (!move_temp_to_file(request->tmpfile, request->filename)) { target = (struct packed_git *)request->userData; + target->pack_size = pack_size; lst = &remote->packs; while (*lst != target) lst = &((*lst)->next); diff --git a/sha1_file.c b/sha1_file.c index 095a7e1622..53e25f278c 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -22,6 +22,12 @@ #endif #endif +#ifdef NO_C99_FORMAT +#define SZ_FMT "lu" +#else +#define SZ_FMT "zu" +#endif + const unsigned char null_sha1[20]; static unsigned int sha1_file_open_flag = O_NOATIME; @@ -407,9 +413,9 @@ struct packed_git *packed_git; void pack_report() { fprintf(stderr, - "pack_report: getpagesize() = %10lu\n" - "pack_report: core.packedGitWindowSize = %10lu\n" - "pack_report: core.packedGitLimit = %10lu\n", + "pack_report: getpagesize() = %10" SZ_FMT "\n" + "pack_report: core.packedGitWindowSize = %10" SZ_FMT "\n" + "pack_report: core.packedGitLimit = %10" SZ_FMT "\n", page_size, packed_git_window_size, packed_git_limit); @@ -417,7 +423,8 @@ void pack_report() "pack_report: pack_used_ctr = %10u\n" "pack_report: pack_mmap_calls = %10u\n" "pack_report: pack_open_windows = %10u / %10u\n" - "pack_report: pack_mapped = %10lu / %10lu\n", + "pack_report: pack_mapped = " + "%10" SZ_FMT " / %10" SZ_FMT "\n", pack_used_ctr, pack_mmap_calls, pack_open_windows, peak_pack_open_windows, diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh index 738d1513d4..8e8d526ef2 100755 --- a/t/t1410-reflog.sh +++ b/t/t1410-reflog.sh @@ -71,6 +71,8 @@ test_expect_success setup ' check_fsck && chmod +x C && + ( test "`git repo-config --bool core.filemode`" != false || + echo executable >>C ) && git add C && test_tick && git commit -m dragon && L=`git rev-parse --verify HEAD` && diff --git a/tree-walk.c b/tree-walk.c index 22f4550b6c..70f899957e 100644 --- a/tree-walk.c +++ b/tree-walk.c @@ -199,10 +199,17 @@ int get_tree_entry(const unsigned char *tree_sha1, const char *name, unsigned ch int retval; void *tree; struct tree_desc t; + unsigned char root[20]; - tree = read_object_with_reference(tree_sha1, tree_type, &t.size, NULL); + tree = read_object_with_reference(tree_sha1, tree_type, &t.size, root); if (!tree) return -1; + + if (name[0] == '\0') { + hashcpy(sha1, root); + return 0; + } + t.buf = tree; retval = find_tree_entry(&t, name, sha1, mode); free(tree); |