diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Documentation/RelNotes-1.7.1.txt | 25 | ||||
-rw-r--r-- | Documentation/git-branch.txt | 2 | ||||
-rw-r--r-- | Documentation/git-fetch.txt | 8 | ||||
-rw-r--r-- | Documentation/git-push.txt | 2 | ||||
-rw-r--r-- | Makefile | 33 | ||||
-rw-r--r-- | branch.c | 2 | ||||
-rw-r--r-- | builtin/apply.c | 5 | ||||
-rw-r--r-- | builtin/fetch.c | 8 | ||||
-rw-r--r-- | builtin/mailinfo.c | 3 | ||||
-rw-r--r-- | builtin/push.c | 2 | ||||
-rw-r--r-- | cache.h | 2 | ||||
-rw-r--r-- | configure.ac | 20 | ||||
-rw-r--r-- | diff.c | 4 | ||||
-rwxr-xr-x | git-instaweb.sh | 6 | ||||
-rw-r--r-- | gitweb/INSTALL | 26 | ||||
-rw-r--r-- | gitweb/Makefile | 30 | ||||
-rw-r--r-- | gitweb/README | 3 | ||||
-rw-r--r-- | refs.c | 1 | ||||
-rw-r--r-- | sha1_file.c | 6 | ||||
-rw-r--r-- | submodule.c | 33 | ||||
-rwxr-xr-x | t/t3301-notes.sh | 9 | ||||
-rwxr-xr-x[-rw-r--r--] | t/t3507-cherry-pick-conflict.sh | 0 | ||||
-rwxr-xr-x | t/t4041-diff-submodule.sh | 15 | ||||
-rwxr-xr-x | t/t7506-status-submodule.sh | 16 |
25 files changed, 178 insertions, 84 deletions
diff --git a/.gitignore b/.gitignore index 7b3acb7664..4c2415276f 100644 --- a/.gitignore +++ b/.gitignore @@ -156,6 +156,7 @@ /git-core-*/?* /gitk-git/gitk-wish /gitweb/gitweb.cgi +/gitweb/gitweb.min.* /test-chmtime /test-ctype /test-date diff --git a/Documentation/RelNotes-1.7.1.txt b/Documentation/RelNotes-1.7.1.txt index 02f9257591..95c5ed6016 100644 --- a/Documentation/RelNotes-1.7.1.txt +++ b/Documentation/RelNotes-1.7.1.txt @@ -7,21 +7,22 @@ Updates since v1.7.0 * Eric Raymond is the maintainer of updated CIAbot scripts, in contrib/. * Some commands (e.g. svn and http interfaces) that interactively ask - password can be told to use an external program given via GIT_ASKPASS. + for a password can be told to use an external program given via + GIT_ASKPASS. * Conflict markers that lead the common ancestor in diff3-style output - now has a label, which hopefully would help third-party tools that + now have a label, which hopefully would help third-party tools that expect one. * Comes with an updated bash-completion script. * "git am" learned "--keep-cr" option to handle inputs that are - mixture of changes to files with and without CRLF line endings. + a mixture of changes to files with and without CRLF line endings. * "git cvsimport" learned -R option to leave revision mapping between CVS revisions and resulting git commits. - * "git diff --submodule" notices and descries dirty submodules. + * "git diff --submodule" notices and describes dirty submodules. * "git for-each-ref" learned %(symref), %(symref:short) and %(flag) tokens. @@ -42,12 +43,11 @@ Updates since v1.7.0 * "git log -p --first-parent -m" shows one-parent diff for merge commits, instead of showing combined diff. - * "git merge-file" learned to use custom conflict marker size and also use - the "union merge" behaviour. + * "git merge-file" learned to use custom conflict marker size and also + to use the "union merge" behaviour. - * "git notes" command has been rewritten in C and learned quite a - many commands and features to help you carry notes forward across - rebases and amends. + * "git notes" command has been rewritten in C and learned many commands + and features to help you carry notes forward across rebases and amends. * "git request-pull" identifies the commit the request is relative to in a more readable way. @@ -56,13 +56,16 @@ Updates since v1.7.0 near the tip while preserving your local changes in a way similar to how "git checkout branch" does. - * "git status" notices and descries dirty submodules. + * "git status" notices and describes dirty submodules. * "git svn" should work better when interacting with repositories with CRLF line endings. * "git imap-send" learned to support CRAM-MD5 authentication. + * "gitweb" installation procedure can use "minified" js/css files + better. + Fixes since v1.7.0 ------------------ @@ -81,5 +84,5 @@ release, unless otherwise noted. --- exec >/var/tmp/1 echo O=$(git describe) -O=v1.7.0.4-382-gb807c52 +O=v1.7.1-rc0-36-gb92cbb6 git shortlog --no-merges ^maint $O.. diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt index 903a690f10..d78f4c7398 100644 --- a/Documentation/git-branch.txt +++ b/Documentation/git-branch.txt @@ -72,6 +72,8 @@ OPTIONS Create the branch's reflog. This activates recording of all changes made to the branch ref, enabling use of date based sha1 expressions such as "<branchname>@\{yesterday}". + Note that in non-bare repositories, reflogs are usually + enabled by default by the `core.logallrefupdates` config option. -f:: --force:: diff --git a/Documentation/git-fetch.txt b/Documentation/git-fetch.txt index 948ea26c5a..400fe7f956 100644 --- a/Documentation/git-fetch.txt +++ b/Documentation/git-fetch.txt @@ -8,13 +8,13 @@ git-fetch - Download objects and refs from another repository SYNOPSIS -------- -'git fetch' <options> <repository> <refspec>... +'git fetch' [<options>] [<repository> [<refspec>...]] -'git fetch' <options> <group> +'git fetch' [<options>] <group> -'git fetch' --multiple <options> [<repository> | <group>]... +'git fetch' --multiple [<options>] [<repository> | <group>]... -'git fetch' --all <options> +'git fetch' --all [<options>] DESCRIPTION diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt index 59dc8b197e..48570242fb 100644 --- a/Documentation/git-push.txt +++ b/Documentation/git-push.txt @@ -11,7 +11,7 @@ SYNOPSIS [verse] 'git push' [--all | --mirror | --tags] [-n | --dry-run] [--receive-pack=<git-receive-pack>] [--repo=<repository>] [-f | --force] [-v | --verbose] [-u | --set-upstream] - [<repository> <refspec>...] + [<repository> [<refspec>...]] DESCRIPTION ----------- @@ -203,6 +203,9 @@ all:: # Define JSMIN to point to JavaScript minifier that functions as # a filter to have gitweb.js minified. # +# Define CSSMIN to point to a CSS minifier in order to generate a minified +# version of gitweb.css +# # Define DEFAULT_PAGER to a sensible pager command (defaults to "less") if # you want to use something different. The value will be interpreted by the # shell at runtime when it is used. @@ -279,9 +282,6 @@ lib = lib # DESTDIR= pathsep = : -# JavaScript minifier invocation that can function as filter -JSMIN = - export prefix bindir sharedir sysconfdir CC = gcc @@ -1561,18 +1561,29 @@ gitweb: $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all ifdef JSMIN -OTHER_PROGRAMS += gitweb/gitweb.cgi gitweb/gitweb.min.js -gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js +GITWEB_PROGRAMS += gitweb/gitweb.min.js +GITWEB_JS = gitweb/gitweb.min.js else -OTHER_PROGRAMS += gitweb/gitweb.cgi -gitweb/gitweb.cgi: gitweb/gitweb.perl +GITWEB_JS = gitweb/gitweb.js endif +ifdef CSSMIN +GITWEB_PROGRAMS += gitweb/gitweb.min.css +GITWEB_CSS = gitweb/gitweb.min.css +else +GITWEB_CSS = gitweb/gitweb.css +endif +OTHER_PROGRAMS += gitweb/gitweb.cgi $(GITWEB_PROGRAMS) +gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS) $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@) ifdef JSMIN gitweb/gitweb.min.js: gitweb/gitweb.js $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@) endif # JSMIN +ifdef CSSMIN +gitweb/gitweb.min.css: gitweb/gitweb.css + $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@) +endif # CSSMIN git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js @@ -1582,11 +1593,13 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb. -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ -e '/@@GITWEB_CGI@@/r gitweb/gitweb.cgi' \ -e '/@@GITWEB_CGI@@/d' \ - -e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \ + -e '/@@GITWEB_CSS@@/r $(GITWEB_CSS)' \ -e '/@@GITWEB_CSS@@/d' \ - -e '/@@GITWEB_JS@@/r gitweb/gitweb.js' \ + -e '/@@GITWEB_JS@@/r $(GITWEB_JS)' \ -e '/@@GITWEB_JS@@/d' \ -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \ + -e 's|@@GITWEB_CSS_NAME@@|$(GITWEB_CSS)|' \ + -e 's|@@GITWEB_JS_NAME@@|$(GITWEB_JS)|' \ $@.sh > $@+ && \ chmod +x $@+ && \ mv $@+ $@ @@ -2085,7 +2098,7 @@ clean: $(RM) $(htmldocs).tar.gz $(manpages).tar.gz $(MAKE) -C Documentation/ clean ifndef NO_PERL - $(RM) gitweb/gitweb.cgi + $(RM) gitweb/gitweb.cgi gitweb/gitweb.min.* $(MAKE) -C perl clean endif ifndef NO_PYTHON @@ -198,7 +198,7 @@ void create_branch(const char *head, log_all_ref_updates = 1; if (forcing) - snprintf(msg, sizeof msg, "branch: Reset from %s", + snprintf(msg, sizeof msg, "branch: Reset to %s", start_name); else if (!dont_change_ref) snprintf(msg, sizeof msg, "branch: Created from %s", diff --git a/builtin/apply.c b/builtin/apply.c index 7ca90472c1..771c972c55 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -2824,11 +2824,8 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s if (stat_ret < 0) { struct checkout costate; /* checkout */ + memset(&costate, 0, sizeof(costate)); costate.base_dir = ""; - costate.base_dir_len = 0; - costate.force = 0; - costate.quiet = 0; - costate.not_new = 0; costate.refresh_cache = 1; if (checkout_entry(*ce, &costate, NULL) || lstat(old_name, st)) diff --git a/builtin/fetch.c b/builtin/fetch.c index 957be9f926..8470850415 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -14,10 +14,10 @@ #include "transport.h" static const char * const builtin_fetch_usage[] = { - "git fetch [options] [<repository> <refspec>...]", - "git fetch [options] <group>", - "git fetch --multiple [options] [<repository> | <group>]...", - "git fetch --all [options]", + "git fetch [<options>] [<repository> [<refspec>...]]", + "git fetch [<options>] <group>", + "git fetch --multiple [<options>] [<repository> | <group>]...", + "git fetch --all [<options>]", NULL }; diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c index ce2ef6bede..4a9729b9b3 100644 --- a/builtin/mailinfo.c +++ b/builtin/mailinfo.c @@ -746,7 +746,8 @@ static int is_scissors_line(const struct strbuf *line) continue; } if (i + 1 < len && - (!memcmp(buf + i, ">8", 2) || !memcmp(buf + i, "8<", 2))) { + (!memcmp(buf + i, ">8", 2) || !memcmp(buf + i, "8<", 2) || + !memcmp(buf + i, ">%", 2) || !memcmp(buf + i, "%<", 2))) { in_perforation = 1; perforation += 2; scissors += 2; diff --git a/builtin/push.c b/builtin/push.c index 62957ededd..f4358b9d23 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -10,7 +10,7 @@ #include "parse-options.h" static const char * const push_usage[] = { - "git push [<options>] [<repository> <refspec>...]", + "git push [<options>] [<repository> [<refspec>...]]", NULL, }; @@ -701,7 +701,7 @@ static inline void *read_sha1_file(const unsigned char *sha1, enum object_type * return read_sha1_file_repl(sha1, type, size, NULL); } extern int hash_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *sha1); -extern int write_sha1_file(void *buf, unsigned long len, const char *type, unsigned char *return_sha1); +extern int write_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *return_sha1); extern int pretend_sha1_file(void *, unsigned long, enum object_type, unsigned char *); extern int force_object_loose(const unsigned char *sha1, time_t mtime); diff --git a/configure.ac b/configure.ac index 914ae5759f..f4d7372ef8 100644 --- a/configure.ac +++ b/configure.ac @@ -179,6 +179,26 @@ fi], AC_MSG_NOTICE([Will try -pthread then -lpthread to enable POSIX Threads.]) ]) +# Define option to enable JavaScript minification +AC_ARG_ENABLE([jsmin], +[AS_HELP_STRING([--enable-jsmin=PATH], + [PATH is the name of a JavaScript minifier or the absolute path to one.])], +[ + JSMIN=$enableval; + AC_MSG_NOTICE([Setting JSMIN to '$JSMIN' to enable JavaScript minifying]) + GIT_CONF_APPEND_LINE(JSMIN=$enableval); +]) + +# Define option to enable CSS minification +AC_ARG_ENABLE([cssmin], +[AS_HELP_STRING([--enable-cssmin=PATH], + [PATH is the name of a CSS minifier or the absolute path to one.])], +[ + CSSMIN=$enableval; + AC_MSG_NOTICE([Setting CSSMIN to '$CSSMIN' to enable CSS minifying]) + GIT_CONF_APPEND_LINE(CSSMIN=$enableval); +]) + ## Site configuration (override autodetection) ## --with-PACKAGE[=ARG] and --without-PACKAGE AC_MSG_NOTICE([CHECKS for site configuration]) @@ -551,6 +551,10 @@ static void emit_rewrite_diff(const char *name_a, emit_rewrite_lines(&ecbdata, '-', data_one, size_one); if (lc_b) emit_rewrite_lines(&ecbdata, '+', data_two, size_two); + if (textconv_one) + free((char *)data_one); + if (textconv_two) + free((char *)data_two); } struct diff_words_buffer { diff --git a/git-instaweb.sh b/git-instaweb.sh index 6a65f255cc..d4941a9ce6 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -391,18 +391,20 @@ EOFGITWEB gitweb_css () { cat > "$1" <<\EOFGITWEB @@GITWEB_CSS@@ + EOFGITWEB } gitweb_js () { cat > "$1" <<\EOFGITWEB @@GITWEB_JS@@ + EOFGITWEB } gitweb_cgi "$GIT_DIR/gitweb/gitweb.cgi" -gitweb_css "$GIT_DIR/gitweb/gitweb.css" -gitweb_js "$GIT_DIR/gitweb/gitweb.js" +gitweb_css "$GIT_DIR/@@GITWEB_CSS_NAME@@" +gitweb_js "$GIT_DIR/@@GITWEB_JS_NAME@@" case "$httpd" in *lighttpd*) diff --git a/gitweb/INSTALL b/gitweb/INSTALL index b76a0cffff..cbdc136470 100644 --- a/gitweb/INSTALL +++ b/gitweb/INSTALL @@ -2,11 +2,11 @@ GIT web Interface (gitweb) Installation ======================================= First you have to generate gitweb.cgi from gitweb.perl using -"make gitweb/gitweb.cgi", then copy appropriate files (gitweb.cgi, +"make gitweb", then copy appropriate files (gitweb.cgi, gitweb.js, gitweb.css, git-logo.png and git-favicon.png) to their destination. For example if git was (or is) installed with /usr prefix, you can do - $ make prefix=/usr gitweb/gitweb.cgi ;# as yourself + $ make prefix=/usr gitweb ;# as yourself # cp gitweb/git* /var/www/cgi-bin/ ;# as root Alternatively you can use autoconf generated ./configure script to @@ -15,7 +15,7 @@ instead $ make configure ;# as yourself $ ./configure --prefix=/usr ;# as yourself - $ make gitweb/gitweb.cgi ;# as yourself + $ make gitweb ;# as yourself # cp gitweb/git* /var/www/cgi-bin/ ;# as root The above example assumes that your web server is configured to run @@ -31,8 +31,7 @@ file for gitweb (in gitweb/README). - There are many configuration variables which affect building of gitweb.cgi; see "default configuration for gitweb" section in main - (top dir) Makefile, and instructions for building gitweb/gitweb.cgi - target. + (top dir) Makefile, and instructions for building gitweb target. One of the most important is where to find the git wrapper binary. Gitweb tries to find the git wrapper at $(bindir)/git, so you have to set $bindir @@ -62,9 +61,15 @@ file for gitweb (in gitweb/README). a suggestion). - You can control where gitweb tries to find its main CSS style file, - its favicon and logo with the GITWEB_CSS, GITWEB_FAVICON and GITWEB_LOGO - build configuration variables. By default gitweb tries to find them - in the same directory as gitweb.cgi script. + its JavaScript file, its favicon and logo with the GITWEB_CSS, GITWEB_JS + GITWEB_FAVICON and GITWEB_LOGO build configuration variables. By default + gitweb tries to find them in the same directory as gitweb.cgi script. + +- You can optionally generate minified versions of gitweb.js and gitweb.css + by defining the JSMIN and CSSMIN build configuration variables. By default + the non-minified versions will be used. NOTE: if you enable this option, + substitute gitweb.min.js and gitweb.min.css for all uses of gitweb.js and + gitweb.css in the help files. Build example ~~~~~~~~~~~~~ @@ -74,13 +79,14 @@ Build example we want to display are under /home/local/scm, you can do make GITWEB_PROJECTROOT="/home/local/scm" \ + GITWEB_JS="/gitweb/gitweb.js" \ GITWEB_CSS="/gitweb/gitweb.css" \ GITWEB_LOGO="/gitweb/git-logo.png" \ GITWEB_FAVICON="/gitweb/git-favicon.png" \ bindir=/usr/local/bin \ - gitweb/gitweb.cgi + gitweb - cp -fv ~/git/gitweb/gitweb.{cgi,css} \ + cp -fv ~/git/gitweb/gitweb.{cgi,js,css} \ ~/git/gitweb/git-{favicon,logo}.png \ /var/www/cgi-bin/gitweb/ diff --git a/gitweb/Makefile b/gitweb/Makefile index c9eb1ee667..ffee4bd1e3 100644 --- a/gitweb/Makefile +++ b/gitweb/Makefile @@ -6,14 +6,14 @@ all:: # Define JSMIN to point to JavaScript minifier that functions as # a filter to have gitweb.js minified. # +# Define CSSMIN to point to a CSS minifier in order to generate a minified +# version of gitweb.css +# prefix ?= $(HOME) bindir ?= $(prefix)/bin RM ?= rm -f -# JavaScript minifier invocation that can function as filter -JSMIN ?= - # default configuration for gitweb GITWEB_CONFIG = gitweb_config.perl GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf @@ -29,11 +29,7 @@ GITWEB_HOMETEXT = indextext.html GITWEB_CSS = gitweb.css GITWEB_LOGO = git-logo.png GITWEB_FAVICON = git-favicon.png -ifdef JSMIN -GITWEB_JS = gitweb.min.js -else GITWEB_JS = gitweb.js -endif GITWEB_SITE_HEADER = GITWEB_SITE_FOOTER = @@ -84,13 +80,16 @@ endif all:: gitweb.cgi +FILES = gitweb.cgi ifdef JSMIN -FILES=gitweb.cgi gitweb.min.js -gitweb.cgi: gitweb.perl gitweb.min.js -else # !JSMIN -FILES=gitweb.cgi -gitweb.cgi: gitweb.perl -endif # JSMIN +FILES += gitweb.min.js +GITWEB_JS = gitweb.min.js +endif +ifdef CSSMIN +FILES += gitweb.min.css +GITWEB_CSS = gitweb.min.css +endif +gitweb.cgi: gitweb.perl $(GITWEB_JS) $(GITWEB_CSS) gitweb.cgi: $(QUIET_GEN)$(RM) $@ $@+ && \ @@ -123,6 +122,11 @@ gitweb.min.js: gitweb.js $(QUIET_GEN)$(JSMIN) <$< >$@ endif # JSMIN +ifdef CSSMIN +gitweb.min.css: gitweb.css + $(QUIET_GEN)$(CSSMIN) <$ >$@ +endif + clean: $(RM) $(FILES) diff --git a/gitweb/README b/gitweb/README index ad6a04c464..71742b335d 100644 --- a/gitweb/README +++ b/gitweb/README @@ -80,7 +80,8 @@ You can specify the following configuration variables when building GIT: Points to the location where you put gitweb.css on your web server (or to be more generic, the URI of gitweb stylesheet). Relative to the base URI of gitweb. Note that you can setup multiple stylesheets from - the gitweb config file. [Default: gitweb.css] + the gitweb config file. [Default: gitweb.css (or gitweb.min.css if the + CSSMIN variable is defined / CSS minifier is used)] * GITWEB_LOGO Points to the location where you put git-logo.png on your web server (or to be more generic URI of logo, 72x27 size, displayed in top right @@ -1276,6 +1276,7 @@ static int log_ref_write(const char *ref_name, const unsigned char *old_sha1, if (log_all_ref_updates && (!prefixcmp(ref_name, "refs/heads/") || !prefixcmp(ref_name, "refs/remotes/") || + !prefixcmp(ref_name, "refs/notes/") || !strcmp(ref_name, "HEAD"))) { if (safe_create_leading_directories(log_file) < 0) return error("unable to create directory for %s", diff --git a/sha1_file.c b/sha1_file.c index a08a9d0880..ff65328006 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2271,7 +2271,7 @@ static int create_tmpfile(char *buffer, size_t bufsiz, const char *filename) } static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen, - void *buf, unsigned long len, time_t mtime) + const void *buf, unsigned long len, time_t mtime) { int fd, ret; unsigned char compressed[4096]; @@ -2307,7 +2307,7 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen, git_SHA1_Update(&c, hdr, hdrlen); /* Then the data itself.. */ - stream.next_in = buf; + stream.next_in = (void *)buf; stream.avail_in = len; do { unsigned char *in0 = stream.next_in; @@ -2342,7 +2342,7 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen, return move_temp_to_file(tmpfile, filename); } -int write_sha1_file(void *buf, unsigned long len, const char *type, unsigned char *returnsha1) +int write_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *returnsha1) { unsigned char sha1[20]; char hdr[32]; diff --git a/submodule.c b/submodule.c index b3b8bc1479..676d48fb33 100644 --- a/submodule.c +++ b/submodule.c @@ -12,8 +12,15 @@ static int add_submodule_odb(const char *path) struct strbuf objects_directory = STRBUF_INIT; struct alternate_object_database *alt_odb; int ret = 0; + const char *git_dir; - strbuf_addf(&objects_directory, "%s/.git/objects/", path); + strbuf_addf(&objects_directory, "%s/.git", path); + git_dir = read_gitfile_gently(objects_directory.buf); + if (git_dir) { + strbuf_reset(&objects_directory); + strbuf_addstr(&objects_directory, git_dir); + } + strbuf_addstr(&objects_directory, "/objects/"); if (!is_directory(objects_directory.buf)) { ret = -1; goto done; @@ -132,7 +139,6 @@ void show_submodule_summary(FILE *f, const char *path, unsigned is_submodule_modified(const char *path, int ignore_untracked) { - int i; ssize_t len; struct child_process cp; const char *argv[] = { @@ -141,16 +147,16 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked) NULL, NULL, }; - const char *env[LOCAL_REPO_ENV_SIZE + 3]; struct strbuf buf = STRBUF_INIT; unsigned dirty_submodule = 0; const char *line, *next_line; + const char *git_dir; - for (i = 0; i < LOCAL_REPO_ENV_SIZE; i++) - env[i] = local_repo_env[i]; - - strbuf_addf(&buf, "%s/.git/", path); - if (!is_directory(buf.buf)) { + strbuf_addf(&buf, "%s/.git", path); + git_dir = read_gitfile_gently(buf.buf); + if (!git_dir) + git_dir = buf.buf; + if (!is_directory(git_dir)) { strbuf_release(&buf); /* The submodule is not checked out, so it is not modified */ return 0; @@ -158,21 +164,16 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked) } strbuf_reset(&buf); - strbuf_addf(&buf, "GIT_WORK_TREE=%s", path); - env[i++] = strbuf_detach(&buf, NULL); - strbuf_addf(&buf, "GIT_DIR=%s/.git", path); - env[i++] = strbuf_detach(&buf, NULL); - env[i] = NULL; - if (ignore_untracked) argv[2] = "-uno"; memset(&cp, 0, sizeof(cp)); cp.argv = argv; - cp.env = env; + cp.env = local_repo_env; cp.git_cmd = 1; cp.no_stdin = 1; cp.out = -1; + cp.dir = path; if (start_command(&cp)) die("Could not run git status --porcelain"); @@ -201,8 +202,6 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked) if (finish_command(&cp)) die("git status --porcelain failed"); - for (i = LOCAL_REPO_ENV_SIZE; env[i]; i++) - free((char *)env[i]); strbuf_release(&buf); return dirty_submodule; } diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh index 1d6cd45b55..b2e7b07039 100755 --- a/t/t3301-notes.sh +++ b/t/t3301-notes.sh @@ -65,6 +65,15 @@ test_expect_success 'create notes' ' test_must_fail git notes show HEAD^ ' +cat >expect <<EOF +d423f8c refs/notes/commits@{0}: notes: Notes added by 'git notes add' +EOF + +test_expect_success 'create reflog entry' ' + git reflog show refs/notes/commits >output && + test_cmp expect output +' + test_expect_success 'edit existing notes' ' MSG=b3 git notes edit && test ! -f .git/NOTES_EDITMSG && diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh index e25cf8039a..e25cf8039a 100644..100755 --- a/t/t3507-cherry-pick-conflict.sh +++ b/t/t3507-cherry-pick-conflict.sh diff --git a/t/t4041-diff-submodule.sh b/t/t4041-diff-submodule.sh index 11b19972ca..019acb926d 100755 --- a/t/t4041-diff-submodule.sh +++ b/t/t4041-diff-submodule.sh @@ -329,4 +329,19 @@ index 0000000..$head7 EOF " +test_expect_success 'setup .git file for sm2' ' + (cd sm2 && + REAL="$(pwd)/../.real" && + mv .git "$REAL" + echo "gitdir: $REAL" >.git) +' + +test_expect_success 'diff --submodule with .git file' ' + git diff --submodule HEAD^ >actual && + diff actual - <<-EOF +Submodule sm1 $head6...0000000 (submodule deleted) +Submodule sm2 0000000...$head7 (new submodule) +EOF +' + test_done diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh index aeec1f6142..3d4f85d74f 100755 --- a/t/t7506-status-submodule.sh +++ b/t/t7506-status-submodule.sh @@ -157,6 +157,22 @@ test_expect_success 'status with added and untracked file in modified submodule EOF ' +test_expect_success 'setup .git file for sub' ' + (cd sub && + rm -f new-file + REAL="$(pwd)/../.real" && + mv .git "$REAL" + echo "gitdir: $REAL" >.git) && + echo .real >>.gitignore && + git commit -m "added .real to .gitignore" .gitignore +' + +test_expect_success 'status with added file in modified submodule with .git file' ' + (cd sub && git reset --hard && echo >foo && git add foo) && + git status >output && + grep "modified: sub (new commits, modified content)" output +' + test_expect_success 'rm submodule contents' ' rm -rf sub/* sub/.git ' |