author | Junio C Hamano <gitster@pobox.com> | |
Tue, 16 Dec 2008 07:06:13 +0000 (23:06 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 16 Dec 2008 07:06:13 +0000 (23:06 -0800) |
* maint:
fast-import: close pack before unlinking it
pager: do not dup2 stderr if it is already redirected
git-show: do not segfault when showing a bad tag
fast-import: close pack before unlinking it
pager: do not dup2 stderr if it is already redirected
git-show: do not segfault when showing a bad tag
builtin-log.c | patch | blob | history | |
fast-import.c | patch | blob | history | |
pager.c | patch | blob | history | |
t/t7007-show.sh | [new file with mode: 0755] | patch | blob |
diff --git a/builtin-log.c b/builtin-log.c
index 840daf907897391fb193706982e2274c2a9e1014..99d1137b081d2e14d75e3d4d1766c3bf921f1493 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
t->tag,
diff_get_color_opt(&rev.diffopt, DIFF_RESET));
ret = show_object(o->sha1, 1, &rev);
- objects[i].item = parse_object(t->tagged->sha1);
+ if (ret)
+ break;
+ o = parse_object(t->tagged->sha1);
+ if (!o)
+ ret = error("Could not read object %s",
+ sha1_to_hex(t->tagged->sha1));
+ objects[i].item = o;
i--;
break;
}
diff --git a/fast-import.c b/fast-import.c
index 3276d5d7aa49aaf41cf9f9e3562a5bbd14b63c18..201d4ffa13696f857c3a7cf84ba41fae21c04a7b 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
pack_id++;
}
- else
+ else {
+ close(old_p->pack_fd);
unlink(old_p->pack_name);
+ }
free(old_p);
/* We can't carry a delta across packfiles. */
index aa0966c9c55566382bf32c946c0a1846f004125a..f19ddbc87df04f117cd5e39189c8322fd5f29d68 100644 (file)
--- a/pager.c
+++ b/pager.c
/* original process continues, but writes to the pipe */
dup2(pager_process.in, 1);
- dup2(pager_process.in, 2);
+ if (isatty(2))
+ dup2(pager_process.in, 2);
close(pager_process.in);
/* this makes sure that the parent terminates after the pager */
diff --git a/t/t7007-show.sh b/t/t7007-show.sh
--- /dev/null
+++ b/t/t7007-show.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+test_description='git show'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ echo hello world >foo &&
+ H=$(git hash-object -w foo) &&
+ git tag -a foo-tag -m "Tags $H" $H &&
+ HH=$(expr "$H" : "\(..\)") &&
+ H38=$(expr "$H" : "..\(.*\)") &&
+ rm -f .git/objects/$HH/$H38
+'
+
+test_expect_success 'showing a tag that point at a missing object' '
+ test_must_fail git --no-pager show foo-tag
+'
+
+test_done