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
This commit is contained in:
Junio C Hamano 2008-08-20 16:18:16 -07:00
commit e28a8670a6
18 changed files with 108 additions and 23 deletions

View file

@ -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

View file

@ -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>::

View file

@ -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;

View file

@ -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);

View file

@ -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

View file

@ -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)

View file

@ -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 ()
{

View file

@ -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;

View file

@ -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

1
diff.c
View file

@ -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);

View file

@ -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;
}

View file

@ -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

View file

@ -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

5
t/t5100/info-from.expect Normal file
View file

@ -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

8
t/t5100/info-from.in Normal file
View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 -)