aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-08-20 16:18:16 -0700
committerJunio C Hamano <gitster@pobox.com>2008-08-20 16:18:16 -0700
commite28a8670a66125aa29d7a5ea10052c0f6824c2ba (patch)
tree6506300a0123f026feabacf2eae76a665390c8eb
parent3814c07498f87e7d27b55175ca2852fcc4cd27f4 (diff)
parent9b99e641c11044dba661f574f9098d362a3f0ef8 (diff)
downloadgit-e28a8670a66125aa29d7a5ea10052c0f6824c2ba.tar.gz
git-e28a8670a66125aa29d7a5ea10052c0f6824c2ba.tar.xz
Merge branch 'maint'
* maint: Update draft release notes for 1.6.0.1 Add hints to revert documentation about other ways to undo changes Install templates with the user and group of the installing personality "git-merge": allow fast-forwarding in a stat-dirty tree completion: find out supported merge strategies correctly decorate: allow const objects to be decorated for-each-ref: cope with tags with incomplete lines diff --check: do not get confused by new blank lines in the middle remote.c: remove useless if-before-free test mailinfo: avoid violating strbuf assertion git format-patch: avoid underrun when format.headers is empty or all NLs
-rw-r--r--Documentation/RelNotes-1.6.0.1.txt20
-rw-r--r--Documentation/git-revert.txt9
-rw-r--r--builtin-for-each-ref.c4
-rw-r--r--builtin-log.c2
-rw-r--r--builtin-mailinfo.c2
-rw-r--r--builtin-merge.c2
-rwxr-xr-xcontrib/completion/git-completion.bash14
-rw-r--r--decorate.c11
-rw-r--r--decorate.h6
-rw-r--r--diff.c1
-rw-r--r--remote.c3
-rwxr-xr-xt/t4015-diff-whitespace.sh11
-rwxr-xr-xt/t5100-mailinfo.sh11
-rw-r--r--t/t5100/info-from.expect5
-rw-r--r--t/t5100/info-from.in8
-rwxr-xr-xt/t6300-for-each-ref.sh10
-rwxr-xr-xt/t7600-merge.sh10
-rw-r--r--templates/Makefile2
18 files changed, 108 insertions, 23 deletions
diff --git a/Documentation/RelNotes-1.6.0.1.txt b/Documentation/RelNotes-1.6.0.1.txt
index 3ee85a799..bac117e89 100644
--- a/Documentation/RelNotes-1.6.0.1.txt
+++ b/Documentation/RelNotes-1.6.0.1.txt
@@ -4,12 +4,28 @@ GIT v1.6.0.1 Release Notes
Fixes since v1.6.0
------------------
-* ...
+* "git diff --check" incorrectly detected new trailing blank lines when
+ whitespace check was in effect.
+
+* "git for-each-ref" tried to dereference NULL when asked for '%(body)" on
+ a tag with a single incomplete line as its payload.
+
+* "git format-patch" peeked before the beginning of a string when
+ "format.headers" variable is empty (a misconfiguration).
+
+* "git mailinfo" (hence "git am") was unhappy when MIME multipart message
+ contained garbage after the finishing boundary.
+
+* "git mailinfo" also was unhappy when the "From: " line only had a bare
+ e-mail address.
+
+* "git merge" did not refresh the index correctly when a merge resulted in
+ a fast-forward.
Contains other various documentation fixes.
--
exec >/var/tmp/1
-O=v1.6.0
+O=v1.6.0-14-g3a634dc
echo O=$(git describe maint)
git shortlog --no-merges $O..maint
diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt
index 98cfa3c0d..caa07298a 100644
--- a/Documentation/git-revert.txt
+++ b/Documentation/git-revert.txt
@@ -15,6 +15,15 @@ Given one existing commit, revert the change the patch introduces, and record a
new commit that records it. This requires your working tree to be clean (no
modifications from the HEAD commit).
+Note: 'git revert' is used to record a new commit to reverse the
+effect of an earlier commit (often a faulty one). If you want to
+throw away all uncommitted changes in your working directory, you
+should see linkgit:git-reset[1], particularly the '--hard' option. If
+you want to extract specific files as they were in another commit, you
+should see linkgit:git-checkout[1], specifically the 'git checkout
+<commit> -- <filename>' syntax. Take care with these alternatives as
+both will discard uncommitted changes in your working directory.
+
OPTIONS
-------
<commit>::
diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c
index 445039e19..4d25ec51d 100644
--- a/builtin-for-each-ref.c
+++ b/builtin-for-each-ref.c
@@ -459,8 +459,10 @@ static void find_subpos(const char *buf, unsigned long sz, const char **sub, con
return;
*sub = buf; /* first non-empty line */
buf = strchr(buf, '\n');
- if (!buf)
+ if (!buf) {
+ *body = "";
return; /* no body */
+ }
while (*buf == '\n')
buf++; /* skip blank between subject and body */
*body = buf;
diff --git a/builtin-log.c b/builtin-log.c
index f4975cf35..911fd6599 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -461,7 +461,7 @@ static int extra_cc_alloc;
static void add_header(const char *value)
{
int len = strlen(value);
- while (value[len - 1] == '\n')
+ while (len && value[len - 1] == '\n')
len--;
if (!strncasecmp(value, "to: ", 4)) {
ALLOC_GROW(extra_to, extra_to_nr + 1, extra_to_alloc);
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index 26d3e5d7a..e890f7a6d 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -107,7 +107,7 @@ static void handle_from(const struct strbuf *from)
el = strcspn(at, " \n\t\r\v\f>");
strbuf_reset(&email);
strbuf_add(&email, at, el);
- strbuf_remove(&f, at - f.buf, el + 1);
+ strbuf_remove(&f, at - f.buf, el + (at[el] ? 1 : 0));
/* The remainder is name. It could be "John Doe <john.doe@xz>"
* or "john.doe@xz (John Doe)", but we have removed the
diff --git a/builtin-merge.c b/builtin-merge.c
index dde0c7ed3..a201c6628 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -566,6 +566,7 @@ static int checkout_fast_forward(unsigned char *head, unsigned char *remote)
if (read_cache_unmerged())
die("you need to resolve your current index first");
+ refresh_cache(REFRESH_QUIET);
fd = hold_locked_index(lock_file, 1);
@@ -936,7 +937,6 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
hex,
find_unique_abbrev(remoteheads->item->object.sha1,
DEFAULT_ABBREV));
- refresh_cache(REFRESH_QUIET);
strbuf_init(&msg, 0);
strbuf_addstr(&msg, "Fast forward");
if (have_message)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 158b91284..a31004088 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -271,15 +271,17 @@ __git_merge_strategies ()
echo "$__git_merge_strategylist"
return
fi
- sed -n "/^all_strategies='/{
- s/^all_strategies='//
- s/'//
+ git merge -s help 2>&1 |
+ sed -n -e '/[Aa]vailable strategies are: /,/^$/{
+ s/\.$//
+ s/.*://
+ s/^[ ]*//
+ s/[ ]*$//
p
- q
- }" "$(git --exec-path)/git-merge"
+ }'
}
__git_merge_strategylist=
-__git_merge_strategylist="$(__git_merge_strategies 2>/dev/null)"
+__git_merge_strategylist=$(__git_merge_strategies 2>/dev/null)
__git_complete_file ()
{
diff --git a/decorate.c b/decorate.c
index d9668d2ef..82d9e221e 100644
--- a/decorate.c
+++ b/decorate.c
@@ -6,13 +6,13 @@
#include "object.h"
#include "decorate.h"
-static unsigned int hash_obj(struct object *obj, unsigned int n)
+static unsigned int hash_obj(const struct object *obj, unsigned int n)
{
unsigned int hash = *(unsigned int *)obj->sha1;
return hash % n;
}
-static void *insert_decoration(struct decoration *n, struct object *base, void *decoration)
+static void *insert_decoration(struct decoration *n, const struct object *base, void *decoration)
{
int size = n->size;
struct object_decoration *hash = n->hash;
@@ -44,7 +44,7 @@ static void grow_decoration(struct decoration *n)
n->nr = 0;
for (i = 0; i < old_size; i++) {
- struct object *base = old_hash[i].base;
+ const struct object *base = old_hash[i].base;
void *decoration = old_hash[i].decoration;
if (!base)
@@ -55,7 +55,8 @@ static void grow_decoration(struct decoration *n)
}
/* Add a decoration pointer, return any old one */
-void *add_decoration(struct decoration *n, struct object *obj, void *decoration)
+void *add_decoration(struct decoration *n, const struct object *obj,
+ void *decoration)
{
int nr = n->nr + 1;
@@ -65,7 +66,7 @@ void *add_decoration(struct decoration *n, struct object *obj, void *decoration)
}
/* Lookup a decoration pointer */
-void *lookup_decoration(struct decoration *n, struct object *obj)
+void *lookup_decoration(struct decoration *n, const struct object *obj)
{
int j;
diff --git a/decorate.h b/decorate.h
index 1fa4ad9be..e7328044f 100644
--- a/decorate.h
+++ b/decorate.h
@@ -2,7 +2,7 @@
#define DECORATE_H
struct object_decoration {
- struct object *base;
+ const struct object *base;
void *decoration;
};
@@ -12,7 +12,7 @@ struct decoration {
struct object_decoration *hash;
};
-extern void *add_decoration(struct decoration *n, struct object *obj, void *decoration);
-extern void *lookup_decoration(struct decoration *n, struct object *obj);
+extern void *add_decoration(struct decoration *n, const struct object *obj, void *decoration);
+extern void *lookup_decoration(struct decoration *n, const struct object *obj);
#endif
diff --git a/diff.c b/diff.c
index 10d54405d..5923fe281 100644
--- a/diff.c
+++ b/diff.c
@@ -1628,6 +1628,7 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,
xdemitcb_t ecb;
memset(&xecfg, 0, sizeof(xecfg));
+ xecfg.ctxlen = 1; /* at least one context line */
xpp.flags = XDF_NEED_MINIMAL;
xdi_diff_outf(&mf1, &mf2, checkdiff_consume, &data,
&xpp, &xecfg, &ecb);
diff --git a/remote.c b/remote.c
index f61a3ab39..105668f8a 100644
--- a/remote.c
+++ b/remote.c
@@ -579,8 +579,7 @@ int valid_fetch_refspec(const char *fetch_refspec_str)
struct refspec *refspec;
refspec = parse_refspec_internal(1, fetch_refspec, 1, 1);
- if (refspec)
- free(refspec);
+ free(refspec);
return !!refspec;
}
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index a27fccc8d..ec98509fd 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -341,4 +341,15 @@ test_expect_success 'checkdiff detects trailing blank lines' '
git diff --check | grep "ends with blank"
'
+test_expect_success 'checkdiff allows new blank lines' '
+ git checkout x &&
+ mv x y &&
+ (
+ echo "/* This is new */" &&
+ echo "" &&
+ cat y
+ ) >x &&
+ git diff --check
+'
+
test_done
diff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh
index 8dfaddda9..198e3503d 100755
--- a/t/t5100-mailinfo.sh
+++ b/t/t5100-mailinfo.sh
@@ -43,4 +43,15 @@ test_expect_success 'Preserve NULs out of MIME encoded message' '
'
+test_expect_success 'mailinfo on from header without name works' '
+
+ mkdir info-from &&
+ git mailsplit -oinfo-from "$TEST_DIRECTORY"/t5100/info-from.in &&
+ test_cmp "$TEST_DIRECTORY"/t5100/info-from.in info-from/0001 &&
+ git mailinfo info-from/msg info-from/patch \
+ <info-from/0001 >info-from/out &&
+ test_cmp "$TEST_DIRECTORY"/t5100/info-from.expect info-from/out
+
+'
+
test_done
diff --git a/t/t5100/info-from.expect b/t/t5100/info-from.expect
new file mode 100644
index 000000000..c31d2eb55
--- /dev/null
+++ b/t/t5100/info-from.expect
@@ -0,0 +1,5 @@
+Author: bare@example.com
+Email: bare@example.com
+Subject: testing bare address in from header
+Date: Sun, 25 May 2008 00:38:18 -0700
+
diff --git a/t/t5100/info-from.in b/t/t5100/info-from.in
new file mode 100644
index 000000000..4f082093f
--- /dev/null
+++ b/t/t5100/info-from.in
@@ -0,0 +1,8 @@
+From 667d8940e719cddee1cfe237cbbe215e20270b09 Mon Sep 17 00:00:00 2001
+From: bare@example.com
+Date: Sun, 25 May 2008 00:38:18 -0700
+Subject: [PATCH] testing bare address in from header
+
+commit message
+---
+patch
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index a3c8941c7..8ced59321 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -262,4 +262,14 @@ for i in "--perl --shell" "-s --python" "--python --tcl" "--tcl --perl"; do
"
done
+test_expect_success 'an unusual tag with an incomplete line' '
+
+ git tag -m "bogo" bogo &&
+ bogo=$(git cat-file tag bogo) &&
+ bogo=$(printf "%s" "$bogo" | git mktag) &&
+ git tag -f bogo "$bogo" &&
+ git for-each-ref --format "%(body)" refs/tags/bogo
+
+'
+
test_done
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 5eeb6c2b2..fee8fb77d 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -488,4 +488,14 @@ test_expect_success 'merge c1 with c1 and c2' '
test_debug 'gitk --all'
+test_expect_success 'merge fast-forward in a dirty tree' '
+ git reset --hard c0 &&
+ mv file file1 &&
+ cat file1 >file &&
+ rm -f file1 &&
+ git merge c2
+'
+
+test_debug 'gitk --all'
+
test_done
diff --git a/templates/Makefile b/templates/Makefile
index 9f3f1fc35..cc3fc3094 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -48,4 +48,4 @@ clean:
install: all
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
(cd blt && $(TAR) cf - .) | \
- (cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xf -)
+ (cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)