diff options
60 files changed, 541 insertions, 207 deletions
diff --git a/Documentation/RelNotes-1.5.4.3.txt b/Documentation/RelNotes-1.5.4.3.txt new file mode 100644 index 0000000000..b0fc67fb2a --- /dev/null +++ b/Documentation/RelNotes-1.5.4.3.txt @@ -0,0 +1,27 @@ +GIT v1.5.4.3 Release Notes +========================== + +Fixes since v1.5.4.2 +-------------------- + + * RPM spec used to pull in everything with 'git'. This has been + changed so that 'git' package contains just the core parts, + and we now supply 'git-all' metapackage to slurp in everything. + This should match end user's expectation better. + + * When some refs failed to update, git-push reported "failure" + which was unclear if some other refs were updated or all of + them failed atomically (the answer is the former). Reworded + the message to clarify this. + + * "git clone" from a repository whose HEAD was misconfigured + did not set up the remote properly. Now it tries to do + better. + + * Updated git-push documentation to clarify what "matching" + means, in order to reduce user confusion. + + * Updated git-add documentation to clarify "add -u" operates in + the current subdirectory you are in, just like other commands. + + * git-gui updates to work on OSX and Windows better. diff --git a/Documentation/RelNotes-1.5.4.4.txt b/Documentation/RelNotes-1.5.4.4.txt new file mode 100644 index 0000000000..5635977c93 --- /dev/null +++ b/Documentation/RelNotes-1.5.4.4.txt @@ -0,0 +1,46 @@ +GIT v1.5.4.4 Release Notes +========================== + +Fixes since v1.5.4.3 +-------------------- + + * Building and installing with an overtight umask such as 077 made + installed templates unreadable by others, while the rest of the install + are done in a way that is friendly to umask 022. + + * "git cvsexportcommit -w $cvsdir" misbehaved when GIT_DIR is set to a + relative directory. + + * "git http-push" had an invalid memory access that could lead it to + segfault. + + * When "git rebase -i" gave control back to the user for a commit that is + marked to be edited, it just said "modify it with commit --amend", + without saying what to do to continue after modifying it. Give an + explicit instruction to run "rebase --continue" to be more helpful. + + * "git send-email" in 1.5.4.3 issued a bogus empty In-Reply-To: header. + + * "git bisect" showed mysterious "won't bisect on seeked tree" error message. + This was leftover from Cogito days to prevent "bisect" starting from a + cg-seeked state. We still keep the Cogito safety, but running "git bisect + start" when another bisect was in effect will clean up and start over. + + * "git push" with an explicit PATH to receive-pack did not quite work if + receive-pack was not on usual PATH. We earlier fixed the same issue + with "git fetch" and upload-pack, but somehow forgot to do so in the + other direction. + + * git-gui's info dialog was not displayed correctly when the user tries + to commit nothing (i.e. without staging anything). + + * "git revert" did not properly fail when attempting to run with a + dirty index. + +Also included are a handful documentation updates. + +--- +exec >/var/tmp/1 +echo O=$(git describe maint) +O=v1.5.4.3-32-g0f2d447 +git shortlog --no-merges $O..maint diff --git a/Documentation/config.txt b/Documentation/config.txt index 6d8cca46ab..531ec46e95 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -796,15 +796,15 @@ remote.<name>.skipDefaultUpdate:: remote.<name>.receivepack:: The default program to execute on the remote side when pushing. See - option \--exec of linkgit:git-push[1]. + option \--receive-pack of linkgit:git-push[1]. remote.<name>.uploadpack:: The default program to execute on the remote side when fetching. See - option \--exec of linkgit:git-fetch-pack[1]. + option \--upload-pack of linkgit:git-fetch-pack[1]. remote.<name>.tagopt:: - Setting this value to --no-tags disables automatic tag following when fetching - from remote <name> + Setting this value to \--no-tags disables automatic tag following when + fetching from remote <name> remotes.<group>:: The list of remotes which are fetched by "git remote update diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt index 9d2ac865d2..47799097ce 100644 --- a/Documentation/git-add.txt +++ b/Documentation/git-add.txt @@ -74,8 +74,8 @@ OPTIONS Update only files that git already knows about. This is similar to what "git commit -a" does in preparation for making a commit, except that the update is limited to paths specified on the - command line. If no paths are specified, all tracked files are - updated. + command line. If no paths are specified, all tracked files in the + current directory and its subdirectories are updated. \--refresh:: Don't add the file(s), but only refresh their stat() diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt index 2ffba2102b..e640fc75cd 100644 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@ -138,7 +138,7 @@ aborts in the middle,. You can recover from this in one of two ways: The command refuses to process new mailboxes while `.dotest` directory exists, so if you decide to start over from scratch, -run `rm -f .dotest` before running the command with mailbox +run `rm -f -r .dotest` before running the command with mailbox names. diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt index 877ab66ef5..f0beb412e6 100644 --- a/Documentation/git-cherry-pick.txt +++ b/Documentation/git-cherry-pick.txt @@ -45,7 +45,7 @@ OPTIONS default is not to do `-x` so this option is a no-op. -m parent-number|--mainline parent-number:: - Usually you cannot revert a merge because you do not know which + Usually you cannot cherry-pick a merge because you do not know which side of the merge should be considered the mainline. This option specifies the parent number (starting from 1) of the mainline and allows cherry-pick to replay the change diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt index e22dfa5803..543a1cf105 100644 --- a/Documentation/git-filter-branch.txt +++ b/Documentation/git-filter-branch.txt @@ -56,7 +56,9 @@ notable exception of the commit filter, for technical reasons). Prior to that, the $GIT_COMMIT environment variable will be set to contain the id of the commit being rewritten. Also, GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_AUTHOR_DATE, GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL, -and GIT_COMMITTER_DATE are set according to the current commit. +and GIT_COMMITTER_DATE are set according to the current commit. If any +evaluation of <command> returns a non-zero exit status, the whole operation +will be aborted. A 'map' function is available that takes an "original sha1 id" argument and outputs a "rewritten sha1 id" if the commit has been already @@ -197,7 +199,7 @@ happened). If this is not the case, use: -------------------------------------------------------------------------- git filter-branch --parent-filter \ - 'cat; test $GIT_COMMIT = <commit-id> && echo "-p <graft-id>"' HEAD + 'test $GIT_COMMIT = <commit-id> && echo "-p <graft-id>" || cat' HEAD -------------------------------------------------------------------------- or even simpler: @@ -240,6 +242,15 @@ committed a merge between P1 and P2, it will be propagated properly and all children of the merge will become merge commits with P1,P2 as their parents instead of the merge commit. +You can rewrite the commit log messages using `--message-filter`. For +example, `git-svn-id` strings in a repository created by `git-svn` can +be removed this way: + +------------------------------------------------------- +git filter-branch --message-filter ' + sed -e "/^git-svn-id:/d" +' +------------------------------------------------------- To restrict rewriting to only part of the history, specify a revision range in addition to the new branch name. The new branch name will diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index 0c9ad7f2bb..c136b10692 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -68,7 +68,8 @@ HOW MERGE WORKS --------------- A merge is always between the current `HEAD` and one or more -remote branch heads, and the index file must exactly match the +commits (usually, branch head or tag), and the index file must +exactly match the tree of `HEAD` commit (i.e. the contents of the last commit) when it happens. In other words, `git-diff --cached HEAD` must report no changes. diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt index 5f2494495b..3128170bcd 100644 --- a/Documentation/git-push.txt +++ b/Documentation/git-push.txt @@ -47,9 +47,9 @@ even if it does not result in a fast forward update. + Note: If no explicit refspec is found, (that is neither on the command line nor in any Push line of the -corresponding remotes file---see below), then all the -heads that exist both on the local side and on the remote -side are updated. +corresponding remotes file---see below), then "matching" heads are +pushed: for every head that exists on the local side, the remote side is +updated if a head of the same name already exists on the remote side. + `tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`. + @@ -108,6 +108,55 @@ the remote repository. include::urls-remotes.txt[] +OUTPUT +------ + +The output of "git push" depends on the transport method used; this +section describes the output when pushing over the git protocol (either +locally or via ssh). + +The status of the push is output in tabular form, with each line +representing the status of a single ref. Each line is of the form: + +------------------------------- + <flag> <summary> <from> -> <to> (<reason>) +------------------------------- + +flag:: + A single character indicating the status of the ref. This is + blank for a successfully pushed ref, `!` for a ref that was + rejected or failed to push, and '=' for a ref that was up to + date and did not need pushing (note that the status of up to + date refs is shown only when `git push` is running verbosely). + +summary:: + For a successfully pushed ref, the summary shows the old and new + values of the ref in a form suitable for using as an argument to + `git log` (this is `<old>..<new>` in most cases, and + `<old>...<new>` for forced non-fast forward updates). For a + failed update, more details are given for the failure. + The string `rejected` indicates that git did not try to send the + ref at all (typically because it is not a fast forward). The + string `remote rejected` indicates that the remote end refused + the update; this rejection is typically caused by a hook on the + remote side. The string `remote failure` indicates that the + remote end did not report the successful update of the ref + (perhaps because of a temporary error on the remote side, a + break in the network connection, or other transient error). + +from:: + The name of the local ref being pushed, minus its + `refs/<type>/` prefix. In the case of deletion, the + name of the local ref is omitted. + +to:: + The name of the remote ref being updated, minus its + `refs/<type>/` prefix. + +reason:: + A human-readable explanation. In the case of successfully pushed + refs, no explanation is needed. For a failed ref, the reason for + failure is described. Examples -------- diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt index cd0dc1bd9d..48e6f5a3f7 100644 --- a/Documentation/git-stash.txt +++ b/Documentation/git-stash.txt @@ -43,7 +43,7 @@ save [<message>]:: subcommand is given. The <message> part is optional and gives the description along with the stashed state. -list:: +list [<options>]:: List the stashes that you currently have. Each 'stash' is listed with its name (e.g. `stash@\{0}` is the latest stash, `stash@\{1}` is @@ -55,6 +55,9 @@ list:: stash@{0}: WIP on submit: 6ebd0e2... Update git-stash documentation stash@{1}: On master: 9cc0589... Add git-stash ---------------------------------------------------------------- ++ +The command takes options applicable to the linkgit:git-log[1] +command to control what is shown and how. show [<stash>]:: diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt index b1d527f74c..115b8bee0d 100644 --- a/Documentation/git-svn.txt +++ b/Documentation/git-svn.txt @@ -159,6 +159,10 @@ New features: our version of --pretty=oneline -- + +NOTE: SVN itself only stores times in UTC and nothing else. The regular svn +client converts the UTC time to the local time (or based on the TZ= +environment). This command has the same behaviour. ++ Any other arguments are passed directly to `git log' -- diff --git a/Documentation/technical/api-diff.txt b/Documentation/technical/api-diff.txt index 83b007e708..20b0241d30 100644 --- a/Documentation/technical/api-diff.txt +++ b/Documentation/technical/api-diff.txt @@ -39,7 +39,7 @@ Calling sequence * Once you finish feeding the pairs of files, call `diffcore_std()`. This will tell the diffcore library to go ahead and do its work. -* Calling `diffcore_flush()` will produce the output. +* Calling `diff_flush()` will produce the output. Data structures diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 03fb9d76ae..0d4c2f79c5 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v1.5.4.2.GIT +DEF_VER=v1.5.4.3.GIT LF=' ' @@ -16,7 +16,8 @@ elif test -d .git && case "$VN" in *$LF*) (exit 1) ;; v[0-9]*) - git diff-index --quiet HEAD || VN="$VN-dirty" ;; + test -z "$(git diff-index --name-only HEAD)" || + VN="$VN-dirty" ;; esac then VN=$(echo "$VN" | sed -e 's/-/./g'); @@ -1087,7 +1087,7 @@ git.spec: git.spec.in mv $@+ $@ GIT_TARNAME=git-$(GIT_VERSION) -dist: git.spec git-archive configure +dist: git.spec git-archive$(X) configure ./git-archive --format=tar \ --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar @mkdir -p $(GIT_TARNAME) @@ -1 +1 @@ -Documentation/RelNotes-1.5.4.2.txt
\ No newline at end of file +Documentation/RelNotes-1.5.4.4.txt
\ No newline at end of file diff --git a/builtin-fast-export.c b/builtin-fast-export.c index ef27eee71b..724cff35d3 100755 --- a/builtin-fast-export.c +++ b/builtin-fast-export.c @@ -123,7 +123,7 @@ static void show_filemodify(struct diff_queue_struct *q, printf("D %s\n", spec->path); else { struct object *object = lookup_object(spec->sha1); - printf("M 0%06o :%d %s\n", spec->mode, + printf("M %06o :%d %s\n", spec->mode, get_object_mark(object), spec->path); } } diff --git a/builtin-init-db.c b/builtin-init-db.c index e1393b8d1e..ff6e87777a 100644 --- a/builtin-init-db.c +++ b/builtin-init-db.c @@ -29,27 +29,6 @@ static void safe_create_dir(const char *dir, int share) die("Could not make %s writable by group\n", dir); } -static int copy_file(const char *dst, const char *src, int mode) -{ - int fdi, fdo, status; - - mode = (mode & 0111) ? 0777 : 0666; - if ((fdi = open(src, O_RDONLY)) < 0) - return fdi; - if ((fdo = open(dst, O_WRONLY | O_CREAT | O_EXCL, mode)) < 0) { - close(fdi); - return fdo; - } - status = copy_fd(fdi, fdo); - if (close(fdo) != 0) - return error("%s: write error: %s", dst, strerror(errno)); - - if (!status && adjust_shared_perm(dst)) - return -1; - - return status; -} - static void copy_templates_1(char *path, int baselen, char *template, int template_baselen, DIR *dir) diff --git a/builtin-ls-remote.c b/builtin-ls-remote.c index 6dd31d1dd6..720280e390 100644 --- a/builtin-ls-remote.c +++ b/builtin-ls-remote.c @@ -94,10 +94,6 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix) transport_set_option(transport, TRANS_OPT_UPLOADPACK, uploadpack); ref = transport_get_remote_refs(transport); - - if (!ref) - return 1; - for ( ; ref; ref = ref->next) { if (!check_ref_type(ref, flags)) continue; diff --git a/builtin-push.c b/builtin-push.c index c8cb63e238..9f727c00f6 100644 --- a/builtin-push.c +++ b/builtin-push.c @@ -90,7 +90,7 @@ static int do_push(const char *repo, int flags) if (!err) continue; - error("failed to push to '%s'", remote->url[i]); + error("failed to push some refs to '%s'", remote->url[i]); errs++; } return !!errs; diff --git a/builtin-reflog.c b/builtin-reflog.c index 4836ec951b..ab53c8cb7c 100644 --- a/builtin-reflog.c +++ b/builtin-reflog.c @@ -276,10 +276,11 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused, for_each_reflog_ent(ref, expire_reflog_ent, &cb); finish: if (cb.newlog) { - if (fclose(cb.newlog)) + if (fclose(cb.newlog)) { status |= error("%s: %s", strerror(errno), newlog_path); - if (rename(newlog_path, log_file)) { + unlink(newlog_path); + } else if (rename(newlog_path, log_file)) { status |= error("cannot rename %s to %s", newlog_path, log_file); unlink(newlog_path); diff --git a/builtin-rerere.c b/builtin-rerere.c index a9e3ebc137..b2971f3445 100644 --- a/builtin-rerere.c +++ b/builtin-rerere.c @@ -267,23 +267,6 @@ static int diff_two(const char *file1, const char *label1, return 0; } -static int copy_file(const char *src, const char *dest) -{ - FILE *in, *out; - char buffer[32768]; - int count; - - if (!(in = fopen(src, "r"))) - return error("Could not open %s", src); - if (!(out = fopen(dest, "w"))) - return error("Could not open %s", dest); - while ((count = fread(buffer, 1, sizeof(buffer), in))) - fwrite(buffer, 1, count, out); - fclose(in); - fclose(out); - return 0; -} - static int do_plain_rerere(struct path_list *rr, int fd) { struct path_list conflict = { NULL, 0, 0, 1 }; @@ -343,7 +326,7 @@ static int do_plain_rerere(struct path_list *rr, int fd) continue; fprintf(stderr, "Recorded resolution for '%s'.\n", path); - copy_file(path, rr_path(name, "postimage")); + copy_file(rr_path(name, "postimage"), path, 0666); tail_optimization: if (i < rr->nr - 1) memmove(rr->items + i, diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c index b9af1a5a55..90dbb9d7c1 100644 --- a/builtin-rev-parse.c +++ b/builtin-rev-parse.c @@ -315,7 +315,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix) s = strchr(sb.buf, ' '); if (!s || *sb.buf == ' ') { o->type = OPTION_GROUP; - o->help = xstrdup(skipspaces(s)); + o->help = xstrdup(skipspaces(sb.buf)); continue; } diff --git a/builtin-revert.c b/builtin-revert.c index 358af53747..64f0d0ee02 100644 --- a/builtin-revert.c +++ b/builtin-revert.c @@ -8,6 +8,8 @@ #include "exec_cmd.h" #include "utf8.h" #include "parse-options.h" +#include "diff.h" +#include "revision.h" /* * This implements the builtins revert and cherry-pick. @@ -245,6 +247,17 @@ static char *help_msg(const unsigned char *sha1) return helpbuf; } +static int index_is_dirty(void) +{ + struct rev_info rev; + init_revisions(&rev, NULL); + setup_revisions(0, NULL, &rev, "HEAD"); + DIFF_OPT_SET(&rev.diffopt, QUIET); + DIFF_OPT_SET(&rev.diffopt, EXIT_WITH_STATUS); + run_diff_index(&rev, 1); + return !!DIFF_OPT_TST(&rev.diffopt, HAS_CHANGES); +} + static int revert_or_cherry_pick(int argc, const char **argv) { unsigned char head[20]; @@ -273,12 +286,11 @@ static int revert_or_cherry_pick(int argc, const char **argv) if (write_tree(head, 0, NULL)) die ("Your index file is unmerged."); } else { - struct wt_status s; - if (get_sha1("HEAD", head)) die ("You do not have a valid HEAD"); - wt_status_prepare(&s); - if (s.commitable) + if (read_cache() < 0) + die("could not read the index"); + if (index_is_dirty()) die ("Dirty index: cannot %s", me); discard_cache(); } @@ -602,6 +602,7 @@ extern const char *git_log_output_encoding; /* IO helper functions */ extern void maybe_flush_or_die(FILE *, const char *); extern int copy_fd(int ifd, int ofd); +extern int copy_file(const char *dst, const char *src, int mode); extern int read_in_full(int fd, void *buf, size_t count); extern int write_in_full(int fd, const void *buf, size_t count); extern void write_or_die(int fd, const void *buf, size_t count); diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el index d8a06381f4..0312d891fd 100644 --- a/contrib/emacs/git.el +++ b/contrib/emacs/git.el @@ -1432,7 +1432,7 @@ Commands: (with-current-buffer buffer (when (and list-buffers-directory (string-equal fulldir (expand-file-name list-buffers-directory)) - (string-match "\\*git-status\\*$" (buffer-name buffer))) + (eq major-mode 'git-status-mode)) (setq found buffer)))) (setq list (cdr list))) found)) @@ -34,3 +34,24 @@ int copy_fd(int ifd, int ofd) close(ifd); return 0; } + +int copy_file(const char *dst, const char *src, int mode) +{ + int fdi, fdo, status; + + mode = (mode & 0111) ? 0777 : 0666; + if ((fdi = open(src, O_RDONLY)) < 0) + return fdi; + if ((fdo = open(dst, O_WRONLY | O_CREAT | O_EXCL, mode)) < 0) { + close(fdi); + return fdo; + } + status = copy_fd(fdi, fdo); + if (close(fdo) != 0) + return error("%s: write error: %s", dst, strerror(errno)); + + if (!status && adjust_shared_perm(dst)) + return -1; + + return status; +} @@ -213,9 +213,9 @@ static const struct { { "EAST", +10, 0, }, /* Eastern Australian Standard */ { "EADT", +10, 1, }, /* Eastern Australian Daylight */ { "GST", +10, 0, }, /* Guam Standard, USSR Zone 9 */ - { "NZT", +11, 0, }, /* New Zealand */ - { "NZST", +11, 0, }, /* New Zealand Standard */ - { "NZDT", +11, 1, }, /* New Zealand Daylight */ + { "NZT", +12, 0, }, /* New Zealand */ + { "NZST", +12, 0, }, /* New Zealand Standard */ + { "NZDT", +12, 1, }, /* New Zealand Daylight */ { "IDLE", +12, 0, }, /* International Date Line East */ }; @@ -272,8 +272,8 @@ static void print_line_count(int count) } } -static void copy_file(int prefix, const char *data, int size, - const char *set, const char *reset) +static void copy_file_with_prefix(int prefix, const char *data, int size, + const char *set, const char *reset) { int ch, nl_just_seen = 1; while (0 < size--) { @@ -331,9 +331,9 @@ static void emit_rewrite_diff(const char *name_a, print_line_count(lc_b); printf(" @@%s\n", reset); if (lc_a) - copy_file('-', one->data, one->size, old, reset); + copy_file_with_prefix('-', one->data, one->size, old, reset); if (lc_b) - copy_file('+', two->data, two->size, new, reset); + copy_file_with_prefix('+', two->data, two->size, new, reset); } static int fill_mmfile(mmfile_t *mf, struct diff_filespec *one) diff --git a/git-bisect.sh b/git-bisect.sh index 6594a62919..f8857747c4 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -67,16 +67,18 @@ bisect_start() { die "Bad HEAD - I need a HEAD" case "$head" in refs/heads/bisect) - if [ -s "$GIT_DIR/head-name" ]; then - branch=`cat "$GIT_DIR/head-name"` + if [ -s "$GIT_DIR/BISECT_START" ]; then + branch=`cat "$GIT_DIR/BISECT_START"` else branch=master fi git checkout $branch || exit ;; refs/heads/*|$_x40) + # This error message should only be triggered by cogito usage, + # and cogito users should understand it relates to cg-seek. [ -s "$GIT_DIR/head-name" ] && die "won't bisect on seeked tree" - echo "${head#refs/heads/}" >"$GIT_DIR/head-name" + echo "${head#refs/heads/}" >"$GIT_DIR/BISECT_START" ;; *) die "Bad HEAD - strange symbolic ref" @@ -353,8 +355,8 @@ bisect_reset() { return } case "$#" in - 0) if [ -s "$GIT_DIR/head-name" ]; then - branch=`cat "$GIT_DIR/head-name"` + 0) if [ -s "$GIT_DIR/BISECT_START" ]; then + branch=`cat "$GIT_DIR/BISECT_START"` else branch=master fi ;; @@ -365,7 +367,9 @@ bisect_reset() { usage ;; esac if git checkout "$branch"; then + # Cleanup head-name if it got left by an old version of git-bisect rm -f "$GIT_DIR/head-name" + rm -f "$GIT_DIR/BISECT_START" bisect_clean_state fi } diff --git a/git-clone.sh b/git-clone.sh index b4e858c388..0d686c3a03 100755 --- a/git-clone.sh +++ b/git-clone.sh @@ -409,11 +409,12 @@ else cd "$D" || exit fi -if test -z "$bare" && test -f "$GIT_DIR/REMOTE_HEAD" +if test -z "$bare" then # a non-bare repository is always in separate-remote layout remote_top="refs/remotes/$origin" - head_sha1=`cat "$GIT_DIR/REMOTE_HEAD"` + head_sha1= + test ! -r "$GIT_DIR/REMOTE_HEAD" || head_sha1=`cat "$GIT_DIR/REMOTE_HEAD"` case "$head_sha1" in 'ref: refs/'*) # Uh-oh, the remote told us (http transport done against @@ -470,9 +471,16 @@ then git config branch."$head_points_at".merge "refs/heads/$head_points_at" ;; '') - # Source had detached HEAD pointing nowhere - git update-ref --no-deref HEAD "$head_sha1" && - rm -f "refs/remotes/$origin/HEAD" + if test -z "$head_sha1" + then + # Source had nonexistent ref in HEAD + echo >&2 "Warning: Remote HEAD refers to nonexistent ref, unable to checkout." + no_checkout=t + else + # Source had detached HEAD pointing nowhere + git update-ref --no-deref HEAD "$head_sha1" && + rm -f "refs/remotes/$origin/HEAD" + fi ;; esac diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl index 9d142d08a5..b6036bd4d3 100755 --- a/git-cvsexportcommit.perl +++ b/git-cvsexportcommit.perl @@ -5,6 +5,7 @@ use Getopt::Std; use File::Temp qw(tempdir); use Data::Dumper; use File::Basename qw(basename dirname); +use File::Spec; our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m, $opt_d, $opt_u, $opt_w); @@ -15,17 +16,15 @@ $opt_h && usage(); die "Need at least one commit identifier!" unless @ARGV; if ($opt_w) { + # Remember where GIT_DIR is before changing to CVS checkout unless ($ENV{GIT_DIR}) { - # Remember where our GIT_DIR is before changing to CVS checkout + # No GIT_DIR set. Figure it out for ourselves my $gd =`git-rev-parse --git-dir`; chomp($gd); - if ($gd eq '.git') { - my $wd = `pwd`; - chomp($wd); - $gd = $wd."/.git" ; - } $ENV{GIT_DIR} = $gd; } + # Make sure GIT_DIR is absolute + $ENV{GIT_DIR} = File::Spec->rel2abs($ENV{GIT_DIR}); if (! -d $opt_w."/CVS" ) { die "$opt_w is not a CVS checkout"; diff --git a/git-gui/Makefile b/git-gui/Makefile index 34438cdf5c..4e321742ab 100644 --- a/git-gui/Makefile +++ b/git-gui/Makefile @@ -13,6 +13,7 @@ GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not') +uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not') SCRIPT_SH = git-gui.sh GITGUI_MAIN := git-gui @@ -91,9 +92,20 @@ ifndef V REMOVE_F1 = && echo ' ' REMOVE `basename "$$dst"` && $(RM_RF) "$$dst" endif -TCL_PATH ?= tclsh TCLTK_PATH ?= wish -TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app +ifeq (./,$(dir $(TCLTK_PATH))) + TCL_PATH ?= $(subst wish,tclsh,$(TCLTK_PATH)) +else + TCL_PATH ?= $(dir $(TCLTK_PATH))$(notdir $(subst wish,tclsh,$(TCLTK_PATH))) +endif + +ifeq ($(uname_S),Darwin) + TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app + ifeq ($(shell expr "$(uname_R)" : '9\.'),2) + TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish\ Shell.app + endif + TKEXECUTABLE = $(shell basename "$(TKFRAMEWORK)" .app) +endif ifeq ($(findstring $(MAKEFLAGS),s),s) QUIET_GEN = @@ -119,7 +131,17 @@ GITGUI_MACOSXAPP := ifeq ($(uname_O),Cygwin) GITGUI_SCRIPT := `cygpath --windows --absolute "$(GITGUI_SCRIPT)"` - gg_libdir_sed_in := $(shell cygpath --windows --absolute "$(gg_libdir)") + + # Is this a Cygwin Tcl/Tk binary? If so it knows how to do + # POSIX path translation just like cygpath does and we must + # keep libdir in POSIX format so Cygwin packages of git-gui + # work no matter where the user installs them. + # + ifeq ($(shell echo 'puts [file normalize /]' | '$(TCL_PATH_SQ)'),$(shell cygpath --mixed --absolute /)) + gg_libdir_sed_in := $(gg_libdir) + else + gg_libdir_sed_in := $(shell cygpath --windows --absolute "$(gg_libdir)") + endif else ifeq ($(exedir),$(gg_libdir)) GITGUI_RELATIVE := 1 @@ -147,7 +169,7 @@ git-gui: GIT-VERSION-FILE GIT-GUI-VARS echo then >>$@+ && \ echo ' 'echo \'git-gui version '$(GITGUI_VERSION)'\' >>$@+ && \ echo else >>$@+ && \ - echo ' 'exec \''$(libdir_SQ)/Git Gui.app/Contents/MacOS/Wish'\' \ + echo ' 'exec \''$(libdir_SQ)/Git Gui.app/Contents/MacOS/$(subst \,,$(TKEXECUTABLE))'\' \ '"$$0" "$$@"' >>$@+ && \ echo fi >>$@+ && \ chmod +x $@+ && \ @@ -157,14 +179,15 @@ Git\ Gui.app: GIT-VERSION-FILE GIT-GUI-VARS \ macosx/Info.plist \ macosx/git-gui.icns \ macosx/AppMain.tcl \ - $(TKFRAMEWORK)/Contents/MacOS/Wish + $(TKFRAMEWORK)/Contents/MacOS/$(TKEXECUTABLE) $(QUIET_GEN)rm -rf '$@' '$@'+ && \ mkdir -p '$@'+/Contents/MacOS && \ mkdir -p '$@'+/Contents/Resources/Scripts && \ - cp '$(subst ','\'',$(TKFRAMEWORK))/Contents/MacOS/Wish' \ + cp '$(subst ','\'',$(subst \,,$(TKFRAMEWORK)/Contents/MacOS/$(TKEXECUTABLE)))' \ '$@'+/Contents/MacOS && \ cp macosx/git-gui.icns '$@'+/Contents/Resources && \ sed -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \ + -e 's/@@GITGUI_TKEXECUTABLE@@/$(TKEXECUTABLE)/g' \ macosx/Info.plist \ >'$@'+/Contents/Info.plist && \ sed -e 's|@@gitexecdir@@|$(gitexecdir_SQ)|' \ @@ -201,6 +224,11 @@ else ifeq ($(shell $(MSGFMT) >/dev/null 2>&1 || echo $$?),127) MSGFMT := $(TCL_PATH) po/po2msg.sh endif + ifeq (msgfmt,$(MSGFMT)) + ifeq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null || echo $?),1) + MSGFMT := $(TCL_PATH) po/po2msg.sh + endif + endif endif msgsdir = $(gg_libdir)/msgs diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh index f42e461fd4..04bd42576e 100755 --- a/git-gui/git-gui.sh +++ b/git-gui/git-gui.sh @@ -662,7 +662,7 @@ if {![regsub {^git version } $_git_version {} _git_version]} { } set _real_git_version $_git_version -regsub -- {-dirty$} $_git_version {} _git_version +regsub -- {[\-\.]dirty$} $_git_version {} _git_version regsub {\.[0-9]+\.g[0-9a-f]+$} $_git_version {} _git_version regsub {\.rc[0-9]+$} $_git_version {} _git_version regsub {\.GIT$} $_git_version {} _git_version diff --git a/git-gui/lib/choose_repository.tcl b/git-gui/lib/choose_repository.tcl index 86faf24cc8..0adcf9d958 100644 --- a/git-gui/lib/choose_repository.tcl +++ b/git-gui/lib/choose_repository.tcl @@ -11,6 +11,7 @@ field w_quit ; # Quit button field o_cons ; # Console object (if active) field w_types ; # List of type buttons in clone field w_recentlist ; # Listbox containing recent repositories +field w_localpath ; # Entry widget bound to local_path field done 0 ; # Finished picking the repository? field local_path {} ; # Where this repository is locally @@ -385,6 +386,7 @@ method _do_new {} { button $w_body.where.b \ -text [mc "Browse"] \ -command [cb _new_local_path] + set w_localpath $w_body.where.t pack $w_body.where.b -side right pack $w_body.where.l -side left @@ -416,6 +418,7 @@ method _new_local_path {} { return } set local_path $p + $w_localpath icursor end } method _do_new2 {} { @@ -481,6 +484,7 @@ method _do_clone {} { -text [mc "Browse"] \ -command [cb _new_local_path] grid $args.where_l $args.where_t $args.where_b -sticky ew + set w_localpath $args.where_t label $args.type_l -text [mc "Clone Type:"] frame $args.type_f diff --git a/git-gui/lib/error.tcl b/git-gui/lib/error.tcl index 0fdd7531da..8c27678e3a 100644 --- a/git-gui/lib/error.tcl +++ b/git-gui/lib/error.tcl @@ -1,6 +1,14 @@ # git-gui branch (create/delete) support # Copyright (C) 2006, 2007 Shawn Pearce +proc _error_parent {} { + set p [grab current .] + if {$p eq {}} { + return . + } + return $p +} + proc error_popup {msg} { set title [appname] if {[reponame] ne {}} { @@ -11,8 +19,8 @@ proc error_popup {msg} { -type ok \ -title [append "$title: " [mc "error"]] \ -message $msg] - if {[winfo ismapped .]} { - lappend cmd -parent . + if {[winfo ismapped [_error_parent]]} { + lappend cmd -parent [_error_parent] } eval $cmd } @@ -27,19 +35,19 @@ proc warn_popup {msg} { -type ok \ -title [append "$title: " [mc "warning"]] \ -message $msg] - if {[winfo ismapped .]} { - lappend cmd -parent . + if {[winfo ismapped [_error_parent]]} { + lappend cmd -parent [_error_parent] } eval $cmd } -proc info_popup {msg {parent .}} { +proc info_popup {msg} { set title [appname] if {[reponame] ne {}} { append title " ([reponame])" } tk_messageBox \ - -parent $parent \ + -parent [_error_parent] \ -icon info \ -type ok \ -title $title \ @@ -56,8 +64,8 @@ proc ask_popup {msg} { -type yesno \ -title $title \ -message $msg] - if {[winfo ismapped .]} { - lappend cmd -parent . + if {[winfo ismapped [_error_parent]]} { + lappend cmd -parent [_error_parent] } eval $cmd } diff --git a/git-gui/macosx/Info.plist b/git-gui/macosx/Info.plist index 99913ec57a..b3bf15fa1c 100644 --- a/git-gui/macosx/Info.plist +++ b/git-gui/macosx/Info.plist @@ -5,7 +5,7 @@ <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleExecutable</key> - <string>Wish</string> + <string>@@GITGUI_TKEXECUTABLE@@</string> <key>CFBundleGetInfoString</key> <string>Git Gui @@GITGUI_VERSION@@ © 2006-2007 Shawn Pearce, et. al.</string> <key>CFBundleIconFile</key> diff --git a/git-merge.sh b/git-merge.sh index 1c123a37e6..03cd39873a 100755 --- a/git-merge.sh +++ b/git-merge.sh @@ -37,6 +37,7 @@ use_strategies= allow_fast_forward=t allow_trivial_merge=t +squash= no_commit= dropsave() { rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \ @@ -152,17 +153,21 @@ parse_config () { --summary) show_diffstat=t ;; --squash) - allow_fast_forward=t squash=t no_commit=t ;; + test "$allow_fast_forward" = t || + die "You cannot combine --squash with --no-ff." + squash=t no_commit=t ;; --no-squash) - allow_fast_forward=t squash= no_commit= ;; + squash= no_commit= ;; --commit) - allow_fast_forward=t squash= no_commit= ;; + no_commit= ;; --no-commit) - allow_fast_forward=t squash= no_commit=t ;; + no_commit=t ;; --ff) - allow_fast_forward=t squash= no_commit= ;; + allow_fast_forward=t ;; --no-ff) - allow_fast_forward=false squash= no_commit= ;; + test "$squash" != t || + die "You cannot combine --squash with --no-ff." + allow_fast_forward=f ;; -s|--strategy) shift case " $all_strategies " in diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index fb12b03b20..c2bedd622c 100755 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -268,6 +268,10 @@ do_next () { warn warn " git commit --amend" warn + warn "Once you are satisfied with your changes, run" + warn + warn " git rebase --continue" + warn exit 0 ;; squash|s) diff --git a/git-send-email.perl b/git-send-email.perl index a1a9d14b00..e5d67f1b6c 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -166,7 +166,9 @@ my $envelope_sender; my $repo = Git->repository(); my $term = eval { - new Term::ReadLine 'git-send-email'; + $ENV{"GIT_SEND_EMAIL_NOTTY"} + ? new Term::ReadLine 'git-send-email', \*STDIN, \*STDOUT + : new Term::ReadLine 'git-send-email'; }; if ($@) { $term = new FakeTerm "$@: going non-interactive"; @@ -406,9 +408,10 @@ if ($thread && !defined $initial_reply_to && $prompting) { $initial_reply_to = $_; } -if (defined $initial_reply_to && $_ ne "") { - $initial_reply_to =~ s/^\s*<?/</; - $initial_reply_to =~ s/>?\s*$/>/; +if (defined $initial_reply_to) { + $initial_reply_to =~ s/^\s*<?//; + $initial_reply_to =~ s/>?\s*$//; + $initial_reply_to = "<$initial_reply_to>" if $initial_reply_to ne ''; } if (!defined $smtp_server) { diff --git a/git-submodule.sh b/git-submodule.sh index a6aaf40b0a..67d3224c8c 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -362,7 +362,7 @@ cmd_status() do name=$(module_name "$path") || exit url=$(git config submodule."$name".url) - if test -z "url" || ! test -d "$path"/.git + if test -z "$url" || ! test -d "$path"/.git then say "-$sha1 $path" continue; diff --git a/git-svn.perl b/git-svn.perl index 75e97cc72f..a4ab05155d 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -3632,6 +3632,7 @@ sub _auth_providers () { SVN::Client::get_ssl_client_cert_file_provider(), SVN::Client::get_ssl_client_cert_prompt_provider( \&Git::SVN::Prompt::ssl_client_cert, 2), + SVN::Client::get_ssl_client_cert_pw_file_provider(), SVN::Client::get_ssl_client_cert_pw_prompt_provider( \&Git::SVN::Prompt::ssl_client_cert_pw, 2), SVN::Client::get_username_provider(), diff --git a/git.spec.in b/git.spec.in index 3f9f88815b..97a26be29a 100644 --- a/git.spec.in +++ b/git.spec.in @@ -3,7 +3,7 @@ Name: git Version: @@VERSION@@ Release: 1%{?dist} -Summary: Git core and tools +Summary: Core git tools License: GPL Group: Development/Tools URL: http://kernel.org/pub/software/scm/git/ @@ -11,80 +11,86 @@ Source: http://kernel.org/pub/software/scm/git/%{name}-%{version}.tar.gz BuildRequires: zlib-devel >= 1.2, openssl-devel, curl-devel, expat-devel, gettext %{!?_without_docs:, xmlto, asciidoc > 6.0.3} BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Requires: git-core = %{version}-%{release} -Requires: git-svn = %{version}-%{release} -Requires: git-cvs = %{version}-%{release} -Requires: git-arch = %{version}-%{release} -Requires: git-email = %{version}-%{release} -Requires: gitk = %{version}-%{release} -Requires: git-gui = %{version}-%{release} Requires: perl-Git = %{version}-%{release} +Requires: zlib >= 1.2, rsync, curl, less, openssh-clients, expat +Provides: git-core = %{version}-%{release} +Obsoletes: git-core <= 1.5.4.2 +Obsoletes: git-p4 %description Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals. -This is a dummy package which brings in all subpackages. +The git rpm installs the core tools with minimal dependencies. To +install all git packages, including tools for integrating with other +SCMs, install the git-all meta-package. -%package core -Summary: Core git tools +%package all +Summary: Meta-package to pull in all git tools Group: Development/Tools -Requires: zlib >= 1.2, rsync, curl, less, openssh-clients, expat -Obsoletes: git-p4 -%description core +Requires: git = %{version}-%{release} +Requires: git-svn = %{version}-%{release} +Requires: git-cvs = %{version}-%{release} +Requires: git-arch = %{version}-%{release} +Requires: git-email = %{version}-%{release} +Requires: gitk = %{version}-%{release} +Requires: git-gui = %{version}-%{release} +Obsoletes: git <= 1.5.4.2 + +%description all Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals. -These are the core tools with minimal dependencies. +This is a dummy package which brings in all subpackages. %package svn Summary: Git tools for importing Subversion repositories Group: Development/Tools -Requires: git-core = %{version}-%{release}, subversion +Requires: git = %{version}-%{release}, subversion %description svn Git tools for importing Subversion repositories. %package cvs Summary: Git tools for importing CVS repositories Group: Development/Tools -Requires: git-core = %{version}-%{release}, cvs, cvsps +Requires: git = %{version}-%{release}, cvs, cvsps %description cvs Git tools for importing CVS repositories. %package arch Summary: Git tools for importing Arch repositories Group: Development/Tools -Requires: git-core = %{version}-%{release}, tla +Requires: git = %{version}-%{release}, tla %description arch Git tools for importing Arch repositories. %package email Summary: Git tools for sending email Group: Development/Tools -Requires: git-core = %{version}-%{release} +Requires: git = %{version}-%{release} %description email Git tools for sending email. %package gui Summary: Git GUI tool Group: Development/Tools -Requires: git-core = %{version}-%{release}, tk >= 8.4 +Requires: git = %{version}-%{release}, tk >= 8.4 %description gui Git GUI tool %package -n gitk Summary: Git revision tree visualiser ('gitk') Group: Development/Tools -Requires: git-core = %{version}-%{release}, tk >= 8.4 +Requires: git = %{version}-%{release}, tk >= 8.4 %description -n gitk Git revision tree visualiser ('gitk') %package -n perl-Git Summary: Perl interface to Git Group: Development/Libraries -Requires: git-core = %{version}-%{release} +Requires: git = %{version}-%{release} Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) BuildRequires: perl(Error) @@ -121,8 +127,12 @@ rm -rf $RPM_BUILD_ROOT%{_mandir} %clean rm -rf $RPM_BUILD_ROOT -%files -# These are no files in the root package +%files -f bin-man-doc-files +%defattr(-,root,root) +%{_datadir}/git-core/ +%doc README COPYING Documentation/*.txt +%{!?_without_docs: %doc Documentation/*.html Documentation/howto} +%{!?_without_docs: %doc Documentation/technical} %files svn %defattr(-,root,root) @@ -173,14 +183,13 @@ rm -rf $RPM_BUILD_ROOT %files -n perl-Git -f perl-files %defattr(-,root,root) -%files core -f bin-man-doc-files -%defattr(-,root,root) -%{_datadir}/git-core/ -%doc README COPYING Documentation/*.txt -%{!?_without_docs: %doc Documentation/*.html Documentation/howto} -%{!?_without_docs: %doc Documentation/technical} +%files all +# No files for you! %changelog +* Fri Feb 15 2008 Kristian Høgsberg <krh@redhat.com> +- Rename git-core to just git and rename meta package from git to git-all. + * Sun Feb 03 2008 James Bowes <jbowes@dangerouslyinc.com> - Add a BuildRequires for gettext @@ -70,7 +70,7 @@ void *lookup_hash(unsigned int hash, struct hash_table *table) { if (!table->array) return NULL; - return &lookup_hash_entry(hash, table)->ptr; + return lookup_hash_entry(hash, table)->ptr; } void **insert_hash(unsigned int hash, void *ptr, struct hash_table *table) diff --git a/http-push.c b/http-push.c index b2b410df90..f9b77d6021 100644 --- a/http-push.c +++ b/http-push.c @@ -1634,12 +1634,19 @@ static struct object_list **process_tree(struct tree *tree, init_tree_desc(&desc, tree->buffer, tree->size); - while (tree_entry(&desc, &entry)) { - if (S_ISDIR(entry.mode)) + while (tree_entry(&desc, &entry)) + switch (object_type(entry.mode)) { + case OBJ_TREE: p = process_tree(lookup_tree(entry.sha1), p, &me, name); - else + break; + case OBJ_BLOB: p = process_blob(lookup_blob(entry.sha1), p, &me, name); - } + break; + default: + /* Subproject commit - not in this repository */ + break; + } + free(tree->buffer); tree->buffer = NULL; return p; @@ -2398,15 +2405,17 @@ int main(int argc, char **argv) fill_active_slots(); add_fill_function(NULL, fill_active_slot); #endif - finish_all_active_slots(); + do { + finish_all_active_slots(); +#ifdef USE_CURL_MULTI + fill_active_slots(); +#endif + } while (request_queue_head && !aborted); /* Update the remote branch if all went well */ - if (aborted || !update_remote(ref->new_sha1, ref_lock)) { + if (aborted || !update_remote(ref->new_sha1, ref_lock)) rc = 1; - goto unlock; - } - unlock: if (!rc) fprintf(stderr, " done\n"); unlock_remote(ref_lock); @@ -281,23 +281,15 @@ void http_init(void) void http_cleanup(void) { struct active_request_slot *slot = active_queue_head; -#ifdef USE_CURL_MULTI - char *wait_url; -#endif while (slot != NULL) { struct active_request_slot *next = slot->next; + if (slot->curl != NULL) { #ifdef USE_CURL_MULTI - if (slot->in_use) { - curl_easy_getinfo(slot->curl, - CURLINFO_EFFECTIVE_URL, - &wait_url); - fprintf(stderr, "Waiting for %s\n", wait_url); - run_active_slot(slot); - } + curl_multi_remove_handle(curlm, slot->curl); #endif - if (slot->curl != NULL) curl_easy_cleanup(slot->curl); + } free(slot); slot = next; } @@ -288,7 +288,7 @@ int unquote_c_style(struct strbuf *sb, const char *quoted, const char **endp) switch (*quoted++) { case '"': if (endp) - *endp = quoted + 1; + *endp = quoted; return 0; case '\\': break; diff --git a/receive-pack.c b/receive-pack.c index 3267495832..c90ec7dde2 100644 --- a/receive-pack.c +++ b/receive-pack.c @@ -469,6 +469,8 @@ int main(int argc, char **argv) if (!dir) usage(receive_pack_usage); + setup_path(NULL); + if (!enter_repo(dir, 0)) die("'%s': unable to chdir or not a git archive", dir); @@ -506,7 +506,7 @@ int peel_ref(const char *ref, unsigned char *sha1) /* fallback - callers should not call this for unpacked refs */ o = parse_object(base); - if (o->type == OBJ_TAG) { + if (o && o->type == OBJ_TAG) { o = deref_tag(o, ref, 0); if (o) { hashcpy(sha1, o->sha1); diff --git a/revision.c b/revision.c index 6e85aaa3fb..a399f27144 100644 --- a/revision.c +++ b/revision.c @@ -749,14 +749,9 @@ static void prepare_show_merge(struct rev_info *revs) add_pending_object(revs, &head->object, "HEAD"); add_pending_object(revs, &other->object, "MERGE_HEAD"); bases = get_merge_bases(head, other, 1); - while (bases) { - struct commit *it = bases->item; - struct commit_list *n = bases->next; - free(bases); - bases = n; - it->object.flags |= UNINTERESTING; - add_pending_object(revs, &it->object, "(merge-base)"); - } + add_pending_commit_list(revs, bases, UNINTERESTING); + free_commit_list(bases); + head->object.flags |= SYMMETRIC_LEFT; if (!active_nr) read_cache(); @@ -775,6 +770,7 @@ static void prepare_show_merge(struct rev_info *revs) i++; } revs->prune_data = prune; + revs->limited = 1; } int handle_revision_arg(const char *arg, struct rev_info *revs, diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh new file mode 100755 index 0000000000..762af5faf7 --- /dev/null +++ b/t/t1502-rev-parse-parseopt.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +test_description='test git rev-parse --parseopt' +. ./test-lib.sh + +cat > expect.err <<EOF +usage: some-command [options] <args>... + + some-command does foo and bar! + + -h, --help show the help + --foo some nifty option --foo + --bar ... some cool option --bar with an argument + +An option group Header + -C [...] option C with an optional argument + +Extras + --extra1 line above used to cause a segfault but no longer does + +EOF + +test_expect_success 'test --parseopt help output' ' + git rev-parse --parseopt -- -h 2> output.err <<EOF +some-command [options] <args>... + +some-command does foo and bar! +-- +h,help show the help + +foo some nifty option --foo +bar= some cool option --bar with an argument + + An option group Header +C? option C with an optional argument + +Extras +extra1 line above used to cause a segfault but no longer does +EOF + git diff expect.err output.err +' + +test_done diff --git a/t/t2008-checkout-subdir.sh b/t/t2008-checkout-subdir.sh index f78945ed8e..3e098ab31e 100755 --- a/t/t2008-checkout-subdir.sh +++ b/t/t2008-checkout-subdir.sh @@ -67,16 +67,16 @@ test_expect_success 'checkout with simple prefix' ' ' -test_expect_failure 'relative path outside tree should fail' \ - 'git checkout HEAD -- ../../Makefile' +test_expect_success 'relative path outside tree should fail' \ + 'test_must_fail git checkout HEAD -- ../../Makefile' -test_expect_failure 'incorrect relative path to file should fail (1)' \ - 'git checkout HEAD -- ../file0' +test_expect_success 'incorrect relative path to file should fail (1)' \ + 'test_must_fail git checkout HEAD -- ../file0' -test_expect_failure 'incorrect relative path should fail (2)' \ - '( cd dir1 && git checkout HEAD -- ./file0 )' +test_expect_success 'incorrect relative path should fail (2)' \ + '( cd dir1 && test_must_fail git checkout HEAD -- ./file0 )' -test_expect_failure 'incorrect relative path should fail (3)' \ - '( cd dir1 && git checkout HEAD -- ../../file0 )' +test_expect_success 'incorrect relative path should fail (3)' \ + '( cd dir1 && test_must_fail git checkout HEAD -- ../../file0 )' test_done diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh index 2dbe04fb20..6da212825a 100755 --- a/t/t3501-revert-cherry-pick.sh +++ b/t/t3501-revert-cherry-pick.sh @@ -59,4 +59,13 @@ test_expect_success 'revert after renaming branch' ' ' +test_expect_success 'revert forbidden on dirty working tree' ' + + echo content >extra_file && + git add extra_file && + test_must_fail git revert HEAD 2>errors && + grep "Dirty index" errors + +' + test_done diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh index 636aec2f71..4fc62f550c 100755 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@ -4,9 +4,6 @@ test_description='git remote porcelain-ish' . ./test-lib.sh -GIT_CONFIG=.git/config -export GIT_CONFIG - setup_repository () { mkdir "$1" && ( cd "$1" && diff --git a/t/t5701-clone-local.sh b/t/t5701-clone-local.sh index 822ac8c28e..59a165a6d4 100755 --- a/t/t5701-clone-local.sh +++ b/t/t5701-clone-local.sh @@ -63,4 +63,12 @@ test_expect_success 'Even without -l, local will make a hardlink' ' test 0 = $copied ' +test_expect_success 'local clone of repo with nonexistent ref in HEAD' ' + cd "$D" && + echo "ref: refs/heads/nonexistent" > a.git/HEAD && + git clone a d && + cd d && + git fetch && + test ! -e .git/refs/remotes/origin/HEAD' + test_done diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index ec71123f4b..4908e878fe 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -260,7 +260,7 @@ test_expect_success 'bisect starting with a detached HEAD' ' git checkout master^ && HEAD=$(git rev-parse --verify HEAD) && git bisect start && - test $HEAD = $(cat .git/head-name) && + test $HEAD = $(cat .git/BISECT_START) && git bisect reset && test $HEAD = $(git rev-parse --verify HEAD) diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh index 50c51c82fa..5d166280cb 100755 --- a/t/t7600-merge.sh +++ b/t/t7600-merge.sh @@ -419,6 +419,7 @@ test_debug 'gitk --all' test_expect_success 'merge c0 with c1 (no-ff)' ' git reset --hard c0 && + git config branch.master.mergeoptions "" && test_tick && git merge --no-ff c1 && verify_merge file result.1 && @@ -427,6 +428,11 @@ test_expect_success 'merge c0 with c1 (no-ff)' ' test_debug 'gitk --all' +test_expect_success 'combining --squash and --no-ff is refused' ' + test_must_fail git merge --squash --no-ff c1 && + test_must_fail git merge --no-ff --squash c1 +' + test_expect_success 'merge c0 with c1 (ff overrides no-ff)' ' git reset --hard c0 && git config branch.master.mergeoptions "--no-ff" && diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 08f7c3d8d7..2efaed441d 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -108,4 +108,25 @@ test_expect_success 'allow long lines with --no-validate' ' 2>errors ' +test_expect_success 'Invalid In-Reply-To' ' + git send-email \ + --from="Example <nobody@example.com>" \ + --to=nobody@example.com \ + --in-reply-to=" " \ + --smtp-server="$(pwd)/fake.sendmail" \ + $patches + 2>errors + ! grep "^In-Reply-To: < *>" msgtxt +' + +test_expect_success 'Valid In-Reply-To when prompting' ' + (echo "From Example <from@example.com>" + echo "To Example <to@example.com>" + echo "" + ) | env GIT_SEND_EMAIL_NOTTY=1 git send-email \ + --smtp-server="$(pwd)/fake.sendmail" \ + $patches 2>errors && + ! grep "^In-Reply-To: < *>" msgtxt +' + test_done diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh index 5c2ee23739..58c59ed5ae 100755 --- a/t/t9200-git-cvsexportcommit.sh +++ b/t/t9200-git-cvsexportcommit.sh @@ -2,7 +2,7 @@ # # Copyright (c) Robin Rosenberg # -test_description='CVS export comit. ' +test_description='Test export of commits to CVS' . ./test-lib.sh @@ -246,6 +246,22 @@ test_expect_success \ ;; esac +test_expect_success '-w option should work with relative GIT_DIR' ' + mkdir W && + echo foobar >W/file1.txt && + echo bazzle >W/file2.txt && + git add W/file1.txt && + git add W/file2.txt && + git commit -m "More updates" && + id=$(git rev-list --max-count=1 HEAD) && + (cd "$GIT_DIR" && + GIT_DIR=. git cvsexportcommit -w "$CVSWORK" -c $id && + check_entries "$CVSWORK/W" "file1.txt/1.1/|file2.txt/1.1/" && + diff -u "$CVSWORK/W/file1.txt" ../W/file1.txt && + diff -u "$CVSWORK/W/file2.txt" ../W/file2.txt + ) +' + test_expect_success 'check files before directories' ' echo Notes > release-notes && diff --git a/t/test-lib.sh b/t/test-lib.sh index 142540e1b1..44f5776a1b 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -3,12 +3,16 @@ # Copyright (c) 2005 Junio C Hamano # +# Keep the original TERM for say_color +ORIGINAL_TERM=$TERM + # For repeatability, reset the environment to known value. LANG=C LC_ALL=C PAGER=cat TZ=UTC -export LANG LC_ALL PAGER TZ +TERM=dumb +export LANG LC_ALL PAGER TERM TZ EDITOR=: VISUAL=: unset GIT_EDITOR @@ -58,12 +62,14 @@ esac # This test checks if command xyzzy does the right thing... # ' # . ./test-lib.sh - -[ "x$TERM" != "xdumb" ] && - [ -t 1 ] && - tput bold >/dev/null 2>&1 && - tput setaf 1 >/dev/null 2>&1 && - tput sgr0 >/dev/null 2>&1 && +[ "x$ORIGINAL_TERM" != "xdumb" ] && ( + TERM=$ORIGINAL_TERM && + export TERM && + [ -t 1 ] && + tput bold >/dev/null 2>&1 && + tput setaf 1 >/dev/null 2>&1 && + tput sgr0 >/dev/null 2>&1 + ) && color=t while test "$#" -ne 0 @@ -91,6 +97,9 @@ done if test -n "$color"; then say_color () { + ( + TERM=$ORIGINAL_TERM + export TERM case "$1" in error) tput bold; tput setaf 1;; # bold red skip) tput bold; tput setaf 2;; # bold green @@ -101,6 +110,7 @@ if test -n "$color"; then shift echo "* $*" tput sgr0 + ) } else say_color() { @@ -257,6 +267,23 @@ test_expect_code () { echo >&3 "" } +# This is not among top-level (test_expect_success | test_expect_failure) +# but is a prefix that can be used in the test script, like: +# +# test_expect_success 'complain and die' ' +# do something && +# do something else && +# test_must_fail git checkout ../outerspace +# ' +# +# Writing this as "! git checkout ../outerspace" is wrong, because +# the failure could be due to a segv. We want a controlled failure. + +test_must_fail () { + "$@" + test $? -gt 0 -a $? -le 128 +} + # Most tests can use the created repository, but some may need to create more. # Usage: test_create_repo <directory> test_create_repo () { diff --git a/templates/Makefile b/templates/Makefile index ebd3a62fd8..bda9d13505 100644 --- a/templates/Makefile +++ b/templates/Makefile @@ -29,10 +29,10 @@ boilerplates.made : $(bpsrc) case "$$boilerplate" in *~) continue ;; esac && \ dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \ dir=`expr "$$dst" : '\(.*\)/'` && \ - mkdir -p blt/$$dir && \ + $(INSTALL) -d -m 755 blt/$$dir && \ case "$$boilerplate" in \ *--) ;; \ - *) cp $$boilerplate blt/$$dst ;; \ + *) cp -p $$boilerplate blt/$$dst ;; \ esac || exit; \ done && \ date >$@ @@ -48,4 +48,4 @@ clean: install: all $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_dir_SQ)' (cd blt && $(TAR) cf - .) | \ - (cd '$(DESTDIR_SQ)$(template_dir_SQ)' && $(TAR) xf -) + (cd '$(DESTDIR_SQ)$(template_dir_SQ)' && umask 022 && $(TAR) xf -) |